diff options
author | Bharat Mediratta <bharat@menalto.com> | 2009-07-02 11:23:40 -0700 |
---|---|---|
committer | Bharat Mediratta <bharat@menalto.com> | 2009-07-02 11:23:40 -0700 |
commit | e5b6193b26cf0f8509a98f7913a1d87fa354da05 (patch) | |
tree | 232a2dacd29acae22795234383140550415dfa63 /modules/server_add/views | |
parent | 495c76f729372e09f7511967c63948e36303e3d7 (diff) |
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
Diffstat (limited to 'modules/server_add/views')
-rw-r--r-- | modules/server_add/views/server_add_tree.html.php | 29 | ||||
-rw-r--r-- | modules/server_add/views/server_add_tree_dialog.html.php | 25 |
2 files changed, 32 insertions, 22 deletions
diff --git a/modules/server_add/views/server_add_tree.html.php b/modules/server_add/views/server_add_tree.html.php index 44f6bfbc..f8205a8b 100644 --- a/modules/server_add/views/server_add_tree.html.php +++ b/modules/server_add/views/server_add_tree.html.php @@ -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 ?> diff --git a/modules/server_add/views/server_add_tree_dialog.html.php b/modules/server_add/views/server_add_tree_dialog.html.php index e2aa5d44..6e4db620 100644 --- a/modules/server_add/views/server_add_tree_dialog.html.php +++ b/modules/server_add/views/server_add_tree_dialog.html.php @@ -1,26 +1,29 @@ <?php defined("SYSPATH") or die("No direct script access.") ?> -<script> - var FATAL_ERROR = "<?= t("Fatal Error") ?>"; - var FILE_IMPORT_WARNING = "<?= t("Add from server warning") ?>"; - $("#gServerAdd").ready(function() { - init_server_add_form(); - }); +<script type="text/javascript"> + var GET_CHILDREN_URL = "<?= url::site("server_add/children?path=__PATH__") ?>"; </script> + <div id="gServerAdd"> <h1 style="display: none;"><?= t("Add Photos to '%title'", array("title" => p::clean($item->title))) ?></h1> <p id="gDescription"><?= t("Photos will be added to album:") ?></p> <ul class="gBreadcrumbs"> <? foreach ($item->parents() as $parent): ?> - <li><?= p::clean($parent->title) ?></li> + <li> + <?= p::clean($parent->title) ?> + </li> <? endforeach ?> - <li class="active"><?= p::clean($item->title) ?></li> + <li class="active"> + <?= p::clean($item->title) ?> + </li> </ul> - <?= form::open(url::abs_site("__ARGS__/{$id}__TASK_ID__?csrf=$csrf"), array("method" => "post")) ?> - <div id="gServerAddTree" > + <?= form::open(url::abs_site("server_add/add"), array("method" => "post")) ?> + <?= access::csrf_form_field(); ?> + <ul id="gServerAddTree" class="gCheckboxTree"> <?= $tree ?> - </div> + </ul> + <span> <?= form::submit(array("id" => "gServerPauseButton", "name" => "add", "disabled" => true, "class" => "submit", "style" => "display:none"), t("Pause")) ?> <?= form::submit(array("id" => "gServerAddButton", "name" => "add", "disabled" => true, "class" => "submit"), t("Add")) ?> |