Added clipboard handler
authorAlexander Ebert <ebert@woltlab.com>
Sat, 21 Jul 2012 21:57:47 +0000 (23:57 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Sat, 21 Jul 2012 21:57:47 +0000 (23:57 +0200)
clipboardAction.xml
files/js/WCF.Conversation.js
files/lib/system/clipboard/action/ConversationClipboardAction.class.php
templates/conversationList.tpl

index ea6a007f93bd6c2fa4f1c558f8e3881c047db1de..29b9aed8a5ec085bd1f3aafe32dce5b9bac00165 100644 (file)
@@ -2,7 +2,7 @@
 <data xmlns="http://www.woltlab.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.woltlab.com http://www.woltlab.com/XSD/maelstrom/clipboardAction.xsd">
        <import>
                <!-- conversation -->
-               <action name="label">
+               <action name="assignLabel">
                        <actionclassname><![CDATA[wcf\system\clipboard\action\ConversationClipboardAction]]></actionclassname>
                        <showorder>1</showorder>
                        <pages>
index 8ceb255154cd1756f1d3d4678b3520c319fbca42..380a33eb0aa5c2e1f633db1e409a7fd5eafd2e6c 100644 (file)
@@ -177,6 +177,51 @@ WCF.Conversation.EditorHandler = Class.extend({
        }
 });
 
+/**
+ * Provides extended actions for thread clipboard actions.
+ */
+WCF.Conversation.Clipboard = Class.extend({
+       /**
+        * editor handler
+        * @var WCF.Conversation.EditorHandler
+        */
+       _editorHandler: null,
+       
+       /**
+        * Initializes a new WCF.Conversation.Clipboard object.
+        * 
+        * @param       WCF.Conversation.EditorHandler  editorHandler
+        */
+       init: function(editorHandler) {
+               this._editorHandler = editorHandler;
+               
+               // bind listener
+               $('.jsClipboardEditor').each($.proxy(function(index, container) {
+                       var $container = $(container);
+                       var $types = eval($container.data('types'));
+                       if (WCF.inArray('com.woltlab.wcf.conversation.conversation', $types)) {
+                               $container.on('clipboardAction', $.proxy(this._execute, this));
+                               $container.on('clipboardActionResponse', $.proxy(this._evaluateResponse, this));
+                               return false;
+                       }
+               }, this));
+       },
+       
+       /**
+        * Handles clipboard actions.
+        * 
+        * @param       object          event
+        * @param       string          type
+        * @param       string          actionName
+        * @param       object          parameters
+        */
+       _execute: function(event, type, actionName, parameters) {
+               if (type === 'com.woltlab.wcf.conversation.conversation' && actionName === 'conversation.assignLabel') {
+                       new WCF.Conversation.Label.Editor(this._editorHandler, null, parameters.objectTypeIDs);
+               }
+       }
+});
+
 /**
  * Inline editor implementation for conversations.
  * 
index 3e58e6fc329ff34ee106a7dfe0c6de919b05ec62..9d8f629ada36f517993ab08f26daa1c39302b590 100644 (file)
@@ -32,10 +32,6 @@ class ConversationClipboardAction implements IClipboardAction {
        public function execute(array $objects, $actionName, $typeData = array()) {
                $item = new ClipboardEditorItem();
                
-               // DEBUG ONLY
-               if ($actionName == 'label') $actionName = 'assignLabel';
-               // DEBUG ONLY
-               
                switch ($actionName) {
                        case 'assignLabel':
                                $conversationIDs = $this->validateAssignLabels($objects);
@@ -45,7 +41,6 @@ class ConversationClipboardAction implements IClipboardAction {
                                
                                $item->addParameter('objectIDs', $conversationIDs);
                                $item->addParameter('actionName', 'assignLabel');
-                               $item->addParameter('className', 'wcf\data\conversation\label\ConversationLabelAction');
                                $item->setName('conversation.assignLabel');
                        break;
                        
index 48767d67d3a033b19604a590d2f4af24ccac0579..35cf20764ab8df9716c71ac8f500656744ce8421 100644 (file)
@@ -14,6 +14,8 @@
                        var $editorHandler = new WCF.Conversation.EditorHandler();
                        var $inlineEditor = new WCF.Conversation.InlineEditor('.conversation');
                        $inlineEditor.setEditorHandler($editorHandler);
+                       
+                       new WCF.Conversation.Clipboard($editorHandler);
                        new WCF.Conversation.Label.Manager('{link controller='ConversationList'}{if $filter}filter={@$filter}{/if}&sortField={$sortField}&sortOrder={$sortOrder}&pageNo={@$pageNo}{/link}');
                });
                //]]>