Updated locallang-XML files with most recent translations.
[Packages/TYPO3.CMS.git] / typo3 / alt_db_navframe.php
index 68299a2..fd65d40 100755 (executable)
@@ -2,7 +2,7 @@
 /***************************************************************
 *  Copyright notice
 *
-*  (c) 1999-2004 Kasper Skaarhoj (kasper@typo3.com)
+*  (c) 1999-2004 Kasper Skaarhoj (kasperYYYY@typo3.com)
 *  All rights reserved
 *
 *  This script is part of the TYPO3 project. The TYPO3 project is
  * Revised for TYPO3 3.6 2/2003 by Kasper Skaarhoj
  * XHTML compliant
  *
- * @author     Kasper Skaarhoj <kasper@typo3.com>
+ * @author     Kasper Skaarhoj <kasperYYYY@typo3.com>
  */
 /**
  * [CLASS/FUNCTION INDEX of SCRIPT]
  *
  *
  *
- *   72: class localPageTree extends t3lib_browseTree
- *   79:     function localPageTree()
- *   90:     function wrapIcon($icon,&$row)
+ *   77: class localPageTree extends t3lib_browseTree
+ *   87:     function localPageTree()
+ *   98:     function wrapIcon($icon,&$row)
+ *  136:     function wrapStop($str,$row)
  *
  *
- *  131: class SC_alt_db_navframe
- *  147:     function init()
- *  235:     function main()
- *  263:     function printContent()
+ *  162: class SC_alt_db_navframe
+ *  180:     function init()
+ *  276:     function main()
+ *  327:     function printContent()
  *
- * TOTAL FUNCTIONS: 5
+ *              SECTION: Temporary DB mounts
+ *  354:     function initializeTemporaryDBmount()
+ *  383:     function settingTemporaryMountPoint($pageId)
+ *
+ * TOTAL FUNCTIONS: 8
  * (This index is automatically created/updated by the extension "extdeveval")
  *
  */
 
 
 $BACK_PATH='';
-require ('init.php');
-require ('template.php');
-require_once (PATH_t3lib.'class.t3lib_browsetree.php');
+require('init.php');
+require('template.php');
+require_once(PATH_t3lib.'class.t3lib_browsetree.php');
 
 
 
 /**
  * Extension class for the t3lib_browsetree class, specially made for browsing pages in the Web module
  *
- * @author     Kasper Skaarhoj <kasper@typo3.com>
+ * @author     Kasper Skaarhoj <kasperYYYY@typo3.com>
  * @package TYPO3
  * @subpackage core
  * @see class t3lib_browseTree
@@ -97,16 +102,16 @@ class localPageTree extends t3lib_browseTree {
                        $lockIcon='<a href="#" onclick="'.htmlspecialchars($aOnClick).'">'.
                                '<img'.t3lib_iconWorks::skinImg('','gfx/recordlock_warning3.gif','width="17" height="12"').' title="'.htmlspecialchars($lockInfo['msg']).'" alt="" />'.
                                '</a>';
-               } else $lockIcon="";
+               } else $lockIcon = '';
 
                        // Add title attribute to input icon tag
                $thePageIcon = $this->addTagAttributes($icon, $this->titleAttrib.'="'.$this->getTitleAttrib($row).'"');
 
                        // Wrap icon in click-menu link.
                if (!$this->ext_IconMode)       {
-                       $thePageIcon = $GLOBALS['TBE_TEMPLATE']->wrapClickMenuOnIcon($thePageIcon,'pages',$row['uid'],0);
+                       $thePageIcon = $GLOBALS['TBE_TEMPLATE']->wrapClickMenuOnIcon($thePageIcon,'pages',$row['uid'],0,'&bank='.$this->bank);
                } elseif (!strcmp($this->ext_IconMode,'titlelink'))     {
-                       $aOnClick = 'return jumpTo('.$this->getJumpToParm($row).',this,\''.$this->treeName.'\');';
+                       $aOnClick = 'return jumpTo(\''.$this->getJumpToParam($row).'\',this,\''.$this->treeName.'\');';
                        $thePageIcon='<a href="#" onclick="'.htmlspecialchars($aOnClick).'">'.$thePageIcon.'</a>';
                }
 
@@ -119,6 +124,21 @@ class localPageTree extends t3lib_browseTree {
 
                return $thePageIcon.$lockIcon.$pageIdStr;
        }
+
+       /**
+        * Adds a red "+" to the input string, $str, if the field "php_tree_stop" in the $row (pages) is set
+        *
+        * @param       string          Input string, like a page title for the tree
+        * @param       array           record row with "php_tree_stop" field
+        * @return      string          Modified string
+        * @access private
+        */
+       function wrapStop($str,$row)    {
+               if ($row['php_tree_stop'])      {
+                       $str.='<a href="'.htmlspecialchars(t3lib_div::linkThisScript(array('setTempDBmount' => $row['uid']))).'" class="typo3-red">+</a> ';
+               }
+               return $str;
+       }
 }
 
 
