summaryrefslogtreecommitdiff
path: root/modules/gallery
diff options
context:
space:
mode:
Diffstat (limited to 'modules/gallery')
-rw-r--r--modules/gallery/controllers/quick.php4
-rw-r--r--modules/gallery/helpers/gallery_event.php60
-rw-r--r--modules/gallery/libraries/Theme_View.php4
-rw-r--r--modules/gallery/models/item.php2
4 files changed, 63 insertions, 7 deletions
diff --git a/modules/gallery/controllers/quick.php b/modules/gallery/controllers/quick.php
index 813d1a93..6cfbbc62 100644
--- a/modules/gallery/controllers/quick.php
+++ b/modules/gallery/controllers/quick.php
@@ -58,12 +58,12 @@ class Quick_Controller extends Controller {
if (Input::instance()->get("page_type") == "collection") {
print json_encode(
- array("src" => $item->thumb_url() . "?rnd=" . rand(),
+ array("src" => $item->thumb_url(),
"width" => $item->thumb_width,
"height" => $item->thumb_height));
} else {
print json_encode(
- array("src" => $item->resize_url() . "?rnd=" . rand(),
+ array("src" => $item->resize_url(),
"width" => $item->resize_width,
"height" => $item->resize_height));
}
diff --git a/modules/gallery/helpers/gallery_event.php b/modules/gallery/helpers/gallery_event.php
index 2416f2e5..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")
@@ -238,6 +238,63 @@ 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(
+ 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, \$('$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")
+ ->id("rotate_cw")
+ ->label(t("Rotate 90° clockwise"))
+ ->css_class("ui-icon-rotate-cw")
+ ->ajax_handler("function(data) { " .
+ "\$.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")));
+ }
+
+ 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) {
@@ -394,7 +451,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")));
}
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;
}