diff options
author | Mario Vavti <mario@mariovavti.com> | 2015-04-21 10:05:26 +0200 |
---|---|---|
committer | Mario Vavti <mario@mariovavti.com> | 2015-04-21 10:05:26 +0200 |
commit | 0bd9fe0b11013423a17ebaabb22482bee38d8f0f (patch) | |
tree | 07f801f228971898d27ba10068f8482deaaef1cd /mod/menu.php | |
parent | 6bc2766d79388ce6f813c429348cbc50d9afadaa (diff) | |
download | volse-hubzilla-0bd9fe0b11013423a17ebaabb22482bee38d8f0f.tar.gz volse-hubzilla-0bd9fe0b11013423a17ebaabb22482bee38d8f0f.tar.bz2 volse-hubzilla-0bd9fe0b11013423a17ebaabb22482bee38d8f0f.zip |
rework and hopefully improve webpage menu creation workflow
Diffstat (limited to 'mod/menu.php')
-rw-r--r-- | mod/menu.php | 82 |
1 files changed, 42 insertions, 40 deletions
diff --git a/mod/menu.php b/mod/menu.php index 4153f1ac0..0dbbfde9c 100644 --- a/mod/menu.php +++ b/mod/menu.php @@ -37,7 +37,7 @@ function menu_post(&$a) { $_REQUEST['menu_id'] = intval(argv(1)); $r = menu_edit($_REQUEST); if($r) { - info( t('Menu updated.') . EOL); + //info( t('Menu updated.') . EOL); goaway(z_root() . '/mitem/' . $menu_id . (($a->is_sys) ? '?f=&sys=1' : '')); } else @@ -46,7 +46,7 @@ function menu_post(&$a) { else { $r = menu_create($_REQUEST); if($r) { - info( t('Menu created.') . EOL); + //info( t('Menu created.') . EOL); goaway(z_root() . '/mitem/' . $r . (($a->is_sys) ? '?f=&sys=1' : '')); } else @@ -70,8 +70,10 @@ function menu_content(&$a) { return ''; } - if(argc() == 1) { + + + // list menus $x = menu_list($uid); if($x) { @@ -80,14 +82,26 @@ function menu_content(&$a) { } } + $create = replace_macros(get_markup_template('menuedit.tpl'), array( + '$menu_name' => array('menu_name', t('Menu Name'), '', t('Unique name (not visible on webpage) - required'), '*'), + '$menu_desc' => array('menu_desc', t('Menu Title'), '', t('Visible on webpage - leave empty for no title'), ''), + '$menu_bookmark' => array('menu_bookmark', t('Allow Bookmarks'), 0 , t('Menu may be used to store saved bookmarks'), array(t('No'), t('Yes'))), + '$submit' => t('Submit and proceed'), + '$sys' => $a->is_sys, + '$display' => 'none' + )); + $o = replace_macros(get_markup_template('menulist.tpl'),array( - '$title' => t('Manage Menus'), + '$title' => t('Menus'), + '$create' => $create, '$menus' => $x, + '$nametitle' => t('Menu Name'), + '$desctitle' => t('Menu Title'), '$edit' => t('Edit'), '$drop' => t('Drop'), '$new' => t('New'), '$bmark' => t('Bookmarks allowed'), - '$hintnew' => t('Create a new menu'), + '$hintnew' => t('Create'), '$hintdrop' => t('Delete this menu'), '$hintcontent' => t('Edit menu contents'), '$hintedit' => t('Edit this menu'), @@ -98,50 +112,38 @@ function menu_content(&$a) { } - if(argc() > 1) { - if(argv(1) === 'new') { - $o = replace_macros(get_markup_template('menuedit.tpl'), array( - '$header' => t('New Menu'), - '$menu_name' => array('menu_name', t('Menu name'), '', t('Must be unique, only seen by you'), '*'), - '$menu_desc' => array('menu_desc', t('Menu title'), '', t('Menu title as seen by others'), ''), - '$menu_bookmark' => array('menu_bookmark', t('Allow bookmarks'), 0 , t('Menu may be used to store saved bookmarks'), ''), - '$submit' => t('Create'), - '$sys' => $a->is_sys - )); - - return $o; - } + if(intval(argv(1))) { - elseif(intval(argv(1))) { - $m = menu_fetch_id(intval(argv(1)),$uid); - if(! $m) { - notice( t('Menu not found.') . EOL); - return ''; - } if(argc() == 3 && argv(2) == 'drop') { $r = menu_delete_id(intval(argv(1)),$uid); - if($r) - info( t('Menu deleted.') . EOL); - else + if(!$r) notice( t('Menu could not be deleted.'). EOL); goaway(z_root() . '/menu' . (($a->is_sys) ? '?f=&sys=1' : '')); } - else { - $o = replace_macros(get_markup_template('menuedit.tpl'), array( - '$header' => t('Edit Menu'), - '$menu_id' => intval(argv(1)), - '$hintedit' => t('Add or remove entries to this menu'), - '$editcontents' => t('Edit menu contents'), - '$menu_name' => array('menu_name', t('Menu name'), $m['menu_name'], t('Must be unique, only seen by you'), '*'), - '$menu_desc' => array('menu_desc', t('Menu title'), $m['menu_desc'], t('Menu title as seen by others'), ''), - '$menu_bookmark' => array('menu_bookmark', t('Allow bookmarks'), (($m['menu_flags'] & MENU_BOOKMARK) ? 1 : 0), t('Menu may be used to store saved bookmarks'), ''), - '$menu_system' => (($m['menu_flags'] & MENU_SYSTEM) ? 1 : 0), - '$submit' => t('Modify') - )); - return $o; + + $m = menu_fetch_id(intval(argv(1)),$uid); + + if(! $m) { + notice( t('Menu not found.') . EOL); + return ''; } + + $o = replace_macros(get_markup_template('menuedit.tpl'), array( + '$header' => t('Edit Menu'), + '$menu_id' => intval(argv(1)), + '$hintedit' => t('Add or remove entries to this menu'), + '$editcontents' => t('Edit menu contents'), + '$menu_name' => array('menu_name', t('Menu name'), $m['menu_name'], t('Must be unique, only seen by you'), '*'), + '$menu_desc' => array('menu_desc', t('Menu title'), $m['menu_desc'], t('Menu title as seen by others'), ''), + '$menu_bookmark' => array('menu_bookmark', t('Allow bookmarks'), (($m['menu_flags'] & MENU_BOOKMARK) ? 1 : 0), t('Menu may be used to store saved bookmarks'), ''), + '$menu_system' => (($m['menu_flags'] & MENU_SYSTEM) ? 1 : 0), + '$submit' => t('Modify') + )); + + return $o; + } else { notice( t('Not found.') . EOL); |