@@ -135,7 +155,7 @@ class localPageTree extends t3lib_browseTree {
 /**
  * Main script class for the page tree navigation frame
  *
- * @author     Kasper Skaarhoj <kasper@typo3.com>
+ * @author     Kasper Skaarhoj <kasperYYYY@typo3.com>
  * @package TYPO3
  * @subpackage core
  */
@@ -145,10 +165,12 @@ class SC_alt_db_navframe {
        var $content;
        var $pagetree;
        var $doc;
+       var $active_tempMountPoint = 0;         // Temporary mount point (record), if any
 
                // Internal, static: GPvar:
        var $currentSubScript;
        var $cMR;
+       var $setTempDBmount;                    // If not '' (blank) then it will clear (0) or set (>0) Temporary DB mount.
 
        /**
         * Initialiation of the class
@@ -161,6 +183,7 @@ class SC_alt_db_navframe {
                        // Setting GPvars:
                $this->currentSubScript = t3lib_div::_GP('currentSubScript');
                $this->cMR = t3lib_div::_GP('cMR');
+               $this->setTempDBmount = t3lib_div::_GP('setTempDBmount');
 
                        // Create page tree object:
                $this->pagetree = t3lib_div::makeInstance('localPageTree');
@@ -172,8 +195,13 @@ class SC_alt_db_navframe {
                $this->pagetree->addField('shortcut_mode');
                $this->pagetree->addField('mount_pid');
                $this->pagetree->addField('mount_pid_ol');
+               $this->pagetree->addField('nav_hide');
                $this->pagetree->addField('url');
 
+#              $this->settingTemporaryMountPoint(11);
+                       // Temporary DB mounts:
+               $this->initializeTemporaryDBmount();
+
                        // Setting highlight mode:
                $this->doHighlight = !$BE_USER->getTSConfigVal('options.pageTree.disableTitleHighlight');
 
@@ -236,7 +264,7 @@ class SC_alt_db_navframe {
                        // Click menu code is added:
                $CMparts=$this->doc->getContextMenuCode();
                $this->doc->bodyTagAdditions = $CMparts[1];
-               $this->doc->JScode.=$CMparts[0];
+               $this->doc->JScode.= $CMparts[0];
                $this->doc->postCode.= $CMparts[2];
        }
 
@@ -251,17 +279,40 @@ class SC_alt_db_navframe {
                        // Produce browse-tree:
                $tree = $this->pagetree->getBrowsableTree();
 
-               $this->content='';
-               $this->content.=$this->doc->startPage('Page tree');
-               $this->content.=$tree;
-               $this->content.='
+                       // Start page:
+               $this->content = '';
+               $this->content.= $this->doc->startPage('Page tree');
+
+                       // 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.php:labels.temporaryDBmount',1).
+                                       '</a><br/>
+                                       '.$LANG->sl('LLL:EXT:lang/locallang_core.php:labels.path',1).': <span title="'.htmlspecialchars($this->active_tempMountPoint['_thePathFull']).'">'.htmlspecialchars(t3lib_div::fixed_lgd_cs($this->active_tempMountPoint['_thePath'],-50)).'</span>
+                               </div>
+                       ';
+               }
+
+                       // Outputting page tree:
+               $this->content.= $tree;
+
+                       // Outputting refresh-link
+               $refreshUrl = t3lib_div::getIndpEnv('REQUEST_URI');
+               $this->content.= '
                        <p class="c-refresh">
-                               <a href="'.htmlspecialchars(t3lib_div::getIndpEnv('REQUEST_URI')).'">'.
+                               <a href="'.htmlspecialchars($refreshUrl).'">'.
                                '<img'.t3lib_iconWorks::skinImg('','gfx/refresh_n.gif','width="14" height="14"').' title="'.$LANG->sL('LLL:EXT:lang/locallang_core.php:labels.refresh',1).'" alt="" />'.
+                               '</a><a href="'.htmlspecialchars($refreshUrl).'">'.
                                $LANG->sL('LLL:EXT:lang/locallang_core.php:labels.refresh',1).'</a>
                        </p>
                        <br />';
 
+                       // CSH icon:
+               $this->content.= t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'pagetree', $GLOBALS['BACK_PATH']);
+
                        // Adding highlight - JavaScript
                if ($this->doHighlight) $this->content .=$this->doc->wrapScriptTags('
                        hilight_row("",top.fsMod.navFrameHighlightedID["web"]);
@@ -277,6 +328,64 @@ class SC_alt_db_navframe {
                $this->content.= $this->doc->endPage();
                echo $this->content;
        }
+
+
+
+
+
+
+
+
+
+
+
+
+       /**********************************
+        *
+        * Temporary DB mounts
+        *
+        **********************************/
+
+       /**
+        * Getting temporary DB mount
+        *
+        * @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...:
+                               $this->settingTemporaryMountPoint($set);
+                       } else {        // Clear:
+                               $this->settingTemporaryMountPoint(0);
+                       }
+               }
+
+                       // Getting temporary mount point ID:
+               $temporaryMountPoint = intval($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))   {
+                       $this->pagetree->MOUNTS = array($temporaryMountPoint);
+                       $this->active_tempMountPoint = t3lib_BEfunc::readPageAccess($temporaryMountPoint, $BE_USER->getPagePermsClause(1));
+               }
+       }
+
+       /**
+        * Setting temporary page id as DB mount
+        *
+        * @param       integer         The page id to set as DB mount
+        * @return      void
+        */
+       function settingTemporaryMountPoint($pageId)    {
+               global $BE_USER;
+
+                       // Setting temporary mount point ID:
+               $BE_USER->setAndSaveSessionData('pageTree_temporaryMountPoint',intval($pageId));
+       }
 }
 
 // Include extension?
@@ -301,4 +410,4 @@ $SOBE->init();
 $SOBE->main();
 $SOBE->printContent();
 
-?>
+?>
\ No newline at end of file