Makes use of AbstractClipboardAction::execute()
authorMatthias Schmidt <gravatronics@live.com>
Wed, 9 Jan 2013 11:32:35 +0000 (12:32 +0100)
committerMatthias Schmidt <gravatronics@live.com>
Wed, 9 Jan 2013 11:32:35 +0000 (12:32 +0100)
files/js/WCF.Conversation.js
files/lib/system/clipboard/action/ConversationClipboardAction.class.php
language/de.xml
language/en.xml

index 4728edded57273cc418b11d4cf82b1a2b0d04ad5..95d9bc0cb1c42780be4b1516d73e445313170ff9 100644 (file)
@@ -326,7 +326,7 @@ WCF.Conversation.Clipboard = Class.extend({
         * @param       object          parameters
         */
        _execute: function(event, type, actionName, parameters) {
-               if (type === 'com.woltlab.wcf.conversation.conversation' && actionName === 'conversation.assignLabel') {
+               if (type === 'com.woltlab.wcf.conversation.conversation' && actionName === 'com.woltlab.wcf.conversation.conversation.assignLabel') {
                        new WCF.Conversation.Label.Editor(this._editorHandler, null, parameters.objectIDs);
                }
        },
@@ -347,14 +347,14 @@ WCF.Conversation.Clipboard = Class.extend({
                }
                
                switch (actionName) {
-                       case 'conversation.leave':
-                       case 'conversation.leavePermanently':
-                       case 'conversation.restore':
+                       case 'com.woltlab.wcf.conversation.conversation.leave':
+                       case 'com.woltlab.wcf.conversation.conversation.leavePermanently':
+                       case 'com.woltlab.wcf.conversation.conversation.restore':
                                window.location.reload();
                        break;
                        
-                       case 'conversation.close':
-                       case 'conversation.open':
+                       case 'com.woltlab.wcf.conversation.conversation.close':
+                       case 'com.woltlab.wcf.conversation.conversation.open':
                                for (var $conversationID in data.returnValues.conversationData) {
                                        var $data = data.returnValues.conversationData[$conversationID];
                                        
index 88a6da6a1179fcbc386b4c10abe6a9eb5aab2e01..b21129fdb5d6bd08ba8c1a3d8d19e70ec18773f5 100644 (file)
@@ -1,6 +1,5 @@
 <?php
 namespace wcf\system\clipboard\action;
-use wcf\system\clipboard\ClipboardEditorItem;
 use wcf\system\database\util\PreparedStatementConditionBuilder;
 use wcf\system\exception\SystemException;
 use wcf\system\WCF;
@@ -16,6 +15,11 @@ use wcf\system\WCF;
  * @category   Community Framework
  */
 class ConversationClipboardAction extends AbstractClipboardAction {
+       /**
+        * @see wcf\system\clipboard\action\AbstractClipboardAction::$actionClassActions
+        */
+       protected $actionClassActions = array('close', 'open');
+       
        /**
         * list of conversations
         * @var array<wcf\data\conversation\Conversation>
@@ -23,11 +27,9 @@ class ConversationClipboardAction extends AbstractClipboardAction {
        public $conversations = null;
        
        /**
-        * @see wcf\system\clipboard\action\IClipboardAction::getTypeName()
+        * @see wcf\system\clipboard\action\AbstractClipboardAction::$supportedActions
         */
-       public function getTypeName() {
-               return 'com.woltlab.wcf.conversation.conversation';
-       }
+       protected $supportedActions = array('assignLabel', 'close', 'leave', 'leavePermanently', 'open', 'restore');
        
        /**
         * @see wcf\system\clipboard\action\IClipboardAction::execute()
@@ -43,7 +45,11 @@ class ConversationClipboardAction extends AbstractClipboardAction {
                        return null;
                }
                
-               $item = new ClipboardEditorItem();
+               $item = parent::execute($objects, $actionName);
+               
+               if ($item === null) {
+                       return null;
+               }
                
                switch ($actionName) {
                        case 'assignLabel':
@@ -59,69 +65,25 @@ class ConversationClipboardAction extends AbstractClipboardAction {
                                }
                                
                                $item->addParameter('objectIDs', array_keys($this->conversations));
-                               $item->setName('conversation.assignLabel');
-                       break;
-                       
-                       case 'close':
-                               $conversationIDs = $this->validateClose();
-                               if (empty($conversationIDs)) {
-                                       return null;
-                               }
-                               
-                               $item->addParameter('objectIDs', $conversationIDs);
-                               $item->addParameter('actionName', 'close');
-                               $item->addParameter('className', 'wcf\data\conversation\ConversationAction');
-                               $item->setName('conversation.close');
                        break;
                        
                        case 'leave':
-                               $conversationIDs = $this->validateLeave();
-                               if (empty($conversationIDs)) {
-                                       return null;
-                               }
-                               
                                $item->addInternalData('parameters', array('hideConversation' => 1));
-                               $item->addParameter('objectIDs', $conversationIDs);
                                $item->addParameter('actionName', 'hideConversation');
-                               $item->addParameter('className', 'wcf\data\conversation\ConversationAction');
-                               $item->setName('conversation.leave');
+                               $item->addParameter('className', $this->getClassName());
                        break;
                        
                        case 'leavePermanently':
-                               $item->addInternalData('parameters', array('hideConversation' => 2));
                                $item->addParameter('objectIDs', array_keys($this->conversations));
+                               $item->addInternalData('parameters', array('hideConversation' => 2));
                                $item->addParameter('actionName', 'hideConversation');
-                               $item->addParameter('className', 'wcf\data\conversation\ConversationAction');
-                               $item->setName('conversation.leavePermanently');
-                       break;
-                       
-                       case 'open':
-                               $conversationIDs = $this->validateOpen();
-                               if (empty($conversationIDs)) {
-                                       return null;
-                               }
-                               
-                               $item->addParameter('objectIDs', $conversationIDs);
-                               $item->addParameter('actionName', 'open');
-                               $item->addParameter('className', 'wcf\data\conversation\ConversationAction');
-                               $item->setName('conversation.open');
+                               $item->addParameter('className', $this->getClassName());
                        break;
                        
                        case 'restore':
-                               $conversationIDs = $this->validateRestore();
-                               if (empty($conversationIDs)) {
-                                       return null;
-                               }
-                               
                                $item->addInternalData('parameters', array('hideConversation' => 0));
-                               $item->addParameter('objectIDs', array_keys($this->conversations));
                                $item->addParameter('actionName', 'hideConversation');
-                               $item->addParameter('className', 'wcf\data\conversation\ConversationAction');
-                               $item->setName('conversation.restore');
-                       break;
-                       
-                       default:
-                               throw new SystemException("Unknown action '".$actionName."'");
+                               $item->addParameter('className', $this->getClassName());
                        break;
                }
                
@@ -135,6 +97,13 @@ class ConversationClipboardAction extends AbstractClipboardAction {
                return 'wcf\data\conversation\ConversationAction';
        }
        
+       /**
+        * @see wcf\system\clipboard\action\IClipboardAction::getTypeName()
+        */
+       public function getTypeName() {
+               return 'com.woltlab.wcf.conversation.conversation';
+       }
+       
        /**
         * Returns a list of conversations with user participation.
         * 
@@ -280,6 +249,6 @@ class ConversationClipboardAction extends AbstractClipboardAction {
         * @see wcf\system\clipboard\action\IClipboardAction::getEditorLabel()
         */
        public function getEditorLabel(array $objects) {
-               return WCF::getLanguage()->getDynamicVariable('wcf.clipboard.label.conversation.marked', array('count' => count($objects)));
+               return WCF::getLanguage()->getDynamicVariable('wcf.clipboard.label.com.woltlab.wcf.conversation.conversation.marked', array('count' => count($objects)));
        }
 }
index 44d56d06174582cdab3a4fd2c028ea5f84524f43..5399207748ad369369b1f381df29af7252815735 100644 (file)
        </category>
        
        <category name="wcf.clipboard">
-               <item name="wcf.clipboard.label.conversation.marked"><![CDATA[{if $count == 1}Eine Konversation{else}{#$count} Konversationen{/if} markiert]]></item>
-       </category>
-       
-       <category name="wcf.clipboard.item">
-               <item name="wcf.clipboard.item.conversation.assignLabel"><![CDATA[Label zuweisen ({#$count})]]></item>
-               <item name="wcf.clipboard.item.conversation.close"><![CDATA[Schließen ({#$count})]]></item>
-               <item name="wcf.clipboard.item.conversation.leave"><![CDATA[Konversation ausblenden ({#$count})]]></item>
-               <item name="wcf.clipboard.item.conversation.leavePermanently"><![CDATA[Konversation verlassen ({#$count})]]></item>
-               <item name="wcf.clipboard.item.conversation.open"><![CDATA[Öffnen ({#$count})]]></item>
-               <item name="wcf.clipboard.item.conversation.restore"><![CDATA[Als aktiv markieren ({#$count})]]></item>
+               <item name="wcf.clipboard.item.com.woltlab.wcf.conversation.conversation.assignLabel"><![CDATA[Label zuweisen ({#$count})]]></item>
+               <item name="wcf.clipboard.item.com.woltlab.wcf.conversation.conversation.close"><![CDATA[Schließen ({#$count})]]></item>
+               <item name="wcf.clipboard.item.com.woltlab.wcf.conversation.conversation.leave"><![CDATA[Konversation ausblenden ({#$count})]]></item>
+               <item name="wcf.clipboard.item.com.woltlab.wcf.conversation.conversation.leavePermanently"><![CDATA[Konversation verlassen ({#$count})]]></item>
+               <item name="wcf.clipboard.item.com.woltlab.wcf.conversation.conversation.open"><![CDATA[Öffnen ({#$count})]]></item>
+               <item name="wcf.clipboard.item.com.woltlab.wcf.conversation.conversation.restore"><![CDATA[Als aktiv markieren ({#$count})]]></item>
+               <item name="wcf.clipboard.label.com.woltlab.wcf.conversation.conversation.marked"><![CDATA[{if $count == 1}Eine Konversation{else}{#$count} Konversationen{/if} markiert]]></item>
        </category>
        
        <category name="wcf.conversation">
index e5cac8556cd2f31358fbe957591434733bb4fd8a..39e46ca9ca0e3d507b0048967061e237620925b7 100644 (file)
        </category>
        
        <category name="wcf.clipboard">
-               <item name="wcf.clipboard.label.conversation.marked"><![CDATA[{if $count == 1}One Conversation{else}{#$count} Conversations{/if} Selected]]></item>
-       </category>
-       
-       <category name="wcf.clipboard.item">
-               <item name="wcf.clipboard.item.conversation.assignLabel"><![CDATA[Assign Label ({#$count})]]></item>
-               <item name="wcf.clipboard.item.conversation.close"><![CDATA[Close ({#$count})]]></item>
-               <item name="wcf.clipboard.item.conversation.leave"><![CDATA[Hide ({#$count})]]></item>
-               <item name="wcf.clipboard.item.conversation.leavePermanently"><![CDATA[Leave ({#$count})]]></item>
-               <item name="wcf.clipboard.item.conversation.open"><![CDATA[Open ({#$count})]]></item>
-               <item name="wcf.clipboard.item.conversation.restore"><![CDATA[Restore ({#$count})]]></item>
+               <item name="wcf.clipboard.item.com.woltlab.wcf.conversation.conversation.assignLabel"><![CDATA[Assign Label ({#$count})]]></item>
+               <item name="wcf.clipboard.item.com.woltlab.wcf.conversation.conversation.close"><![CDATA[Close ({#$count})]]></item>
+               <item name="wcf.clipboard.item.com.woltlab.wcf.conversation.conversation.leave"><![CDATA[Hide ({#$count})]]></item>
+               <item name="wcf.clipboard.item.com.woltlab.wcf.conversation.conversation.leavePermanently"><![CDATA[Leave ({#$count})]]></item>
+               <item name="wcf.clipboard.item.com.woltlab.wcf.conversation.conversation.open"><![CDATA[Open ({#$count})]]></item>
+               <item name="wcf.clipboard.item.com.woltlab.wcf.conversation.conversation.restore"><![CDATA[Restore ({#$count})]]></item>
+               <item name="wcf.clipboard.label.com.woltlab.wcf.conversation.conversation.marked"><![CDATA[{if $count == 1}One Conversation{else}{#$count} Conversations{/if} Selected]]></item>
        </category>
        
        <category name="wcf.conversation">