From a5ddef021c1ca4920e40c0657de082ae0d7008ee Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Sat, 29 Aug 2009 15:03:46 -0700 Subject: Fix invalida syntax on trying to parse the progress bar percentage --- modules/gallery/views/admin_maintenance_task.html.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'modules') diff --git a/modules/gallery/views/admin_maintenance_task.html.php b/modules/gallery/views/admin_maintenance_task.html.php index 0eb0b38c..509e87b5 100644 --- a/modules/gallery/views/admin_maintenance_task.html.php +++ b/modules/gallery/views/admin_maintenance_task.html.php @@ -4,7 +4,7 @@ var animation = null; var delta = 1; animate_progress_bar = function() { - var current_value = Number($(".gProgressBar div").css("width").replace("%", "")); + var current_value = parseInt($(".gProgressBar div").css("width").replace("%", "")); if (target_value > current_value) { // speed up delta = Math.min(delta + 0.04, 3); -- cgit v1.2.3 From 0aceba6f48e5542d3edfbb1f195af50187adbac4 Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Sat, 29 Aug 2009 15:20:27 -0700 Subject: Fix for ticket #628: 1) increased gallery module version to 11 2) added image_sharpened parameter to the gallery module 3) sharpen all resizes. --- modules/gallery/helpers/gallery_installer.php | 9 ++++++++- modules/gallery/helpers/graphics.php | 5 +++++ modules/gallery/module.info | 2 +- 3 files changed, 14 insertions(+), 2 deletions(-) (limited to 'modules') diff --git a/modules/gallery/helpers/gallery_installer.php b/modules/gallery/helpers/gallery_installer.php index a212ef85..40830bc0 100644 --- a/modules/gallery/helpers/gallery_installer.php +++ b/modules/gallery/helpers/gallery_installer.php @@ -223,6 +223,7 @@ class gallery_installer { module::set_var("gallery", "resize_size", 640); module::set_var("gallery", "default_locale", "en_US"); module::set_var("gallery", "image_quality", 75); + module::set_var("gallery", "image_sharpen", 15); // Add rules for generating our thumbnails and resizes graphics::add_rule( @@ -259,7 +260,7 @@ class gallery_installer { module::set_var("gallery", "show_credits", 1); // @todo this string needs to be picked up by l10n_scanner module::set_var("gallery", "credits", "Powered by Gallery %version"); - module::set_version("gallery", 10); + module::set_version("gallery", 11); } static function upgrade($version) { @@ -336,6 +337,12 @@ class gallery_installer { module::set_version("gallery", $version = 10); } + + if ($version == 10) { + module::set_var("gallery", "image_sharpen", 15); + + module::set_version("gallery", $version = 11); + } } static function uninstall() { diff --git a/modules/gallery/helpers/graphics.php b/modules/gallery/helpers/graphics.php index 7dc46eeb..2892011f 100644 --- a/modules/gallery/helpers/graphics.php +++ b/modules/gallery/helpers/graphics.php @@ -206,10 +206,15 @@ class graphics_Core { // Image would get upscaled; do nothing copy($input_file, $output_file); } else { + try { Image::factory($input_file) ->resize($options["width"], $options["height"], $options["master"]) ->quality(module::get_var("gallery", "image_quality")) + ->sharpen(module::get_var("gallery", "image_sharpen")) ->save($output_file); + } catch (Exception $e) { + Kohana::log("error", $e->getMessage()); + } } module::event("graphics_resize_completed", $input_file, $output_file, $options); diff --git a/modules/gallery/module.info b/modules/gallery/module.info index dfb1a7a2..6b9dd1ba 100644 --- a/modules/gallery/module.info +++ b/modules/gallery/module.info @@ -1,3 +1,3 @@ name = "Gallery 3" description = "Gallery core application" -version = 10 +version = 11 -- cgit v1.2.3 From a1ce2d3f0aff6dcb7149f2d7327a10079e5c78f8 Mon Sep 17 00:00:00 2001 From: jhilden Date: Sat, 29 Aug 2009 19:19:04 -0400 Subject: you can close the l10n client directly from its interface now, without going back to the languages admin page --- modules/gallery/js/l10n_client.js | 13 +++++++++++++ modules/gallery/views/l10n_client.html.php | 5 ++++- 2 files changed, 17 insertions(+), 1 deletion(-) (limited to 'modules') diff --git a/modules/gallery/js/l10n_client.js b/modules/gallery/js/l10n_client.js index 80fe166b..35986e5a 100644 --- a/modules/gallery/js/l10n_client.js +++ b/modules/gallery/js/l10n_client.js @@ -205,6 +205,19 @@ Gallery.behaviors.l10nClient = function(context) { Gallery.l10nClient.toggle(0); } }); + + // Close the l10n client using an AJAX call and refreshing the page + $('#gCloseL10n').click(function(event) { + $.ajax({ + type: "GET", + url: toggle_l10n_mode_url, + data: "csrf=" + csrf, + success: function() { + window.location.reload(true); + } + }); + event.preventDefault(); + }); // Register keybindings using jQuery hotkeys // TODO: Either remove hotkeys code or add query.hotkeys.js. diff --git a/modules/gallery/views/l10n_client.html.php b/modules/gallery/views/l10n_client.html.php index 5ee7eca3..6c440b68 100644 --- a/modules/gallery/views/l10n_client.html.php +++ b/modules/gallery/views/l10n_client.html.php @@ -3,7 +3,8 @@
_ - X + " + href="">X

get('show_all_l10n_messages')): ?> @@ -76,5 +77,7 @@ var MSG_CLOSE_X = ""; var l10n_client_data = ; var plural_forms = ; + var toggle_l10n_mode_url = ""; + var csrf = "";

-- cgit v1.2.3 From 483d8df91b443a20a614eb5864cabb2a66ac72d2 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sat, 29 Aug 2009 16:33:22 -0700 Subject: Change the organize tree to expand/collapse. It doesn't properly open up to the album that you're viewing, and if you move a photo to a different album it'll reload the entire album tree. --- modules/organize/controllers/organize.php | 18 +++++----- modules/organize/js/organize.js | 26 ++++++++++++++ modules/organize/views/organize_dialog.html.php | 1 + modules/organize/views/organize_tree.html.php | 46 +++++++------------------ 4 files changed, 47 insertions(+), 44 deletions(-) (limited to 'modules') diff --git a/modules/organize/controllers/organize.php b/modules/organize/controllers/organize.php index 2b966657..3cbcfb28 100644 --- a/modules/organize/controllers/organize.php +++ b/modules/organize/controllers/organize.php @@ -25,7 +25,7 @@ class Organize_Controller extends Controller { $v = new View("organize_dialog.html"); $v->album = $album; - $v->album_tree = self::_tree($album); + $v->album_tree = self::_tree(ORM::factory("item", 1)); $v->micro_thumb_grid = self::_get_micro_thumb_grid($album, 0); print $v; } @@ -50,7 +50,7 @@ class Organize_Controller extends Controller { } print json_encode( - array("tree" => self::_tree($album)->__toString(), + array("tree" => self::_tree(ORM::factory("item", 1))->__toString(), "grid" => self::_get_micro_thumb_grid($album, 0)->__toString())); } @@ -132,17 +132,15 @@ class Organize_Controller extends Controller { return $v; } + public function tree($album_id) { + $album = ORM::factory("item", $album_id); + access::required("view", $album); + print self::_tree($album); + } + private static function _tree($album) { $v = new View("organize_tree.html"); - $v->parents = $album->parents(); $v->album = $album; - - if ($album->id == 1) { - $v->peers = array($album); - } else { - $v->peers = $album->parent()->children(null, 0, array("type" => "album")); - } - return $v; } } diff --git a/modules/organize/js/organize.js b/modules/organize/js/organize.js index 04e14a2f..3dbd0c89 100644 --- a/modules/organize/js/organize.js +++ b/modules/organize/js/organize.js @@ -159,8 +159,34 @@ $(".gMicroThumbGridCell").mousemove($.organize.mouse_move_handler); $(".gOrganizeAlbum").droppable($.organize.branch_droppable); $(".gAlbumText").click($.organize.show_album); + $("#gOrganizeAlbumTree .ui-icon-plus,#gOrganizeAlbumTree .ui-icon-minus").click($.organize.toggle_branch); }, + toggle_branch: function(event) { + event.preventDefault(); + var target = $(event.currentTarget); + var branch = $(target).parent(); + var id = $(event.currentTarget).parent().attr("ref"); + + if ($(target).hasClass("ui-icon-plus")) { + // Expanding + if (!branch.find("ul").length) { + $.get(tree_url.replace("__ALBUM_ID__", id), { }, + function(data) { + branch.replaceWith(data); + $.organize.set_handlers(); + } + ); + } else { + branch.find("ul:eq(0)").slideDown(); + } + } else { + // Contracting + branch.find("ul:eq(0)").slideUp(); + } + $(target).toggleClass("ui-icon-plus"); + $(target).toggleClass("ui-icon-minus"); + }, /** * When the text of a selection is clicked, then show that albums contents diff --git a/modules/organize/views/organize_dialog.html.php b/modules/organize/views/organize_dialog.html.php index b03c066c..d4196460 100644 --- a/modules/organize/views/organize_dialog.html.php +++ b/modules/organize/views/organize_dialog.html.php @@ -3,6 +3,7 @@ var move_url = ""; var rearrange_url = ""; var sort_order_url = ""; + var tree_url = "";

p::purify($album->title))) ?>

