From 93138f6ae78fd5ef11ea5095156827592f61bc56 Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Thu, 27 Aug 2009 15:04:14 -0700 Subject: Don't display the slideshow icon if there are no descendants. ticket #660 --- modules/slideshow/helpers/slideshow_event.php | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/modules/slideshow/helpers/slideshow_event.php b/modules/slideshow/helpers/slideshow_event.php index cf79f71a..1b881de4 100644 --- a/modules/slideshow/helpers/slideshow_event.php +++ b/modules/slideshow/helpers/slideshow_event.php @@ -31,13 +31,17 @@ class slideshow_event_Core { } static function album_menu($menu, $theme) { - $menu - ->append(Menu::factory("link") - ->id("slideshow") - ->label(t("View slideshow")) - ->url("javascript:PicLensLite.start(" . - "{maxScale:0,feedUrl:PicLensLite.indexFeeds()[0].url})") - ->css_id("gSlideshowLink")); + $descendants_count = ORM::factory("item", $theme->item->id) + ->descendants_count(array("type" => "photo")); + if ($descendants_count > 1) { + $menu + ->append(Menu::factory("link") + ->id("slideshow") + ->label(t("View slideshow")) + ->url("javascript:PicLensLite.start(" . + "{maxScale:0,feedUrl:PicLensLite.indexFeeds()[0].url})") + ->css_id("gSlideshowLink")); + } } static function photo_menu($menu, $theme) { -- cgit v1.2.3 From 254feecd0af2da2bfb92ce3995ed65dcbebfd02b Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Thu, 27 Aug 2009 15:22:27 -0700 Subject: Fix ticket #644 1) remove close button 2) extend the grey overlay to the document size 3) allow any keypress to close the fullize image 4) click on the fullsize will close --- lib/gallery.show_full_size.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/lib/gallery.show_full_size.js b/lib/gallery.show_full_size.js index 2f365f0d..1f74e6e2 100644 --- a/lib/gallery.show_full_size.js +++ b/lib/gallery.show_full_size.js @@ -10,7 +10,7 @@ $("body").append('
'); @@ -27,10 +27,14 @@ ''); - $("#gFullsize").append(''); - $("#gFullsizeClose").click(function() { + //$("#gFullsize").append(''); + $("#gFullsize").click(function() { + $("#gFullsizeOverlay*").remove(); + $("#gFullsize").remove(); + }); + $().bind("keypress", function() { $("#gFullsizeOverlay*").remove(); $("#gFullsize").remove(); }); -- cgit v1.2.3 From 5235c7a0b79d12305d99fdafe2710583f5368fcc Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Thu, 27 Aug 2009 15:37:18 -0700 Subject: Allow clicking on the overlay to close the fullsize and remove some debug code --- lib/gallery.show_full_size.js | 35 +++++++++++++++-------------------- 1 file changed, 15 insertions(+), 20 deletions(-) diff --git a/lib/gallery.show_full_size.js b/lib/gallery.show_full_size.js index 1f74e6e2..7e826c32 100644 --- a/lib/gallery.show_full_size.js +++ b/lib/gallery.show_full_size.js @@ -27,27 +27,22 @@ ''); - //$("#gFullsize").append(''); - $("#gFullsize").click(function() { - $("#gFullsizeOverlay*").remove(); - $("#gFullsize").remove(); - }); + $().click(function() { + $("#gFullsizeOverlay*").remove(); + $("#gFullsize").remove(); + }); $().bind("keypress", function() { - $("#gFullsizeOverlay*").remove(); - $("#gFullsize").remove(); - }); + $("#gFullsizeOverlay*").remove(); + $("#gFullsize").remove(); + }); $(window).resize(function() { - $("#gFullsizeOverlay").width($(document).width()) - .height($(document).height()); - image_size = $.gallery_auto_fit_window(image_width, image_height); - $("#gFullsize").height(image_size.height) - .width(image_size.width) - .css("top", image_size.top) - .css("left", image_size.left); - $("#gFullSizeImage").height(image_size.height) - .width(image_size.width); - }); + $("#gFullsizeOverlay").width($(document).width()).height($(document).height()); + image_size = $.gallery_auto_fit_window(image_width, image_height); + $("#gFullsize").height(image_size.height) + .width(image_size.width) + .css("top", image_size.top) + .css("left", image_size.left); + $("#gFullSizeImage").height(image_size.height).width(image_size.width); + }); }; })(jQuery); -- cgit v1.2.3 From a28dd09c4eac11ce406525ffd871df7605d5175f Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Thu, 27 Aug 2009 17:04:48 -0700 Subject: Properly deal with invalid images. This fixes ticket #611 which shows a BMP masquerading as a .jpg causing us to be unable to rebuild resizes and thumbnails. Now if that happens, we discard the file, log it and move on. --- modules/gallery/controllers/simple_uploader.php | 2 +- modules/gallery/helpers/photo.php | 8 +++++-- modules/gallery/views/simple_uploader.html.php | 2 +- modules/server_add/controllers/server_add.php | 30 +++++++++++++++---------- 4 files changed, 26 insertions(+), 16 deletions(-) diff --git a/modules/gallery/controllers/simple_uploader.php b/modules/gallery/controllers/simple_uploader.php index e7c0bd6f..156d18ac 100644 --- a/modules/gallery/controllers/simple_uploader.php +++ b/modules/gallery/controllers/simple_uploader.php @@ -71,7 +71,7 @@ class Simple_Uploader_Controller extends Controller { unlink($temp_filename); } header("HTTP/1.1 500 Internal Server Error"); - print "ERROR:" . $e->getMessage(); + print "ERROR: " . $e->getMessage(); return; } unlink($temp_filename); diff --git a/modules/gallery/helpers/photo.php b/modules/gallery/helpers/photo.php index 5cf37de1..96a66d29 100644 --- a/modules/gallery/helpers/photo.php +++ b/modules/gallery/helpers/photo.php @@ -109,8 +109,12 @@ class photo_Core { // there's only one save() happening here. module::event("item_created", $photo); - // Build our thumbnail/resizes - graphics::generate($photo); + // Build our thumbnail/resizes. If we fail to build thumbnail/resize we assume that the image + // is bad in some way and discard it. + if (!graphics::generate($photo)) { + $photo->delete(); + throw new Exception("@todo BAD_IMAGE_FILE"); + } // If the parent has no cover item, make this it. if (access::can("edit", $parent) && $parent->album_cover_item_id == null) { diff --git a/modules/gallery/views/simple_uploader.html.php b/modules/gallery/views/simple_uploader.html.php index 38ac518c..29a0dfe8 100644 --- a/modules/gallery/views/simple_uploader.html.php +++ b/modules/gallery/views/simple_uploader.html.php @@ -218,7 +218,7 @@ var fp = new File_Progress(file); switch (error_code) { case SWFUpload.UPLOAD_ERROR.HTTP_ERROR: - fp.set_status("error", "" + message); + fp.set_status("error", ""); break; case SWFUpload.UPLOAD_ERROR.UPLOAD_FAILED: fp.set_status("error", ""); diff --git a/modules/server_add/controllers/server_add.php b/modules/server_add/controllers/server_add.php index bfb96506..26b3bd08 100644 --- a/modules/server_add/controllers/server_add.php +++ b/modules/server_add/controllers/server_add.php @@ -220,19 +220,25 @@ class Server_Add_Controller extends Admin_Controller { $album = album::create($parent, $name, $title, null, $owner_id); $entry->item_id = $album->id; } else { - $extension = strtolower(pathinfo($name, PATHINFO_EXTENSION)); - if (in_array($extension, array("gif", "png", "jpg", "jpeg"))) { - $photo = photo::create($parent, $entry->file, $name, $title, null, $owner_id); - $entry->item_id = $photo->id; - } else if (in_array($extension, array("flv", "mp4"))) { - $movie = movie::create($parent, $entry->file, $name, $title, null, $owner_id); - $entry->item_id = $movie->id; - } else { - // This should never happen, because we don't add stuff to the list that we can't - // process. But just in, case.. set this to a non-null value so that we skip this - // entry. + try { + $extension = strtolower(pathinfo($name, PATHINFO_EXTENSION)); + if (in_array($extension, array("gif", "png", "jpg", "jpeg"))) { + $photo = photo::create($parent, $entry->file, $name, $title, null, $owner_id); + $entry->item_id = $photo->id; + } else if (in_array($extension, array("flv", "mp4"))) { + $movie = movie::create($parent, $entry->file, $name, $title, null, $owner_id); + $entry->item_id = $movie->id; + } else { + // This should never happen, because we don't add stuff to the list that we can't + // process. But just in, case.. set this to a non-null value so that we skip this + // entry. + $entry->item_id = 0; + $task->log("Skipping unknown file type: $entry->file"); + } + } catch (Exception $e) { + // This can happen if a photo file is invalid, like a BMP masquerading as a .jpg $entry->item_id = 0; - $task->log("Skipping unknown file type: $entry->file"); + $task->log("Skipping invalid file: $entry->file"); } } -- cgit v1.2.3 From 826e104fa98eca33afd8cb59ebf8123021145609 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Thu, 27 Aug 2009 17:15:20 -0700 Subject: Get rid of the extra "Folder name" row. It's noisy. Fixes ticket #593. --- modules/info/views/info_block.html.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/info/views/info_block.html.php b/modules/info/views/info_block.html.php index 762e989b..3c668168 100644 --- a/modules/info/views/info_block.html.php +++ b/modules/info/views/info_block.html.php @@ -10,9 +10,9 @@ description)) ?> - id != 1): ?> + is_album()): ?>
  • - page_type == 'album' ? t("Folder name:"): t("File name:"); ?> + name) ?>
  • -- cgit v1.2.3