Partial pass of server_add cleanup. It's broken at this stage since

I've redone the browsing code but I have not implemented the adding
code.

1) Rename index() to browse() since index is too generic.
2) Simplify the data that we pass to _dialog and _tree
3) Change _tree to return list items only, so that the outer dialog
   can be a <ul> for consistency.
4) Simplify the data structures so that we're not tracking checked vs.
   unchecked status in the PHP code, it's all done in jquery where we
   can do it with just a line or two of JS
5) use glob() which pretty much entirely replaces _get_children
This commit is contained in:
Bharat Mediratta
2009-07-02 11:23:40 -07:00
parent 495c76f729
commit e5b6193b26
5 changed files with 120 additions and 97 deletions
@@ -1,12 +1,19 @@
<?php defined("SYSPATH") or die("No direct script access.") ?>
<ul id="<?= $tree_id ?>" class="gCheckboxTree">
<? foreach ($data as $file => $file_info): ?>
<li class="<?= empty($file_info["is_dir"]) ? "gFile" : "gDirectory gCollapsed ui-icon-left" ?>">
<? if (!empty($file_info["is_dir"])): ?>
<span class="ui-icon ui-icon-plus"></span>
<? endif ?>
<label> <?= form::checkbox("checkbox[]", p::clean($file_info["path"]), $checked) . " " . p::clean($file) ?> </label>
<div class="gServerAddChildren" style="display: none"></div>
</li>
<? endforeach ?>
</ul>
<? foreach ($files as $file => $name): ?>
<? $id = substr(md5($file), 10) ?>
<li id="file_<?= $id ?>" class="<?= is_file($file) ? "gFile" : "gDirectory gCollapsed ui-icon-left" ?>">
<? if (is_dir($file)): ?>
<span onclick="open_close_branch('<?=$file?>', '<?=$id?>')" class="ui-icon ui-icon-plus"></span>
<? endif ?>
<label>
<?= form::checkbox("path[]", p::clean($file), false, "onclick=click_node(this)") ?>
<?= p::clean($name) ?>
</label>
<? if (is_dir($file)): ?>
<ul id="tree_<?= $id ?>" style="display: none"></ul>
<? endif ?>
</li>
<? endforeach ?>
<? if (!$files): ?>
<li class="gFile"> <i> <?= t("empty") ?> </i> </li>
<? endif ?>