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/views/organize_tree.html.php | 46 +++++++-------------------- 1 file changed, 12 insertions(+), 34 deletions(-) (limited to 'modules/organize/views/organize_tree.html.php') 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 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/organize/views/organize_tree.html.php') 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/organize/views/organize_tree.html.php') 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 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/organize/views/organize_tree.html.php') 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