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>
$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
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:
* @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);
$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 {
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';
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
+?>
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;
}
// 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':
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;
/**
// 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']);
$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 {
// 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='';
// 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);
}
return $out;
}
- /**
+ /**
* Render list of folders.
*
* @param array List of folders. See t3lib_div::get_dirs
<td colspan="2">'.$this->getMsgBox($GLOBALS['LANG']->getLL('findDragDrop')).'</td>
</tr>';
- // Fraverse files:
+ // Traverse files:
while(list(,$filepath)=each($files)) {
$fI = pathinfo($filepath);
* @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');
}
/**
*/
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;
*/
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').':');
$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
// 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);
* @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);
$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 {
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';
class tx_rtehtmlarea_SC_browse_links {
public $mode = 'rte';
public $button = 'link';
- public $readOnly = false;
protected $content = '';
/**
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;
$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;
// 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);
$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']) {
// 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 {
$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'])) {
// 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);
* 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
$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]);
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(...
}
}
}
-
return $filearray;
- }
+ }
/**
* [Describe function...]
$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:
$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)) {
$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 {
<td colspan="2">'.$this->getMsgBox($GLOBALS['LANG']->getLL('findDragDrop')).'</td>
</tr>';
- // Fraverse files:
+ // Traverse files:
while(list(,$filepath)=each($files)) {
$fI = pathinfo($filepath);
class tx_rtehtmlarea_SC_select_image {
public $mode = 'rte';
public $button = 'image';
- public $readOnly = false;
protected $content = '';
/**
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;
$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;
// 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);