Fixed bug #9320: Adding a new mount-type "readonly" for temporary filemounts (thanks...
authorStanislas Rolland <typo3@sjbr.ca>
Fri, 19 Sep 2008 05:58:43 +0000 (05:58 +0000)
committerStanislas Rolland <typo3@sjbr.ca>
Fri, 19 Sep 2008 05:58:43 +0000 (05:58 +0000)
Added feature #8899: Configuration of uploads and create folder in linkbrowser (thanks to Steffen Kamper and Dmitry Dulepov)

git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@4153 709f56b5-9817-0410-a4d7-c38de5d9e867

13 files changed:
ChangeLog
t3lib/class.t3lib_foldertree.php
typo3/browse_links.php
typo3/class.browse_links.php
typo3/class.filelistfoldertree.php
typo3/gfx/i/_icon_ftp_readonly.gif [new file with mode: 0644]
typo3/sysext/rtehtmlarea/mod3/browse_links.php
typo3/sysext/rtehtmlarea/mod3/class.tx_rtehtmlarea_browse_links.php
typo3/sysext/rtehtmlarea/mod3/class.tx_rtehtmlarea_dam_browse_links.php
typo3/sysext/rtehtmlarea/mod4/class.tx_rtehtmlarea_dam_browse_media.php
typo3/sysext/rtehtmlarea/mod4/class.tx_rtehtmlarea_select_image.php
typo3/sysext/rtehtmlarea/mod4/select_image.php
typo3/sysext/t3skin/icons/gfx/i/_icon_ftp_readonly.gif [new file with mode: 0644]

index 9ea068e..328e159 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -6,6 +6,8 @@
 2008-09-18  Stanislas Rolland  <typo3@sjbr.ca>
 
        * Fixed bug #9331: htmlArea RTE Acronym feature: List of unabridged terms shows wrong values
+       * Fixed bug #9320: Adding a new mount-type "readonly" for temporary filemounts (thanks to Steffen Kamper)
+       * Added feature #8899: Configuration of uploads and create folder in linkbrowser (thanks to Steffen Kamper and Dmitry Dulepov)
 
 2008-09-18  Dmitry Dulepov  <dmitry@typo3.org>
 
index f089a35..6ea0769 100755 (executable)
@@ -199,10 +199,19 @@ class t3lib_folderTree extends t3lib_treeView  {
                        $icon='<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/ol/'.($isOpen?'minus':'plus').'only.gif','width="18" height="16"').' alt="" />';
                        $firstHtml= $this->PM_ATagWrap($icon,$cmd);
 
