From 29873759a097513261c63eaed7c15a6de86011e5 Mon Sep 17 00:00:00 2001 From: Matthias Schmidt Date: Sun, 28 Apr 2013 11:05:55 +0200 Subject: [PATCH] Fixes bug when reopening cronjob log error message They could only be opened once and when reopening them, nothing happened since the DOM element had been removed. --- wcfsetup/install/files/acp/js/WCF.ACP.js | 64 ++++++++++++++++++- .../files/acp/templates/cronjobLogList.tpl | 26 ++------ 2 files changed, 68 insertions(+), 22 deletions(-) diff --git a/wcfsetup/install/files/acp/js/WCF.ACP.js b/wcfsetup/install/files/acp/js/WCF.ACP.js index fd247a574e..a53d5d9cf3 100644 --- a/wcfsetup/install/files/acp/js/WCF.ACP.js +++ b/wcfsetup/install/files/acp/js/WCF.ACP.js @@ -2,7 +2,7 @@ * Class and function collection for WCF ACP * * @author Alexander Ebert, Matthias Schmidt - * @copyright 2001-2012 WoltLab GmbH + * @copyright 2001-2013 WoltLab GmbH * @license GNU Lesser General Public License */ @@ -77,6 +77,68 @@ WCF.ACP.Application.SetAsPrimary = Class.extend({ } }); +/** + * Namespace for ACP cronjob management. + */ +WCF.ACP.Cronjob = { }; + +/** + * Handles the cronjob log list. + */ +WCF.ACP.Cronjob.LogList = Class.extend({ + /** + * error message dialog + * @var jQuery + */ + _dialog: null, + + /** + * Initializes WCF.ACP.Cronjob.LogList object. + */ + init: function() { + // bind event listener to delete cronjob log button + $('.jsCronjobLogDelete').click(function() { + WCF.System.Confirmation.show(WCF.Language.get('wcf.acp.cronjob.log.clear.confirm'), function(action) { + if (action == 'confirm') { + new WCF.Action.Proxy({ + autoSend: true, + data: { + actionName: 'clearAll', + className: 'wcf\\data\\cronjob\\log\\CronjobLogAction' + }, + success: function() { + window.location.reload(); + } + }); + } + }); + }); + + // bind event listeners to error badges + $('.jsCronjobError').click($.proxy(this._showError, this)); + }, + + /** + * Shows certain error message + * + * @param object event + */ + _showError: function(event) { + var $errorBadge = $(event.currentTarget); + + if (this._dialog === null) { + this._dialog = $('
' + $errorBadge.next().html() + '
').hide().appendTo(document.body); + this._dialog.wcfDialog({ + title: WCF.Language.get('wcf.acp.cronjob.log.error.details') + }); + } + else { + this._dialog.html($errorBadge.next().html()); + this._dialog.wcfDialog('open'); + } + } +}); + /** * Handles ACPMenu. * diff --git a/wcfsetup/install/files/acp/templates/cronjobLogList.tpl b/wcfsetup/install/files/acp/templates/cronjobLogList.tpl index 7e36aae736..69133c9aa0 100644 --- a/wcfsetup/install/files/acp/templates/cronjobLogList.tpl +++ b/wcfsetup/install/files/acp/templates/cronjobLogList.tpl @@ -3,28 +3,12 @@ @@ -82,7 +66,7 @@ {if $cronjobLog->success} {lang}wcf.acp.cronjob.log.success{/lang} - {elseif $cronjobLog->error} + {elseif $cronjobLog->error} {lang}wcf.acp.cronjob.log.error{/lang} {@$cronjobLog->error} {/if} -- 2.20.1