From b8d328076384ff48be47f59366aea8b1e1cc04a1 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Fri, 29 May 2015 13:08:01 +0200 Subject: some fixes to make menu sharing work and expose it in the ui. --- include/bbcode.php | 3 +++ include/menu.php | 10 ++++------ 2 files changed, 7 insertions(+), 6 deletions(-) (limited to 'include') diff --git a/include/bbcode.php b/include/bbcode.php index 1f5a65399..a766b6aea 100644 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -193,6 +193,9 @@ function translate_design_element($type) { case 'block': $ret = t('block'); break; + case 'menu': + $ret = t('menu'); + break; } return $ret; diff --git a/include/menu.php b/include/menu.php index 5c078c189..ae53945ef 100644 --- a/include/menu.php +++ b/include/menu.php @@ -28,10 +28,10 @@ function menu_element($menu) { $arr = array(); $arr['type'] = 'menu'; - $arr['name'] = $menu['menu_name']; - $arr['desc'] = $menu['menu_desc']; - $arr['created'] = $menu['menu_created']; - $arr['edited'] = $menu['menu_edited']; + $arr['pagetitle'] = $menu['menu']['menu_name']; + $arr['desc'] = $menu['menu']['menu_desc']; + $arr['created'] = $menu['menu']['menu_created']; + $arr['edited'] = $menu['menu']['menu_edited']; $arr['baseurl'] = z_root(); if($menu['menu_flags']) { @@ -124,7 +124,6 @@ function menu_fetch_id($menu_id,$channel_id) { function menu_create($arr) { - $menu_name = trim(escape_tags($arr['menu_name'])); $menu_desc = trim(escape_tags($arr['menu_desc'])); $menu_flags = intval($arr['menu_flags']); @@ -287,7 +286,6 @@ function menu_delete_id($menu_id, $uid) { function menu_add_item($menu_id, $uid, $arr) { - $mitem_link = escape_tags($arr['mitem_link']); $mitem_desc = escape_tags($arr['mitem_desc']); $mitem_order = intval($arr['mitem_order']); -- cgit v1.2.3 From 2514af652490ebe4d379a32c339dd23d9b321897 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Fri, 29 May 2015 17:51:50 +0200 Subject: fix menu render for menu item edit - menu preview --- include/menu.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/menu.php b/include/menu.php index ae53945ef..2b61ebd34 100644 --- a/include/menu.php +++ b/include/menu.php @@ -66,13 +66,17 @@ function menu_element($menu) { -function menu_render($menu, $class='', $edit = false, $var = '') { +function menu_render($menu, $class='', $edit = false, $var = array()) { if(! $menu) return ''; $channel_id = ((is_array(get_app()->profile)) ? get_app()->profile['profile_uid'] : 0); + if ((! $channel_id) && (local_channel())) + $channel_id = local_channel(); + $menu_list = menu_list($channel_id); + $menu_names = array(); foreach($menu_list as $menus) { if($menus['menu_name'] != $menu['menu']['menu_name']) -- cgit v1.2.3 From 504050618497d3f3f43bb44b89637ebd767557ce Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Fri, 29 May 2015 17:59:31 +0200 Subject: should not redefine $var in the function call --- include/menu.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/menu.php b/include/menu.php index 2b61ebd34..d20df1d6e 100644 --- a/include/menu.php +++ b/include/menu.php @@ -86,7 +86,7 @@ function menu_render($menu, $class='', $edit = false, $var = array()) { 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'], $channel_id, get_observer_hash()); - $submenu = menu_render($m, 'dropdown-menu', $edit = false, $var = array('wrap' => 'none')); + $submenu = menu_render($m, 'dropdown-menu', $edit = false, array('wrap' => 'none')); $menu['items'][$x]['submenu'] = $submenu; } -- cgit v1.2.3