summaryrefslogtreecommitdiff
path: root/modules/gallery/helpers/gallery_event.php
diff options
context:
space:
mode:
Diffstat (limited to 'modules/gallery/helpers/gallery_event.php')
-rw-r--r--modules/gallery/helpers/gallery_event.php42
1 files changed, 21 insertions, 21 deletions
diff --git a/modules/gallery/helpers/gallery_event.php b/modules/gallery/helpers/gallery_event.php
index 6225633f..aeb1c7eb 100644
--- a/modules/gallery/helpers/gallery_event.php
+++ b/modules/gallery/helpers/gallery_event.php
@@ -1,7 +1,7 @@
<?php defined("SYSPATH") or die("No direct script access.");
/**
* Gallery - a web based photo album viewer and editor
- * Copyright (C) 2000-2012 Bharat Mediratta
+ * Copyright (C) 2000-2013 Bharat Mediratta
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -86,17 +86,17 @@ class gallery_event_Core {
static function item_created($item) {
access::add_item($item);
- if ($item->is_photo() || $item->is_movie()) {
- // Build our thumbnail/resizes.
- try {
- graphics::generate($item);
- } catch (Exception $e) {
- log::error("graphics", t("Couldn't create a thumbnail or resize for %item_title",
- array("item_title" => $item->title)),
- html::anchor($item->abs_url(), t("details")));
- Kohana_Log::add("error", $e->getMessage() . "\n" . $e->getTraceAsString());
- }
+ // Build our thumbnail/resizes.
+ try {
+ graphics::generate($item);
+ } catch (Exception $e) {
+ log::error("graphics", t("Couldn't create a thumbnail or resize for %item_title",
+ array("item_title" => $item->title)),
+ html::anchor($item->abs_url(), t("details")));
+ Kohana_Log::add("error", $e->getMessage() . "\n" . $e->getTraceAsString());
+ }
+ if ($item->is_photo() || $item->is_movie()) {
// If the parent has no cover item, make this it.
$parent = $item->parent();
if (access::can("edit", $parent) && $parent->album_cover_item_id == null) {
@@ -141,10 +141,9 @@ class gallery_event_Core {
foreach (ORM::factory("item")
->where("album_cover_item_id", "=", $item->id)
->find_all() as $target) {
- copy($item->thumb_path(), $target->thumb_path());
- $target->thumb_width = $item->thumb_width;
- $target->thumb_height = $item->thumb_height;
+ $target->thumb_dirty = 1;
$target->save();
+ graphics::generate($target);
}
}
@@ -347,9 +346,9 @@ class gallery_event_Core {
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";
+ $disabledState = "ui-state-disabled";
} else {
- $disabledState = " ";
+ $disabledState = "";
}
if ($item->parent()->id != 1) {
@@ -358,7 +357,7 @@ class gallery_event_Core {
Menu::factory("ajax_link")
->id("make_album_cover")
->label(t("Choose as the album cover"))
- ->css_class("ui-icon-star")
+ ->css_class("ui-icon-star $disabledState")
->ajax_handler("function(data) { window.location.reload() }")
->url(url::site("quick/make_album_cover/$item->id?csrf=$csrf")));
}
@@ -501,16 +500,16 @@ class gallery_event_Core {
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";
+ $disabledState = "ui-state-disabled";
} else {
- $disabledState = " ";
+ $disabledState = "";
}
if ($item->parent()->id != 1) {
$options_menu
->append(Menu::factory("ajax_link")
->id("make_album_cover")
->label($cover_title)
- ->css_class("ui-icon-star")
+ ->css_class("ui-icon-star $disabledState")
->ajax_handler("function(data) { window.location.reload() }")
->url(url::site("quick/make_album_cover/$item->id?csrf=$csrf")));
}
@@ -519,7 +518,8 @@ class gallery_event_Core {
->id("delete")
->label($delete_title)
->css_class("ui-icon-trash")
- ->url(url::site("quick/form_delete/$item->id?csrf=$csrf&amp;from_id={$theme_item->id}&amp;page_type=$page_type")));
+ ->url(url::site("quick/form_delete/$item->id?csrf=$csrf&amp;" .
+ "from_id={$theme_item->id}&amp;page_type=$page_type")));
}
if ($item->is_album()) {