added feature #7161: create a shortcut manager to delegate calls to create a new...
authorIngo Renner <ingo.renner@typo3.org>
Tue, 15 Jan 2008 16:01:50 +0000 (16:01 +0000)
committerIngo Renner <ingo.renner@typo3.org>
Tue, 15 Jan 2008 16:01:50 +0000 (16:01 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@2899 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
typo3/alt_main.php
typo3/js/backend.js [new file with mode: 0644]
typo3/template.php

index 638357d..60b549f 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,6 +5,7 @@
 2008-01-15  Ingo Renner  <ingo@typo3.org>
 
        * added feature #5536: Some Hooks for tslib_content
+       * added feature #7161: create a shortcut manager to delegate calls to create a new shortcut to the right target
 
 2008-01-15  Benjamin Mack  <mack@xnos.org>
 
index 13534d6..07f6625 100755 (executable)
@@ -457,7 +457,7 @@ class SC_alt_main {
        function startModule() {
                global $BE_USER;
                $module = preg_replace('/[^[:alnum:]_]/','',t3lib_div::_GET('module'));
-               
+
                if (!$module)   {
                        if ($BE_USER->uc['startModule'])        {
                                $module = $BE_USER->uc['startModule'];
@@ -492,6 +492,7 @@ class SC_alt_main {
                $GLOBALS['TBE_TEMPLATE']->JScode= '
                        <script type="text/javascript" src="md5.js"></script>
                        <script type="text/javascript" src="../t3lib/jsfunc.evalfield.js"></script>
+                       <script type="text/javascript" src="js/backend.js"></script>
                        ';
                $GLOBALS['TBE_TEMPLATE']->JScode.=$GLOBALS['TBE_TEMPLATE']->wrapScriptTags($this->mainJScode);
 
diff --git a/typo3/js/backend.js b/typo3/js/backend.js
new file mode 100644 (file)
index 0000000..f2d8cbb
--- /dev/null
@@ -0,0 +1,73 @@
+/***************************************************************
+*  Copyright notice
+*
+*  (c) 2007 Ingo Renner <ingo@typo3.org>
+*  All rights reserved
+*
+*  This script is part of the TYPO3 project. The TYPO3 project is
+*  free software; you can redistribute it and/or modify
+*  it under the terms of the GNU General Public License as published by
+*  the Free Software Foundation; either version 2 of the License, or
+*  (at your option) any later version.
+*
+*  The GNU General Public License can be found at
+*  http://www.gnu.org/copyleft/gpl.html.
+*  A copy is found in the textfile GPL.txt and important notices to the license
+*  from the author is found in LICENSE.txt distributed with these scripts.
+*
+*
+*  This script is distributed in the hope that it will be useful,
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+*  GNU General Public License for more details.
+*
+*  This copyright notice MUST APPEAR in all copies of the script!
+***************************************************************/
+
+/**
+ * general backend javascript functions
+ */
+
+/**
+ * jump the backend to a module
+ */
+function jump(url, modName, mainModName) {
+               // clear information about which entry in nav. tree that might have been highlighted.
+       top.fsMod.navFrameHighlightedID = new Array();
+
+       if (top.content && top.content.nav_frame && top.content.nav_frame.refresh_nav) {
+               top.content.nav_frame.refresh_nav();
+       }
+
+       top.nextLoadModuleUrl = url;
+       top.goToModule(modName);
+}
+
+/**
+ * shortcut manager to delegate the action of creating shortcuts to the new
+ * backend.php shortcut menu or the old shortcut frame depending on what is available
+ */
+var ShortcutManager = {
+
+       /**
+        * central entry point to create a shortcut, delegates the call to correct endpoint
+        */
+       createShortcut: function(confirmQuestion, backPath, moduleName, url) {
+               if(confirm(confirmQuestion)) {
+                       if(typeof TYPO3BackendShortcutMenu != 'undefined') {
+                               TYPO3BackendShortcutMenu.createShortcut(backPath, moduleName, url);
+                       }
+
+                       if(top.shortcutFrame) {
+                               var location = backPath + 'alt_shortcut.php?modName=' + moduleName + '&URL=' + url;
+                               shortcutFrame.location.href = location;
+                       }
+               }
+       }
+}
+
+
+
+
+
+
index 9738390..72e0502 100755 (executable)
@@ -448,12 +448,12 @@ class template {
                        $mMN='&motherModName='.rawurlencode($motherModName);
                } else $mMN='';
 
-               $onClick = 'if (top.shortcutFrame && confirm('.
-                                       $GLOBALS['LANG']->JScharCode($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.makeShortcut')).
-                                       ')){top.shortcutFrame.location.href=\''.$backPath.'alt_shortcut.php?modName='.rawurlencode($modName).
-                                       '&URL='.rawurlencode($pathInfo['path']."?".$storeUrl).
-                                       $mMN.
-                                       '\';}return false;';
+               $onClick = 'top.ShortcutManager.createShortcut('
+                       .$GLOBALS['LANG']->JScharCode($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.makeShortcut')).', '
+                       .'\''.$backPath.'\', '
+                       .'\''.rawurlencode($modName).'\', '
+                       .'\''.rawurlencode($pathInfo['path']."?".$storeUrl).$mMN.'\''
+               .');return false;';
 
                $sIcon = '<a href="#" onclick="'.htmlspecialchars($onClick).'"><img'.t3lib_iconWorks::skinImg($backPath,'gfx/shortcut.gif','width="14" height="14"').' title="'.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.makeShortcut',1).'" alt="" /></a>';
                return $sIcon;
@@ -1247,7 +1247,7 @@ $str.=$this->docBodyTagBegin().
 
 
        /**
-        * Includes a javascript library that exists in the core /typo3/ directory. The 
+        * Includes a javascript library that exists in the core /typo3/ directory. The
         * backpath is automatically applied
         *
         * @param       string          $lib: Library name. Call it with the full path
@@ -1414,7 +1414,7 @@ $str.=$this->docBodyTagBegin().
         * @param       boolean         If set, tab table cells are not allowed to wrap their content
         * @param       boolean         If set, the tabs will span the full width of their position
         * @param       integer         Default tab to open (for toggle <=0). Value corresponds to integer-array index + 1 (index zero is "1", index "1" is 2 etc.). A value of zero (or something non-existing) will result in no default tab open.
-        * @param       integer         If set to '1' empty tabs will be remove, If set to '2' empty tabs will be disabled 
+        * @param       integer         If set to '1' empty tabs will be remove, If set to '2' empty tabs will be disabled
         * @return      string          JavaScript section for the HTML header.
         */
        function getDynTabMenu($menuItems,$identString,$toggle=0,$foldout=FALSE,$newRowCharLimit=50,$noWrap=1,$fullWidth=FALSE,$defaultTabIndex=1,$dividers2tabs=2)     {
@@ -1539,7 +1539,7 @@ $str.=$this->docBodyTagBegin().
                }
                return $content;
        }
-       
+
        /**
         * Creates the id for dynTabMenus.
         *