aboutsummaryrefslogtreecommitdiffstats
path: root/mod
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2013-08-13 18:10:03 -0700
committerfriendica <info@friendica.com>2013-08-13 18:10:03 -0700
commit680baff73d70769714d806c00cc84c6e65faba0f (patch)
treee4d66e2d7baf54597e125ad6c4c83dbbd65f1715 /mod
parentd6c6a2b144ad1c619cef70310bad7e0cdc920e77 (diff)
downloadvolse-hubzilla-680baff73d70769714d806c00cc84c6e65faba0f.tar.gz
volse-hubzilla-680baff73d70769714d806c00cc84c6e65faba0f.tar.bz2
volse-hubzilla-680baff73d70769714d806c00cc84c6e65faba0f.zip
menu management complete (as opposed to menu *content* management, which is not). As usual, this means functionally complete - as theming and presentation have been left for those more suited to the task.
Diffstat (limited to 'mod')
-rw-r--r--mod/menu.php62
1 files changed, 49 insertions, 13 deletions
diff --git a/mod/menu.php b/mod/menu.php
index a624b4727..f00bf7a78 100644
--- a/mod/menu.php
+++ b/mod/menu.php
@@ -7,12 +7,29 @@ function menu_post(&$a) {
if(! local_user())
return;
- $channel = $a->get_channel();
- $menu_id = ((argc() > 1) ? intval(argv(1)) : 0);
+ $_REQUEST['menu_channel_id'] = local_user();
- $menu_name = (($_REQUEST['menu_name']) ? $_REQUEST['menu_name'] : '');
- $menu_desc = (($_REQUEST['menu_desc']) ? $_REQUEST['menu_desc'] : '');
+ $menu_id = ((argc() > 1) ? intval(argv(1)) : 0);
+ if($menu_id) {
+ $_REQUEST['menu_id'] = intval(argv(1));
+ $r = menu_edit($_REQUEST);
+ if($r) {
+ info( t('Menu updated.') . EOL);
+ goaway(z_root() . '/mitem/' . $menu_id);
+ }
+ else
+ notice( t('Unable to update menu.'). EOL);
+ }
+ else {
+ $r = menu_create($_REQUEST);
+ if($r) {
+ info( t('Menu created.') . EOL);
+ goaway(z_root() . '/mitem/' . $r);
+ }
+ else
+ notice( t('Unable to create menu.'). EOL);
+ }
}
@@ -37,6 +54,7 @@ function menu_content(&$a) {
'$new' => t('New'),
'$hintnew' => t('Create a new menu'),
'$hintdrop' => t('Delete this menu'),
+ '$hintcontent' => t('Edit menu contents'),
'$hintedit' => t('Edit this menu')
));
}
@@ -50,14 +68,22 @@ function menu_content(&$a) {
if(argc() > 1) {
- if(argv(1) === 'new') {
- // new menu
-
-
-
+ 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'), ''),
+ '$submit' => t('Create')
+ ));
+ return $o;
}
elseif(intval(argv(1))) {
+ $m = menu_fetch_id(intval(argv(1)),local_user());
+ if(! $m) {
+ notice( t('Menu not found.') . EOL);
+ return '';
+ }
if(argc() == 3 && argv(2) == 'drop') {
$r = menu_delete_id(intval(argv(1)),local_user());
if($r)
@@ -68,12 +94,22 @@ function menu_content(&$a) {
goaway(z_root() . '/menu');
}
else {
- // edit menu
-
-
+ $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'), ''),
+ '$submit' => t('Modify')
+ ));
+ return $o;
}
}
-
+ else {
+ notice( t('Not found.') . EOL);
+ return;
+ }
}
}