[TASK] Migrate Toolbar ShortcutMenu JS to jQuery 30/33930/4
authorWouter Wolters <typo3@wouterwolters.nl>
Sun, 9 Nov 2014 19:54:20 +0000 (20:54 +0100)
committerOliver Hader <oliver.hader@typo3.org>
Fri, 14 Nov 2014 15:04:50 +0000 (16:04 +0100)
In our effort to remove scriptaculous and prototype.js
from the Backend, this patch replaces the existing
InPlaceEditor and JS logic with a RequireJS Module
and jQuery.

Resolves: #62799
Releases: master
Change-Id: I2163e8b315fbbb50656bd4a77d3c66cda1792135
Reviewed-on: http://review.typo3.org/33930
Reviewed-by: Andreas Fernandez <a.fernandez@scripting-base.de>
Tested-by: Andreas Fernandez <a.fernandez@scripting-base.de>
Reviewed-by: Oliver Hader <oliver.hader@typo3.org>
Tested-by: Oliver Hader <oliver.hader@typo3.org>
typo3/sysext/backend/Classes/Template/DocumentTemplate.php
typo3/sysext/backend/Classes/Toolbar/ShortcutToolbarItem.php
typo3/sysext/backend/Resources/Public/JavaScript/Toolbar/ShortcutMenu.js [new file with mode: 0644]
typo3/sysext/backend/Resources/Public/JavaScript/backend.js
typo3/sysext/backend/Resources/Public/JavaScript/shortcutmenu.js [deleted file]
typo3/sysext/core/Configuration/DefaultConfiguration.php