-                       switch($val['type'])    {
-                               case 'user':    $icon = 'gfx/i/_icon_ftp_user.gif';     break;
-                               case 'group':   $icon = 'gfx/i/_icon_ftp_group.gif'; break;
-                               default:                $icon = 'gfx/i/_icon_ftp.gif'; break;
+                       switch ($val['type']) {
+                               case 'user':
+                                       $icon = 'gfx/i/_icon_ftp_user.gif';
+                                       break;
+                               case 'group':
+                                       $icon = 'gfx/i/_icon_ftp_group.gif';
+                                       break;
+                               case 'readonly':
+                                       $icon = 'gfx/i/_icon_ftp_readonly.gif';
+                                       break;
+                               default:
+                                       $icon = 'gfx/i/_icon_ftp.gif';
+                                       break;
                        }
 
                                // Preparing rootRec for the mount
@@ -219,7 +228,7 @@ class t3lib_folderTree extends t3lib_treeView  {
                        if ($isOpen)    {
                                        // Set depth:
                                $depthD='<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/ol/blank.gif','width="18" height="16"').' alt="" />';
-                               $this->getFolderTree($val['path'],999,$depthD);
+                               $this->getFolderTree($val['path'], 999, $depthD, $val['type']);
                        }
 
                                // Add tree:
@@ -237,7 +246,7 @@ class t3lib_folderTree extends t3lib_treeView  {
         * @return      integer         The count of items on the level
         * @see getBrowsableTree()
         */
-       function getFolderTree($files_path, $depth=999, $depthData='' {
+       function getFolderTree($files_path, $depth=999, $depthData='', $type='') {
 
                        // This generates the directory tree
                $dirs = t3lib_div::get_dirs($files_path);
@@ -274,7 +283,8 @@ class t3lib_folderTree extends t3lib_treeView  {
                                        $nextCount=$this->getFolderTree(
                                                $path,
                                                $depth-1,
-                                               $this->makeHTML ? $depthData.'<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/ol/'.$LN.'.gif','width="18" height="16"').' alt="" />' : ''
+                                               $this->makeHTML ? $depthData.'<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/ol/'.$LN.'.gif','width="18" height="16"').' alt="" />' : '',
+                                               $type
                                        );
                                        $exp=1;         // Set "did expand" flag
                                } else {
@@ -286,7 +296,7 @@ class t3lib_folderTree extends t3lib_treeView  {
                                if ($this->makeHTML)    {
                                        $HTML=$depthData.$this->PMicon($row,$a,$c,$nextCount,$exp);
 
-                                       $icon = 'gfx/i/_icon_'.$webpath.'folders.gif';
+                                       $icon = 'gfx/i/_icon_' .$webpath . 'folders' . ($type == 'readonly' ? '_ro' : '') . '.gif';
                                        if ($val=='_temp_')     {
                                                $icon = 'gfx/i/sysf.gif';
                                                $row['title']='TEMP';
@@ -365,4 +375,4 @@ class t3lib_folderTree extends t3lib_treeView  {
 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/class.t3lib_foldertree.php'])       {
        include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/class.t3lib_foldertree.php']);
 }
-?>
\ No newline at end of file
+?>
index a834a03..4470722 100755 (executable)
@@ -145,23 +145,20 @@ class SC_browse_links {
                                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")
+                                       // 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, 0);
+                                               $GLOBALS['BE_USER']->addFileMount('', $filePathRelativeToFileadmindir, $filePathRelativeToFileadmindir, 1, 'readonly');
                                        }
                                        $GLOBALS['FILEMOUNTS'] = $GLOBALS['BE_USER']->returnFilemounts();
-                                       $browser_readOnly = true;
                                }
-                       break;
+                               break;
                }
                        
                        
@@ -182,20 +179,12 @@ 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();
-                       if ($browser_readOnly) {
-                               $this->browser->readOnly = true;        
-                       }
                        $modData = $GLOBALS['BE_USER']->getModuleData('browse_links.php', 'ses');
                        list($modData, $store) = $this->browser->processSessionData($modData);
                        $GLOBALS['BE_USER']->pushModuleData('browse_links.php', $modData);
 
-
-                       
-
-
                                // Output the correct content according to $this->mode
                        switch((string)$this->mode)     {
                                case 'rte':
index 4517b57..21f61d5 100755 (executable)
@@ -761,7 +761,10 @@ class browse_links {
        protected $hookObjects = array();
 
 
-       var     $readOnly = FALSE;      // If set, all operations that changes something should be disabled. This is used for alternativeBrowsing file mounts (see options like "options.folderTree.altElementBrowserMountPoints" in browse_links.php).
+       /**
+        * object for t3lib_basicFileFunctions
+        */
+       public $fileProcessor;
 
 
        /**
@@ -809,7 +812,12 @@ class browse_links {
 
                        // the script to link to
                $this->thisScript = t3lib_div::getIndpEnv('SCRIPT_NAME');
-
+                       
+                       // init fileProcessor
+               $this->fileProcessor = t3lib_div::makeInstance('t3lib_basicFileFunctions');
+               $this->fileProcessor->init($GLOBALS['FILEMOUNTS'], $GLOBALS['TYPO3_CONF_VARS']['BE']['fileExtensions']);
+               
+               
                        // CurrentUrl - the current link url must be passed around if it exists
                if ($this->mode == 'wizard')    {
                        $currentLinkParts = t3lib_div::trimExplode(' ',$this->P['currentValue']);
@@ -1610,13 +1618,12 @@ class browse_links {
                $pArr = explode('|',$this->bparams);
 
                        // Create upload/create folder forms, if a path is given:
-               $fileProcessor = t3lib_div::makeInstance('t3lib_basicFileFunctions');
-               $fileProcessor->init($GLOBALS['FILEMOUNTS'], $GLOBALS['TYPO3_CONF_VARS']['BE']['fileExtensions']);
                $path=$this->expandFolder;
                if (!$path || !@is_dir($path))  {
-                       $path = $fileProcessor->findTempFolder().'/';   // The closest TEMP-path is found
+                               // The closest TEMP-path is found
+                       $path = $this->fileProcessor->findTempFolder().'/';
                }
-               if ($path!='/' && @is_dir($path) && !$this->readOnly && count($GLOBALS['FILEMOUNTS']))  {
+               if ($path!='/' && @is_dir($path)) {
                        $uploadForm=$this->uploadForm($path);
                        $createFolder=$this->createFolder($path);
                } else {
@@ -1699,18 +1706,13 @@ class browse_links {
                        // Init variable:
                $parameters = explode('|', $this->bparams);
 
-                       // Create upload/create folder forms, if a path is given:
-               $fileProcessor = t3lib_div::makeInstance('t3lib_basicFileFunctions');
-               $fileProcessor->init(
-                       $GLOBALS['FILEMOUNTS'],
-                       $GLOBALS['TYPO3_CONF_VARS']['BE']['fileExtensions']
-               );
-
+               
                $path = $this->expandFolder;
-               if(!$path || !@is_dir($path)) {
-                       $path = $fileProcessor->findTempFolder().'/';   // The closest TEMP-path is found
+               if (!$path || !@is_dir($path)) {
+                               // The closest TEMP-path is found
+                       $path = $this->fileProcessor->findTempFolder().'/';
                }
-               if($path != '/' && @is_dir($path)) {
+               if ($path != '/' && @is_dir($path)) {
                        $createFolder = $this->createFolder($path);
                } else {
                        $createFolder='';
@@ -1933,7 +1935,7 @@ class browse_links {
                                //      Add the HTML for the record list to output variable:
                        $out.=$dblist->HTMLcode;
 
-                               // Add support for fieldselectbox in singleTableMode
+                               // Add support for fieldselectbox in singleTableMode
                        if ($dblist->table) {
                                $out.= $dblist->fieldSelectBox($dblist->table);
                        }
@@ -2228,7 +2230,7 @@ class browse_links {
                return $out;
        }
 
-       /**
+       /**
         * Render list of folders.
         *
         * @param       array           List of folders. See t3lib_div::get_dirs
@@ -2379,7 +2381,7 @@ class browse_links {
                                                        <td colspan="2">'.$this->getMsgBox($GLOBALS['LANG']->getLL('findDragDrop')).'</td>
                                                </tr>';
 
-                                               // Fraverse files:
+                                               // Traverse files:
                                        while(list(,$filepath)=each($files))    {
                                                $fI = pathinfo($filepath);
 
@@ -2492,10 +2494,17 @@ class browse_links {
         * @return      boolean         If the input path is found in the backend users filemounts, then return true.
         */
        function checkFolder($folder)   {
-               $fileProcessor = t3lib_div::makeInstance('t3lib_basicFileFunctions');
-               $fileProcessor->init($GLOBALS['FILEMOUNTS'], $GLOBALS['TYPO3_CONF_VARS']['BE']['fileExtensions']);
+               return $this->fileProcessor->checkPathAgainstMounts(ereg_replace('\/$', '', $folder) . '/') ? true : false;
+       }
 
-               return $fileProcessor->checkPathAgainstMounts(ereg_replace('\/$','',$folder).'/') ? TRUE : FALSE;
+       /**
+        * Checks, if a path is within a read-only mountpoint of the backend user
+        *
+        * @param       string          Absolute filepath
+        * @return      boolean         If the input path is found in the backend users filemounts and if the filemount is of type readonly, then return true.
+        */
+       function isReadOnlyFolder($folder) {
+               return ($GLOBALS['FILEMOUNTS'][$this->fileProcessor->checkPathAgainstMounts(ereg_replace('\/$', '', $folder) . '/')]['type'] == 'readonly');
        }
 
        /**
@@ -2641,7 +2650,16 @@ class browse_links {
         */
        function uploadForm($path)      {
                global $BACK_PATH;
-               $count=3;
+               
+               if ($this->isReadOnlyFolder($path)) return '';
+
+                       // Read configuration of upload field count
+               $userSetting = $GLOBALS['BE_USER']->getTSConfigVal('options.fileTree.uploadFieldsInLinkBrowser');
+               $count = isset($userSetting) ? $userSetting : 3;
+               if ($count === '0') {
+                       return '';
+               }
+               $count = intval($count) == 0 ? 3 : intval($count);
 
                        // Create header, showing upload path:
                $header = t3lib_div::isFirstPartOfStr($path,PATH_site)?substr($path,strlen(PATH_site)):$path;
@@ -2695,6 +2713,13 @@ class browse_links {
         */
        function createFolder($path)    {
                global $BACK_PATH;
+               
+               if ($this->isReadOnlyFolder($path)) return '';
+               
+                       // Don't show Folder-create form if it's denied
+               if ($GLOBALS['BE_USER']->getTSConfigVal('options.fileTree.hideCreateFolder')) {
+                       return '';
+               }
                        // Create header, showing upload path:
                $header = t3lib_div::isFirstPartOfStr($path,PATH_site)?substr($path,strlen(PATH_site)):$path;
                $code=$this->barheader($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:file_newfolder.php.pagetitle').':');
index 818f510..a8b83a2 100755 (executable)
@@ -311,10 +311,19 @@ class filelistFolderTree extends t3lib_folderTree {
                        $icon='<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/ol/'.($isOpen?'minus':'plus').'only.gif').' alt="" />';
                        $firstHtml= $this->PM_ATagWrap($icon,$cmd);
 
-                       switch($val['type'])    {
-                               case 'user':    $icon = 'gfx/i/_icon_ftp_user.gif';     break;
-                               case 'group':   $icon = 'gfx/i/_icon_ftp_group.gif'; break;
-                               default:                $icon = 'gfx/i/_icon_ftp.gif'; break;
+                       switch ($val['type']) {
+                               case 'user':
+                                       $icon = 'gfx/i/_icon_ftp_user.gif';
+                                       break;
+                               case 'group':
+                                       $icon = 'gfx/i/_icon_ftp_group.gif';
+                                       break;
+                               case 'readonly':
+                                       $icon = 'gfx/i/_icon_ftp_readonly.gif';
+                                       break;
+                               default:
+                                       $icon = 'gfx/i/_icon_ftp.gif';
+                                       break;
                        }
 
                                // Preparing rootRec for the mount
@@ -329,7 +338,7 @@ class filelistFolderTree extends t3lib_folderTree {
 
                                // If the mount is expanded, go down:
                        if ($isOpen)
-                               $this->getFolderTree($val['path'], 999);
+                               $this->getFolderTree($val['path'], 999, $val['type']);
 
                                // Add tree:
                        $treeArr = array_merge($treeArr, $this->tree);
@@ -347,7 +356,7 @@ class filelistFolderTree extends t3lib_folderTree {
         * @return      integer         The count of items on the level
         * @see getBrowsableTree()
         */
-       function getFolderTree($files_path, $depth=999) {
+       function getFolderTree($files_path, $depth=999, $type='')       {
 
                        // This generates the directory tree
                $dirs = t3lib_div::get_dirs($files_path);
@@ -383,7 +392,8 @@ class filelistFolderTree extends t3lib_folderTree {
                                $nextCount = $this->getFolderTree(
                                        $path,
                                        $depth-1,
-                                       $this->makeHTML ? '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/ol/'.($a == $c ? 'blank' : 'line').'.gif','width="18" height="16"').' alt="" />' : ''
+                                       $this->makeHTML ? '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/ol/'.($a == $c ? 'blank' : 'line').'.gif','width="18" height="16"').' alt="" />' : '',
+                                       $type
                                );
                                $exp = 1;       // Set "did expand" flag
                        } else {
@@ -395,7 +405,7 @@ class filelistFolderTree extends t3lib_folderTree {
                        if ($this->makeHTML)    {
                                $HTML = $this->PMicon($row,$a,$c,$nextCount,$exp);
 
-                               $icon = 'gfx/i/_icon_'.t3lib_BEfunc::getPathType_web_nonweb($path).'folders.gif';
+                               $icon = 'gfx/i/_icon_' .$webpath . 'folders' . ($type == 'readonly' ? '_ro' : '') . '.gif';
                                if ($val == '_temp_')   {
                                        $icon = 'gfx/i/sysf.gif';
                                        $row['title']='TEMP';
diff --git a/typo3/gfx/i/_icon_ftp_readonly.gif b/typo3/gfx/i/_icon_ftp_readonly.gif
new file mode 100644 (file)
index 0000000..775d1e4
Binary files /dev/null and b/typo3/gfx/i/_icon_ftp_readonly.gif differ
index 3cbcae4..8217e47 100644 (file)
@@ -57,7 +57,6 @@ $LANG->includeLLFile('EXT:rtehtmlarea/htmlarea/locallang_dialogs.xml');
 class tx_rtehtmlarea_SC_browse_links {
        public $mode = 'rte';
        public $button = 'link';
-       public $readOnly = false;
        protected $content = '';
 
        /**
@@ -71,17 +70,15 @@ class tx_rtehtmlarea_SC_browse_links {
                if ($altMountPoints) {
                        $GLOBALS['BE_USER']->groupData['webmounts'] = implode(',', array_unique(t3lib_div::intExplode(',', $altMountPoints)));
                        $GLOBALS['WEBMOUNTS'] = $GLOBALS['BE_USER']->returnWebmounts();
-                       $this->readOnly = true;
                }
                        // Setting alternative file 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['BE_USER']->addFileMount('', $filePathRelativeToFileadmindir, $filePathRelativeToFileadmindir, 1, 'readonly');
                        }
                        $GLOBALS['FILEMOUNTS'] = $GLOBALS['BE_USER']->returnFilemounts();
-                       $this->readOnly = true;
                }
                        // Render type by user function
                $browserRendered = false;
@@ -90,7 +87,6 @@ class tx_rtehtmlarea_SC_browse_links {
                                $browserRenderObj = t3lib_div::getUserObj($classRef);
                                if (is_object($browserRenderObj) && method_exists($browserRenderObj, 'isValid') && method_exists($browserRenderObj, 'render'))  {
                                        if ($browserRenderObj->isValid($this->mode, $this)) {
-                                               $browserRenderObj->readOnly = $this->readOnly;
                                                $this->content .=  $browserRenderObj->render($this->mode, $this);
                                                $browserRendered = true;
                                                break;
@@ -101,7 +97,6 @@ class tx_rtehtmlarea_SC_browse_links {
                        // If type was not rendered, use default rendering functions
                if (!$browserRendered) {
                        $GLOBALS['SOBE']->browser = t3lib_div::makeInstance('tx_rtehtmlarea_browse_links');
-                       $GLOBALS['SOBE']->browser->readOnly = $this->readOnly;
                        $GLOBALS['SOBE']->browser->init();
                        $modData = $GLOBALS['BE_USER']->getModuleData('browse_links.php','ses');
                        list($modData, $store) = $GLOBALS['SOBE']->browser->processSessionData($modData);
index e5882ea..6c3c952 100644 (file)
@@ -226,6 +226,10 @@ class tx_rtehtmlarea_browse_links extends browse_links {
                $this->initConfiguration();
                $this->initHookObjects('ext/rtehtmlarea/mod3/class.tx_rtehtmlarea_browse_links.php');
 
+                       // init fileProcessor
+               $this->fileProcessor = t3lib_div::makeInstance('t3lib_basicFileFunctions');
+               $this->fileProcessor->init($GLOBALS['FILEMOUNTS'], $GLOBALS['TYPO3_CONF_VARS']['BE']['fileExtensions']);
+               
                        // CurrentUrl - the current link url must be passed around if it exists
                $this->curUrlArray = t3lib_div::_GP('curUrl');
                if ($this->curUrlArray['all'])  {
@@ -731,13 +735,11 @@ class tx_rtehtmlarea_browse_links extends browse_links {
 
                                        // Create upload/create folder forms, if a path is given:
                                if ($BE_USER->getTSConfigVal('options.uploadFieldsInTopOfEB')) {
-                                       $fileProcessor = t3lib_div::makeInstance('t3lib_basicFileFunctions');
-                                       $fileProcessor->init($GLOBALS['FILEMOUNTS'], $GLOBALS['TYPO3_CONF_VARS']['BE']['fileExtensions']);
                                        $path=$this->expandFolder;
                                        if (!$path || !@is_dir($path))  {
-                                               $path = $fileProcessor->findTempFolder().'/';   // The closest TEMP-path is found
+                                               $path = $this->fileProcessor->findTempFolder().'/';     // The closest TEMP-path is found
                                        }
-                                       if ($path!='/' && @is_dir($path) && !$this->readOnly && count($GLOBALS['FILEMOUNTS']))  { 
+                                       if ($path!='/' && @is_dir($path)) { 
                                                $uploadForm=$this->uploadForm($path);
                                                $createFolder=$this->createFolder($path);
                                        } else {
index acac2b7..e72cfe6 100644 (file)
@@ -154,6 +154,10 @@ class tx_rtehtmlarea_dam_browse_links extends tx_dam_browse_media {
                        $this->mode='rte';
                }
 
+                       // init fileProcessor
+               $this->fileProcessor = t3lib_div::makeInstance('t3lib_basicFileFunctions');
+               $this->fileProcessor->init($GLOBALS['FILEMOUNTS'], $GLOBALS['TYPO3_CONF_VARS']['BE']['fileExtensions']);
+               
                        // init hook objects:
                $this->hookObjects = array();
                if (is_array($TYPO3_CONF_VARS['SC_OPTIONS']['typo3/class.browse_links.php']['browseLinksHook'])) {
@@ -505,6 +509,10 @@ class tx_rtehtmlarea_dam_browse_links extends tx_dam_browse_media {
                        // Initializing the action value, possibly removing blinded values etc:
                $this->allowedItems = explode(',','page,file,url,mail,spec,upload');
 
+                       // Remove upload tab if filemount is readonly
+               if ($this->isReadOnlyFolder(tx_dam::path_makeAbsolute($this->damSC->path))) {
+                       $this->allowedItems = array_diff($this->allowedItems, array('upload'));
+               } 
                        //call hook for extra options
                foreach($this->hookObjects as $hookObject) {
                        $this->allowedItems = $hookObject->addAllowedItems($this->allowedItems);
index 6800911..0d26fcd 100644 (file)
@@ -3,7 +3,7 @@
 *  Copyright notice
 *
 *  (c) 1999-2008 Kasper Skaarhoj (kasper@typo3.com)
-*  (c) 2004-2008 Stanislas Rolland <stanislas.rolland(arobas)fructifor.ca>
+*  (c) 2004-2008 Stanislas Rolland <typo3(arobas)sjbr.ca>
 *  All rights reserved
 *
 *  This script is part of the TYPO3 project. The TYPO3 project is
@@ -160,6 +160,11 @@ class tx_rtehtmlarea_dam_browse_media extends tx_dam_browse_media {
                        $this->act='magic';
                }
 
+                       // init fileProcessor
+               $this->fileProcessor = t3lib_div::makeInstance('t3lib_basicFileFunctions');
+               $this->fileProcessor->init($GLOBALS['FILEMOUNTS'], $GLOBALS['TYPO3_CONF_VARS']['BE']['fileExtensions']);
+               
+               
                $RTEtsConfigParts = explode(':', $this->RTEtsConfigParams);
                $RTEsetup = $BE_USER->getTSConfig('RTE',t3lib_BEfunc::getPagesTSconfig($RTEtsConfigParts[5]));
                $this->thisConfig = t3lib_BEfunc::RTEsetup($RTEsetup['properties'],$RTEtsConfigParts[0],$RTEtsConfigParts[2],$RTEtsConfigParts[4]);
@@ -847,10 +852,8 @@ class tx_rtehtmlarea_dam_browse_media extends tx_dam_browse_media {
                global $TYPO3_CONF_VARS, $TYPO3_DB;
 
                $filearray = array();
-               //
-               // Use the current selection to create a query and count selected records
-               //
 
+                       // Use the current selection to create a query and count selected records
                $this->damSC->selection->addSelectionToQuery();
                $this->damSC->selection->qg->query['FROM']['tx_dam'] = tx_dam_db::getMetaInfoFieldList(true, array('hpixels','vpixels',$this->imgTitleDAMColumn,'alt_text'));
                #$this->damSC->selection->qg->addSelectFields(...
@@ -901,9 +904,8 @@ class tx_rtehtmlarea_dam_browse_media extends tx_dam_browse_media {
                                }
                        }
                }
-
                return $filearray;
-       }
+       }
 
        /**
         * [Describe function...]
@@ -915,10 +917,13 @@ class tx_rtehtmlarea_dam_browse_media extends tx_dam_browse_media {
 
                $path = tx_dam::path_makeAbsolute($this->damSC->path);
                if (!$path OR !@is_dir($path))  {
-                       $fileProcessor = t3lib_div::makeInstance('t3lib_basicFileFunctions');
-                       $fileProcessor->init($GLOBALS['FILEMOUNTS'], $GLOBALS['TYPO3_CONF_VARS']['BE']['fileExtensions']);
-                       $path = $fileProcessor->findTempFolder().'/';   // The closest TEMP-path is found
+                               // The closest TEMP-path is found
+                       $path = $this->fileProcessor->findTempFolder().'/';
                }
+                        // Remove upload tab if filemount is readonly
+               if ($this->isReadOnlyFolder($path)) {
+                       $this->allowedItems = array_diff($this->allowedItems, array('upload'));
+               } 
                $this->damSC->path = tx_dam::path_makeRelative($path); // mabe not needed
 
                        // Starting content:
index e53f902..2fa3fee 100644 (file)
@@ -165,6 +165,10 @@ class tx_rtehtmlarea_select_image extends browse_links {
                $this->initConfiguration();
                $this->initHookObjects();
                
+                       // init fileProcessor
+               $this->fileProcessor = t3lib_div::makeInstance('t3lib_basicFileFunctions');
+               $this->fileProcessor->init($GLOBALS['FILEMOUNTS'], $GLOBALS['TYPO3_CONF_VARS']['BE']['fileExtensions']);
+               
                $this->allowedItems = $this->getAllowedItems('dragdrop,magic,plain,image', $this->buttonConfig);
                reset($this->allowedItems);
                if (!in_array($this->act,$this->allowedItems))  {
@@ -871,12 +875,11 @@ class tx_rtehtmlarea_select_image extends browse_links {
                $content = '';
                if ($GLOBALS['BE_USER']->getTSConfigVal('options.uploadFieldsInTopOfEB') && !$this->readOnly && count($GLOBALS['FILEMOUNTS'])) {
                        $path = $folderPath;
-                       $fileProcessor = t3lib_div::makeInstance('t3lib_basicFileFunctions');
-                       $fileProcessor->init($GLOBALS['FILEMOUNTS'], $GLOBALS['TYPO3_CONF_VARS']['BE']['fileExtensions']);
                        if (!$path || !@is_dir($path))  {
-                               $path = $fileProcessor->findTempFolder().'/';   // The closest TEMP-path is found
+                                       // The closest TEMP-path is found
+                               $path = $this->fileProcessor->findTempFolder().'/';
                        }
-                       if ($path!='/' && @is_dir($path))       {
+                       if ($path!='/' && @is_dir($path)) {
                                $uploadForm=$this->uploadForm($path);
                                $createFolder=$this->createFolder($path);
                        } else {
@@ -997,7 +1000,7 @@ class tx_rtehtmlarea_select_image extends browse_links {
                                                        <td colspan="2">'.$this->getMsgBox($GLOBALS['LANG']->getLL('findDragDrop')).'</td>
                                                </tr>';
 
-                                               // Fraverse files:
+                                               // Traverse files:
                                        while(list(,$filepath)=each($files))    {
                                                $fI = pathinfo($filepath);
 
index cc037b1..8df5cfa 100644 (file)
@@ -54,7 +54,6 @@ $LANG->includeLLFile('EXT:rtehtmlarea/htmlarea/locallang_dialogs.xml');
 class tx_rtehtmlarea_SC_select_image {
        public $mode = 'rte';
        public $button = 'image';
-       public $readOnly = false;
        protected $content = '';
 
        /**
@@ -68,10 +67,9 @@ class tx_rtehtmlarea_SC_select_image {
                if ($altMountPoints) {
                        $altMountPoints = t3lib_div::trimExplode(',', $altMountPoints);
                        foreach ($altMountPoints as $filePathRelativeToFileadmindir) {
-                               $GLOBALS['BE_USER']->addFileMount('', $filePathRelativeToFileadmindir, $filePathRelativeToFileadmindir, 1, 0);
+                               $GLOBALS['BE_USER']->addFileMount('', $filePathRelativeToFileadmindir, $filePathRelativeToFileadmindir, 1, 'readonly');
                        }
                        $GLOBALS['FILEMOUNTS'] = $GLOBALS['BE_USER']->returnFilemounts();
-                       $this->readOnly = true;
                }
                        // Rendering type by user function
                $browserRendered = false;
@@ -80,7 +78,6 @@ class tx_rtehtmlarea_SC_select_image {
                                $browserRenderObj = t3lib_div::getUserObj($classRef);
                                if (is_object($browserRenderObj) && method_exists($browserRenderObj, 'isValid') && method_exists($browserRenderObj, 'render')) {
                                        if ($browserRenderObj->isValid($this->mode, $this)) {
-                                               $browserRenderObj->readOnly = $this->readOnly;
                                                $this->content .=  $browserRenderObj->render($this->mode, $this);
                                                $browserRendered = true;
                                                break;
@@ -91,7 +88,6 @@ class tx_rtehtmlarea_SC_select_image {
                        // If type was not rendered, use default rendering functions
                if (!$browserRendered) {
                        $GLOBALS['SOBE']->browser = t3lib_div::makeInstance('tx_rtehtmlarea_select_image');
-                       $GLOBALS['SOBE']->browser->readOnly = $this->readOnly;
                        $GLOBALS['SOBE']->browser->init();
                        $modData = $GLOBALS['BE_USER']->getModuleData('select_image.php','ses');
                        list($modData, $store) = $GLOBALS['SOBE']->browser->processSessionData($modData);
diff --git a/typo3/sysext/t3skin/icons/gfx/i/_icon_ftp_readonly.gif b/typo3/sysext/t3skin/icons/gfx/i/_icon_ftp_readonly.gif
new file mode 100644 (file)
index 0000000..e84a17d
Binary files /dev/null and b/typo3/sysext/t3skin/icons/gfx/i/_icon_ftp_readonly.gif differ