From 57680ffc4bdb7d3b72fec361c43bafa039fcc550 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Fri, 12 Oct 2012 01:29:33 +0200 Subject: [PATCH] Added button to duplicate a style ("copy") --- acptemplates/styleAdd.tpl | 14 +++++++-- files/acp/js/WCF.ACP.Style.js | 57 +++++++++++++++++++++++++++++++++++ language/de.xml | 4 +++ 3 files changed, 73 insertions(+), 2 deletions(-) diff --git a/acptemplates/styleAdd.tpl b/acptemplates/styleAdd.tpl index 3377126966..ad4aa44520 100644 --- a/acptemplates/styleAdd.tpl +++ b/acptemplates/styleAdd.tpl @@ -1,6 +1,6 @@ {include file='header'} - + @@ -45,6 +51,10 @@
diff --git a/files/acp/js/WCF.ACP.Style.js b/files/acp/js/WCF.ACP.Style.js index 9422ae7d53..a920152285 100644 --- a/files/acp/js/WCF.ACP.Style.js +++ b/files/acp/js/WCF.ACP.Style.js @@ -7,6 +7,63 @@ */ WCF.ACP.Style = { }; +/** + * Handles style duplicating. + * + * @param integer styleID + */ +WCF.ACP.Style.CopyStyle = Class.extend({ + /** + * style id + * @var integer + */ + _styleID: 0, + + /** + * Initializes the WCF.ACP.Style.CopyStyle class. + * + * @param integer styleID + */ + init: function(styleID) { + this._styleID = styleID; + + var self = this; + $('.jsCopyStyle').click(function() { + WCF.System.Confirmation.show(WCF.Language.get('wcf.acp.style.copyStyle.confirmMessage'), $.proxy(self._copy, self)); + }); + }, + + /** + * Invokes the style duplicating process. + * + * @param string action + */ + _copy: function(action) { + if (action === 'confirm') { + new WCF.Action.Proxy({ + autoSend: true, + data: { + actionName: 'copy', + className: 'wcf\\data\\style\\StyleAction', + objectIDs: [ this._styleID ] + }, + success: $.proxy(this._success, this) + }); + } + }, + + /** + * Redirects to newly created style. + * + * @param object data + * @param string textStatus + * @param jQuery jqXHR + */ + _success: function(data, textStatus, jqXHR) { + window.location = data.returnValues.redirectURL; + } +}); + /** * Handles the preview image upload. * diff --git a/language/de.xml b/language/de.xml index bace34250b..11df806458 100644 --- a/language/de.xml +++ b/language/de.xml @@ -32,7 +32,11 @@ + + styleName}“ wirklich duplizieren?]]> styleName}“ wirklich löschen?]]> + + -- 2.20.1