diff options
author | Bharat Mediratta <bharat@menalto.com> | 2008-12-24 00:20:26 +0000 |
---|---|---|
committer | Bharat Mediratta <bharat@menalto.com> | 2008-12-24 00:20:26 +0000 |
commit | 672eca53371b131484d00cbe6a069092d0b7f6b3 (patch) | |
tree | 507cce76fc6dc9d022455eed9075e039fa779da2 /core/helpers/core_menu.php | |
parent | c76d730a7c07253e7cc3224a78c616ce63989f40 (diff) |
Lots of deltas rolled up into a bigger change. Sorry for the mess.
1) Deleted in-place-editing. We'll be replacing this with a real edit
system that groups settings together and is more coherent.
2) Tweaked the way that dialog boxes work to get the ajax stuff working
again. It's imperfect and does not work properly for uploading images.
This is going to get redone also, but this is a good resting point.
3) Created edit forms for albums and photos. Moved _update and _create out
of Items_Controller and into the individual subclasses.
4) Created access::required which is a shorthand for:
if (!access::can(...)) {
access::forbidden();
}
5) Added validation rules to Items_Model
6) Converted login to use the regular modal dialog approach in the theme.
Diffstat (limited to 'core/helpers/core_menu.php')
-rw-r--r-- | core/helpers/core_menu.php | 37 |
1 files changed, 22 insertions, 15 deletions
diff --git a/core/helpers/core_menu.php b/core/helpers/core_menu.php index 63a742ee..685ccf64 100644 --- a/core/helpers/core_menu.php +++ b/core/helpers/core_menu.php @@ -32,24 +32,31 @@ class core_menu_Core { $item = $theme->item(); if (!user::active()->guest) { - $admin_menu = Menu::factory("submenu") - ->id("admin_menu") - ->label(_("Admin")); - $menu->append($admin_menu); + $menu->append($admin_menu = Menu::factory("submenu") + ->id("admin_menu") + ->label(_("Admin"))); } if ($item && access::can("edit", $item)) { - $menu->append(Menu::factory("submenu") - ->id("options_menu") - ->label(_("Options")) - ->append(Menu::factory("dialog") - ->id("add_item") - ->label(_("Add an item")) - ->url(url::site("form/add/photos/$item->id"))) - ->append(Menu::factory("dialog") - ->id("add_album") - ->label(_("Add album")) - ->url(url::site("form/add/albums/$item->id")))); + $menu->append($options_menu = Menu::factory("submenu") + ->id("options_menu") + ->label(_("Options")) + ->append(Menu::factory("dialog") + ->id("edit_item") + ->label($item->type == "album" ? _("Edit album") : _("Edit photo")) + ->url(url::site("form/edit/{$item->type}s/$item->id")))); + + if ($item->type == "album") { + $options_menu + ->append(Menu::factory("dialog") + ->id("add_item") + ->label(_("Add a photo")) + ->url(url::site("form/add/albums/$item->id?type=photo"))) + ->append(Menu::factory("dialog") + ->id("add_album") + ->label(_("Add an album")) + ->url(url::site("form/add/albums/$item->id?type=album"))); + } $admin_menu->append(Menu::factory("dialog") ->id("edit") |