From e0e450d90fe67ac199d82d2b8e902cff5c8b6c7d Mon Sep 17 00:00:00 2001 From: Chad Kieffer Date: Sat, 11 Jul 2009 00:40:57 -0600 Subject: Position gItem and gPhoto relative, then position quick and thumb menus as absolute within them. Moved css from quick.js to quick.css. --- themes/default/js/ui.init.js | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'themes/default/js/ui.init.js') diff --git a/themes/default/js/ui.init.js b/themes/default/js/ui.init.js index 9d9d3079..29e04d5e 100644 --- a/themes/default/js/ui.init.js +++ b/themes/default/js/ui.init.js @@ -36,6 +36,14 @@ $(document).ready(function() { $(dialogLinks[i]).bind("click", handleDialogEvent); } + // gThumbMenu + if ($(".gItem .gMenu").length) { + $(".gItem .gMenu").removeClass("sf-menu"); + $(".gItem .gMenu span").removeClass("sf-sub-indicator"); + $(".gItem .gMenu span").addClass("ui-icon ui-icon-triangle-1-n"); + $(".gItem .gMenu li:first-child").addClass("ui-icon-right ui-corner-top ui-state-default"); + } + // Initialize view menu if ($("#gViewMenu").length) { $("#gViewMenu ul").removeClass("gMenu").removeClass("sf-menu"); -- cgit v1.2.3 From 8bfcf09b4c9628f13fdee2b958b3d11c9abce474 Mon Sep 17 00:00:00 2001 From: Chad Kieffer Date: Sat, 11 Jul 2009 23:14:26 -0600 Subject: Styled thumb menu, still needs script to set up interraction. --- themes/default/css/screen.css | 14 +++++++++----- themes/default/js/ui.init.js | 20 +++++++++++++++----- 2 files changed, 24 insertions(+), 10 deletions(-) (limited to 'themes/default/js/ui.init.js') diff --git a/themes/default/css/screen.css b/themes/default/css/screen.css index d08ada17..66989ea4 100644 --- a/themes/default/css/screen.css +++ b/themes/default/css/screen.css @@ -584,17 +584,21 @@ form .gError, /* Thumb Menu ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ -.gItem .gMenu { +#gContent .gThumbMenu { bottom: 0; - margin-bottom: -2px; + left: 0; position: absolute; - right: 0; + width: 100%; } -.gItem .gMenu li { - font-weight: normal !important; +#gContent .gThumbMenu li { + border-left: none; + border-right: none; } +#gContent .gThumbMenu a:hover { + text-decoration: none; +} /* View Menu ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ #gViewMenu { diff --git a/themes/default/js/ui.init.js b/themes/default/js/ui.init.js index 29e04d5e..b14127f6 100644 --- a/themes/default/js/ui.init.js +++ b/themes/default/js/ui.init.js @@ -13,6 +13,10 @@ var shortForms = new Array( $(document).ready(function() { + // Remove .gMenu from thumb menu's before initializing Superfish + $("#gContent .gItem .gMenu").removeClass("gMenu"); + $("#gContent .gQuick + ul").addClass("gThumbMenu") + // Initialize Superfish menus $("ul.gMenu").addClass("sf-menu"); $('ul.sf-menu').superfish({ @@ -37,11 +41,17 @@ $(document).ready(function() { } // gThumbMenu - if ($(".gItem .gMenu").length) { - $(".gItem .gMenu").removeClass("sf-menu"); - $(".gItem .gMenu span").removeClass("sf-sub-indicator"); - $(".gItem .gMenu span").addClass("ui-icon ui-icon-triangle-1-n"); - $(".gItem .gMenu li:first-child").addClass("ui-icon-right ui-corner-top ui-state-default"); + if ($("#gContent .gThumbMenu").length) { + $("#gContent .gThumbMenu li").addClass("ui-state-default"); + // ui-icon-triangle-1-n + $("#gContent .gThumbMenu li a") + .not('[class]') + .addClass("gButtonLink ui-icon") + .css({ + "height":"10px", + "margin":"0", + "padding":"0" + }); } // Initialize view menu -- cgit v1.2.3 From 58d0a5013d4cda1be0cf528b8ff08d44b123d75f Mon Sep 17 00:00:00 2001 From: Chad Kieffer Date: Sun, 12 Jul 2009 11:43:41 -0600 Subject: First attempt at animating gThumbMenu. Doesn't work. --- themes/default/css/screen.css | 2 +- themes/default/js/ui.init.js | 17 ++++++++++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) (limited to 'themes/default/js/ui.init.js') diff --git a/themes/default/css/screen.css b/themes/default/css/screen.css index 0c65cd96..1853a11d 100644 --- a/themes/default/css/screen.css +++ b/themes/default/css/screen.css @@ -459,7 +459,7 @@ form .gError, font-size: .7em; height: 240px; overflow: hidden; - padding: 14px 8px; + padding: 15px 8px 30px 8px; position: relative; text-align: center; width: 213px; diff --git a/themes/default/js/ui.init.js b/themes/default/js/ui.init.js index b14127f6..d5755aed 100644 --- a/themes/default/js/ui.init.js +++ b/themes/default/js/ui.init.js @@ -50,8 +50,23 @@ $(document).ready(function() { .css({ "height":"10px", "margin":"0", - "padding":"0" + "padding":"0", + "width":"16px" }); + var menuHt = $("#gContent .gThumbMenu").height(); + var bottomPos = "-" + (menuHt - 15) + "px"; + $("#gContent .gThumbMenu").css("bottom",bottomPos); + console.log("Initilizing: Placing at " + bottomPos); + $("#gContent .gThumbMenu li").hover( + function(){ + $(this).css("bottom","0"); + console.log("Placing at 0px"); + }, + function(){ + $(this).css("bottom",bottomPos); + console.log("Placing at " + bottomPos); + } + ); } // Initialize view menu -- cgit v1.2.3 From 413174e89edb36b311237aea4ab8386d75d16760 Mon Sep 17 00:00:00 2001 From: Chad Kieffer Date: Sun, 12 Jul 2009 16:07:16 -0600 Subject: Second attempt at showing and hiding the thumb menu. Renamed gThumbMenu to gPhotoMenu for use on both album and photo pages, eventually. --- themes/default/css/screen.css | 9 +++++---- themes/default/js/ui.init.js | 28 +++++++++++----------------- 2 files changed, 16 insertions(+), 21 deletions(-) (limited to 'themes/default/js/ui.init.js') diff --git a/themes/default/css/screen.css b/themes/default/css/screen.css index 1853a11d..93b68e68 100644 --- a/themes/default/css/screen.css +++ b/themes/default/css/screen.css @@ -582,23 +582,24 @@ form .gError, margin-bottom: 0; } -/* Thumb Menu ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ +/* Photo Menu ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ -#gContent .gThumbMenu { +#gContent .gPhotoMenu { bottom: 0; left: 0; position: absolute; width: 100%; } -#gContent .gThumbMenu li { +#gContent .gPhotoMenu li { border-left: none; border-right: none; } -#gContent .gThumbMenu a:hover { +#gContent .gPhotoMenu a:hover { text-decoration: none; } + /* View Menu ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ #gViewMenu { diff --git a/themes/default/js/ui.init.js b/themes/default/js/ui.init.js index d5755aed..37261727 100644 --- a/themes/default/js/ui.init.js +++ b/themes/default/js/ui.init.js @@ -14,8 +14,9 @@ var shortForms = new Array( $(document).ready(function() { // Remove .gMenu from thumb menu's before initializing Superfish + // @todo gallery_menu should only apply gMenu to top-level menus, submenus should be gSubMenu-N $("#gContent .gItem .gMenu").removeClass("gMenu"); - $("#gContent .gQuick + ul").addClass("gThumbMenu") + $("#gContent .gQuick + ul").addClass("gPhotoMenu"); // Initialize Superfish menus $("ul.gMenu").addClass("sf-menu"); @@ -40,31 +41,24 @@ $(document).ready(function() { $(dialogLinks[i]).bind("click", handleDialogEvent); } - // gThumbMenu - if ($("#gContent .gThumbMenu").length) { - $("#gContent .gThumbMenu li").addClass("ui-state-default"); - // ui-icon-triangle-1-n - $("#gContent .gThumbMenu li a") + // Initialize photo menus + if ($("#gContent .gPhotoMenu").length) { + $("#gContent .gPhotoMenu li").addClass("ui-state-default"); + $("#gContent .gPhotoMenu li a") .not('[class]') .addClass("gButtonLink ui-icon") .css({ "height":"10px", "margin":"0", - "padding":"0", - "width":"16px" + "padding":"0" }); - var menuHt = $("#gContent .gThumbMenu").height(); - var bottomPos = "-" + (menuHt - 15) + "px"; - $("#gContent .gThumbMenu").css("bottom",bottomPos); - console.log("Initilizing: Placing at " + bottomPos); - $("#gContent .gThumbMenu li").hover( + //$(".gPhotoMenu ul").hide(); + $(".gPhotoMenu").hover( function(){ - $(this).css("bottom","0"); - console.log("Placing at 0px"); + $(this + " ul").show(); }, function(){ - $(this).css("bottom",bottomPos); - console.log("Placing at " + bottomPos); + $(this + " ul").hide(); } ); } -- cgit v1.2.3 From 895fbfd95b5e7a42dd865f4a18401fd2e1491bc2 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sat, 11 Jul 2009 17:59:55 -0700 Subject: Get the thumbnail menu working. 1) Stop changing the menu classes in JS, instead allow us to specify it in the Menu class itself and then set it to be gThumbMenu in Theme_View 2) Move the gThumbMenu init code to the bottom of the $(document).ready() block; something in there was interfering with it. --- modules/gallery/libraries/Menu.php | 9 ++++-- modules/gallery/libraries/Theme_View.php | 11 ++++---- themes/default/css/screen.css | 8 +++--- themes/default/js/ui.init.js | 47 ++++++++++++++++---------------- 4 files changed, 38 insertions(+), 37 deletions(-) (limited to 'themes/default/js/ui.init.js') diff --git a/modules/gallery/libraries/Menu.php b/modules/gallery/libraries/Menu.php index 162cd3b0..a39b59a5 100644 --- a/modules/gallery/libraries/Menu.php +++ b/modules/gallery/libraries/Menu.php @@ -136,7 +136,9 @@ class Menu_Core extends Menu_Element { return new Menu_Element_Dialog($type); case "root": - return new Menu("root"); + $menu = new Menu("root"); + $menu->css_class("gMenu"); + return $menu; case "submenu": return new Menu("submenu"); @@ -156,6 +158,7 @@ class Menu_Core extends Menu_Element { } } } + return $this; } public function __construct($type) { @@ -206,8 +209,8 @@ class Menu_Core extends Menu_Element { } public function __toString() { - $html = $this->is_root ? "
    " : - "
  • label\">$this->label
      "; + $html = $this->is_root ? "
        css_class\">" : + "
      • label\">$this->label
          "; $html .= implode("\n", $this->elements); $html .= $this->is_root ? "
        " : "
      "; return $html; diff --git a/modules/gallery/libraries/Theme_View.php b/modules/gallery/libraries/Theme_View.php index 75138f25..fa45ec89 100644 --- a/modules/gallery/libraries/Theme_View.php +++ b/modules/gallery/libraries/Theme_View.php @@ -99,19 +99,19 @@ class Theme_View_Core extends Gallery_View { } public function album_menu() { - $this->_menu("album"); + print $this->_menu("album"); } public function tag_menu() { - $this->_menu("tag"); + print $this->_menu("tag"); } public function photo_menu() { - $this->_menu("photo"); + print $this->_menu("photo"); } public function thumb_menu($item) { - $this->_menu("thumb", $item); + print $this->_menu("thumb", $item)->css_class("gThumbMenu"); } private function _menu($type, $item=null) { @@ -127,8 +127,7 @@ class Theme_View_Core extends Gallery_View { } } - $menu->compact(); - print $menu; + return $menu->compact(); } public function pager() { diff --git a/themes/default/css/screen.css b/themes/default/css/screen.css index 93b68e68..c0954690 100644 --- a/themes/default/css/screen.css +++ b/themes/default/css/screen.css @@ -582,21 +582,21 @@ form .gError, margin-bottom: 0; } -/* Photo Menu ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ +/* Thumb Menu ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ -#gContent .gPhotoMenu { +#gContent .gThumbMenu { bottom: 0; left: 0; position: absolute; width: 100%; } -#gContent .gPhotoMenu li { +#gContent .gThumbMenu li { border-left: none; border-right: none; } -#gContent .gPhotoMenu a:hover { +#gContent .gThumbMenu a:hover { text-decoration: none; } diff --git a/themes/default/js/ui.init.js b/themes/default/js/ui.init.js index 37261727..ac7ef8d2 100644 --- a/themes/default/js/ui.init.js +++ b/themes/default/js/ui.init.js @@ -15,8 +15,6 @@ $(document).ready(function() { // Remove .gMenu from thumb menu's before initializing Superfish // @todo gallery_menu should only apply gMenu to top-level menus, submenus should be gSubMenu-N - $("#gContent .gItem .gMenu").removeClass("gMenu"); - $("#gContent .gQuick + ul").addClass("gPhotoMenu"); // Initialize Superfish menus $("ul.gMenu").addClass("sf-menu"); @@ -41,28 +39,6 @@ $(document).ready(function() { $(dialogLinks[i]).bind("click", handleDialogEvent); } - // Initialize photo menus - if ($("#gContent .gPhotoMenu").length) { - $("#gContent .gPhotoMenu li").addClass("ui-state-default"); - $("#gContent .gPhotoMenu li a") - .not('[class]') - .addClass("gButtonLink ui-icon") - .css({ - "height":"10px", - "margin":"0", - "padding":"0" - }); - //$(".gPhotoMenu ul").hide(); - $(".gPhotoMenu").hover( - function(){ - $(this + " ul").show(); - }, - function(){ - $(this + " ul").hide(); - } - ); - } - // Initialize view menu if ($("#gViewMenu").length) { $("#gViewMenu ul").removeClass("gMenu").removeClass("sf-menu"); @@ -118,6 +94,29 @@ $(document).ready(function() { } ); + // Initialize thumbnail menus + if ($("#gContent .gThumbMenu").length) { + $("#gContent .gThumbMenu li").addClass("ui-state-default"); + $("#gContent .gThumbMenu li a") + .not('[class]') + .addClass("gButtonLink ui-icon") + .css({ + height: "10px", + margin: "0", + padding: "0" + }); + + $(".gThumbMenu ul").hide(); + $(".gThumbMenu").hover( + function() { + $(this).find("ul").slideDown("fast"); + }, + function() { + $(this).find("ul").slideUp("slow"); + } + ); + } + }); /** -- cgit v1.2.3 From 50cd41655a5e083de3fee5b43fd72c21ffb3dd25 Mon Sep 17 00:00:00 2001 From: Chad Kieffer Date: Sun, 12 Jul 2009 22:41:57 -0600 Subject: Minor style tweaks. --- themes/default/css/screen.css | 5 +++++ themes/default/js/ui.init.js | 9 +++++---- 2 files changed, 10 insertions(+), 4 deletions(-) (limited to 'themes/default/js/ui.init.js') diff --git a/themes/default/css/screen.css b/themes/default/css/screen.css index c0954690..88631e81 100644 --- a/themes/default/css/screen.css +++ b/themes/default/css/screen.css @@ -594,6 +594,11 @@ form .gError, #gContent .gThumbMenu li { border-left: none; border-right: none; + border-bottom: none; +} + +#gContent .gThumbMenu li li { + padding: .3em; } #gContent .gThumbMenu a:hover { diff --git a/themes/default/js/ui.init.js b/themes/default/js/ui.init.js index ac7ef8d2..92a42ded 100644 --- a/themes/default/js/ui.init.js +++ b/themes/default/js/ui.init.js @@ -95,24 +95,25 @@ $(document).ready(function() { ); // Initialize thumbnail menus + // @todo Toggle between north and south caret's on hover if ($("#gContent .gThumbMenu").length) { $("#gContent .gThumbMenu li").addClass("ui-state-default"); $("#gContent .gThumbMenu li a") .not('[class]') - .addClass("gButtonLink ui-icon") + .addClass("gButtonLink ui-icon ui-icon-caret-l-n") .css({ height: "10px", margin: "0", - padding: "0" + padding: "0 0 3px 0" }); $(".gThumbMenu ul").hide(); $(".gThumbMenu").hover( function() { - $(this).find("ul").slideDown("fast"); + $(this).find("ul").slideDown("fast"); }, function() { - $(this).find("ul").slideUp("slow"); + $(this).find("ul").slideUp("slow"); } ); } -- cgit v1.2.3 From ae22abcdf64e10dc9f96357fbd74b3efd918d4c1 Mon Sep 17 00:00:00 2001 From: Chad Kieffer Date: Sun, 19 Jul 2009 16:45:14 -0600 Subject: Fire .vAlign() when gItem's changed, ex. rotated. Fix for #304. --- themes/default/js/ui.init.js | 3 +++ 1 file changed, 3 insertions(+) (limited to 'themes/default/js/ui.init.js') diff --git a/themes/default/js/ui.init.js b/themes/default/js/ui.init.js index 92a42ded..b7508ee5 100644 --- a/themes/default/js/ui.init.js +++ b/themes/default/js/ui.init.js @@ -57,6 +57,9 @@ $(document).ready(function() { if ($("#gAlbumGrid").length) { // Vertical align thumbnails/metadata in album grid $(".gItem").vAlign(); + $(".gItem").change(function(){ + $(".gItem").vAlign(); + }); } // Photo/Item item view only -- cgit v1.2.3 From 329b6ce28ce0424303fece0fa0f542a0f1cb39ae Mon Sep 17 00:00:00 2001 From: Chad Kieffer Date: Mon, 20 Jul 2009 23:06:08 -0600 Subject: Fire vAlign after gQuick ajax load is complete. --- themes/default/js/ui.init.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'themes/default/js/ui.init.js') diff --git a/themes/default/js/ui.init.js b/themes/default/js/ui.init.js index b7508ee5..11cd06ed 100644 --- a/themes/default/js/ui.init.js +++ b/themes/default/js/ui.init.js @@ -57,7 +57,7 @@ $(document).ready(function() { if ($("#gAlbumGrid").length) { // Vertical align thumbnails/metadata in album grid $(".gItem").vAlign(); - $(".gItem").change(function(){ + $(".gQuick").ajaxStop(function(){ $(".gItem").vAlign(); }); } -- cgit v1.2.3 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 ----- themes/default/css/fix-ie.css | 4 - themes/default/css/screen.css | 9 +- themes/default/js/ui.init.js | 31 ++---- themes/default/views/album.html.php | 2 +- 15 files changed, 131 insertions(+), 396 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 'themes/default/js/ui.init.js') 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)): ?> -"> - - - - - - - diff --git a/themes/default/css/fix-ie.css b/themes/default/css/fix-ie.css index c7c1ebad..eee88c15 100644 --- a/themes/default/css/fix-ie.css +++ b/themes/default/css/fix-ie.css @@ -35,7 +35,3 @@ input.submit { .gPager .ui-icon-right { width: 60px; } - -.gQuickPane { - height: 32px !important; -} \ No newline at end of file diff --git a/themes/default/css/screen.css b/themes/default/css/screen.css index c5a9956d..eb092b83 100644 --- a/themes/default/css/screen.css +++ b/themes/default/css/screen.css @@ -588,24 +588,25 @@ form .gError, /* Thumb Menu ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ -#gContent .gThumbMenu { +#gContent .gContextMenu { bottom: 0; left: 0; position: absolute; width: 100%; + display: none; } -#gContent .gThumbMenu li { +#gContent .gContextMenu li { border-left: none; border-right: none; border-bottom: none; } -#gContent .gThumbMenu li li { +#gContent .gContextMenu li li { padding: .3em; } -#gContent .gThumbMenu a:hover { +#gContent .gContextMenu a:hover { text-decoration: none; } diff --git a/themes/default/js/ui.init.js b/themes/default/js/ui.init.js index 11cd06ed..d796cb67 100644 --- a/themes/default/js/ui.init.js +++ b/themes/default/js/ui.init.js @@ -32,7 +32,6 @@ $(document).ready(function() { $("#gMessage li").showMessage(); // Initialize dialogs - $(".gMenuLink").addClass("gDialogLink"); $("#gLoginLink").addClass("gDialogLink"); var dialogLinks = $(".gDialogLink"); for (var i=0; i < dialogLinks.length; i++) { @@ -57,9 +56,6 @@ $(document).ready(function() { if ($("#gAlbumGrid").length) { // Vertical align thumbnails/metadata in album grid $(".gItem").vAlign(); - $(".gQuick").ajaxStop(function(){ - $(".gItem").vAlign(); - }); } // Photo/Item item view only @@ -97,26 +93,19 @@ $(document).ready(function() { } ); - // Initialize thumbnail menus - // @todo Toggle between north and south caret's on hover - if ($("#gContent .gThumbMenu").length) { - $("#gContent .gThumbMenu li").addClass("ui-state-default"); - $("#gContent .gThumbMenu li a") - .not('[class]') - .addClass("gButtonLink ui-icon ui-icon-caret-l-n") - .css({ - height: "10px", - margin: "0", - padding: "0 0 3px 0" - }); - - $(".gThumbMenu ul").hide(); - $(".gThumbMenu").hover( + // Initialize context menus + if ($("#gContent .gContextMenu").length) { + $("#gContent .gContextMenu li").addClass("ui-state-default"); + $(".gContextMenu").parent().hover( function() { - $(this).find("ul").slideDown("fast"); + $(this).find(".gContextMenu").slideDown("fast"); + var dialogLinks = $(this).find(".gDialogLink"); + for (var i = 0; i < dialogLinks.length; i++) { + $(dialogLinks[i]).bind("click", handleDialogEvent); + } }, function() { - $(this).find("ul").slideUp("slow"); + $(this).find(".gContextMenu").slideUp("slow"); } ); } diff --git a/themes/default/views/album.html.php b/themes/default/views/album.html.php index 65ea3381..ce57458e 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) ?> - thumb_menu($child) ?> + context_menu($child) ?>

      title) ?>