From 04f02b49c5d524345bc916aad6e247c714177662 Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Sun, 5 Jul 2009 17:38:49 -0700 Subject: 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. --- modules/gallery/views/admin_maintenance.html.php | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'modules/gallery/views/admin_maintenance.html.php') 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 @@ id?csrf=$csrf") ?>"> + get_task_log()): ?> + id?csrf=$csrf") ?>"> + + + id?csrf=$csrf") ?>"> -- cgit v1.2.3 From 5d9e334fe6d7c7c1cf6d39a12684e215e797b4b3 Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Tue, 7 Jul 2009 12:49:21 -0700 Subject: Added a wee bit of phpDoc. Changed the name of the method get_task_log to get_log Changed the default name of the file when the log is downloaded to gallery3_task_log.txt --- modules/gallery/controllers/admin_maintenance.php | 4 ++-- modules/gallery/models/task.php | 14 +++++++++++++- modules/gallery/views/admin_maintenance.html.php | 2 +- modules/gallery/views/admin_maintenance_show_log.html.php | 2 +- 4 files changed, 17 insertions(+), 5 deletions(-) (limited to 'modules/gallery/views/admin_maintenance.html.php') diff --git a/modules/gallery/controllers/admin_maintenance.php b/modules/gallery/controllers/admin_maintenance.php index 37cc5222..543961a1 100644 --- a/modules/gallery/controllers/admin_maintenance.php +++ b/modules/gallery/controllers/admin_maintenance.php @@ -119,8 +119,8 @@ class Admin_Maintenance_Controller extends Admin_Controller { } header("Content-Type: application/text"); - header("Content-Disposition: filename=g2_import.txt"); - print $task->get_task_log(); + header("Content-Disposition: filename=gallery3_task_log.txt"); + print $task->get_log(); } /** diff --git a/modules/gallery/models/task.php b/modules/gallery/models/task.php index 55bb8e21..b7e255a2 100644 --- a/modules/gallery/models/task.php +++ b/modules/gallery/models/task.php @@ -49,6 +49,10 @@ class Task_Model extends ORM { return user::lookup($this->owner_id); } + /** + * Log a message to the task log. + * @params $msg mixed a string or array of strings + */ public function log($msg) { $key = $this->_cache_key(); $log = Cache::instance()->get($key); @@ -63,11 +67,19 @@ class Task_Model extends ORM { array("task", "log", "import"), 2592000); } - public function get_task_log() { + /** + * Retrieve the cached log information for this task. + * @returns the log data or null if there is no log data + */ + public function get_log() { $log_data = Cache::instance()->get($this->_cache_key()); return $log_data !== null ? $log_data : false; } + /** + * Build the task cache key + * @returns the key to use in access the cache + */ private function _cache_key() { return md5("$this->id; $this->name; $this->callback"); } diff --git a/modules/gallery/views/admin_maintenance.html.php b/modules/gallery/views/admin_maintenance.html.php index f50c95dd..eecc045c 100644 --- a/modules/gallery/views/admin_maintenance.html.php +++ b/modules/gallery/views/admin_maintenance.html.php @@ -164,7 +164,7 @@ id?csrf=$csrf") ?>"> - get_task_log()): ?> + get_log()): ?> id?csrf=$csrf") ?>"> diff --git a/modules/gallery/views/admin_maintenance_show_log.html.php b/modules/gallery/views/admin_maintenance_show_log.html.php index afd988bb..9d850986 100644 --- a/modules/gallery/views/admin_maintenance_show_log.html.php +++ b/modules/gallery/views/admin_maintenance_show_log.html.php @@ -12,7 +12,7 @@ appendTo('body').submit().remove();

name ?>

-
get_task_log()) ?>
+
get_log()) ?>
-- cgit v1.2.3 From 2852161ca31f1a5b90bfd16a14615dd1812bd78a Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Tue, 7 Jul 2009 21:49:54 -0700 Subject: Provide some clarity on the action links by formating them as buttons on the Maintenance Tasks admin page. --- modules/gallery/views/admin_maintenance.html.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'modules/gallery/views/admin_maintenance.html.php') diff --git a/modules/gallery/views/admin_maintenance.html.php b/modules/gallery/views/admin_maintenance.html.php index eecc045c..501daa0b 100644 --- a/modules/gallery/views/admin_maintenance.html.php +++ b/modules/gallery/views/admin_maintenance.html.php @@ -161,22 +161,23 @@ done): ?> - id?csrf=$csrf") ?>"> + id?csrf=$csrf") ?>" class="gButtonLink ui-state-default ui-corner-all"> get_log()): ?> - id?csrf=$csrf") ?>"> + id?csrf=$csrf") ?>" class="gDialogLink gButtonLink ui-state-default ui-corner-all"> - id?csrf=$csrf") ?>"> + id?csrf=$csrf") ?>" class="gDialogLink gButtonLink" ui-state-default ui-corner-all> - id?csrf=$csrf") ?>"> + id?csrf=$csrf") ?>" class="gButtonLink ui-state-default ui-corner-all"> + -- cgit v1.2.3 From 9f00e734ed28f9c359fa52cfc4694ead5e4cf84e Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Wed, 8 Jul 2009 08:26:14 -0700 Subject: Added the button formatting to the other links on the Admin Maintenance page. --- modules/gallery/views/admin_maintenance.html.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'modules/gallery/views/admin_maintenance.html.php') diff --git a/modules/gallery/views/admin_maintenance.html.php b/modules/gallery/views/admin_maintenance.html.php index 501daa0b..cd1cc02e 100644 --- a/modules/gallery/views/admin_maintenance.html.php +++ b/modules/gallery/views/admin_maintenance.html.php @@ -29,7 +29,7 @@ callback?csrf=$csrf") ?>" - class="gDialogLink"> + class="gDialogLink gButtonLink ui-icon-left ui-state-default ui-corner-all"> @@ -94,11 +94,13 @@ state == "stalled"): ?> - id?csrf=$csrf") ?>"> + id?csrf=$csrf") ?>"> - id?csrf=$csrf") ?>"> + id?csrf=$csrf") ?>" + class="gButtonLink ui-icon-left ui-state-default ui-corner-all right"> -- cgit v1.2.3