* 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 <http://opensource.org/licenses/lgpl-license.php>
*/
}
});
+/**
+ * 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 = $('<div>' + $errorBadge.next().html() + '</div>').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.
*
<script type="text/javascript">
//<![CDATA[
$(function() {
- $('.jsCronjobLogDelete').click(function() {
- WCF.System.Confirmation.show('{lang}wcf.acp.cronjob.log.clear.confirm{/lang}', 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();
- }
- });
- }
- });
+ WCF.Language.addObject({
+ 'wcf.acp.cronjob.log.clear.confirm': '{lang}wcf.acp.cronjob.log.clear.confirm{/lang}',
+ 'wcf.acp.cronjob.log.error.details': '{lang}wcf.acp.cronjob.log.error.details{/lang}'
});
- $('.jsCronjobError').click(function(event) {
- $(event.currentTarget).next().wcfDialog({
- title: '{lang}wcf.acp.cronjob.log.error.details{/lang}'
- });
- });
+ new WCF.ACP.Cronjob.LogList();
});
//]]>
</script>
<td class="columnText columnSuccess">
{if $cronjobLog->success}
<span class="badge green">{lang}wcf.acp.cronjob.log.success{/lang}</span>
- {elseif $cronjobLog->error}
+ {elseif $cronjobLog->error}
<a class="badge red jsTooltip jsCronjobError" title="{lang}wcf.acp.cronjob.log.error.showDetails{/lang}">{lang}wcf.acp.cronjob.log.error{/lang}</a>
<span style="display: none">{@$cronjobLog->error}</span>
{/if}