Added feature #9109: Enable altMountPoints feature in RTE element browser (Thanks...
authorStanislas Rolland <typo3@sjbr.ca>
Sat, 16 Aug 2008 16:15:49 +0000 (16:15 +0000)
committerStanislas Rolland <typo3@sjbr.ca>
Sat, 16 Aug 2008 16:15:49 +0000 (16:15 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@3981 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
typo3/browse_links.php
typo3/sysext/rtehtmlarea/ChangeLog
typo3/sysext/rtehtmlarea/mod3/browse_links.php
typo3/sysext/rtehtmlarea/mod3/class.tx_rtehtmlarea_browse_links.php
typo3/sysext/rtehtmlarea/mod4/select_image.php

index 51c99d7..b38df5e 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2008-08-16  Stanislas Rolland  <typo3@sjbr.ca>
+
+       * Added feature #9109: Enable altMountPoints feature in RTE element browser (Thanks to Steffen Kamper)
+
 2008-08-15  Benjamin Mack  <benni@typo3.org>
 
        * Fixed bug #6574: Template nextlevel with size=3 & allowed = 1 (Thanks to Georg Ringer)
index 173c6c3..a834a03 100755 (executable)
@@ -132,10 +132,39 @@ 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();
+                                       $browser_readOnly = true;
+                               }
+                       break;
+                       case 'file':
+                       case 'filedrag':
+                       case 'folder':
+                                       // Setting alternative browsing mounts (ONLY local to browse_links.php this script so they stay "read-only")
+                               $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, 0);
+                                       }
+                                       $GLOBALS['FILEMOUNTS'] = $GLOBALS['BE_USER']->returnFilemounts();
+                                       $browser_readOnly = true;
+                               }
+                       break;
+               }
+                       
+                       
                        // render type by user func
                $browserRendered = false;
                if (is_array ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/browse_links.php']['browserRendering'])) {
@@ -156,40 +185,15 @@ class SC_browse_links {
 
                        $this->browser = t3lib_div::makeInstance('browse_links');
                        $this->browser->init();
-
-                       $modData = $BE_USER->getModuleData('browse_links.php','ses');
+                       if ($browser_readOnly) {
+                               $this->browser->readOnly = true;        
+                       }
+                       $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)     {
-                               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)    {
-                                               $BE_USER->groupData['webmounts'] = implode(',',array_unique(t3lib_div::intExplode(',',$altMountPoints)));
-                                               $GLOBALS['WEBMOUNTS'] = $BE_USER->returnWebmounts();
-                                               $this->browser->readOnly = TRUE;
-                                       }
-                               break;
-                               case 'file':
-                               case 'filedrag':
-                               case 'folder':
-                                               // Setting alternative browsing mounts (ONLY local to browse_links.php this script so they stay "read-only")
-                                       $altMountPoints = trim($GLOBALS['BE_USER']->getTSConfigVal('options.folderTree.altElementBrowserMountPoints'));
-                                       if ($altMountPoints)    {
-                                               $altMountPoints = t3lib_div::trimExplode(',',$altMountPoints);
-                                               foreach($altMountPoints as $filePathRelativeToFileadmindir)     {
-                                                       $BE_USER->addFileMount('', $filePathRelativeToFileadmindir, $filePathRelativeToFileadmindir, 1,0);
-                                               }
-                                               $GLOBALS['FILEMOUNTS'] = $BE_USER->returnFilemounts();
-                                               $this->browser->readOnly = TRUE;
-                                       }
-                               break;
-                       }
+                       
 
 
                                // Output the correct content according to $this->mode
index 2a5fedf..be1607a 100644 (file)
@@ -1,3 +1,7 @@
+2008-08-16  Stanislas Rolland  <typo3@sjbr.ca>
+
+       * Added feature #9109: Enable altMountPoints feature in RTE element browser (Thanks to Steffen Kamper)
+
 2008-08-12  Stanislas Rolland  <typo3@sjbr.ca>
 
        * Fixed bug #8988: htmlArea RTE: Pasting text from MS Word to Firefox 3 brings a lot of garbage
