From 616338c17e9eabc6355e27694c9e49f1f4586055 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Sun, 10 May 2015 15:00:18 +0200 Subject: provide ability to create submenus --- include/menu.php | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/menu.php b/include/menu.php index a2e91f7ed..84ea78f00 100644 --- a/include/menu.php +++ b/include/menu.php @@ -29,17 +29,33 @@ function menu_render($menu, $class='', $edit = false, $var = '') { if(! $menu) return ''; + $uid = local_channel(); + $menu_list = menu_list($uid); + + foreach($menu_list as $menus) { + if($menus['menu_name'] != $menu['menu']['menu_name']) + $menu_names[] = $menus['menu_name']; + } + for($x = 0; $x < count($menu['items']); $x ++) { + if(in_array($menu['items'][$x]['mitem_link'], $menu_names)) { + $m = menu_fetch($menu['items'][$x]['mitem_link'],local_channel(), get_observer_hash()); + $submenu = menu_render($m, 'dropdown-menu', $edit = false, $var = array('wrap' => 'none')); + $menu['items'][$x]['submenu'] = $submenu; + } + if($menu['items'][$x]['mitem_flags'] & MENU_ITEM_ZID) $menu['items'][$x]['mitem_link'] = zid($menu['items'][$x]['mitem_link']); + if($menu['items'][$x]['mitem_flags'] & MENU_ITEM_NEWWIN) $menu['items'][$x]['newwin'] = '1'; + $menu['items'][$x]['mitem_desc'] = bbcode($menu['items'][$x]['mitem_desc']); } $wrap = (($var['wrap'] === 'none') ? false : true); - return replace_macros(get_markup_template('usermenu.tpl'),array( + $ret = replace_macros(get_markup_template('usermenu.tpl'),array( '$menu' => $menu['menu'], '$class' => $class, '$edit' => (($edit) ? t("Edit") : ''), @@ -47,6 +63,8 @@ function menu_render($menu, $class='', $edit = false, $var = '') { '$items' => $menu['items'], '$wrap' => $wrap )); + + return $ret; } -- cgit v1.2.3 From 70e5bf04e160bf1e3f2673f4405ac6a6adecb485 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Sun, 10 May 2015 21:52:48 +0200 Subject: uid > channel id to make submenus visible for observers --- include/menu.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/menu.php b/include/menu.php index 84ea78f00..5c0811437 100644 --- a/include/menu.php +++ b/include/menu.php @@ -29,8 +29,8 @@ function menu_render($menu, $class='', $edit = false, $var = '') { if(! $menu) return ''; - $uid = local_channel(); - $menu_list = menu_list($uid); + $channel_id = ((is_array(get_app()->profile)) ? get_app()->profile['profile_uid'] : 0); + $menu_list = menu_list($channel_id); foreach($menu_list as $menus) { if($menus['menu_name'] != $menu['menu']['menu_name']) @@ -39,7 +39,7 @@ function menu_render($menu, $class='', $edit = false, $var = '') { for($x = 0; $x < count($menu['items']); $x ++) { if(in_array($menu['items'][$x]['mitem_link'], $menu_names)) { - $m = menu_fetch($menu['items'][$x]['mitem_link'],local_channel(), get_observer_hash()); + $m = menu_fetch($menu['items'][$x]['mitem_link'], $channel_id, get_observer_hash()); $submenu = menu_render($m, 'dropdown-menu', $edit = false, $var = array('wrap' => 'none')); $menu['items'][$x]['submenu'] = $submenu; } -- cgit v1.2.3 From 3140650b8f057b6e88827908a71cecbe68494a10 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Sun, 10 May 2015 13:17:41 -0700 Subject: rev update --- include/diaspora.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/diaspora.php b/include/diaspora.php index 4aa525838..e8a470178 100755 --- a/include/diaspora.php +++ b/include/diaspora.php @@ -2430,7 +2430,7 @@ function diaspora_send_status($item,$owner,$contact,$public_batch = false) { if($item['item_flags'] & ITEM_CONSENSUS) { $poll = replace_macros(get_markup_template('diaspora_consensus.tpl'), array( '$guid_q' => random_string(), - '$question' => '', + '$question' => t('Please choose'), '$guid_y' => random_string(), '$agree' => t('Agree'), '$guid_n' => random_string(), -- cgit v1.2.3