summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Almdal <tnalmdal@shaw.ca>2010-02-02 14:34:50 -0800
committerTim Almdal <tnalmdal@shaw.ca>2010-02-02 14:34:50 -0800
commit19fee6b5e4ceb8a5f90cafe4ad770856ece108ef (patch)
tree7311805e500ceae811dd7b1220892fc5eddf25a4
parent8a9301f756f5ed033bd86a9e275d6ed6e489c27f (diff)
Refactor the admin maintenance screen so that events are used to pupluate the action buttons and other content such as the list of scheduled tasks.
-rw-r--r--modules/gallery/controllers/admin_maintenance.php11
-rw-r--r--modules/gallery/views/admin_maintenance.html.php16
2 files changed, 16 insertions, 11 deletions
diff --git a/modules/gallery/controllers/admin_maintenance.php b/modules/gallery/controllers/admin_maintenance.php
index 487e77a6..8e4845a9 100644
--- a/modules/gallery/controllers/admin_maintenance.php
+++ b/modules/gallery/controllers/admin_maintenance.php
@@ -44,10 +44,17 @@ class Admin_Maintenance_Controller extends Admin_Controller {
$view->content->task_definitions = task::get_definitions();
$view->content->running_tasks = ORM::factory("task")
->where("done", "=", 0)->order_by("updated", "DESC")->find_all();
- $view->content->schedule_definitions =
- module::is_active("scheduler") ? scheduler::get_definitions() : "";
$view->content->finished_tasks = ORM::factory("task")
->where("done", "=", 1)->order_by("updated", "DESC")->find_all();
+ $task_buttons =
+ new ArrayObject(array((object)array("text" => t("run"),
+ "url" =>url::site("admin/maintenance/start"))));
+ module::event("admin_maintenance_task_buttons", $task_buttons);
+ $view->content->task_buttons = $task_buttons;
+
+ $maintenance_content = new ArrayObject();
+ module::event("admin_maintenance_content", $maintenance_content);
+ $view->content->task_maintenance_content = $maintenance_content;
print $view;
}
diff --git a/modules/gallery/views/admin_maintenance.html.php b/modules/gallery/views/admin_maintenance.html.php
index 15d04caa..444bf1fe 100644
--- a/modules/gallery/views/admin_maintenance.html.php
+++ b/modules/gallery/views/admin_maintenance.html.php
@@ -29,23 +29,21 @@
<?= $task->description ?>
</td>
<td>
- <a href="<?= url::site("admin/maintenance/start/$task->callback?csrf=$csrf") ?>"
+ <? foreach ($task_buttons as $button): ?>
+ <a href="<?= "{$button->url}/$task->callback?csrf=$csrf" ?>"
class="g-dialog-link g-button ui-icon-left ui-state-default ui-corner-all">
- <?= t("run") ?>
+ <?= html::clean($button->text) ?>
</a>
- <? if (module::is_active("scheduler")): ?>
- <a href="<?= url::site("form/add/admin/schedule/$task->callback?csrf=$csrf") ?>"
- class="g-dialog-link g-button ui-icon-left ui-state-default ui-corner-all">
- <?= t("schedule") ?>
- </a>
- <? endif ?>
+ <? endforeach ?>
</td>
</tr>
<? endforeach ?>
</table>
</div>
- <?= $schedule_definitions ?>
+ <? foreach ($task_maintenance_content as $content): ?>
+ <?= $content ?>
+ <? endforeach ?>
<? if ($running_tasks->count()): ?>
<div id="g-running-tasks">