diff --git a/modules/organize/views/organize_tree.html.php b/modules/organize/views/organize_tree.html.php index 36f900ac..4677234c 100644 --- a/modules/organize/views/organize_tree.html.php +++ b/modules/organize/views/organize_tree.html.php @@ -1,44 +1,22 @@ - -
  • " - ref="id ?>"> +
  • " + ref="id ?>"> - - title) ?> + + title) ?> -
      - - - -
    • " - ref="id ?>"> - "> +
        + children(null, 0, array("type" => "album")) as $child): ?> +
      • " + ref="id ?>"> + - " - ref="id ?>"> - title) ?> + + title) ?> - - id == $album->id): ?> -
          - children(null, 0, array("type" => "album")) as $child): ?> -
        • " - ref="id ?>"> - - - - title) ?> - -
        • - -
        -
      • - -
    • - + -- cgit v1.2.3 From 878b9c91b234f464eb9e1a3bdfbd0e6285a1a0e7 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sat, 29 Aug 2009 16:38:53 -0700 Subject: Remove try/catch in resize() since that will swallow any exceptions that we generate when resizing. --- modules/gallery/helpers/graphics.php | 4 ---- 1 file changed, 4 deletions(-) (limited to 'modules') diff --git a/modules/gallery/helpers/graphics.php b/modules/gallery/helpers/graphics.php index 2892011f..a20c58dd 100644 --- a/modules/gallery/helpers/graphics.php +++ b/modules/gallery/helpers/graphics.php @@ -206,15 +206,11 @@ class graphics_Core { // Image would get upscaled; do nothing copy($input_file, $output_file); } else { - try { Image::factory($input_file) ->resize($options["width"], $options["height"], $options["master"]) ->quality(module::get_var("gallery", "image_quality")) ->sharpen(module::get_var("gallery", "image_sharpen")) ->save($output_file); - } catch (Exception $e) { - Kohana::log("error", $e->getMessage()); - } } module::event("graphics_resize_completed", $input_file, $output_file, $options); -- cgit v1.2.3 From 4bc7165dab267311407294b11a77e6c2689ad4a1 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sat, 29 Aug 2009 16:42:33 -0700 Subject: Delete obsolete comment and tighten the code in site_menu(). --- modules/server_add/helpers/server_add_event.php | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'modules') diff --git a/modules/server_add/helpers/server_add_event.php b/modules/server_add/helpers/server_add_event.php index 6b21ec2e..b9dd8c28 100644 --- a/modules/server_add/helpers/server_add_event.php +++ b/modules/server_add/helpers/server_add_event.php @@ -31,15 +31,11 @@ class server_add_event_Core { $paths = unserialize(module::get_var("server_add", "authorized_paths")); if ($item && user::active()->admin && $item->is_album() && !empty($paths)) { - // This is a little tricky. Normally there's an "Add Photo" menu option, but we want to - // turn that into a dropdown if there are two different ways to add things. Do that in a - // portable way for now. If we find ourselves duplicating this pattern, we should make an - // API method for this. - $add_menu = $menu->get("add_menu"); - $add_menu->append(Menu::factory("dialog") - ->id("server_add") - ->label(t("Server add")) - ->url(url::site("server_add/browse/$item->id"))); + $menu->get("add_menu") + ->append(Menu::factory("dialog") + ->id("server_add") + ->label(t("Server add")) + ->url(url::site("server_add/browse/$item->id"))); } } } -- cgit v1.2.3 From af6bfa3c71ccc2d45d3029c96f934a7ecd2c2143 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sun, 30 Aug 2009 13:29:05 -0700 Subject: Change the processing time for search_task and exif_task to start the 1.5 second counter only after we've done any expensive queries. This guarantees at least some time to do work. Fixes ticket #693. --- modules/exif/helpers/exif_task.php | 12 +++++++++--- modules/search/helpers/search_task.php | 10 ++++++++-- 2 files changed, 17 insertions(+), 5 deletions(-) (limited to 'modules') diff --git a/modules/exif/helpers/exif_task.php b/modules/exif/helpers/exif_task.php index c269b732..7c4c97c4 100644 --- a/modules/exif/helpers/exif_task.php +++ b/modules/exif/helpers/exif_task.php @@ -50,12 +50,18 @@ class exif_task_Core { ->orwhere("exif_records.dirty", 1) ->close_paren() ->find_all() as $item) { - if (microtime(true) - $start > 1.5) { - break; + // The query above can take a long time, so start the timer after its done + // to give ourselves a little time to actually process rows. + if (!isset($start)) { + $start = microtime(true); } - $completed++; exif::extract($item); + $completed++; + + if (microtime(true) - $start > 1.5) { + break; + } } list ($remaining, $total, $percent) = exif::stats(); diff --git a/modules/search/helpers/search_task.php b/modules/search/helpers/search_task.php index 5643573a..9508f420 100644 --- a/modules/search/helpers/search_task.php +++ b/modules/search/helpers/search_task.php @@ -48,12 +48,18 @@ class search_task_Core { ->where("search_records.item_id", null) ->orwhere("search_records.dirty", 1) ->find_all() as $item) { - if (microtime(true) - $start > 1.5) { - break; + // The query above can take a long time, so start the timer after its done + // to give ourselves a little time to actually process rows. + if (!isset($start)) { + $start = microtime(true); } search::update($item); $completed++; + + if (microtime(true) - $start > 1.5) { + break; + } } list ($remaining, $total, $percent) = search::stats(); -- cgit v1.2.3 From d1ade6620e814ecf536dfde17c95593a311d1c2c Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sun, 30 Aug 2009 14:35:27 -0700 Subject: Precalculate the organize tree based on the selected album and render it right away while still allowing incremental tree loading. --- modules/organize/controllers/organize.php | 17 ++++++++++++----- modules/organize/views/organize_tree.html.php | 9 ++++++++- 2 files changed, 20 insertions(+), 6 deletions(-) (limited to 'modules') diff --git a/modules/organize/controllers/organize.php b/modules/organize/controllers/organize.php index 3cbcfb28..24e5bf97 100644 --- a/modules/organize/controllers/organize.php +++ b/modules/organize/controllers/organize.php @@ -25,7 +25,7 @@ class Organize_Controller extends Controller { $v = new View("organize_dialog.html"); $v->album = $album; - $v->album_tree = self::_tree(ORM::factory("item", 1)); + $v->album_tree = self::_expanded_tree(ORM::factory("item", 1), $album); $v->micro_thumb_grid = self::_get_micro_thumb_grid($album, 0); print $v; } @@ -50,7 +50,7 @@ class Organize_Controller extends Controller { } print json_encode( - array("tree" => self::_tree(ORM::factory("item", 1))->__toString(), + array("tree" => self::_expanded_tree(ORM::factory("item", 1), $album)->__toString(), "grid" => self::_get_micro_thumb_grid($album, 0)->__toString())); } @@ -135,12 +135,19 @@ class Organize_Controller extends Controller { public function tree($album_id) { $album = ORM::factory("item", $album_id); access::required("view", $album); - print self::_tree($album); + + print self::_expanded_tree($album, $album); } - private static function _tree($album) { + /** + * Create an HTML representation of the tree from the root down to the selected album. We only + * include albums along the descendant hierarchy that includes the selected album, and the + * immediate child albums. + */ + private static function _expanded_tree($root, $selected_album) { $v = new View("organize_tree.html"); - $v->album = $album; + $v->album = $root; + $v->selected = $selected_album; return $v; } } diff --git a/modules/organize/views/organize_tree.html.php b/modules/organize/views/organize_tree.html.php index 4677234c..a99d2337 100644 --- a/modules/organize/views/organize_tree.html.php +++ b/modules/organize/views/organize_tree.html.php @@ -3,11 +3,17 @@ ref="id ?>"> - + + " + ref="id ?>"> title) ?>
        children(null, 0, array("type" => "album")) as $child): ?> + is_descendant($selected)): ?> + $selected, "album" => $child)); ?> +
      • " ref="id ?>"> @@ -16,6 +22,7 @@ title) ?>
      • +
      -- cgit v1.2.3 From c615918829fae1496a09886ef929869fce9b9f6a Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sun, 30 Aug 2009 14:40:55 -0700 Subject: Manage the selection so we don't automatically select an album whenever we expand a tree. --- modules/organize/controllers/organize.php | 4 ++-- modules/organize/views/organize_tree.html.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'modules') diff --git a/modules/organize/controllers/organize.php b/modules/organize/controllers/organize.php index 24e5bf97..22f106e9 100644 --- a/modules/organize/controllers/organize.php +++ b/modules/organize/controllers/organize.php @@ -136,7 +136,7 @@ class Organize_Controller extends Controller { $album = ORM::factory("item", $album_id); access::required("view", $album); - print self::_expanded_tree($album, $album); + print self::_expanded_tree($album); } /** @@ -144,7 +144,7 @@ class Organize_Controller extends Controller { * include albums along the descendant hierarchy that includes the selected album, and the * immediate child albums. */ - private static function _expanded_tree($root, $selected_album) { + private static function _expanded_tree($root, $selected_album=null) { $v = new View("organize_tree.html"); $v->album = $root; $v->selected = $selected_album; diff --git a/modules/organize/views/organize_tree.html.php b/modules/organize/views/organize_tree.html.php index a99d2337..59f683ef 100644 --- a/modules/organize/views/organize_tree.html.php +++ b/modules/organize/views/organize_tree.html.php @@ -4,14 +4,14 @@ + id == $selected->id ? "selected" : "" ?> " ref="id ?>"> title) ?>
        children(null, 0, array("type" => "album")) as $child): ?> - is_descendant($selected)): ?> + is_descendant($selected)): ?> $selected, "album" => $child)); ?>
      • " -- cgit v1.2.3 From a498d3776365b6d0d14ce07a4ccd564f41b7f7be Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sun, 30 Aug 2009 14:49:51 -0700 Subject: remove unused #gOrganizeDialog --- modules/organize/css/organize.css | 4 ---- 1 file changed, 4 deletions(-) (limited to 'modules') diff --git a/modules/organize/css/organize.css b/modules/organize/css/organize.css index 85168810..cbd1e138 100644 --- a/modules/organize/css/organize.css +++ b/modules/organize/css/organize.css @@ -2,10 +2,6 @@ /******************************************************************* * Dialog wide stylings */ -#gOrganizeDialog { - text-align: left; -} - #gOrganize { overflow: hidden; } -- cgit v1.2.3 From 5cce88cd040fe33ee0f7037e0b045792d60ed9d8 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sun, 30 Aug 2009 14:50:53 -0700 Subject: Rename gAlbumText to gOrganizeAlbumText for consistency since this is an organize-only construct. --- modules/organize/css/organize.css | 4 ++-- modules/organize/js/organize.js | 4 ++-- modules/organize/views/organize_tree.html.php | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) (limited to 'modules') diff --git a/modules/organize/css/organize.css b/modules/organize/css/organize.css index cbd1e138..3a8a6412 100644 --- a/modules/organize/css/organize.css +++ b/modules/organize/css/organize.css @@ -47,7 +47,7 @@ padding-left: 1.2em; } -.gAlbumText:hover { +.gOrganizeAlbumText:hover { border: 1px dashed #999; padding: 1px; } @@ -63,7 +63,7 @@ cursor: pointer; } -.gAlbumText { +.gOrganizeAlbumText { cursor: pointer; width: auto; } diff --git a/modules/organize/js/organize.js b/modules/organize/js/organize.js index 3dbd0c89..ad14a99e 100644 --- a/modules/organize/js/organize.js +++ b/modules/organize/js/organize.js @@ -158,7 +158,7 @@ $(".gMicroThumbGridCell").draggable($.organize.micro_thumb_draggable); $(".gMicroThumbGridCell").mousemove($.organize.mouse_move_handler); $(".gOrganizeAlbum").droppable($.organize.branch_droppable); - $(".gAlbumText").click($.organize.show_album); + $(".gOrganizeAlbumText").click($.organize.show_album); $("#gOrganizeAlbumTree .ui-icon-plus,#gOrganizeAlbumTree .ui-icon-minus").click($.organize.toggle_branch); }, @@ -203,7 +203,7 @@ $("#gMicroThumbPanel").selectable("destroy"); var id = $(event.currentTarget).attr("ref"); $("#gOrganizeAlbumTree .selected").removeClass("selected"); - $(".gAlbumText[ref=" + id + "]").addClass("selected"); + $(".gOrganizeAlbumText[ref=" + id + "]").addClass("selected"); var url = $("#gMicroThumbPanel").attr("ref").replace("__ITEM_ID__", id).replace("__OFFSET__", 0); $.get(url, {}, function(data) { diff --git a/modules/organize/views/organize_tree.html.php b/modules/organize/views/organize_tree.html.php index 59f683ef..58621c3c 100644 --- a/modules/organize/views/organize_tree.html.php +++ b/modules/organize/views/organize_tree.html.php @@ -3,7 +3,7 @@ ref="id ?>"> - id == $selected->id ? "selected" : "" ?> " ref="id ?>"> @@ -18,7 +18,7 @@ ref="id ?>"> - + title) ?>
      • -- cgit v1.2.3 From 53390ba79a78eab54d2c4fe8f00b79f3b3fc5648 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sun, 30 Aug 2009 14:58:26 -0700 Subject: CSS rename: gMicroThumbXxx -> gOrganizeMicroThumbXxx to make it clear that this is organize only. --- modules/organize/css/organize.css | 14 ++++---- modules/organize/js/organize.js | 38 +++++++++++----------- modules/organize/views/organize_dialog.html.php | 4 +-- .../organize/views/organize_thumb_grid.html.php | 8 ++--- 4 files changed, 32 insertions(+), 32 deletions(-) (limited to 'modules') diff --git a/modules/organize/css/organize.css b/modules/organize/css/organize.css index 3a8a6412..4a65d20e 100644 --- a/modules/organize/css/organize.css +++ b/modules/organize/css/organize.css @@ -70,7 +70,7 @@ /******************************************************************* * Album Panel Styles */ -#gMicroThumbPanel { +#gOrganizeMicroThumbPanel { margin: 0 !important; padding: 0 !important; background-color: #cfdeff; @@ -81,11 +81,11 @@ overflow-y: auto; } -#gMicroThumbGrid { +#gOrganizeMicroThumbGrid { padding: 1em; } -.gMicroThumbGridCell { +.gOrganizeMicroThumbGridCell { float: left; font-size: 0.8em; padding: .5em !important; @@ -94,14 +94,14 @@ border-right: 1px hidden #13A; } -.gMicroThumb { +.gOrganizeMicroThumb { display: block; height: 9em; text-align: center; width: 9em; } -.gMicroThumbGridCell.ui-state-selected { +.gOrganizeMicroThumbGridCell.ui-state-selected { opacity: 1; } @@ -114,11 +114,11 @@ padding: .5em; } -#gMicroThumbPanel #gMicroThumbGrid .gAlbum { +#gOrganizeMicroThumbPanel #gOrganizeMicroThumbGrid .gAlbum { background-color: #e8e8e8; } -#gMicroThumbPanel #gMicroThumbGrid :hover { +#gOrganizeMicroThumbPanel #gOrganizeMicroThumbGrid :hover { opacity: 1; } diff --git a/modules/organize/js/organize.js b/modules/organize/js/organize.js index ad14a99e..edafae61 100644 --- a/modules/organize/js/organize.js +++ b/modules/organize/js/organize.js @@ -4,7 +4,7 @@ handle: ".ui-state-selected", distance: 10, cursorAt: { left: -10, top: -10}, - appendTo: "#gMicroThumbPanel", + appendTo: "#gOrganizeMicroThumbPanel", helper: function(event, ui) { var selected = $(".ui-draggable.ui-state-selected img"); if (selected.length) { @@ -37,16 +37,16 @@ }, start: function(event, ui) { - $("#gMicroThumbPanel .ui-state-selected").hide(); + $("#gOrganizeMicroThumbPanel .ui-state-selected").hide(); }, drag: function(event, ui) { - var top = $("#gMicroThumbPanel").offset().top; - var height = $("#gMicroThumbPanel").height(); + var top = $("#gOrganizeMicroThumbPanel").offset().top; + var height = $("#gOrganizeMicroThumbPanel").height(); if (ui.offset.top > height + top - 20) { - $("#gMicroThumbPanel").get(0).scrollTop += 100; + $("#gOrganizeMicroThumbPanel").get(0).scrollTop += 100; } else if (ui.offset.top < top + 20) { - $("#gMicroThumbPanel").get(0).scrollTop = Math.max(0, $("#gMicroThumbPanel").get(0).scrollTop - 100); + $("#gOrganizeMicroThumbPanel").get(0).scrollTop = Math.max(0, $("#gOrganizeMicroThumbPanel").get(0).scrollTop - 100); } } }, @@ -74,7 +74,7 @@ drop: function(event, ui) { if ($(event.target).hasClass("gViewOnly")) { $(".ui-state-selected").show(); - $(".gMicroThumbGridCell").css("borderStyle", "none"); + $(".gOrganizeMicroThumbGridCell").css("borderStyle", "none"); } else { $.organize.do_drop({ url: move_url.replace("__ALBUM_ID__", $(event.target).attr("ref")), @@ -85,7 +85,7 @@ }, do_drop: function(options) { - $("#gMicroThumbPanel").selectable("destroy"); + $("#gOrganizeMicroThumbPanel").selectable("destroy"); var source_ids = []; $(options.source).each(function(i) { source_ids.push($(this).attr("ref")); @@ -104,7 +104,7 @@ $("#gOrganizeAlbumTree").html(data.tree); } if (data.grid) { - $("#gMicroThumbGrid").html(data.grid); + $("#gOrganizeMicroThumbGrid").html(data.grid); $("#gOrganizeSortColumn").attr("value", data.sort_column); $("#gOrganizeSortOrder").attr("value", data.sort_order); } @@ -113,7 +113,7 @@ mouse_move_handler: function(event) { if ($(".gDragHelper").length) { - $(".gMicroThumbGridCell").css("borderStyle", "hidden"); + $(".gOrganizeMicroThumbGridCell").css("borderStyle", "hidden"); $(".currentDropTarget").removeClass("currentDropTarget"); var borderStyle = event.pageX < $(this).offset().left + $(this).width() / 2 ? "borderLeftStyle" : "borderRightStyle"; @@ -132,7 +132,7 @@ $("#gDialog").dialog("option", "zIndex", 70); $("#gDialog").bind("dialogopen", function(event, ui) { $("#gOrganize").height($("#gDialog").innerHeight() - 20); - $("#gMicroThumbPanel").height($("#gDialog").innerHeight() - 90); + $("#gOrganizeMicroThumbPanel").height($("#gDialog").innerHeight() - 90); $("#gOrganizeAlbumTree").height($("#gDialog").innerHeight() - 59); }); @@ -152,11 +152,11 @@ }, set_handlers: function() { - $("#gMicroThumbPanel").selectable({filter: ".gMicroThumbGridCell"}); - $("#gMicroThumbPanel").droppable($.organize.content_droppable); + $("#gOrganizeMicroThumbPanel").selectable({filter: ".gOrganizeMicroThumbGridCell"}); + $("#gOrganizeMicroThumbPanel").droppable($.organize.content_droppable); - $(".gMicroThumbGridCell").draggable($.organize.micro_thumb_draggable); - $(".gMicroThumbGridCell").mousemove($.organize.mouse_move_handler); + $(".gOrganizeMicroThumbGridCell").draggable($.organize.micro_thumb_draggable); + $(".gOrganizeMicroThumbGridCell").mousemove($.organize.mouse_move_handler); $(".gOrganizeAlbum").droppable($.organize.branch_droppable); $(".gOrganizeAlbumText").click($.organize.show_album); $("#gOrganizeAlbumTree .ui-icon-plus,#gOrganizeAlbumTree .ui-icon-minus").click($.organize.toggle_branch); @@ -200,14 +200,14 @@ if ($(parent).hasClass("gViewOnly")) { return; } - $("#gMicroThumbPanel").selectable("destroy"); + $("#gOrganizeMicroThumbPanel").selectable("destroy"); var id = $(event.currentTarget).attr("ref"); $("#gOrganizeAlbumTree .selected").removeClass("selected"); $(".gOrganizeAlbumText[ref=" + id + "]").addClass("selected"); - var url = $("#gMicroThumbPanel").attr("ref").replace("__ITEM_ID__", id).replace("__OFFSET__", 0); + var url = $("#gOrganizeMicroThumbPanel").attr("ref").replace("__ITEM_ID__", id).replace("__OFFSET__", 0); $.get(url, {}, function(data) { - $("#gMicroThumbGrid").html(data.grid); + $("#gOrganizeMicroThumbGrid").html(data.grid); $("#gOrganizeSortColumn").attr("value", data.sort_column); $("#gOrganizeSortOrder").attr("value", data.sort_order); $.organize.set_handlers(); @@ -225,7 +225,7 @@ .replace("__DIR__", dir); $.get(url, {}, function(data) { - $("#gMicroThumbGrid").html(data.grid); + $("#gOrganizeMicroThumbGrid").html(data.grid); $("#gOrganizeSortColumn").attr("value", data.sort_column); $("#gOrganizeSortOrder").attr("value", data.sort_order); $.organize.set_handlers(); diff --git a/modules/organize/views/organize_dialog.html.php b/modules/organize/views/organize_dialog.html.php index d4196460..54f21178 100644 --- a/modules/organize/views/organize_dialog.html.php +++ b/modules/organize/views/organize_dialog.html.php @@ -23,9 +23,9 @@
  • -
    "> -
      +
    diff --git a/modules/organize/views/organize_thumb_grid.html.php b/modules/organize/views/organize_thumb_grid.html.php index 31dc9af5..929d9ec3 100644 --- a/modules/organize/views/organize_thumb_grid.html.php +++ b/modules/organize/views/organize_thumb_grid.html.php @@ -1,8 +1,8 @@ children(25, $offset) as $child): ?> -
  • -
    "> +
  • +
    "> thumb_img(array("class" => "gThumbnail", "ref" => $child->id), 90, true) ?>
  • @@ -13,7 +13,7 @@ setTimeout(function() { $.get("id/" . ($offset + 25)) ?>", function(data) { - $("#gMicroThumbGrid").append(data); + $("#gOrganizeMicroThumbGrid").append(data); $.organize.set_handlers(); } ); -- cgit v1.2.3 From dee0abfab9c613855c9145bd189776cc23d92973 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sun, 30 Aug 2009 15:04:39 -0700 Subject: Use is_descendant() API inside move_to() for clarity. --- modules/gallery/libraries/ORM_MPTT.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'modules') diff --git a/modules/gallery/libraries/ORM_MPTT.php b/modules/gallery/libraries/ORM_MPTT.php index a7defba9..9b3e1f2b 100644 --- a/modules/gallery/libraries/ORM_MPTT.php +++ b/modules/gallery/libraries/ORM_MPTT.php @@ -212,8 +212,7 @@ class ORM_MPTT_Core extends ORM { * @return ORM_MTPP */ function move_to($target) { - if ($this->left_ptr <= $target->left_ptr && - $this->right_ptr >= $target->right_ptr) { + if ($this->is_descendant($target)) { throw new Exception("@todo INVALID_TARGET can't move item inside itself"); } -- cgit v1.2.3 From db03c5d799dbe34301b7034018a254ab0f0f32f3 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sun, 30 Aug 2009 15:09:13 -0700 Subject: Don't try to move an item into its own descendant hierarchy. Just leave it out of the move for now. --- modules/organize/controllers/organize.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'modules') diff --git a/modules/organize/controllers/organize.php b/modules/organize/controllers/organize.php index 22f106e9..27299e85 100644 --- a/modules/organize/controllers/organize.php +++ b/modules/organize/controllers/organize.php @@ -46,7 +46,10 @@ class Organize_Controller extends Controller { $album = ORM::factory("item", $album_id); foreach ($this->input->post("source_ids") as $source_id) { - item::move(ORM::factory("item", $source_id), $album); + $source = ORM::factory("item", $source_id); + if (!$album->is_descendant($source)) { + item::move($source, $album); + } } print json_encode( -- cgit v1.2.3