Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
made "Add photos" its own site menu item
* open for suggestions on the submenu item labels
* @bharat: not sure about the add photos menu item id in the dropdown case
  • Loading branch information
jhilden committed Jun 2, 2009
1 parent 01c5774 commit dde5fb9
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 16 deletions.
13 changes: 8 additions & 5 deletions modules/gallery/helpers/gallery_menu.php
Expand Up @@ -30,7 +30,14 @@ static function site($menu, $theme) {

$can_edit = $item && access::can("edit", $item) || $is_admin;
$can_add = $item && (access::can("add", $item) || $is_admin);


if ($can_add) {
$menu->append(Menu::factory("dialog")
->id("add_photos_item")
->label(t("Add photos"))
->url(url::site("simple_uploader/app/$item->id")));
}

if ($item && $can_edit || $can_add) {
$menu->append($options_menu = Menu::factory("submenu")
->id("options_menu")
Expand All @@ -48,10 +55,6 @@ static function site($menu, $theme) {
if ($item->is_album()) {
if ($can_add) {
$options_menu
->append(Menu::factory("dialog")
->id("add_item")
->label(t("Add a photo"))
->url(url::site("simple_uploader/app/$item->id")))
->append(Menu::factory("dialog")
->id("add_album")
->label(t("Add an album"))
Expand Down
25 changes: 14 additions & 11 deletions modules/server_add/helpers/server_add_menu.php
Expand Up @@ -40,22 +40,25 @@ static function site($menu, $theme) {
->label(t("Add from server"))
->url(url::site("server_add/index/$item->id"));
$options_menu = $menu->get("options_menu");
$add_item = $options_menu->get("add_item");
$add_menu = $options_menu->get("add_menu");
$add_photos_item = $menu->get("add_photos_item");
$add_photos_menu = $menu->get("add_photos_menu");

if ($add_item && !$add_menu) {
if ($add_photos_item && !$add_photos_menu) {
// Assuming that $add_menu is unset, create add_menu and add our item
$options_menu->add_after(
"add_item",
$menu->add_after(
"home",
Menu::factory("submenu")
->id("add_menu")
->label(t("Add"))
->append($add_item)
->id("add_photos_menu")
->label(t("Add Photos"))
->append(Menu::factory("dialog")
->id("add_photos_submenu_item")
->label(t("via Simple Uploader"))
->url(url::site("simple_uploader/app/$item->id")))
->append($server_add));
$options_menu->remove("add_item");
} else if ($add_menu) {
$menu->remove("add_photos_item");
} else if ($add_photos_menu) {
// Append to the existing sub-menu
$add_menu->append($server_add);
$add_photos_menu->append($server_add);
} else {
// Else just add it in at the end of Options
$options_menu->append($server_add);
Expand Down

0 comments on commit dde5fb9

Please sign in to comment.