aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2013-08-11 19:04:07 -0700
committerfriendica <info@friendica.com>2013-08-11 19:04:07 -0700
commit6191cfef2adaa52019940cc448e28e2ad1a7ae6d (patch)
treec0d7fc1444a1c8fdfa013e8831f96f847667f9f2
parent4eca591aed1e71a94c1f80b87aad9bb844199ffc (diff)
downloadvolse-hubzilla-6191cfef2adaa52019940cc448e28e2ad1a7ae6d.tar.gz
volse-hubzilla-6191cfef2adaa52019940cc448e28e2ad1a7ae6d.tar.bz2
volse-hubzilla-6191cfef2adaa52019940cc448e28e2ad1a7ae6d.zip
check these in so I can go back and find out why the stylsheet is horked
-rwxr-xr-xboot.php6
-rw-r--r--include/menu.php40
-rw-r--r--install/database.sql6
-rw-r--r--install/update.php14
-rw-r--r--view/tpl/usermenu.tpl11
5 files changed, 74 insertions, 3 deletions
diff --git a/boot.php b/boot.php
index 1fd0d2172..02162bb6a 100755
--- a/boot.php
+++ b/boot.php
@@ -43,7 +43,7 @@ require_once('include/taxonomy.php');
define ( 'RED_PLATFORM', 'Red Matrix' );
define ( 'RED_VERSION', trim(file_get_contents('version.inc')) . 'R');
define ( 'ZOT_REVISION', 1 );
-define ( 'DB_UPDATE_VERSION', 1058 );
+define ( 'DB_UPDATE_VERSION', 1059 );
define ( 'EOL', '<br />' . "\r\n" );
define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' );
@@ -288,6 +288,10 @@ define ( 'ATTACH_FLAG_OS', 0x0002);
+define ( 'MENU_ITEM_ZID', 0x0001);
+
+
+
/**
* Maximum number of "people who like (or don't like) this" that we will list by name
*/
diff --git a/include/menu.php b/include/menu.php
new file mode 100644
index 000000000..98c18a45b
--- /dev/null
+++ b/include/menu.php
@@ -0,0 +1,40 @@
+<?php /** @file */
+
+require_once('include/security.php');
+
+function menu_fetch($name,$uid,$observer_xchan) {
+
+ $sql_options = permission_sql($uid);
+
+ $r = q("select * from menu where menu_channel_id = %d and menu_name = '%s' limit 1",
+ intval($uid),
+ dbesc($name)
+ );
+ if($r) {
+ $x = q("select * from menu_item where mitem_menu_id = %d and mitem_channel_id = %d
+ $sql_options
+ order by mitem_order asc, mitem_desc asc",
+ intval($x[0]['menu_id']),
+ intval($uid)
+ );
+
+ $result = array('menu' => $r[0], 'items' => $x );
+
+
+ }
+ return null;
+}
+
+
+function menu_render($menu) {
+ if(! $menu)
+ return '';
+ for($x = 0; $x < count($menu['items']); $x ++)
+ if($menu['items']['mitem_flags'] & MENU_ITEM_ZID)
+ $menu['items']['link'] = zid($menu['items']['link']);
+
+ return replace_macros(get_markup_template('usermenu.tpl'),array(
+ '$menu' => $menu['menu'],
+ '$items' => $menu['items']
+ ));
+}
diff --git a/install/database.sql b/install/database.sql
index cd1c72ac6..0a86b8321 100644
--- a/install/database.sql
+++ b/install/database.sql
@@ -530,15 +530,18 @@ CREATE TABLE IF NOT EXISTS `manage` (
CREATE TABLE IF NOT EXISTS `menu` (
`menu_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`menu_channel_id` int(10) unsigned NOT NULL DEFAULT '0',
+ `menu_name` char(255) NOT NULL DEFAULT '',
`menu_desc` char(255) NOT NULL DEFAULT '',
PRIMARY KEY (`menu_id`),
- KEY `menu_channel_id` (`menu_channel_id`)
+ KEY `menu_channel_id` (`menu_channel_id`),
+ KEY `menu_name` (`menu_name`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `menu_item` (
`mitem_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`mitem_link` char(255) NOT NULL DEFAULT '',
`mitem_desc` char(255) NOT NULL DEFAULT '',
+ `mitem_flags` int(11) NOT NULL DEFAULT '0',
`allow_cid` mediumtext NOT NULL,
`allow_gid` mediumtext NOT NULL,
`deny_cid` mediumtext NOT NULL,
@@ -547,6 +550,7 @@ CREATE TABLE IF NOT EXISTS `menu_item` (
`mitem_menu_id` int(10) unsigned NOT NULL DEFAULT '0',
`mitem_order` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`mitem_id`),
+ KEY `mitem_flags` (`mitem_flags`),
KEY `mitem_channel_id` (`mitem_channel_id`),
KEY `mitem_menu_id` (`mitem_menu_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
diff --git a/install/update.php b/install/update.php
index c09bc9d64..c97b5619f 100644
--- a/install/update.php
+++ b/install/update.php
@@ -1,6 +1,6 @@
<?php
-define( 'UPDATE_VERSION' , 1058 );
+define( 'UPDATE_VERSION' , 1059 );
/**
*
@@ -670,3 +670,15 @@ function update_r1057() {
return UPDATE_SUCCESS;
return UPDATE_FAILED;
}
+
+function update_r1058() {
+ $r1 = q("ALTER TABLE `menu` ADD `menu_name` CHAR( 255 ) NOT NULL DEFAULT '' AFTER `menu_channel_id` ,
+ADD INDEX ( `menu_name` ) ");
+
+ $r2 = q("ALTER TABLE `menu_item` ADD `mitem_flags` INT NOT NULL DEFAULT '0' AFTER `mitem_desc` ,
+ADD INDEX ( `mitem_flags` ) ");
+
+ if($r1 && $r2)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
diff --git a/view/tpl/usermenu.tpl b/view/tpl/usermenu.tpl
new file mode 100644
index 000000000..1eb3f9127
--- /dev/null
+++ b/view/tpl/usermenu.tpl
@@ -0,0 +1,11 @@
+<div class="pmenu">
+ <div class="pmenu-title">{{$menu.menu_desc}}</div>
+{{if $items }}
+<ul class="pmenu-body">
+{{foreach $items as $mitem }}
+<li class="pmenu-item"><a href="{{$mitem.mitem_link}}">{{$mitem.mitem_desc}}</a></li>
+{{/foreach }}
+</ul>
+{{/if}}
+<div class="pmenu-end"></div>
+</div>