index 8d0870b..9320f69 100644 (file)
@@ -615,7 +615,6 @@ function jumpToUrl(URL) {
         * @return string HTML content
         */
        public function makeShortcutIcon($gvList, $setList, $modName, $motherModName = '') {
-               $backPath = $this->backPath;
                $storeUrl = $this->makeShortcutUrl($gvList, $setList);
                $pathInfo = parse_url(GeneralUtility::getIndpEnv('REQUEST_URI'));
                // Add the module identifier automatically if typo3/mod.php is used:
@@ -629,9 +628,9 @@ function jumpToUrl(URL) {
                } else {
                        $mMN = '';
                }
-               $onClick = 'top.ShortcutManager.createShortcut(' . GeneralUtility::quoteJSvalue($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.makeBookmark')) . ', ' . '\'' . $backPath . '\', ' . '\'' . rawurlencode($modName) . '\', ' . '\'' . rawurlencode(($pathInfo['path'] . '?' . $storeUrl)) . $mMN . '\'' . ');return false;';
-               $sIcon = '<a href="#" onclick="' . htmlspecialchars($onClick) . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.makeBookmark', TRUE) . '">' . IconUtility::getSpriteIcon('actions-system-shortcut-new') . '</a>';
-               return $sIcon;
+               $confirmationText = GeneralUtility::quoteJSvalue($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.makeBookmark'));
+               $onClick = 'top.TYPO3.ShortcutMenu.createShortcut(\'' . rawurlencode($modName) . '\', ' . '\'' . rawurlencode(($pathInfo['path'] . '?' . $storeUrl)) . $mMN . '\', ' . $confirmationText . ');return false;';
+               return '<a href="#" onclick="' . htmlspecialchars($onClick) . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.makeBookmark', TRUE) . '">' . IconUtility::getSpriteIcon('actions-system-shortcut-new') . '</a>';
        }
 
        /**
index 93311d6..13efcdb 100644 (file)
@@ -112,7 +112,7 @@ class ShortcutToolbarItem implements ToolbarItemInterface {
         */
        public function render() {
                $title = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:toolbarItems.bookmarks', TRUE);
-               $this->addJavascriptToBackend();
+               $this->backendReference->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Backend/Toolbar/ShortcutMenu');
                $shortcutMenu = array();
                $shortcutMenu[] = '<a href="#" class="dropdown-toggle" data-toggle="dropdown">' . IconUtility::getSpriteIcon('apps-toolbar-menu-shortcut', array('title' => $title)) . '</a>';
                $shortcutMenu[] = '<div class="dropdown-menu" role="menu">';
@@ -138,12 +138,12 @@ class ShortcutToolbarItem implements ToolbarItemInterface {
                $noGroupShortcuts = $this->getShortcutsByGroup(0);
                foreach ($noGroupShortcuts as $shortcut) {
                        $shortcutMenu[] = '
-                       <tr id="shortcut-' . $shortcut['raw']['uid'] . '" class="shortcut">
+                       <tr class="shortcut" data-shortcutid="' . $shortcut['raw']['uid'] . '">
                                <td class="shortcut-icon">' . $shortcut['icon'] . '</td>
                                <td class="shortcut-label">
-                                       <a id="shortcut-label-' . $shortcut['raw']['uid'] . '" href="#" onclick="' . $shortcut['action'] . '; return false;">' . htmlspecialchars($shortcut['label']) . '</a>
+                                       <a href="#" onclick="' . $shortcut['action'] . '; return false;">' . htmlspecialchars($shortcut['label']) . '</a>
                                </td>
-                               <td class="shortcut-edit">' . $editIcon . ' id="shortcut-edit-' . $shortcut['raw']['uid'] . '" /></td>
+                               <td class="shortcut-edit">' . $editIcon . ' /></td>
                                <td class="shortcut-delete">' . $deleteIcon . '</td>
                        </tr>';
                }
@@ -167,12 +167,12 @@ class ShortcutToolbarItem implements ToolbarItemInterface {
                                                $firstRow = ' first-row';
                                        }
                                        $shortcutGroup .= '
-                                       <tr id="shortcut-' . $shortcut['raw']['uid'] . '" class="shortcut' . $firstRow . '">
+                                       <tr class="shortcut' . $firstRow . '" data-shortcutid="' . $shortcut['raw']['uid'] . '" data-shortcutgroup="' . $groupId . '">
                                                <td class="shortcut-icon">' . $shortcut['icon'] . '</td>
                                                <td class="shortcut-label">
-                                                       <a id="shortcut-label-' . $shortcut['raw']['uid'] . '" href="#" onclick="' . $shortcut['action'] . '; return false;">' . htmlspecialchars($shortcut['label']) . '</a>
+                                                       <a href="#" onclick="' . $shortcut['action'] . '; return false;">' . htmlspecialchars($shortcut['label']) . '</a>
                                                </td>
-                                               <td class="shortcut-edit">' . $editIcon . ' id="shortcut-edit-' . $shortcut['raw']['uid'] . '" /></td>
+                                               <td class="shortcut-edit">' . $editIcon . ' /></td>
                                                <td class="shortcut-delete">' . $deleteIcon . '</td>
                                        </tr>';
                                }
@@ -200,21 +200,12 @@ class ShortcutToolbarItem implements ToolbarItemInterface {
         * @param \TYPO3\CMS\Core\Http\AjaxRequestHandler $ajaxObj Object of type AjaxRequestHandler
         * @return void
         */
-       public function renderAjax($params = array(), \TYPO3\CMS\Core\Http\AjaxRequestHandler &$ajaxObj = NULL) {
+       public function renderAjaxMenu($params = array(), \TYPO3\CMS\Core\Http\AjaxRequestHandler &$ajaxObj = NULL) {
                $menuContent = $this->renderMenu();
                $ajaxObj->addContent('shortcutMenu', $menuContent);
        }
 
        /**
-        * Adds the necessary JavaScript to the backend
-        *
-        * @return void
-        */
-       protected function addJavascriptToBackend() {
-               $this->backendReference->addJavascriptFile('sysext/backend/Resources/Public/JavaScript/shortcutmenu.js');
-       }
-
-       /**
         * Returns additional attributes for the list item in the toolbar
         *
         * This should not contain the "class" or "id" attribute.
@@ -446,13 +437,17 @@ class ShortcutToolbarItem implements ToolbarItemInterface {
        }
 
        /**
-        * gets the available shortcut groups
+        * gets the available shortcut groups, renders a form so it can be saved lateron
         *
         * @param array $params Array of parameters from the AJAX interface, currently unused
         * @param \TYPO3\CMS\Core\Http\AjaxRequestHandler $ajaxObj Object of type AjaxRequestHandler
         * @return void
         */
-       public function getAjaxShortcutGroups($params = array(), \TYPO3\CMS\Core\Http\AjaxRequestHandler &$ajaxObj = NULL) {
+       public function getAjaxShortcutEditForm($params = array(), \TYPO3\CMS\Core\Http\AjaxRequestHandler &$ajaxObj = NULL) {
+               $selectedShortcutId = (int)GeneralUtility::_GP('shortcutId');
+               $selectedShortcutGroupId = (int)GeneralUtility::_GP('shortcutGroup');
+               $selectedShortcut = $this->getShortcutById($selectedShortcutId);
+
                $shortcutGroups = $this->shortcutGroups;
                if (!$GLOBALS['BE_USER']->isAdmin()) {
                        foreach ($shortcutGroups as $groupId => $groupName) {
@@ -461,8 +456,18 @@ class ShortcutToolbarItem implements ToolbarItemInterface {
                                }
                        }
                }
-               $ajaxObj->addContent('shortcutGroups', $shortcutGroups);
-               $ajaxObj->setContentFormat('json');
+
+               // build the form
+               $content = '<form class="shortcut-form">' .
+                       '<input type="text" name="shortcut-title" value="' . htmlspecialchars($selectedShortcut['label']) . '">';
+
+               $content .= '<select name="shortcut-group">';
+               foreach ($shortcutGroups as $shortcutGroupId => $shortcutGroupTitle) {
+                       $content .= '<option value="' . (int)$shortcutGroupId . '"' . ($selectedShortcutGroupId == $shortcutGroupId ? ' selected="selected"' : '') . '>' . htmlspecialchars($shortcutGroupTitle) . '</option>';
+               }
+               $content .= '</select><input type="button" class="shortcut-form-save" value="Save"><input type="button" class="shortcut-form-cancel" value="Cancel"></form>';
+
+               $ajaxObj->addContent('data', $content);
        }
 
        /**
@@ -501,6 +506,7 @@ class ShortcutToolbarItem implements ToolbarItemInterface {
                $module = GeneralUtility::_POST('module');
                $motherModule = GeneralUtility::_POST('motherModName');
                // Determine shortcut type
+               $url = rawurldecode($url);
                $queryParts = parse_url($url);
                $queryParameters = GeneralUtility::explodeUrl2Array($queryParts['query'], 1);
                // Proceed only if no scheme is defined, as URL is expected to be relative
@@ -567,8 +573,8 @@ class ShortcutToolbarItem implements ToolbarItemInterface {
         */
        public function setAjaxShortcut($params = array(), \TYPO3\CMS\Core\Http\AjaxRequestHandler &$ajaxObj = NULL) {
                $shortcutId = (int)GeneralUtility::_POST('shortcutId');
-               $shortcutName = strip_tags(GeneralUtility::_POST('value'));
-               $shortcutGroupId = (int)GeneralUtility::_POST('shortcut-group');
+               $shortcutName = strip_tags(GeneralUtility::_POST('shortcutTitle'));
+               $shortcutGroupId = (int)GeneralUtility::_POST('shortcutGroup');
                if ($shortcutGroupId > 0 || $GLOBALS['BE_USER']->isAdmin()) {
                        // Users can delete only their own shortcuts (except admins)
                        $addUserWhere = !$GLOBALS['BE_USER']->isAdmin() ? ' AND userid=' . (int)$GLOBALS['BE_USER']->user['uid'] : '';
diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/Toolbar/ShortcutMenu.js b/typo3/sysext/backend/Resources/Public/JavaScript/Toolbar/ShortcutMenu.js
new file mode 100644 (file)
index 0000000..e9fcdc1
--- /dev/null
@@ -0,0 +1,171 @@
+/**
+ * This file is part of the TYPO3 CMS project.
+ *
+ * It is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License, either version 2
+ * of the License, or any later version.
+ *
+ * For the full copyright and license information, please read the
+ * LICENSE.txt file that was distributed with this source code.
+ *
+ * The TYPO3 project - inspiring people to share!
+ */
+/**
+ * shortcut menu logic to add new shortcut, remove a shortcut
+ * and edit a shortcut
+ */
+define('TYPO3/CMS/Backend/Toolbar/ShortcutMenu', ['jquery'], function($) {
+
+       var ShortcutMenu = {
+               $spinnerElement: $('<span>', {
+                       class: 't3-icon fa fa-circle-o-notch fa-spin'
+               }),
+               options: {
+                       containerSelector: '#shortcut-menu',
+                       toolbarIconSelector: '.dropdown-toggle span.t3-icon',
+                       toolbarMenuSelector: '.dropdown-menu',
+                       shortcutItemSelector: '.dropdown-menu .shortcut',
+                       shortcutLabelSelector: '.shortcut-label',
+                       shortcutDeleteSelector: '.shortcut-delete',
+                       shortcutEditSelector: '.shortcut-edit',
+                       shortcutFormTitleSelector: 'input[name="shortcut-title"]',
+                       shortcutFormGroupSelector: 'select[name="shortcut-group"]',
+                       shortcutFormSaveSelector: '.shortcut-form-save',
+                       shortcutFormCancelSelector: '.shortcut-form-cancel'
+               }
+       };
+
+       /**
+        * build the in-place-editor for a shortcut
+        */
+       ShortcutMenu.editShortcut = function($shortcutRecord) {
+               $shortcutRecord.find(ShortcutMenu.options.shortcutEditSelector).hide();
+               // load the form
+               $.ajax({
+                       url: TYPO3.settings.ajaxUrls['ShortcutMenu::getShortcutEditForm'],
+                       data: {
+                               shortcutId: $shortcutRecord.data('shortcutid'),
+                               shortcutGroup: $shortcutRecord.data('shortcutgroup')
+                       },
+                       cache: false
+               }).done(function(data) {
+                       $shortcutRecord.find(ShortcutMenu.options.shortcutLabelSelector).html(data);
+               });
+       };
+
+       /**
+        * save the data from the in-place-editor for a shortcut
+        */
+       ShortcutMenu.saveShortcutForm = function($shortcutRecord) {
+               $.ajax({
+                       url: TYPO3.settings.ajaxUrls['ShortcutMenu::saveShortcut'],
+                       data: {
+                               shortcutId: $shortcutRecord.data('shortcutid'),
+                               shortcutTitle: $shortcutRecord.find(ShortcutMenu.options.shortcutFormTitleSelector).val(),
+                               shortcutGroup: $shortcutRecord.find(ShortcutMenu.options.shortcutFormGroupSelector).val()
+                       },
+                       type: 'post',
+                       cache: false
+               }).done(function(data) {
+                       // @todo: we can evaluate here, but what to do? a message?
+                       ShortcutMenu.refreshMenu();
+               });
+       };
+
+       /**
+        * removes an existing short by sending an AJAX call
+        */
+       ShortcutMenu.deleteShortcut = function($shortcutRecord) {
+               // @todo: translations
+               if (confirm('Do you really want to remove this bookmark?')) {
+                       $.ajax({
+                               url: TYPO3.settings.ajaxUrls['ShortcutMenu::delete'],
+                               data: {
+                                       shortcutId: $shortcutRecord.data('shortcutid')
+                               },
+                               type: 'post',
+                               cache: false
+                       }).done(function() {
+                               // a reload is used in order to restore the original behaviour
+                               // e.g. remove groups that are now empty because the last one in the group
+                               // was removed
+                               ShortcutMenu.refreshMenu();
+                       });
+               }
+       };
+
+       /**
+        * makes a call to the backend class to create a new shortcut,
+        * when finished it reloads the menu
+        */
+       ShortcutMenu.createShortcut = function(moduleName, url, confirmationText) {
+               var shouldCreateShortcut = true;
+               if (typeof confirmationText !== 'undefined') {
+                       shouldCreateShortcut = window.confirm(confirmationText);
+               }
+
+               if (shouldCreateShortcut) {
+                       var $toolbarItemIcon = $(ShortcutMenu.options.toolbarIconSelector, ShortcutMenu.options.containerSelector);
+                       var $spinner = ShortcutMenu.$spinnerElement.clone();
+                       var $existingItem = $toolbarItemIcon.replaceWith($spinner);
+
+                       $.ajax({
+                               url: TYPO3.settings.ajaxUrls['ShortcutMenu::create'],
+                               type: 'post',
+                               data: {
+                                       module: moduleName,
+                                       url: url
+                               },
+                               cache: false
+                       }).done(function() {
+                               ShortcutMenu.refreshMenu();
+                               $spinner.replaceWith($existingItem);
+                       });
+               }
+       };
+
+       /**
+        * reloads the menu after an update
+        */
+       ShortcutMenu.refreshMenu = function() {
+               $.ajax({
+                       url: TYPO3.settings.ajaxUrls['ShortcutMenu::render'],
+                       type: 'get',
+                       cache: false
+               }).done(function(data) {
+                       $(ShortcutMenu.options.toolbarMenuSelector, ShortcutMenu.options.containerSelector).html(data);
+               });
+       };
+
+       /**
+        * Registers listeners
+        */
+       ShortcutMenu.initializeEvents = function() {
+               $(ShortcutMenu.options.containerSelector).on('click', ShortcutMenu.options.shortcutDeleteSelector, function(evt) {
+                       evt.preventDefault();
+                       evt.stopImmediatePropagation();
+                       ShortcutMenu.deleteShortcut($(this).closest(ShortcutMenu.options.shortcutItemSelector));
+               }).on('click', ShortcutMenu.options.shortcutEditSelector, function(evt) {
+                       evt.preventDefault();
+                       evt.stopImmediatePropagation();
+                       ShortcutMenu.editShortcut($(this).closest(ShortcutMenu.options.shortcutItemSelector));
+               }).on('click', ShortcutMenu.options.shortcutFormSaveSelector, function(evt) {
+                       ShortcutMenu.saveShortcutForm($(this).closest(ShortcutMenu.options.shortcutItemSelector));
+               }).on('click', ShortcutMenu.options.shortcutFormCancelSelector, function() {
+                       // re-render the menu on canceling the update of a shortcut
+                       ShortcutMenu.refreshMenu();
+               });
+       };
+
+       /**
+        * initialize and return the ShortcutMenu object
+        */
+       return function() {
+               $(document).ready(function() {
+                       ShortcutMenu.initializeEvents();
+               });
+
+               TYPO3.ShortcutMenu = ShortcutMenu;
+               return ShortcutMenu;
+       }();
+});
\ No newline at end of file
index 057c9e9..96a7d32 100644 (file)
@@ -45,13 +45,15 @@ var ShortcutManager = {
 
        /**
         * central entry point to create a shortcut, delegates the call to correct endpoint
+        * kept for backwards compatibility, use top.TYPO3.ShortcutMenu.createShortcut directly
+        * in the future
         */
        createShortcut: function(confirmQuestion, backPath, moduleName, url) {
-               if(confirm(confirmQuestion)) {
-                       if (typeof TYPO3BackendShortcutMenu !== undefined) {
-                                       // backend.php
-                               TYPO3BackendShortcutMenu.createShortcut('', moduleName, url);
-                       }
+               if (console) {
+                       console.debug('ShortcutManager.createShortcut is deprecated since TYPO3 CMS 7, use TYPO3.ShortcutMenu directly.');
+               }
+               if (TYPO3.ShortcutMenu !== undefined) {
+                       TYPO3.ShortcutMenu.createShortcut(moduleName, url, confirmQuestion);
                }
        }
 }
diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/shortcutmenu.js b/typo3/sysext/backend/Resources/Public/JavaScript/shortcutmenu.js
deleted file mode 100644 (file)
index ea089ce..0000000
+++ /dev/null
@@ -1,205 +0,0 @@
-/**
- * This file is part of the TYPO3 CMS project.
- *
- * It is free software; you can redistribute it and/or modify it under
- * the terms of the GNU General Public License, either version 2
- * of the License, or any later version.
- *
- * For the full copyright and license information, please read the
- * LICENSE.txt file that was distributed with this source code.
- *
- * The TYPO3 project - inspiring people to share!
- */
-
-
-/**
- * class to handle the shortcut menu
- */
-var ShortcutMenu = Class.create({
-
-       /**
-        * registers for resize event listener and executes on DOM ready
-        */
-       initialize: function() {
-               Ext.onReady(function() {
-                       this.toolbarItemIcon = $$('#shortcut-menu .dropdown-toggle span.t3-icon')[0];
-                       this.initControls();
-               }, this);
-       },
-
-       /**
-        * initializes the controls to follow, edit, and delete shortcuts
-        *
-        */
-       initControls: function() {
-
-               $$('.shortcut-label a').each(function(element) {
-                       var shortcutId = element.up('tr.shortcut').identify().slice(9);
-
-                               // map InPlaceEditor to edit icons
-                       var edit = new Ajax.InPlaceEditor('shortcut-label-' + shortcutId, TYPO3.settings.ajaxUrls['ShortcutMenu::saveShortcut'], {
-                               externalControl     : 'shortcut-edit-' + shortcutId,
-                               externalControlOnly : true,
-                               highlightcolor      : 'transparent',
-                               highlightendcolor   : 'transparent',
-                               onFormCustomization : this.addGroupSelect,
-                               onComplete          : this.reRenderMenu.bind(this),
-                               callback            : function(form, nameInputFieldValue) {
-                                       var params = form.serialize(true);
-                                       params.shortcutId = shortcutId;
-                                       return params;
-                               },
-                               textBetweenControls : ' ',
-                               cancelControl       : 'button',
-                               clickToEditText     : '',
-                               htmlResponse        : true
-                       });
-
-                               // follow/execute shortcuts
-                       element.observe('click', function(event) {
-                               this.toggleMenu();
-                       }.bind(this));
-
-               }.bind(this));
-
-                       // activate delete icon
-               $$('.shortcut-delete img').each(function(element) {
-                       element.observe('click', function(event) {
-                               if (confirm('Do you really want to remove this bookmark?')) {
-                                       var deleteControl = event.element();
-                                       var shortcutId = deleteControl.up('tr.shortcut').identify().slice(9);
-
-                                       var del = new Ajax.Request(TYPO3.settings.ajaxUrls['ShortcutMenu::delete'], {
-                                               parameters : '&shortcutId=' + shortcutId,
-                                               onComplete : this.reRenderMenu.bind(this)
-                                       });
-                               }
-                       }.bind(this));
-               }.bind(this));
-
-       },
-
-       /**
-        * toggles the visibility of the menu and places it under the toolbar icon
-        */
-       toggleMenu: function(event) {},
-
-       /**
-        * adds a select field for the groups
-        */
-       addGroupSelect: function(inPlaceEditor, inPlaceEditorForm) {
-               var selectField = $(document.createElement('select'));
-
-                       // determine the shortcut id
-               var shortcutId  = inPlaceEditorForm.identify().slice(9, -14);
-
-                       // now determine the shortcut's group id
-               var shortcut        = $('shortcut-' + shortcutId).up('tr.shortcut');
-               var firstInGroup    = null;
-               var shortcutGroupId = 0;
-
-               if (shortcut.hasClassName('first-row')) {
-                       firstInGroup = shortcut;
-               } else {
-                       firstInGroup = shortcut.previous('.first-row');
-               }
-
-               if (undefined !== firstInGroup) {
-                       shortcutGroupId = firstInGroup.previous().identify().slice(15);
-               }
-
-               selectField.name = 'shortcut-group';
-               selectField.id = 'shortcut-group-select-' + shortcutId;
-               selectField.size = 1;
-               selectField.setStyle({marginBottom: '5px'});
-
-                       // create options
-               var option;
-                       // first create an option for "no group"
-               option = document.createElement('option');
-               option.value = 0;
-               option.selected = (shortcutGroupId === 0 ? true : false);
-               option.appendChild(document.createTextNode('No Group'));
-               selectField.appendChild(option);
-
-                       // get the groups
-               var getGroups = new Ajax.Request(TYPO3.settings.ajaxUrls['ShortcutMenu::getGroups'], {
-                       method: 'get',
-                       asynchronous: false, // needs to be synchronous to build the options before adding the selectfield
-                       requestHeaders: {Accept: 'application/json'},
-                       onSuccess: function(transport, json) {
-                               var shortcutGroups = transport.responseText.evalJSON(true);
-
-                                       // explicitly make the object a Hash
-                               shortcutGroups = $H(json.shortcutGroups);
-                               shortcutGroups.each(function(group) {
-                                       option = document.createElement('option');
-                                       option.value = group.key
-                                       option.selected = (shortcutGroupId === group.key ? true : false);
-                                       option.appendChild(document.createTextNode(group.value));
-                                       selectField.appendChild(option);
-                               });
-
-                       }
-               });
-
-               inPlaceEditor._form.appendChild(document.createElement('br'));
-               inPlaceEditor._form.appendChild(selectField);
-               inPlaceEditor._form.appendChild(document.createElement('br'));
-       },
-
-       /**
-        * gets called when the update was succesfull, fetches the complete menu to
-        * honor changes in group assignments
-        */
-       reRenderMenu: function(transport, element, backPath) {
-               var container = $$('#shortcut-menu .dropdown-menu')[0];
-               if (!backPath) {
-                       var backPath = '';
-               }
-
-               container.setStyle({
-                       height: container.getHeight() + 'px'
-               });
-               container.update('LOADING');
-
-               var render = new Ajax.Updater(
-                       container,
-                       backPath + TYPO3.settings.ajaxUrls['ShortcutMenu::render'],
-                       {
-                               asynchronous : false
-                       }
-               );
-
-               container.setStyle({
-                       height: 'auto'
-               });
-
-               this.initControls();
-       },
-
-       /**
-        * makes a call to the backend class to create a new shortcut,
-        * when finished it reloads the menu
-        */
-       createShortcut: function(backPath, moduleName, url) {
-               var toolbarItemIcon = $$('#shortcut-menu .dropdown-toggle span.t3-icon')[0];
-
-               var parent = Element.up(toolbarItemIcon);
-               var spinner = new Element('span').addClassName('spinner');
-               var oldIcon = toolbarItemIcon.replace(spinner);
-
-               // synchrous call to wait for it to complete and call the render
-               // method with backpath _afterwards_
-               var call = new Ajax.Request(backPath + TYPO3.settings.ajaxUrls['ShortcutMenu::create'], {
-                       parameters : 'module=' + moduleName + '&url=' + url,
-                       asynchronous : false
-               });
-
-               this.reRenderMenu(null, null, backPath);
-               spinner.replace(oldIcon);
-       }
-
-});
-
-var TYPO3BackendShortcutMenu = new ShortcutMenu();
index 57298f7..ce3b058 100644 (file)
@@ -634,8 +634,8 @@ return array(
                                'callbackMethod' => 'TYPO3\\CMS\\Backend\\Form\\Element\\SuggestElement->processAjaxRequest',
                                'csrfTokenCheck' => TRUE
                        ),
-                       'ShortcutMenu::getGroups' => array(
-                               'callbackMethod' => 'TYPO3\\CMS\\Backend\\Toolbar\\ShortcutToolbarItem->getAjaxShortcutGroups',
+                       'ShortcutMenu::getShortcutEditForm' => array(
+                               'callbackMethod' => 'TYPO3\\CMS\\Backend\\Toolbar\\ShortcutToolbarItem->getAjaxShortcutEditForm',
                                'csrfTokenCheck' => TRUE
                        ),
                        'ShortcutMenu::saveShortcut' => array(
@@ -643,7 +643,7 @@ return array(
                                'csrfTokenCheck' => TRUE
                        ),
                        'ShortcutMenu::render' => array(
-                               'callbackMethod' => 'TYPO3\\CMS\\Backend\\Toolbar\\ShortcutToolbarItem->renderAjax',
+                               'callbackMethod' => 'TYPO3\\CMS\\Backend\\Toolbar\\ShortcutToolbarItem->renderAjaxMenu',
                                'csrfTokenCheck' => TRUE
                        ),
                        'ShortcutMenu::delete' => array(