Skip to content

Commit

Permalink
Manage the selection so we don't automatically select an album
Browse files Browse the repository at this point in the history
whenever we expand a tree.
  • Loading branch information
bharat committed Aug 30, 2009
1 parent d1ade66 commit c615918
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions modules/organize/controllers/organize.php
Expand Up @@ -136,15 +136,15 @@ public function tree($album_id) {
$album = ORM::factory("item", $album_id);
access::required("view", $album);

print self::_expanded_tree($album, $album);
print self::_expanded_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) {
private static function _expanded_tree($root, $selected_album=null) {
$v = new View("organize_tree.html");
$v->album = $root;
$v->selected = $selected_album;
Expand Down
4 changes: 2 additions & 2 deletions modules/organize/views/organize_tree.html.php
Expand Up @@ -4,14 +4,14 @@
<span class="ui-icon ui-icon-minus">
</span>
<span class="gAlbumText
<?= $album->id == $selected->id ? "selected" : "" ?>
<?= $selected && $album->id == $selected->id ? "selected" : "" ?>
"
ref="<?= $album->id ?>">
<?= p::clean($album->title) ?>
</span>
<ul>
<? foreach ($album->children(null, 0, array("type" => "album")) as $child): ?>
<? if ($child->is_descendant($selected)): ?>
<? if ($selected && $child->is_descendant($selected)): ?>
<?= View::factory("organize_tree.html", array("selected" => $selected, "album" => $child)); ?>
<? else: ?>
<li class="gOrganizeAlbum ui-icon-left <?= access::can("edit", $child) ? "" : "gViewOnly" ?>"
Expand Down

0 comments on commit c615918

Please sign in to comment.