[TASK] Remove unsupported functionality related to workspaces
[Packages/TYPO3.CMS.git] / typo3 / alt_db_navframe.php
old mode 100755 (executable)
new mode 100644 (file)
index 057a2b1..ca682c0
@@ -2,7 +2,7 @@
 /***************************************************************
 *  Copyright notice
 *
-*  (c) 1999-2005 Kasper Skaarhoj (kasperYYYY@typo3.com)
+*  (c) 1999-2011 Kasper Skårhøj (kasperYYYY@typo3.com)
 *  All rights reserved
 *
 *  This script is part of the TYPO3 project. The TYPO3 project is
 /**
  * Page navigation tree for the Web module
  *
- * $Id$
- * Revised for TYPO3 3.6 2/2003 by Kasper Skaarhoj
+ * Revised for TYPO3 3.6 2/2003 by Kasper Skårhøj
  * XHTML compliant
  *
- * @author     Kasper Skaarhoj <kasperYYYY@typo3.com>
- */
-/**
- * [CLASS/FUNCTION INDEX of SCRIPT]
- *
- *
- *  192: class SC_alt_db_navframe
- *  210:     function init()
- *  313:     function main()
- *  387:     function printContent()
- *
- *              SECTION: Temporary DB mounts
- *  415:     function initializeTemporaryDBmount()
- *  449:     function settingTemporaryMountPoint($pageId)
- *
- * TOTAL FUNCTIONS: 9
- * (This index is automatically created/updated by the extension "extdeveval")
- *
+ * @author     Kasper Skårhøj <kasperYYYY@typo3.com>
  */
 
 
@@ -61,7 +43,7 @@ require_once('class.webpagetree.php');
 /**
  * Main script class for the page tree navigation frame
  *
- * @author     Kasper Skaarhoj <kasperYYYY@typo3.com>
+ * @author     Kasper Skårhøj <kasperYYYY@typo3.com>
  * @package TYPO3
  * @subpackage core
  */
