Added button to duplicate a style ("copy")
authorAlexander Ebert <ebert@woltlab.com>
Thu, 11 Oct 2012 23:29:33 +0000 (01:29 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Thu, 11 Oct 2012 23:29:33 +0000 (01:29 +0200)
acptemplates/styleAdd.tpl
files/acp/js/WCF.ACP.Style.js
language/de.xml

index 3377126966313ab0b6ad4f59e33be5b6a275d484..ad4aa44520089f9ee4e802d7135b1738003bf79d 100644 (file)
@@ -1,6 +1,6 @@
 {include file='header'}
 
-<script type="text/javascript" src="{@$__wcf->getPath()}acp/js/WCF.ACP.StyleEditor.js"></script>
+<script type="text/javascript" src="{@$__wcf->getPath()}acp/js/WCF.ACP.Style.js"></script>
 <script type="text/javascript" src="{@$__wcf->getPath()}js/WCF.ColorPicker.js"></script>
 <script type="text/javascript">
        //<![CDATA[
                $useFluidLayout.change(useFluidLayout);
                useFluidLayout();
                
-               new WCF.ACP.StyleEditor.Upload(0, '{$tmpHash}');
+               new WCF.ACP.Style.ImageUpload(0, '{$tmpHash}');
+               
+               {if $action == 'edit' && $__wcf->getSession()->getPermission('admin.style.canAddStyle')}new WCF.ACP.Style.CopyStyle({@$style->styleID});{/if}
+               
+               WCF.Language.addObject({
+                       'wcf.acp.style.copyStyle.confirmMessage': '{lang}wcf.acp.style.copyStyle.confirmMessage{/lang}'
+               });
        });
        //]]>
 </script>
 <div class="contentNavigation">
        <nav>
                <ul>
+                       {if $action == 'edit'}
+                               <li><a href="{link controller='StyleExport' id=$style->styleID}{/link}" class="button"><img src="{@$__wcf->getPath()}icon/download.svg" alt="" class="icon24" /> <span>{lang}wcf.acp.style.exportStyle{/lang}</span></a></li>
+                               {if $__wcf->getSession()->getPermission('admin.style.canAddStyle')}<li><a class="jsCopyStyle button"><img src="{@$__wcf->getPath()}icon/add.svg" alt="" class="icon24" /> <span>{lang}wcf.acp.style.copyStyle{/lang}</span></a></li>{/if}
+                       {/if}
                        <li><a href="{link controller='StyleList'}{/link}" title="{lang}wcf.acp.menu.link.style.list{/lang}" class="button"><img src="{@$__wcf->getPath()}icon/list.svg" alt="" class="icon24" /> <span>{lang}wcf.acp.menu.link.style.list{/lang}</span></a></li>
                </ul>
        </nav>
index 9422ae7d53378d6dd35c845b974773cc8bcad0e7..a9201522859fe11fb31da80252dd2c3f63e73473 100644 (file)
@@ -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.
  * 
index bace34250b1678eb2d57190d4ebfd10175f95943..11df8064581411043f4d5d98b17419335594a5c5 100644 (file)
                <item name="wcf.acp.style.colors.tabular"><![CDATA[Tabellarische Auflistungen]]></item>
                <item name="wcf.acp.style.colors.userPanel"><![CDATA[Benutzerleiste]]></item>
                <item name="wcf.acp.style.copyright"><![CDATA[Copyright]]></item>
+               <item name="wcf.acp.style.copyStyle"><![CDATA[Stil kopieren]]></item>
+               <item name="wcf.acp.style.copyStyle.confirmMessage"><![CDATA[Möchten Sie den Stil &bdquo;{$style->styleName}&ldquo; wirklich duplizieren?]]></item>
                <item name="wcf.acp.style.delete.confirmMessage"><![CDATA[Möchten Sie den Stil &bdquo;{$style->styleName}&ldquo; wirklich löschen?]]></item>
+               <item name="wcf.acp.style.edit"><![CDATA[Stil bearbeiten]]></item>
+               <item name="wcf.acp.style.exportStyle"><![CDATA[Stil exportieren]]></item>
                <item name="wcf.acp.style.general"><![CDATA[Daten]]></item>
                <item name="wcf.acp.style.general.data"><![CDATA[Allgemein]]></item>
                <item name="wcf.acp.style.general.files"><![CDATA[Dateien]]></item>