Fixed bug #1044: Indexed Search results always on same page as search
[Packages/TYPO3.CMS.git] / typo3 / browse_links.php
old mode 100755 (executable)
new mode 100644 (file)
index 4eeea49..6c13a55
@@ -2,7 +2,7 @@
 /***************************************************************
 *  Copyright notice
 *
-*  (c) 1999-2005 Kasper Skaarhoj (kasperYYYY@typo3.com)
+*  (c) 1999-2009 Kasper Skaarhoj (kasperYYYY@typo3.com)
 *  All rights reserved
 *
 *  This script is part of the TYPO3 project. The TYPO3 project is
@@ -89,10 +89,10 @@ class SC_browse_links {
         * @see main()
         */
        var $mode;
-       
+
        /**
         * holds Instance of main browse_links class
-        * needed fo intercommunication between various classes that need access to variables via $GLOBALS['SOBE'] 
+        * needed fo intercommunication between various classes that need access to variables via $GLOBALS['SOBE']
         * Not the most nice solution but introduced since we don't have another general way to return class-instances or registry for now
         *
         * @var browse_links
@@ -122,7 +122,6 @@ class SC_browse_links {
                        // Creating backend template object:
                        // this might not be needed but some classes refer to $GLOBALS['SOBE']->doc, so ...
                $this->doc = t3lib_div::makeInstance('template');
-               $this->doc->docType= 'xhtml_trans';
                $this->doc->backPath = $GLOBALS['BACK_PATH'];
        }
 
@@ -133,18 +132,44 @@ class SC_browse_links {
         * @return      void
         */
        function main() {
-               global $BE_USER, $BACK_PATH;
 
                $this->content = '';
 
+                       // look for alternativ mountpoints
+               switch((string)$this->mode)     {
+                       case 'rte':
+                       case 'db':
+                       case 'wizard':
+                                       // Setting alternative browsing mounts (ONLY local to browse_links.php this script so they stay "read-only")
+                               $altMountPoints = trim($GLOBALS['BE_USER']->getTSConfigVal('options.pageTree.altElementBrowserMountPoints'));
+                               if ($altMountPoints) {
+                                       $GLOBALS['BE_USER']->groupData['webmounts'] = implode(',', array_unique(t3lib_div::intExplode(',', $altMountPoints)));
+                                       $GLOBALS['WEBMOUNTS'] = $GLOBALS['BE_USER']->returnWebmounts();
+                               }
+                       case 'file':
+                       case 'filedrag':
+                       case 'folder':
+                                       // Setting additional read-only browsing file mounts
+                               $altMountPoints = trim($GLOBALS['BE_USER']->getTSConfigVal('options.folderTree.altElementBrowserMountPoints'));
+                               if ($altMountPoints) {
+                                       $altMountPoints = t3lib_div::trimExplode(',', $altMountPoints);
+                                       foreach($altMountPoints as $filePathRelativeToFileadmindir)     {
+                                               $GLOBALS['BE_USER']->addFileMount('', $filePathRelativeToFileadmindir, $filePathRelativeToFileadmindir, 1, 'readonly');
+                                       }
+                                       $GLOBALS['FILEMOUNTS'] = $GLOBALS['BE_USER']->returnFilemounts();
+                               }
+                               break;
+               }
+
+
                        // render type by user func
                $browserRendered = false;
                if (is_array ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/browse_links.php']['browserRendering'])) {
                        foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/browse_links.php']['browserRendering'] as $classRef) {
                                $browserRenderObj = t3lib_div::getUserObj($classRef);
-                               if(is_object($browserRenderObj) && method_exists($browserRenderObj, 'isValid') && method_exists($browserRenderObj, 'render'))   {
+                               if (is_object($browserRenderObj) && method_exists($browserRenderObj, 'isValid') && method_exists($browserRenderObj, 'render')) {
                                        if ($browserRenderObj->isValid($this->mode, $this)) {
-                                               $this->content .=  $browserRenderObj->render($this->mode, $this);
+                                               $this->content.= $browserRenderObj->render($this->mode, $this);
                                                $browserRendered = true;
                                                break;
                                        }
@@ -154,13 +179,11 @@ class SC_browse_links {
 
                        // if type was not rendered use default rendering functions
                if(!$browserRendered) {
-
                        $this->browser = t3lib_div::makeInstance('browse_links');
                        $this->browser->init();
-
-                       $modData = $BE_USER->getModuleData('browse_links.php','ses');
+                       $modData = $GLOBALS['BE_USER']->getModuleData('browse_links.php', 'ses');
                        list($modData, $store) = $this->browser->processSessionData($modData);
-                       $BE_USER->pushModuleData('browse_links.php',$modData);
+                       $GLOBALS['BE_USER']->pushModuleData('browse_links.php', $modData);
 
                                // Output the correct content according to $this->mode
                        switch((string)$this->mode)     {
@@ -174,6 +197,9 @@ class SC_browse_links {
                                case 'filedrag':
                                        $this->content = $this->browser->main_file();
                                break;
+                               case 'folder':
+                                       $this->content = $this->browser->main_folder();
+                               break;
                                case 'wizard':
                                        $this->content = $this->browser->main_rte(1);
                                break;
@@ -194,21 +220,17 @@ class SC_browse_links {
 }
 
 
-// Include extension?
+
 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/browse_links.php']) {
        include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/browse_links.php']);
 }
 
 
 
-
-
-
-
-
 // Make instance:
 $SOBE = t3lib_div::makeInstance('SC_browse_links');
 $SOBE->init();
 $SOBE->main();
 $SOBE->printContent();
+
 ?>
\ No newline at end of file