Rework server_add. It's smaller and leaner now, storing the list of

files out in a separate model for scalability.  Removed the "pause"
functionality.

- Server_Add_Controller extends Admin_Controller so that we don't have
  to check for admin every time.
- Task completion time now factors in the time it takes to walk the
  arbitrarily deep trees
- Moved checkbox management entirely into JS using jQuery
- Simplified the JS considerably
This commit is contained in:
Bharat Mediratta
2009-07-07 21:16:36 -07:00
parent 22b2e1044f
commit faabae5dae
8 changed files with 273 additions and 479 deletions

View File

@@ -1,6 +1,7 @@
<?php defined("SYSPATH") or die("No direct script access.") ?>
<script type="text/javascript">
var GET_CHILDREN_URL = "<?= url::site("server_add/children?path=__PATH__") ?>";
var START_URL = "<?= url::site("server_add/start?item_id={$item->id}&csrf=$csrf") ?>";
</script>
<div id="gServerAdd">
@@ -18,18 +19,28 @@
</li>
</ul>
<?= form::open(url::abs_site("server_add/add"), array("method" => "post")) ?>
<?= form::open(url::abs_site("server_add/start/$item->id"), array("method" => "post")) ?>
<?= access::csrf_form_field(); ?>
<ul id="gServerAddTree" class="gCheckboxTree">
<?= $tree ?>
</ul>
<div class="gProgressBar" style="display: none"></div>
<span>
<input id="gServerAddPauseButton" class="submit ui-state-disabled" disabled="disabled" type="submit"
value="<?= t("Pause") ?>" style="display: none">
<input id="gServerAddAddButton" class="submit ui-state-disabled" disabled="disabled" type="submit"
value="<?= t("Add") ?>">
<input id="gServerAddAddButton" class="submit ui-state-disabled" disabled="disabled"
type="submit" value="<?= t("Add") ?>">
</span>
<?= form::close() ?>
<div class="gProgressBar" style="visibility: hidden" ></div>
<script type="text/javascript">
$("#gServerAddAddButton").ready(function() {
$("#gServerAddAddButton").click(function(event) {
event.preventDefault();
$("#gServerAdd .gProgressBar").
progressbar().
progressbar("value", 0).
slideDown("fast", function() { start_add() });
});
});
</script>
</div>