Major refactor of organize:

* Clean up naming conventions for variables in the controller
  so that we specifically refer to albums with $album_id, etc.

* Move complexity for drawing tree out of the controller and into
  the view.

* Simplify task definitions to get rid of extraneous text

* Change __PLACEHOLDERS__ to clearly define which is the album
  and which is the item that we're moving before/after

* Remove as many CSS ids as we can from the tree view to keep
  things simple
This commit is contained in:
Bharat Mediratta
2009-08-29 10:00:47 -07:00
parent acce8cbafd
commit f257cd3d69
6 changed files with 140 additions and 135 deletions

View File

@@ -1,17 +1,47 @@
<?php defined("SYSPATH") or die("No direct script access.") ?>
<li class="gOrganizeBranch ui-icon-left <?= $can_edit ? "" : "gViewOnly" ?>" ref="<?= $album->id ?>">
<div id="gOrganizeBranch-<?= $album->id ?>" ref="<?= $album->id ?>"
class="<?= $selected ? "gBranchSelected" : "" ?>">
<span id="gOrganizeIcon-<?= $album->id ?>" ref="<?= $album->id ?>"
class="ui-icon <?= $album_icon ?>">
</span>
<span class="gBranchText" ref="<?= $album->id ?>"><?= p::clean($album->title) ?></span>
</div>
<ul id="gOrganizeChildren-<?= $album->id ?>"
class="<?= $album_icon == "ui-icon-plus" ? "gBranchCollapsed" : "" ?>">
<li style="display:none">&nbsp;</li>
<? foreach ($children as $child): ?>
<?= $child ?>
<? foreach ($parents as $parent): ?>
<li class="gOrganizeAlbum ui-icon-left <?= access::can("edit", $parent) ? "" : "gViewOnly" ?>"
ref="<?= $parent->id ?>">
<span class="ui-icon ui-icon-minus">
</span>
<span class="gAlbumText" ref="<?= $parent->id ?>">
<?= p::clean($parent->title) ?>
</span>
<ul class="ui-icon-plus">
<? endforeach ?>
<? if ($parent->id == $album->parent_id): ?>
<? foreach ($parent->children(null, 0, array("type" => "album")) as $peer): ?>
<li class="gOrganizeAlbum ui-icon-left <?= access::can("edit", $peer) ? "" : "gViewOnly" ?>"
ref="<?= $peer->id ?>">
<span class="ui-icon <?= $peer->id == $album->id ? "ui-icon-minus" : "ui-icon-plus" ?>">
</span>
<span class="gAlbumText <?= $peer->id == $album->id ? "selected" : "" ?>"
ref="<?= $peer->id ?>">
<?= p::clean($peer->title) ?>
</span>
<? if ($peer->id == $album->id): ?>
<ul class="ui-icon-plus">
<? foreach ($album->children(null, 0, array("type" => "album")) as $child): ?>
<li class="gOrganizeAlbum ui-icon-left <?= access::can("edit", $child) ? "" : "gViewOnly" ?>"
ref="<?= $child->id ?>">
<span class="ui-icon ui-icon-plus">
</span>
<span class="gAlbumText"
ref="<?= $child->id ?>">
<?= p::clean($child->title) ?>
</span>
</li>
<? endforeach ?>
</ul>
<? endif ?>
</li>
<? endforeach ?>
<? endif ?>
<? foreach ($parents as $parent): ?>
</ul>
</li>
<? endforeach ?>