From 52147cf6f857c4c54a2f3d753e72b27b5141d028 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Mon, 3 Aug 2009 21:45:54 -0700 Subject: Combine the quick menu and the thumb menu into a single menu called the "context" menu. This new context menu is generated using the typical event processing system, like our other menus. The specialized quick CSS and JS is now gone, replaced by our generic menu handling code. It's all rolled together currently using the thumb_menu UI for easy packaging. All the CSS and JS is updated. NOTE: the non-dialog links (rotate, album_cover) have a broken UI because they return JSON which the quick.js code handled specially, but we don't handle properly now. I need to fix this. --- modules/digibug/helpers/digibug_event.php | 4 +- modules/gallery/controllers/quick.php | 14 --- modules/gallery/css/quick.css | 52 ---------- modules/gallery/helpers/gallery.php | 102 ++++++++++++++++++++ modules/gallery/helpers/gallery_quick.php | 152 ------------------------------ modules/gallery/helpers/gallery_theme.php | 31 ------ modules/gallery/helpers/module.php | 8 +- modules/gallery/js/quick.js | 78 --------------- modules/gallery/libraries/Menu.php | 4 +- modules/gallery/libraries/Theme_View.php | 10 +- modules/gallery/views/quick_pane.html.php | 26 ----- 11 files changed, 115 insertions(+), 366 deletions(-) delete mode 100644 modules/gallery/css/quick.css delete mode 100644 modules/gallery/helpers/gallery_quick.php delete mode 100644 modules/gallery/js/quick.js delete mode 100644 modules/gallery/views/quick_pane.html.php (limited to 'modules') diff --git a/modules/digibug/helpers/digibug_event.php b/modules/digibug/helpers/digibug_event.php index c4f9e560..efe66a0f 100644 --- a/modules/digibug/helpers/digibug_event.php +++ b/modules/digibug/helpers/digibug_event.php @@ -36,9 +36,9 @@ class digibug_event_Core { ->css_id("gDigibugLink")); } - static function thumb_menu($menu, $theme, $item) { + static function context_menu($menu, $theme, $item) { if ($item->type == "photo") { - $menu->get("options_menu") + $menu ->append( Menu::factory("link") ->id("digibug") diff --git a/modules/gallery/controllers/quick.php b/modules/gallery/controllers/quick.php index de027c1b..82176e02 100644 --- a/modules/gallery/controllers/quick.php +++ b/modules/gallery/controllers/quick.php @@ -18,20 +18,6 @@ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ class Quick_Controller extends Controller { - public function pane($id) { - $item = model_cache::get("item", $id); - if (!access::can("view", $item) || !access::can("edit", $item)) { - return ""; - } - - $view = new View("quick_pane.html"); - $page_type = Input::instance()->get("page_type"); - $view->button_list = gallery_quick::get_quick_buttons($item, $page_type); - $view->item = $item; - $view->page_type = $page_type; - print $view; - } - public function rotate($id, $dir) { access::verify_csrf(); $item = model_cache::get("item", $id); diff --git a/modules/gallery/css/quick.css b/modules/gallery/css/quick.css deleted file mode 100644 index f153d475..00000000 --- a/modules/gallery/css/quick.css +++ /dev/null @@ -1,52 +0,0 @@ -.gQuickPane { - position: absolute; - top: 0; - left: 0; - text-align: center; - width: 100%; - height: auto; -} - -.gItem:hover { - background-color: #cfdeff; -} - -.gQuick { - border: none !important; - margin: 0 !important; - padding: 0 !important; -} - -.gQuickPane { - background: #000; - border-bottom: 1px solid #ccc; - opacity: 0.9; - position: absolute; - top: 0; - left: 0; -} - -.gQuickPane a { - cursor: pointer; - float: left; - margin: 4px; -} - -.gQuickPaneOptions { - background: #000; - float: left; - width: 100%; -} - -.gQuickPaneOptions li a { - display: block; - float: none; - width: auto; - margin: 0; - padding: .5em .5em .5em .8em; - text-align: left; -} - -.gQuickPaneOptions li a:hover { - background-color: #4d4d4d; -} diff --git a/modules/gallery/helpers/gallery.php b/modules/gallery/helpers/gallery.php index 476e9cbe..085965a2 100644 --- a/modules/gallery/helpers/gallery.php +++ b/modules/gallery/helpers/gallery.php @@ -196,4 +196,106 @@ class gallery_Core { ->url(url::site("admin/maintenance"))); return $menu; } + + static function context_menu($menu, $theme, $item, $page_type) { + switch ($item->type) { + case "movie": + $edit_title = t("Edit this movie"); + $move_title = t("Move this movie to another album"); + $cover_title = t("Choose this movie as the album cover"); + $delete_title = t("Delete this movie"); + break; + + case "album": + $edit_title = t("Edit this album"); + $move_title = t("Move this album to another album"); + $cover_title = t("Choose this album as the album cover"); + $delete_title = t("Delete this album"); + break; + + default: + $edit_title = t("Edit this photo"); + $move_title = t("Move this photo to another album"); + $cover_title = t("Choose this photo as the album cover"); + $delete_title = t("Delete this photo"); + break; + } + + $csrf = access::csrf_token(); + $menu->append(Menu::factory("dialog") + ->id("edit") + ->label($edit_title) + ->css_clasS("ui-icon-pencil") + ->url(url::site("quick/form_edit/$item->id?page_type=$page_type"))); + + + if ($item->is_photo() && graphics::can("rotate")) { + $menu + ->append(Menu::factory("link") + ->id("rotate_ccw") + ->label(t("Rotate 90 degrees counter clockwise")) + ->css_class("ui-icon-rotate-ccw") + ->url(url::site("quick/rotate/$item->id/ccw?csrf=$csrf&page_type=$page_type"))) + ->append(Menu::factory("link") + ->id("rotate_cw") + ->label(t("Rotate 90 degrees clockwise")) + ->css_class("ui-icon-rotate-cw") + ->url(url::site("quick/rotate/$item->id/cw?csrf=$csrf&page_type=$page_type"))); + } + + // Don't move photos from the photo page; we don't yet have a good way of redirecting after move + if ($page_type == "album") { + $menu + ->append(Menu::factory("dialog") + ->id("move") + ->label($move_title) + ->css_class("ui-icon-folder-open") + ->url(url::site("move/browse/$item->id"))); + } + + $parent = $item->parent(); + if (access::can("edit", $parent)) { + // We can't make this item the highlight if it's an album with no album cover, or if it's + // already the album cover. + if (($item->type == "album" && empty($item->album_cover_item_id)) || + ($item->type == "album" && $parent->album_cover_item_id == $item->album_cover_item_id) || + $parent->album_cover_item_id == $item->id) { + $disabledState = " ui-state-disabled"; + } else { + $disabledState = " "; + } + $menu + ->append(Menu::factory("link") + ->id("make_album_cover") + ->label($cover_title) + ->css_class($disabledState) + ->url( + url::site("quick/make_album_cover/$item->id?csrf=$csrf&page_type=$page_type"))) + ->append(Menu::factory("dialog") + ->id("delete") + ->label($delete_title) + ->css_class("ui-icon-trash") + ->css_id("gQuickDelete") + ->url(url::site("quick/form_delete/$item->id?csrf=$csrf&page_type=$page_type"))); + } + + if ($item->is_album()) { + $menu + ->append(Menu::factory("dialog") + ->id("add_item") + ->label(t("Add a photo")) + ->css_class("add_item") + ->url(url::site("simple_uploader/app/$item->id"))) + ->append(Menu::factory("dialog") + ->id("add_album") + ->label(t("Add an album")) + ->css_class("add_album") + ->url(url::site("form/add/albums/$item->id?type=album"))) + ->append(Menu::factory("dialog") + ->id("edit_permissions") + ->label(t("Edit permissions")) + ->css_class("permissions") + ->url(url::site("permissions/browse/$item->id"))); + } + } } \ No newline at end of file diff --git a/modules/gallery/helpers/gallery_quick.php b/modules/gallery/helpers/gallery_quick.php deleted file mode 100644 index 8a92890b..00000000 --- a/modules/gallery/helpers/gallery_quick.php +++ /dev/null @@ -1,152 +0,0 @@ -name == "gallery") { - continue; - } - $class_name = "{$module->name}_quick"; - if (method_exists($class_name, "buttons")) { - $module_buttons = call_user_func(array($class_name, "buttons"), $item, $page_type); - foreach (array("left", "center", "right", "additional") as $position) { - if (!empty($module_buttons[$position])) { - $buttons[$position] = array_merge($buttons[$position], $module_buttons[$position]); - } - } - } - } - - $sorted_buttons->main = array(); - foreach (array("left", "center", "right") as $position) { - $sorted_buttons->main = array_merge($sorted_buttons->main, $buttons[$position]); - } - - $sorted_buttons->additional = $buttons["additional"]; - $max_display = empty($sorted_buttons->additional) ? 6 : 5; - if (count($sorted_buttons->main) >= $max_display) { - $to_move = array_slice($sorted_buttons->main, 5); - $sorted_buttons->additional = array_merge($to_move, $sorted_buttons->additional); - for ($i = count($sorted_buttons->main); $i >= 5; $i--) { - unset($sorted_buttons->main[$i]); - } - } - - return $sorted_buttons; - } - - static function buttons($item, $page_type) { - $elements = array("left" => array(), "center" => array(), "right" => array(), - "additional" => array()); - switch ($item->type) { - case "movie": - $edit_title = t("Edit this movie"); - $move_title = t("Move this movie to another album"); - $cover_title = t("Choose this movie as the album cover"); - $delete_title = t("Delete this movie"); - break; - case "album": - $edit_title = t("Edit this album"); - $move_title = t("Move this album to another album"); - $cover_title = t("Choose this album as the album cover"); - $delete_title = t("Delete this album"); - break; - default: - $edit_title = t("Edit this photo"); - $move_title = t("Move this photo to another album"); - $cover_title = t("Choose this photo as the album cover"); - $delete_title = t("Delete this photo"); - break; - } - - $csrf = access::csrf_token(); - $elements["left"][] = (object)array( - "title" => $edit_title, - "class" => "gDialogLink gButtonLink", - "icon" => "ui-icon-pencil", - "href" => url::site("quick/form_edit/$item->id?page_type=$page_type")); - - if ($item->is_photo() && graphics::can("rotate")) { - $elements["left"][] = - (object)array( - "title" => t("Rotate 90 degrees counter clockwise"), - "class" => "gButtonLink", - "icon" => "ui-icon-rotate-ccw", - "href" => url::site("quick/rotate/$item->id/ccw?csrf=$csrf&page_type=$page_type")); - $elements["left"][] = - (object)array( - "title" => t("Rotate 90 degrees clockwise"), - "class" => "gButtonLink", - "icon" => "ui-icon-rotate-cw", - "href" => url::site("quick/rotate/$item->id/cw?csrf=$csrf&page_type=$page_type")); - } - - // Don't move photos from the photo page; we don't yet have a good way of redirecting after move - if ($page_type == "album") { - $elements["left"][] = (object)array( - "title" => $move_title, - "class" => "gDialogLink gButtonLink", - "icon" => "ui-icon-folder-open", - "href" => url::site("move/browse/$item->id")); - } - - $parent = $item->parent(); - if (access::can("edit", $parent)) { - // We can't make this item the highlight if it's an album with no album cover, or if it's - // already the album cover. - if (($item->type == "album" && empty($item->album_cover_item_id)) || - ($item->type == "album" && $parent->album_cover_item_id == $item->album_cover_item_id) || - $parent->album_cover_item_id == $item->id) { - $disabledState = " ui-state-disabled"; - } else { - $disabledState = " "; - } - $elements["right"][] = (object)array( - "title" => $cover_title, - "class" => "gButtonLink$disabledState", - "icon" => "ui-icon-star", - "href" => url::site("quick/make_album_cover/$item->id?csrf=$csrf&page_type=$page_type")); - - $elements["right"][] = (object)array( - "title" => $delete_title, - "class" => "gDialogLink gButtonLink", - "icon" => "ui-icon-trash", - "id" => "gQuickDelete", - "href" => url::site("quick/form_delete/$item->id?csrf=$csrf&page_type=$page_type")); - } - - if ($item->is_album()) { - $elements["additional"][] = (object)array( - "title" => t("Add a photo"), - "class" => "add_item gDialogLink", - "href" => url::site("simple_uploader/app/$item->id")); - $elements["additional"][] = (object)array( - "title" => t("Add an album"), - "class" => "add_album gDialogLink", - "href" => url::site("form/add/albums/$item->id?type=album")); - $elements["additional"][] = (object)array( - "title" => t("Edit permissions"), - "class" => "permissions gDialogLink", - "href" => url::site("permissions/browse/$item->id")); - } - return $elements; - } -} diff --git a/modules/gallery/helpers/gallery_theme.php b/modules/gallery/helpers/gallery_theme.php index d3751b80..8fe1c768 100644 --- a/modules/gallery/helpers/gallery_theme.php +++ b/modules/gallery/helpers/gallery_theme.php @@ -24,11 +24,6 @@ class gallery_theme_Core { if ($session->get("debug")) { $theme->css("debug.css"); } - if (($theme->page_type == "album" || $theme->page_type == "photo") - && access::can("edit", $theme->item())) { - $theme->css("quick.css"); - $theme->script("quick.js"); - } if (module::is_active("rss")) { if ($item = $theme->item()) { @@ -51,32 +46,6 @@ class gallery_theme_Core { return $buf; } - static function resize_top($theme, $item) { - if (access::can("edit", $item)) { - $edit_link = url::site("quick/pane/$item->id?page_type=photo"); - return "
"; - } - } - - static function resize_bottom($theme, $item) { - if (access::can("edit", $item)) { - return "
"; - } - } - - static function thumb_top($theme, $child) { - if (access::can("edit", $child)) { - $edit_link = url::site("quick/pane/$child->id?page_type=album"); - return "
"; - } - } - - static function thumb_bottom($theme, $child) { - if (access::can("edit", $child)) { - return "
"; - } - } - static function admin_head($theme) { $session = Session::instance(); if ($session->get("debug")) { diff --git a/modules/gallery/helpers/module.php b/modules/gallery/helpers/module.php index 0d483206..03d538a9 100644 --- a/modules/gallery/helpers/module.php +++ b/modules/gallery/helpers/module.php @@ -274,11 +274,9 @@ class module_Core { array_shift($args); $function = str_replace(".", "_", $name); - foreach (self::$modules as $module) { - if (!$module->active) { - continue; - } - + // @todo: consider calling gallery_event first, since for things menus we need it to do some + // setup + foreach (self::$active as $module) { $class = "{$module->name}_event"; if (method_exists($class, $function)) { call_user_func_array(array($class, $function), $args); diff --git a/modules/gallery/js/quick.js b/modules/gallery/js/quick.js deleted file mode 100644 index fda6470f..00000000 --- a/modules/gallery/js/quick.js +++ /dev/null @@ -1,78 +0,0 @@ -$(document).ready(function() { - if ($("#gAlbumGrid").length) { - // @todo Add quick edit pane for album (meta, move, permissions, delete) - $(".gItem").hover(show_quick, function() {}); - } - if ($("#gPhoto").length) { - $("#gPhoto").hover(show_quick, function() {}); - } -}); - -var show_quick = function() { - var cont = $(this); - var quick = $(this).find(".gQuick"); - var img = cont.find(".gThumbnail,.gResize"); - cont.find(".gQuickPane").remove(); - cont.append("
"); - cont.find(".gQuickPane").hide(); - cont.hover(function() {}, function() { cont.find(".gQuickPane").remove(); }); - $.get( - quick.attr("href"), - {}, - function(data, textStatus) { - cont.find(".gQuickPane").html(data).slideDown("fast"); - $(".ui-state-default").hover( - function() { - $(this).addClass("ui-state-hover"); - }, - function() { - $(this).removeClass("ui-state-hover"); - } - ); - cont.find(".gQuickPane a:not(.options)").click(function(e) { - e.preventDefault(); - quick_do(cont, $(this), img); - }); - cont.find(".gQuickPane a.options").click(function(e) { - e.preventDefault(); - cont.find(".gQuickPaneOptions").slideToggle("fast"); - }); - } - ); -}; - -var quick_do = function(cont, pane, img) { - if (pane.hasClass("ui-state-disabled")) { - return false; - } - if (pane.hasClass("gDialogLink")) { - openDialog(pane); - } else { - img.css("opacity", "0.1"); - cont.addClass("gLoadingLarge"); - $.ajax({ - type: "GET", - url: pane.attr("href"), - dataType: "json", - success: function(data) { - img.css("opacity", "1"); - cont.removeClass("gLoadingLarge"); - if (data.src) { - img.attr("width", data.width); - img.attr("height", data.height); - img.attr("src", data.src); - if (data.height > data.width) { - img.css("margin-top", -32); - } else { - img.css("margin-top", 0); - } - } else if (data.location) { - window.location = data.location; - } else if (data.reload) { - window.location.reload(); - } - } - }); - } - return false; -}; diff --git a/modules/gallery/libraries/Menu.php b/modules/gallery/libraries/Menu.php index a39b59a5..263dc38d 100644 --- a/modules/gallery/libraries/Menu.php +++ b/modules/gallery/libraries/Menu.php @@ -91,7 +91,7 @@ class Menu_Element_Link extends Menu_Element { } else { $css_class = ""; } - return "
  • url\" " . + return "
  • url\" " . "title=\"$this->label\">$this->label
  • "; } } @@ -111,7 +111,7 @@ class Menu_Element_Dialog extends Menu_Element { } else { $css_class = ""; } - return "
  • url\" " . + return "
  • url\" " . "title=\"$this->label\">$this->label
  • "; } } diff --git a/modules/gallery/libraries/Theme_View.php b/modules/gallery/libraries/Theme_View.php index 360e5e46..24dea729 100644 --- a/modules/gallery/libraries/Theme_View.php +++ b/modules/gallery/libraries/Theme_View.php @@ -111,14 +111,16 @@ class Theme_View_Core extends Gallery_View { return $menu->compact(); } - public function thumb_menu($item) { + public function context_menu($item) { $menu = Menu::factory("root") ->append(Menu::factory("submenu") - ->id("options_menu") + ->id("context_menu") ->label(t("Options"))) - ->css_class("gThumbMenu"); + ->css_class("gContextMenu"); - module::event("thumb_menu", $menu, $this, $item); + $page_type = Input::instance()->get("page_type"); + gallery::context_menu($menu, $this, $item, $page_type); + module::event("context_menu", $menu, $this, $item, $page_type); return $menu->compact(); } diff --git a/modules/gallery/views/quick_pane.html.php b/modules/gallery/views/quick_pane.html.php deleted file mode 100644 index e5469696..00000000 --- a/modules/gallery/views/quick_pane.html.php +++ /dev/null @@ -1,26 +0,0 @@ - -main as $button): ?> - - - title ?> - - - - -additional)): ?> -"> - - - - - - - -- cgit v1.2.3 From 6357f3332b9bc33b10c11dc93b83ba9e72eec109 Mon Sep 17 00:00:00 2001 From: Chad Kieffer Date: Sat, 8 Aug 2009 01:14:22 -0600 Subject: Added basic context menu affects and styles. Simplified some of the action labels in the menu. --- modules/digibug/helpers/digibug_event.php | 18 ++++----- modules/gallery/helpers/gallery.php | 30 ++++++++------- themes/default/css/screen.css | 64 ++++++++++++++++++++++++++----- themes/default/js/ui.init.js | 63 +++++++++++++++++++++++------- 4 files changed, 128 insertions(+), 47 deletions(-) (limited to 'modules') diff --git a/modules/digibug/helpers/digibug_event.php b/modules/digibug/helpers/digibug_event.php index efe66a0f..93bc1747 100644 --- a/modules/digibug/helpers/digibug_event.php +++ b/modules/digibug/helpers/digibug_event.php @@ -28,19 +28,19 @@ class digibug_event_Core { static function photo_menu($menu, $theme) { $item = $theme->item(); - $menu->append( - Menu::factory("link") - ->id("digibug") - ->label(t("Print with Digibug")) - ->url(url::site("digibug/print_photo/$item->id?csrf=$theme->csrf")) - ->css_id("gDigibugLink")); + $menu->get("options_menu") + ->append(Menu::factory("link") + ->id("digibug") + ->label(t("Print with Digibug")) + ->url(url::site("digibug/print_photo/$item->id?csrf=$theme->csrf")) + ->css_id("gDigibugLink")); } static function context_menu($menu, $theme, $item) { + $item = $theme->item(); if ($item->type == "photo") { - $menu - ->append( - Menu::factory("link") + $menu->get("options_menu") + ->append(Menu::factory("link") ->id("digibug") ->label(t("Print with Digibug")) ->url(url::site("digibug/print_photo/$item->id?csrf=$theme->csrf")) diff --git a/modules/gallery/helpers/gallery.php b/modules/gallery/helpers/gallery.php index 085965a2..72e7aeeb 100644 --- a/modules/gallery/helpers/gallery.php +++ b/modules/gallery/helpers/gallery.php @@ -201,28 +201,30 @@ class gallery_Core { switch ($item->type) { case "movie": $edit_title = t("Edit this movie"); - $move_title = t("Move this movie to another album"); - $cover_title = t("Choose this movie as the album cover"); $delete_title = t("Delete this movie"); break; case "album": $edit_title = t("Edit this album"); - $move_title = t("Move this album to another album"); - $cover_title = t("Choose this album as the album cover"); $delete_title = t("Delete this album"); break; default: $edit_title = t("Edit this photo"); - $move_title = t("Move this photo to another album"); - $cover_title = t("Choose this photo as the album cover"); $delete_title = t("Delete this photo"); break; } + $cover_title = t("Choose as the album cover"); + $move_title = t("Move to another album"); $csrf = access::csrf_token(); - $menu->append(Menu::factory("dialog") + + $menu->append($options_menu = Menu::factory("submenu") + ->id("options") + ->label(t("Options")) + ->css_class("ui-icon-carat-1-n")); + + $options_menu->append(Menu::factory("dialog") ->id("edit") ->label($edit_title) ->css_clasS("ui-icon-pencil") @@ -230,22 +232,22 @@ class gallery_Core { if ($item->is_photo() && graphics::can("rotate")) { - $menu + $options_menu ->append(Menu::factory("link") ->id("rotate_ccw") - ->label(t("Rotate 90 degrees counter clockwise")) + ->label(t("Rotate 90° counter clockwise")) ->css_class("ui-icon-rotate-ccw") ->url(url::site("quick/rotate/$item->id/ccw?csrf=$csrf&page_type=$page_type"))) ->append(Menu::factory("link") ->id("rotate_cw") - ->label(t("Rotate 90 degrees clockwise")) + ->label(t("Rotate 90° clockwise")) ->css_class("ui-icon-rotate-cw") ->url(url::site("quick/rotate/$item->id/cw?csrf=$csrf&page_type=$page_type"))); } // Don't move photos from the photo page; we don't yet have a good way of redirecting after move if ($page_type == "album") { - $menu + $options_menu ->append(Menu::factory("dialog") ->id("move") ->label($move_title) @@ -264,11 +266,11 @@ class gallery_Core { } else { $disabledState = " "; } - $menu + $options_menu ->append(Menu::factory("link") ->id("make_album_cover") ->label($cover_title) - ->css_class($disabledState) + ->css_class("ui-icon-star") ->url( url::site("quick/make_album_cover/$item->id?csrf=$csrf&page_type=$page_type"))) ->append(Menu::factory("dialog") @@ -280,7 +282,7 @@ class gallery_Core { } if ($item->is_album()) { - $menu + $options_menu ->append(Menu::factory("dialog") ->id("add_item") ->label(t("Add a photo")) diff --git a/themes/default/css/screen.css b/themes/default/css/screen.css index eb092b83..1cb813f3 100644 --- a/themes/default/css/screen.css +++ b/themes/default/css/screen.css @@ -453,26 +453,32 @@ form .gError, #gContent #gAlbumGrid { margin: 1em 0; + position: relative; + z-index: 1; } #gContent #gAlbumGrid .gItem { - border: 1px solid #e8e8e8; - border-right-color: #ccc; - border-bottom-color: #ccc; + background-color: #fff; + border: 1px solid #fff; float: left; font-size: .7em; - height: 240px; + height: 220px; overflow: hidden; - padding: 15px 8px 30px 8px; + padding: .6em 8px; position: relative; text-align: center; width: 213px; + z-index: 1; } #gContent #gAlbumGrid .gItem h2 { margin: 5px 0; } +.gPhoto h2, .gItem .gMetadata { + display: none; +} + #gContent #gAlbumGrid .gAlbum { background-color: #e8e8e8; } @@ -485,6 +491,35 @@ form .gError, width: 16px; } +#gContent #gAlbumGrid #gHoverItem { + background-color: #fff; + border: 1px solid #000; + display: none; + height: auto; + margin-top: -1em; + margin-left: -.4em; + padding: 0; + position: absolute; + width: auto; + z-index: 100; +} + +#gContent #gAlbumGrid #gHoverItem .gItem { + float: none; + height: 210px; + margin: 0; + padding: 0 1em 3em; +} + +#gContent #gAlbumGrid #gHoverItem .gItem div { + margin-top: 1em !important; +} + +#gHoverItem .gItem h2, +#gHoverItem .gItem .gMetadata { + display: block; +} + /* Individual photo content ~~~~~~~~~~~~~~ */ #gContent #gItem { @@ -588,25 +623,34 @@ form .gError, /* Thumb Menu ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ -#gContent .gContextMenu { +.gContextMenu { bottom: 0; + display: none; left: 0; position: absolute; width: 100%; - display: none; } -#gContent .gContextMenu li { +.gContextMenu li { border-left: none; border-right: none; border-bottom: none; } -#gContent .gContextMenu li li { +.gContextMenu li li { padding: .3em; } -#gContent .gContextMenu a:hover { + +#gHoverItem .gContextMenu { + display: block; +} + +#gHoverItem .gContextMenu li { + text-align: left; +} + +#gHoverItem .gContextMenu a:hover { text-decoration: none; } diff --git a/themes/default/js/ui.init.js b/themes/default/js/ui.init.js index 6414cbcc..b3c1d514 100644 --- a/themes/default/js/ui.init.js +++ b/themes/default/js/ui.init.js @@ -96,21 +96,56 @@ $(document).ready(function() { ); // Initialize context menus - if ($("#gContent .gContextMenu").length) { - $("#gContent .gContextMenu li").addClass("ui-state-default"); - $(".gContextMenu").parent().hover( - function() { - $(this).find(".gContextMenu").slideDown("fast"); - var dialogLinks = $(this).find(".gDialogLink"); - for (var i = 0; i < dialogLinks.length; i++) { - $(dialogLinks[i]).bind("click", handleDialogEvent); + // @todo Switch Options icon to carat-1-s when menu's open + // @todo apply hover affect to links + $(".gItem").hover( + function(){ + var pos = $(this).position(); + var itemClasses = $(this).attr("class"); + var bgColor = $(this).css("background-color"); + var cont = $(this).parent(); + var iconSpan = ""; + $("#gHoverItem .ui-icon-carat-1-n").html(iconSpan + $("#gHoverItem .ui-icon-carat-1-n").html()); + + $("#gHoverItem").remove(); + cont.append("
    " + + $(this).html() + "
    "); + $("#gHoverItem").css("top", pos.top); + $("#gHoverItem").css("left", pos.left); + $("#gHoverItem").css("background-color", bgColor); + $("#gHoverItem").fadeIn("fast"); + $("#gHoverItem").hover( + function(){ + // Initialize context menus + $("#gContent .gContextMenu li").addClass("ui-state-default"); + $(".gContextMenu ul").hide(); + $(".gContextMenu").hover( + function() { + $(this).find("ul").slideDown("fast"); + var optLinks = $(this).find("a"); + for (var i = 0; i < optLinks.length; i++) { + var iconClass = $(optLinks[i]).attr("class").match(/ui-icon-.[^\s]*/); + iconSpan = ""; + $(optLinks[i]).html(iconSpan + $(optLinks[i]).html()); + if ($(optLinks[i]).hasClass("gDialogLink")) { + $(optLinks[i]).bind("click", handleDialogEvent); + } + } + $("#gContent .gContextMenu li a").addClass("gButtonLink ui-icon-left"); + }, + function() { + $(this).find("ul").slideUp("slow"); + } + ); + }, + function() { + $(this).hide(); } - }, - function() { - $(this).find(".gContextMenu").slideUp("slow"); - } - ); - } + ); + }, + function(){ + } + ); }); -- cgit v1.2.3 From 1c4e1344c6899f1abbfd914d36e7686afec2e5cc Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sun, 9 Aug 2009 12:14:17 -0700 Subject: Update photo_menu() and context_menu() to work with recent menu changes. --- modules/digibug/helpers/digibug_event.php | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) (limited to 'modules') diff --git a/modules/digibug/helpers/digibug_event.php b/modules/digibug/helpers/digibug_event.php index 93bc1747..c75eed49 100644 --- a/modules/digibug/helpers/digibug_event.php +++ b/modules/digibug/helpers/digibug_event.php @@ -28,23 +28,21 @@ class digibug_event_Core { static function photo_menu($menu, $theme) { $item = $theme->item(); - $menu->get("options_menu") - ->append(Menu::factory("link") - ->id("digibug") - ->label(t("Print with Digibug")) - ->url(url::site("digibug/print_photo/$item->id?csrf=$theme->csrf")) - ->css_id("gDigibugLink")); + $menu->append(Menu::factory("link") + ->id("digibug") + ->label(t("Print with Digibug")) + ->url(url::site("digibug/print_photo/$item->id?csrf=$theme->csrf")) + ->css_id("gDigibugLink")); } static function context_menu($menu, $theme, $item) { $item = $theme->item(); if ($item->type == "photo") { - $menu->get("options_menu") - ->append(Menu::factory("link") - ->id("digibug") - ->label(t("Print with Digibug")) - ->url(url::site("digibug/print_photo/$item->id?csrf=$theme->csrf")) - ->css_id("gDigibugLink")); + $menu->append(Menu::factory("link") + ->id("digibug") + ->label(t("Print with Digibug")) + ->url(url::site("digibug/print_photo/$item->id?csrf=$theme->csrf")) + ->css_id("gDigibugLink")); } } } -- cgit v1.2.3 From 85afa537df540bf60ea58029b8954753903f53e6 Mon Sep 17 00:00:00 2001 From: Chad Kieffer Date: Sun, 9 Aug 2009 13:56:39 -0600 Subject: Add jquery ui print icon class to menu --- modules/digibug/helpers/digibug_event.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'modules') diff --git a/modules/digibug/helpers/digibug_event.php b/modules/digibug/helpers/digibug_event.php index c75eed49..b257d16c 100644 --- a/modules/digibug/helpers/digibug_event.php +++ b/modules/digibug/helpers/digibug_event.php @@ -32,17 +32,19 @@ class digibug_event_Core { ->id("digibug") ->label(t("Print with Digibug")) ->url(url::site("digibug/print_photo/$item->id?csrf=$theme->csrf")) - ->css_id("gDigibugLink")); + ->css_id("gDigibugLink") + ->css_class("ui-icon-print")); } - static function context_menu($menu, $theme, $item) { + static function context_menu($menu, $theme) { $item = $theme->item(); if ($item->type == "photo") { $menu->append(Menu::factory("link") ->id("digibug") ->label(t("Print with Digibug")) ->url(url::site("digibug/print_photo/$item->id?csrf=$theme->csrf")) - ->css_id("gDigibugLink")); + ->css_id("gDigibugLink") + ->css_class("ui-icon-print")); } } } -- cgit v1.2.3 From 13546d0be70764af812bb52c6022c4eeb0438ac0 Mon Sep 17 00:00:00 2001 From: Chad Kieffer Date: Sun, 9 Aug 2009 13:59:48 -0600 Subject: Fixed case --- modules/gallery/helpers/gallery.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'modules') diff --git a/modules/gallery/helpers/gallery.php b/modules/gallery/helpers/gallery.php index 72e7aeeb..0bf180c1 100644 --- a/modules/gallery/helpers/gallery.php +++ b/modules/gallery/helpers/gallery.php @@ -227,7 +227,7 @@ class gallery_Core { $options_menu->append(Menu::factory("dialog") ->id("edit") ->label($edit_title) - ->css_clasS("ui-icon-pencil") + ->css_class("ui-icon-pencil") ->url(url::site("quick/form_edit/$item->id?page_type=$page_type"))); -- cgit v1.2.3 From f7a23e0a9cdd4a85e4bc50964917d6995b7d54ab Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sun, 9 Aug 2009 23:08:35 -0700 Subject: Fix up context menus a bit. - Update digibug_event::context_menu() to take the actual item - Change gallery::context_menu() to not require the page_type as an argument --- modules/digibug/helpers/digibug_event.php | 16 ++++++++-------- modules/gallery/helpers/gallery.php | 7 ++++--- modules/gallery/libraries/Theme_View.php | 5 ++--- 3 files changed, 14 insertions(+), 14 deletions(-) (limited to 'modules') diff --git a/modules/digibug/helpers/digibug_event.php b/modules/digibug/helpers/digibug_event.php index b257d16c..d2830b80 100644 --- a/modules/digibug/helpers/digibug_event.php +++ b/modules/digibug/helpers/digibug_event.php @@ -36,15 +36,15 @@ class digibug_event_Core { ->css_class("ui-icon-print")); } - static function context_menu($menu, $theme) { - $item = $theme->item(); + static function context_menu($menu, $theme, $item) { if ($item->type == "photo") { - $menu->append(Menu::factory("link") - ->id("digibug") - ->label(t("Print with Digibug")) - ->url(url::site("digibug/print_photo/$item->id?csrf=$theme->csrf")) - ->css_id("gDigibugLink") - ->css_class("ui-icon-print")); + $menu->get("options_menu") + ->append(Menu::factory("link") + ->id("digibug") + ->label(t("Print with Digibug")) + ->url(url::site("digibug/print_photo/$item->id?csrf=$theme->csrf")) + ->css_id("gDigibugLink") + ->css_class("ui-icon-print")); } } } diff --git a/modules/gallery/helpers/gallery.php b/modules/gallery/helpers/gallery.php index 0bf180c1..279f2013 100644 --- a/modules/gallery/helpers/gallery.php +++ b/modules/gallery/helpers/gallery.php @@ -197,7 +197,8 @@ class gallery_Core { return $menu; } - static function context_menu($menu, $theme, $item, $page_type) { + static function context_menu($menu, $theme, $item) { + $page_type = $theme->page_type(); switch ($item->type) { case "movie": $edit_title = t("Edit this movie"); @@ -218,9 +219,9 @@ class gallery_Core { $move_title = t("Move to another album"); $csrf = access::csrf_token(); - + $menu->append($options_menu = Menu::factory("submenu") - ->id("options") + ->id("options_menu") ->label(t("Options")) ->css_class("ui-icon-carat-1-n")); diff --git a/modules/gallery/libraries/Theme_View.php b/modules/gallery/libraries/Theme_View.php index 24dea729..a5f5db03 100644 --- a/modules/gallery/libraries/Theme_View.php +++ b/modules/gallery/libraries/Theme_View.php @@ -118,9 +118,8 @@ class Theme_View_Core extends Gallery_View { ->label(t("Options"))) ->css_class("gContextMenu"); - $page_type = Input::instance()->get("page_type"); - gallery::context_menu($menu, $this, $item, $page_type); - module::event("context_menu", $menu, $this, $item, $page_type); + gallery::context_menu($menu, $this, $item); + module::event("context_menu", $menu, $this, $item); return $menu->compact(); } -- cgit v1.2.3 From 351532d858b8071e23176bf3bf0eff8a5eab53f6 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Mon, 10 Aug 2009 10:07:54 -0700 Subject: Fix indentation. --- modules/gallery/helpers/gallery.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'modules') diff --git a/modules/gallery/helpers/gallery.php b/modules/gallery/helpers/gallery.php index 279f2013..42097a99 100644 --- a/modules/gallery/helpers/gallery.php +++ b/modules/gallery/helpers/gallery.php @@ -226,21 +226,21 @@ class gallery_Core { ->css_class("ui-icon-carat-1-n")); $options_menu->append(Menu::factory("dialog") - ->id("edit") - ->label($edit_title) - ->css_class("ui-icon-pencil") - ->url(url::site("quick/form_edit/$item->id?page_type=$page_type"))); + ->id("edit") + ->label($edit_title) + ->css_class("ui-icon-pencil") + ->url(url::site("quick/form_edit/$item->id?page_type=$page_type"))); if ($item->is_photo() && graphics::can("rotate")) { $options_menu ->append(Menu::factory("link") - ->id("rotate_ccw") + ->id("rotate_ccw") ->label(t("Rotate 90° counter clockwise")) ->css_class("ui-icon-rotate-ccw") ->url(url::site("quick/rotate/$item->id/ccw?csrf=$csrf&page_type=$page_type"))) ->append(Menu::factory("link") - ->id("rotate_cw") + ->id("rotate_cw") ->label(t("Rotate 90° clockwise")) ->css_class("ui-icon-rotate-cw") ->url(url::site("quick/rotate/$item->id/cw?csrf=$csrf&page_type=$page_type"))); -- cgit v1.2.3 From cbba45fffc7368280e9529f55e108d0080175b6a Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Mon, 10 Aug 2009 23:05:05 -0700 Subject: Create the concept of an "ajax link" and use it for thumbnail rotation and album covers in the context menu. Notes: - This requires context_menu() to have a CSS selector that refers to the that we're operating on, otherwise we don't know how to find the thumbnail, etc. - Create Menu_Element_Ajax_Link which has an ajax_handler attribute that contains a snippet of JS that we're going to run when the ajax call returns. - Add $.gallery_replace_image in gallery.common.js - Add lib/gallery.ajax.js which can be used to ajaxify any link, and have ui.init.js in the themes call that on all .gAjaxLink elements. --- lib/gallery.ajax.js | 15 +++ lib/gallery.common.js | 4 + modules/gallery/helpers/gallery.php | 191 ++++++++++++++++-------------- modules/gallery/libraries/Menu.php | 34 ++++++ modules/gallery/libraries/Theme_View.php | 6 +- themes/admin_default/js/ui.init.js | 3 + themes/admin_default/views/admin.html.php | 1 + themes/default/js/ui.init.js | 9 +- themes/default/views/album.html.php | 2 +- themes/default/views/movie.html.php | 2 +- themes/default/views/page.html.php | 1 + themes/default/views/photo.html.php | 2 +- 12 files changed, 169 insertions(+), 101 deletions(-) create mode 100644 lib/gallery.ajax.js (limited to 'modules') diff --git a/lib/gallery.ajax.js b/lib/gallery.ajax.js new file mode 100644 index 00000000..4f26745d --- /dev/null +++ b/lib/gallery.ajax.js @@ -0,0 +1,15 @@ +(function($) { + $.widget("ui.gallery_ajax", { + _init: function() { + this.element.click(function(event) { + eval("var ajax_handler = " + $(event.currentTarget).attr("ajax_handler")); + $.get($(event.currentTarget).attr("href"), function(data) { + eval("var data = " + data); + ajax_handler(data); + }); + event.preventDefault(); + return false; + }); + } + }); +})(jQuery); diff --git a/lib/gallery.common.js b/lib/gallery.common.js index fdb7a1cc..53c2fafb 100644 --- a/lib/gallery.common.js +++ b/lib/gallery.common.js @@ -104,5 +104,9 @@ ); }; + // Ajax handler for replacing an image, used in Ajax thumbnail rotation + $.gallery_replace_image = function(data, thumb) { + $(thumb).attr({src: data.src, width: data.width, height: data.height}); + }; })(jQuery); diff --git a/modules/gallery/helpers/gallery.php b/modules/gallery/helpers/gallery.php index 42097a99..c81af842 100644 --- a/modules/gallery/helpers/gallery.php +++ b/modules/gallery/helpers/gallery.php @@ -197,108 +197,117 @@ class gallery_Core { return $menu; } - static function context_menu($menu, $theme, $item) { - $page_type = $theme->page_type(); - switch ($item->type) { - case "movie": - $edit_title = t("Edit this movie"); - $delete_title = t("Delete this movie"); - break; - - case "album": - $edit_title = t("Edit this album"); - $delete_title = t("Delete this album"); - break; - - default: - $edit_title = t("Edit this photo"); - $delete_title = t("Delete this photo"); - break; - } - $cover_title = t("Choose as the album cover"); - $move_title = t("Move to another album"); - - $csrf = access::csrf_token(); - + static function context_menu($menu, $theme, $item, $thumb_css_selector) { $menu->append($options_menu = Menu::factory("submenu") ->id("options_menu") ->label(t("Options")) ->css_class("ui-icon-carat-1-n")); - $options_menu->append(Menu::factory("dialog") - ->id("edit") - ->label($edit_title) - ->css_class("ui-icon-pencil") - ->url(url::site("quick/form_edit/$item->id?page_type=$page_type"))); + if (access::can("edit", $item)) { + $page_type = $theme->page_type(); + switch ($item->type) { + case "movie": + $edit_title = t("Edit this movie"); + $delete_title = t("Delete this movie"); + break; + case "album": + $edit_title = t("Edit this album"); + $delete_title = t("Delete this album"); + break; - if ($item->is_photo() && graphics::can("rotate")) { - $options_menu - ->append(Menu::factory("link") - ->id("rotate_ccw") - ->label(t("Rotate 90° counter clockwise")) - ->css_class("ui-icon-rotate-ccw") - ->url(url::site("quick/rotate/$item->id/ccw?csrf=$csrf&page_type=$page_type"))) - ->append(Menu::factory("link") - ->id("rotate_cw") - ->label(t("Rotate 90° clockwise")) - ->css_class("ui-icon-rotate-cw") - ->url(url::site("quick/rotate/$item->id/cw?csrf=$csrf&page_type=$page_type"))); - } + default: + $edit_title = t("Edit this photo"); + $delete_title = t("Delete this photo"); + break; + } + $cover_title = t("Choose as the album cover"); + $move_title = t("Move to another album"); - // Don't move photos from the photo page; we don't yet have a good way of redirecting after move - if ($page_type == "album") { - $options_menu - ->append(Menu::factory("dialog") - ->id("move") - ->label($move_title) - ->css_class("ui-icon-folder-open") - ->url(url::site("move/browse/$item->id"))); - } + $csrf = access::csrf_token(); + + $options_menu->append(Menu::factory("dialog") + ->id("edit") + ->label($edit_title) + ->css_class("ui-icon-pencil") + ->url(url::site("quick/form_edit/$item->id?page_type=$page_type"))); - $parent = $item->parent(); - if (access::can("edit", $parent)) { - // We can't make this item the highlight if it's an album with no album cover, or if it's - // already the album cover. - if (($item->type == "album" && empty($item->album_cover_item_id)) || - ($item->type == "album" && $parent->album_cover_item_id == $item->album_cover_item_id) || - $parent->album_cover_item_id == $item->id) { - $disabledState = " ui-state-disabled"; - } else { - $disabledState = " "; + + if ($item->is_photo() && graphics::can("rotate")) { + $options_menu + ->append( + Menu::factory("ajax_link") + ->id("rotate_ccw") + ->label(t("Rotate 90° counter clockwise")) + ->css_class("ui-icon-rotate-ccw") + ->ajax_handler("function(data) { " . + "\$.gallery_replace_image(data, \$('$thumb_css_selector')) }") + ->url(url::site("quick/rotate/$item->id/ccw?csrf=$csrf&page_type=$page_type"))) + ->append( + Menu::factory("ajax_link") + ->id("rotate_cw") + ->label(t("Rotate 90° clockwise")) + ->css_class("ui-icon-rotate-cw") + ->ajax_handler("function(data) { " . + "\$.gallery_replace_image(data, \$('$thumb_css_selector')) }") + ->url(url::site("quick/rotate/$item->id/cw?csrf=$csrf&page_type=$page_type"))); + } + + // Don't move photos from the photo page; we don't yet have a good way of redirecting after + // move + if ($page_type == "album") { + $options_menu + ->append(Menu::factory("dialog") + ->id("move") + ->label($move_title) + ->css_class("ui-icon-folder-open") + ->url(url::site("move/browse/$item->id"))); } - $options_menu - ->append(Menu::factory("link") - ->id("make_album_cover") - ->label($cover_title) - ->css_class("ui-icon-star") - ->url( - url::site("quick/make_album_cover/$item->id?csrf=$csrf&page_type=$page_type"))) - ->append(Menu::factory("dialog") - ->id("delete") - ->label($delete_title) - ->css_class("ui-icon-trash") - ->css_id("gQuickDelete") - ->url(url::site("quick/form_delete/$item->id?csrf=$csrf&page_type=$page_type"))); - } - if ($item->is_album()) { - $options_menu - ->append(Menu::factory("dialog") - ->id("add_item") - ->label(t("Add a photo")) - ->css_class("add_item") - ->url(url::site("simple_uploader/app/$item->id"))) - ->append(Menu::factory("dialog") - ->id("add_album") - ->label(t("Add an album")) - ->css_class("add_album") - ->url(url::site("form/add/albums/$item->id?type=album"))) - ->append(Menu::factory("dialog") - ->id("edit_permissions") - ->label(t("Edit permissions")) - ->css_class("permissions") - ->url(url::site("permissions/browse/$item->id"))); + $parent = $item->parent(); + if (access::can("edit", $parent)) { + // We can't make this item the highlight if it's an album with no album cover, or if it's + // already the album cover. + if (($item->type == "album" && empty($item->album_cover_item_id)) || + ($item->type == "album" && $parent->album_cover_item_id == $item->album_cover_item_id) || + $parent->album_cover_item_id == $item->id) { + $disabledState = " ui-state-disabled"; + } else { + $disabledState = " "; + } + $options_menu + ->append(Menu::factory("ajax_link") + ->id("make_album_cover") + ->label($cover_title) + ->css_class("ui-icon-star") + ->ajax_handler("function(data) { window.location.reload() }") + ->url(url::site("quick/make_album_cover/$item->id?csrf=$csrf"))) + ->append(Menu::factory("dialog") + ->id("delete") + ->label($delete_title) + ->css_class("ui-icon-trash") + ->css_id("gQuickDelete") + ->url(url::site("quick/form_delete/$item->id?csrf=$csrf&page_type=$page_type"))); + } + + if ($item->is_album()) { + $options_menu + ->append(Menu::factory("dialog") + ->id("add_item") + ->label(t("Add a photo")) + ->css_class("add_item") + ->url(url::site("simple_uploader/app/$item->id"))) + ->append(Menu::factory("dialog") + ->id("add_album") + ->label(t("Add an album")) + ->css_class("add_album") + ->url(url::site("form/add/albums/$item->id?type=album"))) + ->append(Menu::factory("dialog") + ->id("edit_permissions") + ->label(t("Edit permissions")) + ->css_class("permissions") + ->url(url::site("permissions/browse/$item->id"))); + } } } } \ No newline at end of file diff --git a/modules/gallery/libraries/Menu.php b/modules/gallery/libraries/Menu.php index 263dc38d..07b2b2b8 100644 --- a/modules/gallery/libraries/Menu.php +++ b/modules/gallery/libraries/Menu.php @@ -96,6 +96,37 @@ class Menu_Element_Link extends Menu_Element { } } +/** + * Menu element that provides an AJAX link. + */ +class Menu_Element_Ajax_Link extends Menu_Element { + public $ajax_handler; + + /** + * Set the AJAX handler + * @chainable + */ + public function ajax_handler($ajax_handler) { + $this->ajax_handler = $ajax_handler; + return $this; + } + + public function __toString() { + if (isset($this->css_id) && !empty($this->css_id)) { + $css_id = " id=\"$this->css_id\""; + } else { + $css_id = ""; + } + if (isset($this->css_class) && !empty($this->css_class)) { + $css_class = " $this->css_class"; + } else { + $css_class = ""; + } + return "
  • url\" " . + "title=\"$this->label\" ajax_handler=\"$this->ajax_handler\">$this->label
  • "; + } +} + /** * Menu element that provides a pop-up dialog */ @@ -132,6 +163,9 @@ class Menu_Core extends Menu_Element { case "link": return new Menu_Element_Link($type); + case "ajax_link": + return new Menu_Element_Ajax_Link($type); + case "dialog": return new Menu_Element_Dialog($type); diff --git a/modules/gallery/libraries/Theme_View.php b/modules/gallery/libraries/Theme_View.php index a5f5db03..541bce88 100644 --- a/modules/gallery/libraries/Theme_View.php +++ b/modules/gallery/libraries/Theme_View.php @@ -111,15 +111,15 @@ class Theme_View_Core extends Gallery_View { return $menu->compact(); } - public function context_menu($item) { + public function context_menu($item, $thumbnail_css_selector) { $menu = Menu::factory("root") ->append(Menu::factory("submenu") ->id("context_menu") ->label(t("Options"))) ->css_class("gContextMenu"); - gallery::context_menu($menu, $this, $item); - module::event("context_menu", $menu, $this, $item); + gallery::context_menu($menu, $this, $item, $thumbnail_css_selector); + module::event("context_menu", $menu, $this, $item, $thumbnail_css_selector); return $menu->compact(); } diff --git a/themes/admin_default/js/ui.init.js b/themes/admin_default/js/ui.init.js index e52f0c4c..daa6dd70 100644 --- a/themes/admin_default/js/ui.init.js +++ b/themes/admin_default/js/ui.init.js @@ -19,6 +19,9 @@ $(document).ready(function(){ // Initialize modal dialogs $(".gDialogLink").gallery_dialog(); + // Initialize ajax links + $(".gDialogLink").gallery_ajax(); + // Initialize panels $(".gPanelLink").gallery_panel(); diff --git a/themes/admin_default/views/admin.html.php b/themes/admin_default/views/admin.html.php index d27f9260..3f4128cb 100644 --- a/themes/admin_default/views/admin.html.php +++ b/themes/admin_default/views/admin.html.php @@ -25,6 +25,7 @@ + script("gallery.ajax.js") ?> script("gallery.dialog.js") ?> script("superfish/js/superfish.js") ?> script("jquery.dropshadow.js") ?> diff --git a/themes/default/js/ui.init.js b/themes/default/js/ui.init.js index 3726d305..60482972 100644 --- a/themes/default/js/ui.init.js +++ b/themes/default/js/ui.init.js @@ -34,6 +34,7 @@ $(document).ready(function() { // Initialize dialogs $("#gLoginLink").addClass("gDialogLink"); $(".gDialogLink").gallery_dialog(); + $(".gAjaxLink").gallery_ajax(); // Initialize view menu if ($("#gViewMenu").length) { @@ -100,8 +101,8 @@ $(document).ready(function() { $(".gContextMenu").hover( function() { $(this).find("ul").slideDown("fast"); - var dialogLinks = $(this).find(".gDialogLink"); - $(dialogLinks).gallery_dialog(); + $(this).find(".gDialogLink").gallery_dialog(); + $(this).find(".gAjaxLink").gallery_ajax(); }, function() { $(this).find("ul").slideUp("slow"); @@ -128,8 +129,8 @@ $(document).ready(function() { $(".gContextMenu").hover( function() { $(this).find("ul").slideDown("fast"); - var dialogLinks = $(this).find(".gDialogLink"); - $(dialogLinks).gallery_dialog(); + $(this).find(".gDialogLink").gallery_dialog(); + $(this).find(".gAjaxLink").gallery_ajax(); }, function() { $(this).find("ul").slideUp("slow"); diff --git a/themes/default/views/album.html.php b/themes/default/views/album.html.php index ce57458e..e2890482 100644 --- a/themes/default/views/album.html.php +++ b/themes/default/views/album.html.php @@ -19,7 +19,7 @@ thumb_img(array("class" => "gThumbnail")) ?> thumb_bottom($child) ?> - context_menu($child) ?> + context_menu($child, "#gItemId-{$child->id} .gThumbnail") ?>

    title) ?>