summaryrefslogtreecommitdiff
path: root/modules/gallery/views
diff options
context:
space:
mode:
authorTim Almdal <tnalmdal@shaw.ca>2009-07-05 17:38:49 -0700
committerTim Almdal <tnalmdal@shaw.ca>2009-07-05 17:38:49 -0700
commit04f02b49c5d524345bc916aad6e247c714177662 (patch)
tree2410e3ca63a67511c8dbdfd3a8f20a174492a9e5 /modules/gallery/views
parentfcb031c2b60ac9e1888592296cba25791e77b446 (diff)
Add task logging functionality. When a task runs, it creates a log that is
stored in the persistant cache for 30 days. On the admin_maintenance page there is a new link for completed tasks "browse log". Clicking this will open a dialog box that has the the contents of the log displayed. The user can then view the log and close the dialog, or press the save button to download the log to their local machine.
Diffstat (limited to 'modules/gallery/views')
-rw-r--r--modules/gallery/views/admin_maintenance.html.php5
-rw-r--r--modules/gallery/views/admin_maintenance_show_log.html.php19
2 files changed, 24 insertions, 0 deletions
diff --git a/modules/gallery/views/admin_maintenance.html.php b/modules/gallery/views/admin_maintenance.html.php
index c47f77f8..f50c95dd 100644
--- a/modules/gallery/views/admin_maintenance.html.php
+++ b/modules/gallery/views/admin_maintenance.html.php
@@ -164,6 +164,11 @@
<a href="<?= url::site("admin/maintenance/remove/$task->id?csrf=$csrf") ?>">
<?= t("remove") ?>
</a>
+ <? if ($task->get_task_log()): ?>
+ <a class="gDialogLink" href="<?= url::site("admin/maintenance/show_log/$task->id?csrf=$csrf") ?>">
+ <?= t("browse log") ?>
+ </a>
+ <? endif ?>
<? else: ?>
<a class="gDialogLink" href="<?= url::site("admin/maintenance/resume/$task->id?csrf=$csrf") ?>">
<?= t("resume") ?>
diff --git a/modules/gallery/views/admin_maintenance_show_log.html.php b/modules/gallery/views/admin_maintenance_show_log.html.php
new file mode 100644
index 00000000..afd988bb
--- /dev/null
+++ b/modules/gallery/views/admin_maintenance_show_log.html.php
@@ -0,0 +1,19 @@
+<?php defined("SYSPATH") or die("No direct script access.") ?>
+<script type="text/javascript">
+ dismiss = function() {
+ window.location.reload();
+ }
+ download = function(){
+ // send request
+ $('<form action="<?= url::site("admin/maintenance/save_log/$task->id?csrf=$csrf") ?>" method="post"></form>').
+appendTo('body').submit().remove();
+ };
+</script>
+<div id="gTaskLogDialog">
+ <h1> <?= $task->name ?> </h1>
+ <div class="gTaskLog">
+ <pre><?= p::purify($task->get_task_log()) ?></pre>
+ </div>
+ <button id="gCloseButton" class="ui-state-default ui-corner-all" onclick="dismiss()"><?= t("Close") ?></button>
+ <button id="gSaveButton" class="ui-state-default ui-corner-all" onclick="download()"><?= t("Save") ?></button>
+</div>