@@ -94,10 +76,9 @@ class SC_alt_db_navframe {
         * @return      void
         */
        function init() {
-               global $BE_USER,$BACK_PATH;
 
                        // Setting backPath
-               $this->backPath = $BACK_PATH;
+               $this->backPath = $GLOBALS['BACK_PATH'];
 
                        // Setting GPvars:
                $this->cMR = t3lib_div::_GP('cMR');
@@ -105,15 +86,15 @@ class SC_alt_db_navframe {
                $this->setTempDBmount = t3lib_div::_GP('setTempDBmount');
 
                        // look for User setting
-               $this->hasFilterBox = !$BE_USER->getTSConfigVal('options.pageTree.hideFilter');
+               $this->hasFilterBox = !$GLOBALS['BE_USER']->getTSConfigVal('options.pageTree.hideFilter');
 
                        // Create page tree object:
                $this->pagetree = t3lib_div::makeInstance('webPageTree');
-               $this->pagetree->ext_IconMode = $BE_USER->getTSConfigVal('options.pageTree.disableIconLinkToContextmenu');
-               $this->pagetree->ext_showPageId = $BE_USER->getTSConfigVal('options.pageTree.showPageIdWithTitle');
-               $this->pagetree->ext_showNavTitle = $BE_USER->getTSConfigVal('options.pageTree.showNavTitle');
-               $this->pagetree->ext_separateNotinmenuPages = $BE_USER->getTSConfigVal('options.pageTree.separateNotinmenuPages');
-               $this->pagetree->ext_alphasortNotinmenuPages = $BE_USER->getTSConfigVal('options.pageTree.alphasortNotinmenuPages');
+               $this->pagetree->ext_IconMode = $GLOBALS['BE_USER']->getTSConfigVal('options.pageTree.disableIconLinkToContextmenu');
+               $this->pagetree->ext_showPageId = $GLOBALS['BE_USER']->getTSConfigVal('options.pageTree.showPageIdWithTitle');
+               $this->pagetree->ext_showNavTitle = $GLOBALS['BE_USER']->getTSConfigVal('options.pageTree.showNavTitle');
+               $this->pagetree->ext_separateNotinmenuPages = $GLOBALS['BE_USER']->getTSConfigVal('options.pageTree.separateNotinmenuPages');
+               $this->pagetree->ext_alphasortNotinmenuPages = $GLOBALS['BE_USER']->getTSConfigVal('options.pageTree.alphasortNotinmenuPages');
                $this->pagetree->thisScript = 'alt_db_navframe.php';
                $this->pagetree->addField('alias');
                $this->pagetree->addField('shortcut');
@@ -136,21 +117,20 @@ class SC_alt_db_navframe {
         * @return      void
         */
        public function initPage() {
-               global $BE_USER;
 
                        // Setting highlight mode:
-               $this->doHighlight = !$BE_USER->getTSConfigVal('options.pageTree.disableTitleHighlight');
+               $this->doHighlight = !$GLOBALS['BE_USER']->getTSConfigVal('options.pageTree.disableTitleHighlight');
 
                        // If highlighting is active, define the CSS class for the active item depending on the workspace
                if ($this->doHighlight) {
-                       $hlClass = ($BE_USER->workspace === 0 ? 'active' : 'active active-ws wsver'.$BE_USER->workspace);
+                       $hlClass = ($GLOBALS['BE_USER']->workspace === 0 ? 'active' : 'active active-ws wsver' . $GLOBALS['BE_USER']->workspace);
                }
 
                        // Create template object:
                $this->doc = t3lib_div::makeInstance('template');
-               $this->doc->backPath = $BACK_PATH;
+               $this->doc->backPath = $GLOBALS['BACK_PATH'];
                $this->doc->setModuleTemplate('templates/alt_db_navframe.html');
-               $this->doc->docType  = 'xhtml_trans';
+               $this->doc->showFlashMessages = FALSE;
 
                        // get HTML-Template
 
@@ -158,7 +138,12 @@ class SC_alt_db_navframe {
                        // Adding javascript code for AJAX (prototype), drag&drop and the pagetree as well as the click menu code
                $this->doc->getDragDropCode('pages');
                $this->doc->getContextMenuCode();
-               $this->doc->loadJavascriptLib('contrib/scriptaculous/scriptaculous.js?load=effects');
+               $this->doc->getPageRenderer()->loadScriptaculous('effects');
+               $this->doc->getPageRenderer()->loadExtJS();
+
+               if ($this->hasFilterBox) {
+                       $this->doc->getPageRenderer()->addJsFile('js/pagetreefiltermenu.js');
+               }
 
                $this->doc->JScode .= $this->doc->wrapScriptTags(
                ($this->currentSubScript?'top.currentSubScript=unescape("'.rawurlencode($this->currentSubScript).'");':'').'
@@ -167,11 +152,14 @@ class SC_alt_db_navframe {
 
                // Function, loading the list frame from navigation tree:
                function jumpTo(id, linkObj, highlightID, bank) { //
-                       var theUrl = top.TS.PATH_typo3 + top.currentSubScript + "?id=" + id;
+                       var theUrl = top.TS.PATH_typo3 + top.currentSubScript ;
+                       if (theUrl.indexOf("?") != -1) {
+                               theUrl += "&id=" + id
+                       } else {
+                               theUrl += "?id=" + id
+                       }
                        top.fsMod.currentBank = bank;
-
-                       if (top.condensedMode) top.content.location.href = theUrl;
-                       else                   parent.list_frame.location.href=theUrl;
+                       top.TYPO3.Backend.ContentContainer.setUrl(theUrl);
 
                        '.($this->doHighlight ? 'Tree.highlightActiveItem("web", highlightID + "_" + bank);' : '').'
                        '.(!$GLOBALS['CLIENT']['FORMSTYLE'] ? '' : 'if (linkObj) linkObj.blur(); ').'
@@ -193,7 +181,6 @@ class SC_alt_db_navframe {
         * @return      void
         */
        function main() {
-               global $LANG,$CLIENT;
 
                        // Produce browse-tree:
                $tree = $this->pagetree->getBrowsableTree();
@@ -201,15 +188,25 @@ class SC_alt_db_navframe {
 
                        // Outputting Temporary DB mount notice:
                if ($this->active_tempMountPoint)       {
-                       $this->content.= '
-       <div class="bgColor4 c-notice">
-               <img'.t3lib_iconWorks::skinImg('','gfx/icon_note.gif','width="18" height="16"').' align="top" alt="" />'.
-               '<a href="'.htmlspecialchars(t3lib_div::linkThisScript(array('setTempDBmount' => 0))).'">'.
-               $LANG->sl('LLL:EXT:lang/locallang_core.xml:labels.temporaryDBmount',1).
-               '</a><br/>
-               '.$LANG->sl('LLL:EXT:lang/locallang_core.xml:labels.path',1).': <span title="'.htmlspecialchars($this->active_tempMountPoint['_thePathFull']).'">'.htmlspecialchars(t3lib_div::fixed_lgd_cs($this->active_tempMountPoint['_thePath'],-50)).'</span>
-       </div>
+                       $flashText = '
+                               <a href="' . htmlspecialchars(t3lib_div::linkThisScript(array('setTempDBmount' => 0))) . '">' .
+                               $GLOBALS['LANG']->sl('LLL:EXT:lang/locallang_core.xml:labels.temporaryDBmount', 1) .
+                               '</a>           <br />' .
+                               $GLOBALS['LANG']->sl('LLL:EXT:lang/locallang_core.xml:labels.path', 1) . ': <span title="' .
+                               htmlspecialchars($this->active_tempMountPoint['_thePathFull']) . '">' .
+                               htmlspecialchars(t3lib_div::fixed_lgd_cs($this->active_tempMountPoint['_thePath'],-50)).
+                               '</span>
                        ';
+
+                       $flashMessage = t3lib_div::makeInstance(
+                               't3lib_FlashMessage',
+                               $flashText,
+                               '',
+                               t3lib_FlashMessage::INFO
+                       );
+
+
+                       $this->content.= $flashMessage->render();
                }
 
                        // Outputting page tree:
@@ -224,7 +221,11 @@ class SC_alt_db_navframe {
                        // Setting up the buttons and markers for docheader
                $docHeaderButtons = $this->getButtons();
                $markers = array(
-                       'IMG_RESET'     => '<img'.t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'], 'gfx/close_gray.gif', ' width="16" height="16"').' id="treeFilterReset" alt="Reset Filter" />',
+                       'IMG_RESET'     => t3lib_iconWorks::getSpriteIcon('actions-document-close', array(
+                                               'id' =>'treeFilterReset',
+                                               'alt'=> $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:labels.resetFilter'),
+                                               'title' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:labels.resetFilter')
+                                       )),
                        'WORKSPACEINFO' => $this->getWorkspaceInfo(),
                        'CONTENT'       => $this->content
                );
@@ -255,24 +256,32 @@ class SC_alt_db_navframe {
         *
         * @return      array   all available buttons as an assoc. array
         */
-       private function getButtons()   {
-               global $LANG;
-
+       protected function getButtons() {
                $buttons = array(
                        'csh' => '',
                        'new_page' => '',
                        'refresh' => '',
+                       'filter' => '',
                );
 
                        // New Page
-               $onclickNewPageWizard = 'top.content.list_frame.location.href=top.TS.PATH_typo3+\'db_new.php?pagesOnly=1&id=\'+Tree.pageID;"';
-               $buttons['new_page'] = '<a href="#" onclick="' . $onclickNewPageWizard . '"><img' . t3lib_iconWorks::skinImg('', 'gfx/new_page.gif') . ' title="' . $LANG->sL('LLL:EXT:cms/layout/locallang.xml:newPage', 1) . '" alt="" /></a>';
+               $onclickNewPageWizard = 'top.content.list_frame.location.href=top.TS.PATH_typo3+\'db_new.php?pagesOnly=1&amp;id=\'+Tree.pageID;';
+               $buttons['new_page'] = '<a href="#" onclick="' . $onclickNewPageWizard . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:cms/layout/locallang.xml:newPage', TRUE) . '">' .
+                               t3lib_iconWorks::getSpriteIcon('actions-page-new') .
+                       '</a>';
 
                        // Refresh
-               $buttons['refresh'] = '<a href="' . htmlspecialchars(t3lib_div::getIndpEnv('REQUEST_URI')) . '"><img' . t3lib_iconWorks::skinImg('', 'gfx/refresh_n.gif') . ' title="' . $LANG->sL('LLL:EXT:lang/locallang_core.php:labels.refresh', 1) . '" alt="" /></a>';
+               $buttons['refresh'] = '<a href="' . htmlspecialchars(t3lib_div::getIndpEnv('REQUEST_URI')) . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.refresh', TRUE) . '">' .
+                               t3lib_iconWorks::getSpriteIcon('actions-system-refresh') .
+                       '</a>';
 
                        // CSH
-               $buttons['csh'] = str_replace('typo3-csh-inline','typo3-csh-inline show-right',t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'pagetree', $GLOBALS['BACK_PATH']));
+               $buttons['csh'] = str_replace('typo3-csh-inline','typo3-csh-inline show-right',t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'pagetree', $GLOBALS['BACK_PATH'], '', TRUE));
+
+                       // Filter
+               if ($this->hasFilterBox) {
+                       $buttons['filter'] = '<a href="#" id="tree-toolbar-filter-item">' . t3lib_iconWorks::getSpriteIcon('actions-system-tree-search-open', array('title'=> $GLOBALS['LANG']->sL('LLL:EXT:cms/layout/locallang.xml:labels.filter', 1))) . '</a>';
+               }
 
                return $buttons;
        }
@@ -282,28 +291,23 @@ class SC_alt_db_navframe {
         *
         * @return      string  HTML containing workspace info
         */
-       private function getWorkspaceInfo() {
-               global $LANG;
-
-               if ($GLOBALS['BE_USER']->workspace!==0 || $GLOBALS['BE_USER']->getTSConfigVal('options.pageTree.onlineWorkspaceInfo'))  {
-                       switch($GLOBALS['BE_USER']->workspace)  {
-                               case 0:
-                                       $wsTitle = '&nbsp;'.$this->doc->icons(2).'['.$LANG->sL('LLL:EXT:lang/locallang_misc.xml:shortcut_onlineWS',1).']';
-                               break;
-                               case -1:
-                                       $wsTitle = '['.$LANG->sL('LLL:EXT:lang/locallang_misc.xml:shortcut_offlineWS',1).']';
-                               break;
-                               default:
-                                       $wsTitle = '['.$GLOBALS['BE_USER']->workspace.'] '.htmlspecialchars($GLOBALS['BE_USER']->workspaceRec['title']);
-                               break;
-                       }
+       protected function getWorkspaceInfo() {
+
+               if (t3lib_extMgm::isLoaded('workspaces') && ($GLOBALS['BE_USER']->workspace !== 0 || $GLOBALS['BE_USER']->getTSConfigVal('options.pageTree.onlineWorkspaceInfo'))) {
+                       $wsTitle = htmlspecialchars(tx_Workspaces_Service_Workspaces::getWorkspaceTitle($GLOBALS['BE_USER']->workspace));
 
                        $workspaceInfo = '
-                               <div class="bgColor4 workspace-info">
-                                       <a href="'.htmlspecialchars('mod/user/ws/index.php').'" target="content">'.
-                                       '<img'.t3lib_iconWorks::skinImg('','gfx/i/sys_workspace.png','width="18" height="16"').' align="top" alt="" />'.
-                                       '</a>'.$wsTitle.'
-                               </div>
+                               <div class="bgColor4 workspace-info">' .
+                                        t3lib_iconWorks::getSpriteIcon(
+                                               'apps-toolbar-menu-workspace',
+                                               array(
+                                                       'title' => $wsTitle,
+                                                       'onclick' => 'top.goToModule(\'web_WorkspacesWorkspaces\');',
+                                                       'style' => 'cursor:pointer;'
+                                               )
+                                       ) .
+                                       $wsTitle .
+                               '</div>
                        ';
                }
 
@@ -323,12 +327,12 @@ class SC_alt_db_navframe {
         * @return      void
         */
        function initializeTemporaryDBmount(){
-               global $BE_USER;
 
                        // Set/Cancel Temporary DB Mount:
                if (strlen($this->setTempDBmount))      {
-                       $set = t3lib_div::intInRange($this->setTempDBmount,0);
-                       if ($set>0 && $BE_USER->isInWebMount($set))     {       // Setting...:
+                       $set = t3lib_utility_Math::forceIntegerInRange($this->setTempDBmount,0);
+                       if ($set > 0 && $GLOBALS['BE_USER']->isInWebMount($set)){
+                                       // Setting...:
                                $this->settingTemporaryMountPoint($set);
                        } else {        // Clear:
                                $this->settingTemporaryMountPoint(0);
@@ -336,11 +340,11 @@ class SC_alt_db_navframe {
                }
 
                        // Getting temporary mount point ID:
-               $temporaryMountPoint = intval($BE_USER->getSessionData('pageTree_temporaryMountPoint'));
+               $temporaryMountPoint = intval($GLOBALS['BE_USER']->getSessionData('pageTree_temporaryMountPoint'));
 
                        // If mount point ID existed and is within users real mount points, then set it temporarily:
-               if ($temporaryMountPoint > 0 && $BE_USER->isInWebMount($temporaryMountPoint))   {
-                       if ($this->active_tempMountPoint = t3lib_BEfunc::readPageAccess($temporaryMountPoint, $BE_USER->getPagePermsClause(1))) {
+               if ($temporaryMountPoint > 0 && $GLOBALS['BE_USER']->isInWebMount($temporaryMountPoint)) {
+                       if ($this->active_tempMountPoint = t3lib_BEfunc::readPageAccess($temporaryMountPoint, $GLOBALS['BE_USER']->getPagePermsClause(1))) {
                                $this->pagetree->MOUNTS = array($temporaryMountPoint);
                        }
                        else {
@@ -373,12 +377,10 @@ class SC_alt_db_navframe {
         * Called by typo3/ajax.php
         *
         * @param       array           $params: additional parameters (not used here)
-        * @param       TYPO3AJAX       &$ajaxObj: reference of the TYPO3AJAX object of this request
+        * @param       TYPO3AJAX       $ajaxObj: The TYPO3AJAX object of this request
         * @return      void
         */
-       public function ajaxExpandCollapse($params, &$ajaxObj) {
-               global $LANG;
-
+       public function ajaxExpandCollapse($params, $ajaxObj) {
                $this->init();
                $tree = $this->pagetree->getBrowsableTree();
                if (!$this->pagetree->ajaxStatus) {
@@ -390,9 +392,9 @@ class SC_alt_db_navframe {
 }
 
 
-// Include extension?
-if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/alt_db_navframe.php'])      {
-       include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/alt_db_navframe.php']);
+
+if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['typo3/alt_db_navframe.php'])) {
+       include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['typo3/alt_db_navframe.php']);
 }
 
 
@@ -405,4 +407,4 @@ if (!(TYPO3_REQUESTTYPE & TYPO3_REQUESTTYPE_AJAX)) {
        $SOBE->printContent();
 }
 
-?>
+?>
\ No newline at end of file