Fixed bug #14536: Use sprite icons in toolbar (Thanks to Steffen Gebert)
authorBenni Mack <benni.mack@typo3.org>
Mon, 31 May 2010 08:06:03 +0000 (08:06 +0000)
committerBenni Mack <benni.mack@typo3.org>
Mon, 31 May 2010 08:06:03 +0000 (08:06 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@7775 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
typo3/classes/class.backendsearchmenu.php
typo3/classes/class.clearcachemenu.php
typo3/classes/class.shortcutmenu.php
typo3/classes/class.workspaceselector.php
typo3/js/backendsearch.js
typo3/js/clearcachemenu.js
typo3/js/shortcutmenu.js
typo3/sysext/opendocs/class.tx_opendocs.php
typo3/sysext/opendocs/opendocs.css
typo3/sysext/opendocs/opendocs.js

index 32d0c37..5c5030c 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,6 @@
 2010-05-31  Benjamin Mack  <benni@typo3.org>
 
+       * Fixed bug #14536: Use sprite icons in toolbar (Thanks to Steffen Gebert)
        * Fixed bug #14534: Cleanup: Icons missing in the new icon-set, and therefore sprites are updated (Thanks to Steffen Ritter)
        * Fixed bug #14535: Checkbox Alignment in TCEforms is broken (Thanks to Steffen Kamper)
        * Fixed bug #14532: SpriteIcons: Clickmenu is not replaced (Thanks to Steffen Ritter)
index ccb5813..d7080b4 100644 (file)
@@ -73,7 +73,9 @@ class BackendSearchMenu implements backend_toolbarItem {
                $this->addJavascriptToBackend();
                $searchMenu = array();
 
-               $searchMenu[] = '<a href="#" class="toolbar-item"><img'.t3lib_iconWorks::skinImg($this->backPath, 'gfx/magnifier.png', 'width="16" height="16"').' title="'.$title.'" alt="'.$title.'" /></a>';
+               $searchMenu[] = '<a href="#" class="toolbar-item">' .
+                       t3lib_iconWorks::getSpriteIcon('apps-toolbar-menu-search', array('title' => $title)) .
+                       '</a>';
 
                $searchMenu[] = '<div class="toolbar-item-menu" style="display: none;">';
                $searchMenu[] = '<input type="text" id="search-query" name="search-query" value="" />';
index 9c7293c..dd13fd9 100644 (file)
@@ -137,7 +137,9 @@ class ClearCacheMenu implements backend_toolbarItem {
                $this->addJavascriptToBackend();
                $cacheMenu = array();
 
-               $cacheMenu[] = '<a href="#" class="toolbar-item"><img'.t3lib_iconWorks::skinImg($this->backPath, 'gfx/lightning.png', 'width="16" height="16"').' title="'.$title.'" alt="'.$title.'" /></a>';
+               $cacheMenu[] = '<a href="#" class="toolbar-item">' .
+                       t3lib_iconWorks::getSpriteIcon('apps-toolbar-menu-cache', array('title' => $title)) . 
+                       '</a>';
 
                $cacheMenu[] = '<ul class="toolbar-item-menu" style="display: none;">';
 
index fe25ee7..af4741f 100644 (file)
@@ -116,7 +116,9 @@ class ShortcutMenu implements backend_toolbarItem {
 
                $shortcutMenu = array();
 
-               $shortcutMenu[] = '<a href="#" class="toolbar-item"><img'.t3lib_iconWorks::skinImg($this->backPath, 'gfx/toolbar_shortcut.png', 'width="16" height="16"').' title="'.$title.'" alt="'.$title.'" /></a>';
+               $shortcutMenu[] = '<a href="#" class="toolbar-item">' .
+                       t3lib_iconWorks::getSpriteIcon('apps-toolbar-menu-shortcut', array('title' => $title)) .
+                       '</a>';
                $shortcutMenu[] = '<div class="toolbar-item-menu" style="display: none;">';
                $shortcutMenu[] = $this->renderMenu();
                $shortcutMenu[] = '</div>';
index 77e5f40..f804f20 100644 (file)
@@ -189,12 +189,9 @@ class WorkspaceSelector implements backend_toolbarItem {
                        'title' => $GLOBALS['LANG']->getLL('shortcut_inactive')
                ));
 
-               $workspaceMenu[] = '<a href="#" class="toolbar-item"><img' .
-                       t3lib_iconWorks::skinImg(
-                               $this->backPath,
-                               'gfx/i/sys_workspace.png',
-                               'width="16" height="16"') .
-                       ' title="' . $title . '" alt="' . $title . '" /></a>';
+               $workspaceMenu[] = '<a href="#" class="toolbar-item">' .
+                       t3lib_iconWorks::getSpriteIcon('apps-toolbar-menu-workspace', array('title' => $title)) . 
+                               '</a>';
                $workspaceMenu[] = '<ul class="toolbar-item-menu" style="display: none;">';
 
                if (count($availableWorkspaces)) {
index 267eb8e..1dbef49 100644 (file)
@@ -39,7 +39,7 @@ var BackendSearch = Class.create({
 
                Ext.onReady(function() {
                        this.positionMenu();
-                       this.toolbarItemIcon = $$('#backend-search-menu .toolbar-item img')[0].src;
+                       this.toolbarItemIcon = $$('#backend-search-menu .toolbar-item span.t3-icon')[0];
 
                        $('search-query').observe('keypress', function(event) {
                                var keyCode;
index 5cdad46..830b300 100644 (file)
@@ -39,7 +39,7 @@ var ClearCacheMenu = Class.create({
 
                Ext.onReady(function() {
                        this.positionMenu();
-                       this.toolbarItemIcon = $$('#clear-cache-actions-menu .toolbar-item img')[0].src;
+                       this.toolbarItemIcon = $$('#clear-cache-actions-menu .toolbar-item span.t3-icon')[0];
 
                        Event.observe('clear-cache-actions-menu', 'click', this.toggleMenu)
 
@@ -110,14 +110,17 @@ var ClearCacheMenu = Class.create({
         * @param       Event   prototype event object
         */
        clearCache: function(event) {
-               var toolbarItemIcon = $$('#clear-cache-actions-menu .toolbar-item img')[0];
+               var toolbarItemIcon = $$('#clear-cache-actions-menu .toolbar-item span.t3-icon')[0];
                var url             = '';
                var clickedElement  = Event.element(event);
 
                        // activate the spinner
-               toolbarItemIcon.src = 'gfx/spinner.gif';
+               var parent = Element.up(toolbarItemIcon);
+               var oldIcon = toolbarItemIcon.remove();
+               var spinner = Element('span', { 'class': 'spinner'});
+               parent.insert(spinner, {position: content});
 
-               if (clickedElement.tagName === 'IMG') {
+               if (clickedElement.tagName === 'SPAN') {
                        url =  clickedElement.up('a').href;
                } else {
                        url =  clickedElement.href;
@@ -127,7 +130,8 @@ var ClearCacheMenu = Class.create({
                        var call = new Ajax.Request(url, {
                                'method': 'get',
                                'onComplete': function() {
-                                       toolbarItemIcon.src = this.toolbarItemIcon;
+                                       spinner.remove();
+                                       parent.insert(oldIcon, {position: content});
                                }.bind(this)
                        });
                }
index 01beae2..2078831 100644 (file)
@@ -40,7 +40,7 @@ var ShortcutMenu = Class.create({
 
                Ext.onReady(function() {
                        this.positionMenu();
-                       this.toolbarItemIcon = $$('#shortcut-menu .toolbar-item img')[0].src;
+                       this.toolbarItemIcon = $$('#shortcut-menu .toolbar-item span.t3-icon')[0];
 
                        Event.observe($$('#shortcut-menu .toolbar-item')[0], 'click', this.toggleMenu);
                        this.initControls();
@@ -251,7 +251,12 @@ var ShortcutMenu = Class.create({
         * when finished it reloads the menu
         */
        createShortcut: function(backPath, moduleName, url) {
-               $$('#shortcut-menu .toolbar-item img')[0].src = 'gfx/spinner.gif';
+               var toolbarItemIcon = $$('#shortcut-menu .toolbar-item span.t3-icon')[0];
+
+               var parent = Element.up(toolbarItemIcon);
+               var oldIcon = toolbarItemIcon.remove();
+               var spinner = Element('span', { 'class': 'spinner'});
+               parent.insert(spinner, {position: content});
 
                        // synchrous call to wait for it to complete and call the render
                        // method with backpath _afterwards_
@@ -261,7 +266,8 @@ var ShortcutMenu = Class.create({
                });
 
                this.reRenderMenu(null, null, backPath);
-               $$('#shortcut-menu .toolbar-item img')[0].src = this.toolbarItemIcon;
+               spinner.remove();
+               parent.insert(oldIcon, {position: content});
        }
 
 });
index 12bad19..c247e13 100644 (file)
@@ -98,7 +98,7 @@ class tx_opendocs implements backend_toolbarItem {
                        // toolbar item icon
                $opendocsMenu[] = '<a href="#" class="toolbar-item">';
                $opendocsMenu[] = '<input type="text" id="tx-opendocs-counter" disabled="disabled" value="' . $numDocs . '" />';
-               $opendocsMenu[] = '<img' . t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'], t3lib_extMgm::extRelPath($this->EXTKEY) . 'opendocs.png', 'width="23" height="16"') . '  alt="' . $title . '" title="' . $title . '" /></a>';
+               $opendocsMenu[] = t3lib_iconWorks::getSpriteIcon('apps-toolbar-menu-opendocs', array('title' => $title)) . '</a>';
 
                        // toolbar item menu and initial content
                $opendocsMenu[] = '<div class="toolbar-item-menu" style="display: none;">';
index 571fdaa..6488009 100644 (file)
@@ -26,8 +26,6 @@ Description : styles the Open Documents toolbar item
        text-align: right;
        border: 1px dashed #999;
        padding: 1px 2px;
-       position: relative;
-       top: -4px;
 }
 
 #tx-opendocs-menu .toolbar-item-menu {
index 12bda03..094ad41 100644 (file)
@@ -41,12 +41,11 @@ var OpenDocs = Class.create({
 
                Ext.onReady(function() {
                        this.positionMenu();
-                       this.toolbarItemIcon = $$('#tx-opendocs-menu .toolbar-item img')[0].src;
+                       this.toolbarItemIcon = $$('#tx-opendocs-menu .toolbar-item span.t3-icon')[0];
                        this.ajaxScript      = top.TS.PATH_typo3 + this.ajaxScript; // can't be initialized earlier
 
                        Event.observe($$('#tx-opendocs-menu .toolbar-item')[0], 'click', this.toggleMenu);
                        this.menu = $$('#tx-opendocs-menu .toolbar-item-menu')[0];
-                       this.toolbarItemIcon = $$('#shortcut-menu .toolbar-item img')[0].src;
                }, this);
        },