From 44753c524996415f465f44d05be46e878911ce4a Mon Sep 17 00:00:00 2001 From: ckieffer Date: Sat, 8 May 2010 15:05:56 -0600 Subject: Deleted extra CSS class assignment for context_menu delete option. --- modules/gallery/helpers/gallery_event.php | 1 - 1 file changed, 1 deletion(-) (limited to 'modules/gallery/helpers') diff --git a/modules/gallery/helpers/gallery_event.php b/modules/gallery/helpers/gallery_event.php index d723cc1b..c77ed9d4 100644 --- a/modules/gallery/helpers/gallery_event.php +++ b/modules/gallery/helpers/gallery_event.php @@ -383,7 +383,6 @@ class gallery_event_Core { ->id("delete") ->label($delete_title) ->css_class("ui-icon-trash") - ->css_class("g-quick-delete") ->url(url::site("quick/form_delete/$item->id?csrf=$csrf&from_id=$theme_item->id&page_type=$page_type"))); } -- cgit v1.2.3 From d98b85f7d3142676e6b4f407a18ed81564823f88 Mon Sep 17 00:00:00 2001 From: ckieffer Date: Fri, 14 May 2010 17:14:34 -0600 Subject: Drop context_menu for wind's photo/resize view. Move photo edit options to the site_menu. --- modules/gallery/helpers/gallery_event.php | 54 +++++++++++++++++++++++++++++++ themes/wind/views/photo.html.php | 1 - 2 files changed, 54 insertions(+), 1 deletion(-) (limited to 'modules/gallery/helpers') diff --git a/modules/gallery/helpers/gallery_event.php b/modules/gallery/helpers/gallery_event.php index c77ed9d4..d01b2956 100644 --- a/modules/gallery/helpers/gallery_event.php +++ b/modules/gallery/helpers/gallery_event.php @@ -227,6 +227,60 @@ class gallery_event_Core { } } } + + 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&from_id=$theme_item->id&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&from_id=$theme_item->id&page_type=$page_type"))); + } + + if ($item->id != item::root()->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 = " "; + } + + if ($item->parent()->id != 1) { + $options_menu + ->append( + Menu::factory("ajax_link") + ->id("make_album_cover") + ->label(t("Choose as the album cover")) + ->css_class("ui-icon-star") + ->ajax_handler("function(data) { window.location.reload() }") + ->url(url::site("quick/make_album_cover/$item->id?csrf=$csrf"))); + } + $options_menu + ->append( + Menu::factory("dialog") + ->id("delete") + ->label(t("Delete this photo")) + ->css_class("ui-icon-trash") + ->css_class("g-quick-delete") + ->url(url::site("quick/form_delete/$item->id?csrf=$csrf&from_id=$theme_item->id&page_type=$page_type"))); + } + } } if (identity::active_user()->admin) { diff --git a/themes/wind/views/photo.html.php b/themes/wind/views/photo.html.php index e0fae3f1..07952c94 100644 --- a/themes/wind/views/photo.html.php +++ b/themes/wind/views/photo.html.php @@ -27,7 +27,6 @@ resize_bottom($item) ?> - context_menu($item, "#g-photo-id-{$item->id}") ?>
-- cgit v1.2.3 From 1240878df0f4a2b0ad0cdb32814717038ff2773f Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Fri, 14 May 2010 16:55:15 -0700 Subject: Fix-ups for d98b85f7d3142676e6b4f407a18ed81564823f88 - Pass the CSS selector of the active image in as an arg to site_menu so that quick operations know what they're operating on. - Change the ids from g-{photo,movie}-id to the generic g-item-id - Initialize ajax handlers for site menu on the photo and movie page - Drop the movie context menu, it's now in the site menu --- modules/gallery/helpers/gallery_event.php | 9 ++++++--- modules/gallery/libraries/Theme_View.php | 4 ++-- modules/gallery/models/item.php | 2 +- themes/wind/js/ui.init.js | 3 +++ themes/wind/views/movie.html.php | 3 +-- themes/wind/views/page.html.php | 2 +- themes/wind/views/photo.html.php | 2 +- 7 files changed, 15 insertions(+), 10 deletions(-) (limited to 'modules/gallery/helpers') diff --git a/modules/gallery/helpers/gallery_event.php b/modules/gallery/helpers/gallery_event.php index 9b3aa82d..89ad6a4c 100644 --- a/modules/gallery/helpers/gallery_event.php +++ b/modules/gallery/helpers/gallery_event.php @@ -167,7 +167,7 @@ class gallery_event_Core { } } - static function site_menu($menu, $theme) { + static function site_menu($menu, $theme, $item_css_selector) { if ($theme->page_subtype != "login") { $menu->append(Menu::factory("link") ->id("home") @@ -239,6 +239,9 @@ class gallery_event_Core { } } + $csrf = access::csrf_token(); + $theme_item = $theme->item(); + $page_type = $theme->page_type(); if ($item->is_photo() && graphics::can("rotate")) { $options_menu ->append( @@ -247,7 +250,7 @@ class gallery_event_Core { ->label(t("Rotate 90° counter clockwise")) ->css_class("ui-icon-rotate-ccw") ->ajax_handler("function(data) { " . - "\$.gallery_replace_image(data, \$('$thumb_css_selector')) }") + "\$.gallery_replace_image(data, \$('$item_css_selector')) }") ->url(url::site("quick/rotate/$item->id/ccw?csrf=$csrf&from_id=$theme_item->id&page_type=$page_type"))) ->append( Menu::factory("ajax_link") @@ -255,7 +258,7 @@ class gallery_event_Core { ->label(t("Rotate 90° clockwise")) ->css_class("ui-icon-rotate-cw") ->ajax_handler("function(data) { " . - "\$.gallery_replace_image(data, \$('$thumb_css_selector')) }") + "\$.gallery_replace_image(data, \$('$item_css_selector')) }") ->url(url::site("quick/rotate/$item->id/cw?csrf=$csrf&from_id=$theme_item->id&page_type=$page_type"))); } diff --git a/modules/gallery/libraries/Theme_View.php b/modules/gallery/libraries/Theme_View.php index 8b432fb6..6246c6f1 100644 --- a/modules/gallery/libraries/Theme_View.php +++ b/modules/gallery/libraries/Theme_View.php @@ -86,9 +86,9 @@ class Theme_View_Core extends Gallery_View { return $menu->render(); } - public function site_menu() { + public function site_menu($item_css_selector) { $menu = Menu::factory("root"); - module::event("site_menu", $menu, $this); + module::event("site_menu", $menu, $this, $item_css_selector); return $menu->render(); } diff --git a/modules/gallery/models/item.php b/modules/gallery/models/item.php index 7fc37325..409ed3cc 100644 --- a/modules/gallery/models/item.php +++ b/modules/gallery/models/item.php @@ -674,7 +674,7 @@ class Item_Model extends ORM_MPTT { $v->attrs = array_merge($extra_attrs, array("style" => "display:block;width:{$this->width}px;height:{$this->height}px")); if (empty($v->attrs["id"])) { - $v->attrs["id"] = "g-movie-id-{$this->id}"; + $v->attrs["id"] = "g-item-id-{$this->id}"; } return $v; } diff --git a/themes/wind/js/ui.init.js b/themes/wind/js/ui.init.js index 6edf6be4..53b58516 100644 --- a/themes/wind/js/ui.init.js +++ b/themes/wind/js/ui.init.js @@ -108,6 +108,9 @@ $(document).ready(function() { duration: 1000, hash: true }); + + $(this).find(".g-dialog-link").gallery_dialog(); + $(this).find(".g-ajax-link").gallery_ajax(); } // Initialize button hover effect diff --git a/themes/wind/views/movie.html.php b/themes/wind/views/movie.html.php index 27c293ce..8481c7ce 100644 --- a/themes/wind/views/movie.html.php +++ b/themes/wind/views/movie.html.php @@ -5,8 +5,7 @@ paginator() ?>
- movie_img(array("class" => "g-movie", "id" => "g-movie-id-{$item->id}")) ?> - context_menu($item, "#g-movie-id-{$item->id}") ?> + movie_img(array("class" => "g-movie", "id" => "g-item-id-{$item->id}")) ?>
diff --git a/themes/wind/views/page.html.php b/themes/wind/views/page.html.php index ebfbf700..4cc949ce 100644 --- a/themes/wind/views/page.html.php +++ b/themes/wind/views/page.html.php @@ -89,7 +89,7 @@ diff --git a/themes/wind/views/photo.html.php b/themes/wind/views/photo.html.php index 07952c94..f8b5511c 100644 --- a/themes/wind/views/photo.html.php +++ b/themes/wind/views/photo.html.php @@ -22,7 +22,7 @@ for_html_attr() ?>"> - resize_img(array("id" => "g-photo-id-{$item->id}", "class" => "g-resize")) ?> + resize_img(array("id" => "g-item-id-{$item->id}", "class" => "g-resize")) ?> -- cgit v1.2.3