Fixed issue #17312: Pagetree - Provide a default contextmenu action to open custom...
authorErnesto Baschny <ernst@cron-it.de>
Tue, 25 Jan 2011 21:22:49 +0000 (21:22 +0000)
committerErnesto Baschny <ernst@cron-it.de>
Tue, 25 Jan 2011 21:22:49 +0000 (21:22 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@10312 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
t3lib/contextmenu/class.t3lib_contextmenu_abstractdataprovider.php
t3lib/contextmenu/class.t3lib_contextmenu_action.php
t3lib/js/extjs/components/pagetree/javascript/actions.js
t3lib/js/extjs/components/pagetree/javascript/contextmenu.js

index 21e0915..029362c 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -4,6 +4,7 @@
 
 2011-01-25  Ernesto Baschny  <ernst@cron-it.de>
 
+       * Fixed issue #17312: Pagetree - Provide a default contextmenu action to open custom urls (Thanks to Stefan Galinksi)
        * Re-added feature #17313: Since using new flags from sprites (#15668), the sys_language hasn't a flag-selector by icon (Thanks to Jo Hasenau)
        * Fixed bug #17305: Login/ Logout was not possible after introducing the locking in #17289 (Thanks to Helmut Hummel)
 
index b58108e..70ef478 100644 (file)
@@ -216,6 +216,10 @@ abstract class t3lib_contextmenu_AbstractDataProvider {
                                } else {
                                        $action->setType('action');
                                        $action->setCallbackAction($actionConfiguration['callbackAction']);
+
+                                       if (is_array($actionConfiguration['customAttributes.'])) {
+                                               $action->setCustomAttributes($actionConfiguration['customAttributes.']);
+                                       }
                                }
 
                                $action->setLabel($label);
index 3f8422e..b242afb 100644 (file)
@@ -83,6 +83,13 @@ class t3lib_contextmenu_Action {
        protected $childActions = NULL;
 
        /**
+        * Custom Action Attributes
+        *
+        * @var array
+        */
+       protected $customAttributes = array();
+
+       /**
         * Returns the label
         *
         * @return string
@@ -225,6 +232,25 @@ class t3lib_contextmenu_Action {
        }
 
        /**
+        * Sets the custom attributes
+        *
+        * @param array $customAttributes
+        * @return void
+        */
+       public function setCustomAttributes(array $customAttributes) {
+               $this->customAttributes = $customAttributes;
+       }
+
+       /**
+        * Returns the custom attributes
+        * 
+        * @return array
+        */
+       public function getCustomAttributes() {
+               return $this->customAttributes;
+       }
+
+       /**
         * Returns the action as an array
         *
         * @return array
@@ -237,6 +263,7 @@ class t3lib_contextmenu_Action {
                        'class' => $this->getClass(),
                        'callbackAction' => $this->getCallbackAction(),
                        'type' => $this->getType(),
+                       'customAttributes' => $this->getCustomAttributes()
                );
 
                $arrayRepresentation['childActions'] = '';
index 885ada3..bca78a2 100644 (file)
@@ -684,6 +684,26 @@ TYPO3.Components.PageTree.Actions = {
        },
 
        /**
+        * Opens a configured url inside the content frame
+        *
+        * @param {Ext.tree.TreeNode} node
+        * @param {TYPO3.Components.PageTree.Tree} tree
+        * @param {Object} contextItem
+        * @return {void}
+        */
+       openCustomUrlInContentFrame: function(node, tree, contextItem) {
+               console.log(contextItem);
+               if (!contextItem.customAttributes || !contextItem.customAttributes.contentUrl) {
+                       return;
+               }
+
+               node.select();
+               TYPO3.Backend.ContentContainer.setUrl(
+                       contextItem.customAttributes.contentUrl.replace('###ID###', node.attributes.nodeData.id)
+               );
+       },
+
+       /**
         * Updates the title of a node
         *
         * @param {Ext.tree.TreeNode} node
index 07f32a4..d830250 100644 (file)
@@ -79,7 +79,8 @@ TYPO3.Components.PageTree.ContextMenu = Ext.extend(Ext.menu.Menu, {
 
                                        this.pageTree.commandProvider[item.callbackAction](
                                                item.parentMenu.node,
-                                               item.parentMenu.pageTree
+                                               item.parentMenu.pageTree,
+                                               item
                                        );
                                }
                        }
@@ -165,7 +166,8 @@ TYPO3.Components.PageTree.ContextMenu = Ext.extend(Ext.menu.Menu, {
                                                'text': contextMenuConfiguration[singleAction]['label'],
                                                'icon': contextMenuConfiguration[singleAction]['icon'],
                                                'iconCls': contextMenuConfiguration[singleAction]['class'],
-                                               'callbackAction': contextMenuConfiguration[singleAction]['callbackAction']
+                                               'callbackAction': contextMenuConfiguration[singleAction]['callbackAction'],
+                                               'customAttributes': contextMenuConfiguration[singleAction]['customAttributes']
                                        };
 
                                        component.itemTpl = Ext.menu.Item.prototype.itemTpl = new Ext.XTemplate(