index 0b66bbe..a92210a 100644 (file)
@@ -73,6 +73,25 @@ class tx_rtehtmlarea_SC_browse_links {
 
                $this->content = '';
 
+               //altMountPoints
+               $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();
+                       $browser_readOnly = true;
+               }
+                       
+                       // Setting alternative browsing mounts (ONLY local to browse_links.php this script so they stay "read-only")
+               $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, 0);
+                       }
+                       $GLOBALS['FILEMOUNTS'] = $GLOBALS['BE_USER']->returnFilemounts();
+                       $browser_readOnly = true;
+               }
+                       
                        // render type by user func
                $browserRendered = false;
                if (is_array ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/browse_links.php']['browserRendering'])) {
@@ -93,11 +112,17 @@ class tx_rtehtmlarea_SC_browse_links {
 
                        $SOBE->browser = t3lib_div::makeInstance('tx_rtehtmlarea_browse_links');
                        $SOBE->browser->init();
-
+                       if ($browser_readOnly) {
+                               $SOBE->browser->readOnly = true;        
+                       }
+                       
                        $modData = $BE_USER->getModuleData('browse_links.php','ses');
                        list($modData, $store) = $SOBE->browser->processSessionData($modData);
                        $BE_USER->pushModuleData('browse_links.php',$modData);
-
+                       
+                       
+                       
+                       
                                                        // Output the correct content according to $this->mode
                        switch((string)$this->mode)     {
                                case 'rte':
@@ -137,4 +162,4 @@ if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/rtehtml
 $SOBE = t3lib_div::makeInstance('tx_rtehtmlarea_SC_browse_links');
 $SOBE->main();
 $SOBE->printContent();
-?>
\ No newline at end of file
+?>
index 6cfa23a..8ff70a5 100644 (file)
@@ -209,13 +209,13 @@ class tx_rtehtmlarea_browse_links extends browse_links {
 
        var $editorNo;
        var $buttonConfig = array();
-
+       
        public $anchorTypes = array( 'page', 'url', 'file', 'mail', 'spec');
        protected $classesAnchorDefault = array();
        protected $classesAnchorDefaultTitle = array();
        protected $classesAnchorDefaultTarget = array();
        protected $classesAnchorJSOptions = array();
-       public $allowedItems;
+       public $allowedItems;    
 
        /**
         * Constructor:
@@ -718,7 +718,7 @@ class tx_rtehtmlarea_browse_links extends browse_links {
                        break;
                        case 'file':
                                $content.=$this->addAttributesForm();
-
+                               
                                $foldertree = t3lib_div::makeInstance('tx_rtehtmlarea_folderTree');
                                $tree=$foldertree->getBrowsableTree();
 
@@ -742,7 +742,7 @@ class tx_rtehtmlarea_browse_links extends browse_links {
                                        if (!$path || !@is_dir($path))  {
                                                $path = $fileProcessor->findTempFolder().'/';   // The closest TEMP-path is found
                                        }
-                                       if ($path!='/' && @is_dir($path))       {
+                                       if ($path!='/' && @is_dir($path) && !$this->readOnly && count($GLOBALS['FILEMOUNTS']))  { 
                                                $uploadForm=$this->uploadForm($path);
                                                $createFolder=$this->createFolder($path);
                                        } else {
@@ -755,6 +755,8 @@ class tx_rtehtmlarea_browse_links extends browse_links {
                                        }
                                }
 
+                               
+                               
                                $content.= '
                        <!--
                        Wrapper table for folder tree / file list:
index c0ad48c..60147ec 100644 (file)
@@ -71,6 +71,17 @@ class tx_rtehtmlarea_SC_select_image {
 
                $this->content = '';
 
+               // Setting alternative browsing mounts (ONLY local to browse_links.php this script so they stay "read-only")
+               $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, 0);
+                       }
+                       $GLOBALS['FILEMOUNTS'] = $GLOBALS['BE_USER']->returnFilemounts();
+                       $browser_readOnly = true;
+               }
+               
                        // render type by user func
                $browserRendered = false;
                if (is_array ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/browse_links.php']['browserRendering'])) {
@@ -91,7 +102,9 @@ class tx_rtehtmlarea_SC_select_image {
 
                        $SOBE->browser = t3lib_div::makeInstance('tx_rtehtmlarea_select_image');
                        $SOBE->browser->init();
-
+                       if ($browser_readOnly) {
+                               $SOBE->browser->readOnly = true;
+                       }
                        $modData = $BE_USER->getModuleData('select_image.php','ses');
                        list($modData, $store) = $SOBE->browser->processSessionData($modData);
                        $BE_USER->pushModuleData('select_image.php',$modData);
@@ -120,4 +133,4 @@ $SOBE = t3lib_div::makeInstance('tx_rtehtmlarea_SC_select_image');
 $SOBE->main();
 $SOBE->printContent();
 
-?>
\ No newline at end of file
+?>