--- original/ElementBrowser.php 2013-07-14 13:38:47.496999072 +0200
+++ patched/ElementBrowser.php 2013-07-14 13:39:43.672998365 +0200
@@ -1266,6 +1266,10 @@
} else {
$createFolder = '';
}
+ // Or get the user's default upload folder
+ if (!$this->selectedFolder) {
+ $this->selectedFolder = $GLOBALS['BE_USER']->getDefaultUploadFolder();
+ }
// Create folder tree:
$foldertree = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TBE_FolderTree');
$foldertree->thisScript = $this->thisScript;
@@ -1671,91 +1675,76 @@
/**
* Render list of folders.
*
- * @param array $baseFolder List of folders. See \TYPO3\CMS\Core\Utility\GeneralUtility::get_dirs
- * @param string $folders If set a header with a folder icon and folder name are shown
+ * @param string \TYPO3\CMS\Core\Resource\Folder $folder List content of this folder
* @return string HTML output
* @todo Define visibility
*/
- public function folderList($baseFolder, $folders) {
+ public function folderList(\TYPO3\CMS\Core\Resource\Folder $folder) {
$content = '';
- // Create headline (showing number of folders):
- $content .= $this->barheader(sprintf($GLOBALS['LANG']->getLL('folders') . ' (%s):', count($folders)));
- $titleLength = intval($GLOBALS['BE_USER']->uc['titleLen']);
- // Create the header of current folder:
- if ($baseFolder) {
- if (strstr($baseFolder, ',') || strstr($baseFolder, '|')) {
- // In case an invalid character is in the filepath, display error message:
- $errorMessage = $GLOBALS['LANG']->JScharCode(sprintf($GLOBALS['LANG']->getLL('invalidChar'), ', |'));
- $aTag = ($aTag_alt = '');
- } else {
- // If foldername is OK, just add it:
- $aTag = '';
- $aTag_alt = substr($aTag, 0, -4) . ',\'\',1);">';
- }
+ if ($folder) {
+ $subfolders = $folder->getSubfolders();
+ // Create headline (showing number of folders):
+ $content .= $this->barheader(sprintf($GLOBALS['LANG']->getLL('folders') . ' (%s):', count($subfolders)));
+ $titleLength = intval($GLOBALS['BE_USER']->uc['titleLen']);
+ $encodedPublicUrl = rawurlencode($folder->getPublicUrl());
+ $aTag = '';
+ $aTag_alt = substr($aTag, 0, -4) . ',\'\',1);">';
$aTag_e = '';
// Add the foder icon
$folderIcon = $aTag_alt;
$folderIcon .= '';
- $folderIcon .= htmlspecialchars(\TYPO3\CMS\Core\Utility\GeneralUtility::fixed_lgd_cs(basename($baseFolder), $titleLength));
+ $folderIcon .= htmlspecialchars(\TYPO3\CMS\Core\Utility\GeneralUtility::fixed_lgd_cs(basename($folder->getName()), $titleLength));
$folderIcon .= $aTag_e;
$content .= $folderIcon . '
';
- }
- // Listing the folders:
- if (is_array($folders)) {
- if (count($folders) > 0) {
- // Traverse the folder list:
- $lines = array();
- foreach ($folders as $folderPath) {
- $pathInfo = pathinfo($folderPath);
- // Create folder icon:
- $icon = '';
- // Create links for adding the folder:
- if ($this->P['itemName'] != '' && $this->P['formName'] != '') {
- $aTag = '';
- } else {
- $aTag = '';
- }
- if (strstr($folderPath, ',') || strstr($folderPath, '|')) {
- // In case an invalid character is in the filepath, display error message:
- $errorMessage = $GLOBALS['LANG']->JScharCode(sprintf($GLOBALS['LANG']->getLL('invalidChar'), ', |'));
- $aTag = ($aTag_alt = '');
- } else {
- // If foldername is OK, just add it:
- $aTag_alt = substr($aTag, 0, -4) . ',\'\',1);">';
- }
- $aTag_e = '';
- // Combine icon and folderpath:
- $foldernameAndIcon = $aTag_alt . $icon . htmlspecialchars(\TYPO3\CMS\Core\Utility\GeneralUtility::fixed_lgd_cs(basename($folderPath), $titleLength)) . $aTag_e;
- if ($this->P['itemName'] != '') {
- $lines[] = '
-