[FEATURE] Use mod dispatcher for filelist module
authorSusanne Moog <typo3@susannemoog.de>
Fri, 15 Jun 2012 18:56:22 +0000 (20:56 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Sat, 16 Jun 2012 12:31:10 +0000 (14:31 +0200)
Use the backend module dispatcher for the
filelist extension.

Change-Id: I3b3ab0c485feabab0189cdb4b70d50c92464e41c
Resolves: #38103
Releases: 6.0
Reviewed-on: http://review.typo3.org/12110
Reviewed-by: Philipp Gampe
Tested-by: Philipp Gampe
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
t3lib/class.t3lib_clipboard.php
t3lib/class.t3lib_recordlist.php
typo3/class.file_list.inc
typo3/file_upload.php
typo3/js/flashupload.js
typo3/sysext/filelist/mod1/conf.php
typo3/sysext/filelist/mod1/file_list.php [deleted file]
typo3/sysext/filelist/mod1/index.php [new file with mode: 0644]

index 31899a5..762eaef 100644 (file)
@@ -123,7 +123,7 @@ class t3lib_clipboard {
        /**
         * The array $cmd may hold various keys which notes some action to take.
         * Normally perform only one action at a time.
-        * In scripts like db_list.php / file_list.php the GET-var CB is used to control the clipboard.
+        * In scripts like db_list.php / filelist/mod1/index.php the GET-var CB is used to control the clipboard.
         *
         * Selecting / Deselecting elements
         * Array $cmd['el'] has keys = element-ident, value = element value (see description of clipData array in header)
@@ -529,7 +529,7 @@ class t3lib_clipboard {
                        } else {
                                if (t3lib_extMgm::isLoaded('filelist')) {
                                        $str = '<a href="' . htmlspecialchars(
-                                               $this->backPath . t3lib_extMgm::extRelPath('filelist') . 'mod1/file_list.php?id=' . dirname($rec)
+                                               $this->backPath . t3lib_BEfunc::getModuleUrl('file_list') . '&id=' . dirname($rec)
                                        ) . '">' . $str . '</a>';
                                }
                        }
index 086fcbb..5dd3b97 100644 (file)
@@ -39,7 +39,7 @@
  * @author Kasper Skårhøj <kasperYYYY@typo3.com>
  * @package TYPO3
  * @subpackage t3lib
- * @see typo3/db_list.php, typo3/file_list.php
+ * @see typo3/db_list.php, typo3/sysext/filelist/mod1/index.php
  */
 class t3lib_recordList {
 
index ce0d520..7e2b6ae 100644 (file)
@@ -48,7 +48,7 @@ class fileList extends t3lib_recordList {
        var $widthGif = '<img src="clear.gif" width="1" height="1" hspace="165" alt="" />';
                // Max length of strings
        var $fixedL = 30;
-       var $script = 'file_list.php';
+       var $script = '';
                // If TRUE click menus are generated on files and folders
        var $clickMenus = 1;
                // The field to sort by...
@@ -91,7 +91,7 @@ class fileList extends t3lib_recordList {
         */
        function start(t3lib_file_Folder $folderObject, $pointer, $sort, $sortRev, $clipBoard = FALSE, $bigControlPanel = FALSE) {
 
-               $this->script = t3lib_extMgm::extRelPath('filelist') . 'mod1/file_list.php';
+               $this->script = t3lib_BEfunc::getModuleUrl('file_list');
                $this->folderObject = $folderObject;
                $this->counter = 0;
                $this->totalbytes = 0;
@@ -596,7 +596,7 @@ class fileList extends t3lib_recordList {
        }
 
        /**
-        * Wraps the directory-titles ($code) in a link to file_list.php (id=$path) and sorting commands...
+        * Wraps the directory-titles ($code) in a link to filelist/mod1/index.php (id=$path) and sorting commands...
         *
         * @param string $code String to be wrapped
         * @param string $folderIdentifier ID (path)
index 8e1ec9d..e12fbbc 100644 (file)
@@ -84,7 +84,7 @@ class SC_file_upload {
                $this->target = t3lib_div::_GP('target');
                $this->returnUrl = t3lib_div::sanitizeLocalUrl(t3lib_div::_GP('returnUrl'));
                if (!$this->returnUrl) {
-                       $this->returnUrl = t3lib_div::getIndpEnv('TYPO3_SITE_URL') . TYPO3_mainDir . t3lib_extMgm::extRelPath('filelist') . 'mod1/file_list.php?id=' . rawurlencode($this->target);
+                       $this->returnUrl = t3lib_div::getIndpEnv('TYPO3_SITE_URL') . TYPO3_mainDir . t3lib_BEfunc::getModuleUrl('file_list') . '&id=' . rawurlencode($this->target);
                }
 
                        // Create the folder object
index f4f4f8f..2809954 100644 (file)
@@ -2,7 +2,7 @@
  * Javascript functions regarding the inclusion 
  * of a TYPO3-customized version of SWFupload
  *
- * For proper use see file_list.php or the doc_core_api manual
+ * For proper use see filelist/mod1/index.php or the doc_core_api manual
  *
  * (c) 2009-2011 Benjamin Mack <benni@typo3.org>
  * All rights reserved
index 9240e45..b6fda27 100644 (file)
@@ -1,11 +1,9 @@
 <?php
-define('TYPO3_MOD_PATH', 'sysext/filelist/mod1/');
-$BACK_PATH='../../../';
 
 $MLANG['default']['tabs_images']['tab'] = 'list.gif';
 $MLANG['default']['ll_ref']='LLL:EXT:lang/locallang_mod_file_list.xml';
 
-$MCONF['script']='file_list.php';
+$MCONF['script']='_DISPATCH';
 $MCONF['access']='user,group';
 $MCONF['name']='file_list';
 $MCONF['workspaces']='online,custom';
diff --git a/typo3/sysext/filelist/mod1/file_list.php b/typo3/sysext/filelist/mod1/file_list.php
deleted file mode 100644 (file)
index 15a1fb4..0000000
+++ /dev/null
@@ -1,498 +0,0 @@
-<?php
-/***************************************************************
-*  Copyright notice
-*
-*  (c) 1999-2011 Kasper Skårhøj (kasperYYYY@typo3.com)
-*  All rights reserved
-*
-*  This script is part of the TYPO3 project. The TYPO3 project is
-*  free software; you can redistribute it and/or modify
-*  it under the terms of the GNU General Public License as published by
-*  the Free Software Foundation; either version 2 of the License, or
-*  (at your option) any later version.
-*
-*  The GNU General Public License can be found at
-*  http://www.gnu.org/copyleft/gpl.html.
-*  A copy is found in the textfile GPL.txt and important notices to the license
-*  from the author is found in LICENSE.txt distributed with these scripts.
-*
-*
-*  This script is distributed in the hope that it will be useful,
-*  but WITHOUT ANY WARRANTY; without even the implied warranty of
-*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-*  GNU General Public License for more details.
-*
-*  This copyright notice MUST APPEAR in all copies of the script!
-***************************************************************/
-/**
- * Web>File: File listing
- *
- * Revised for TYPO3 3.6 2/2003 by Kasper Skårhøj
- *
- * @author     Kasper Skårhøj <kasperYYYY@typo3.com>
- */
-
-
-unset($MCONF);
-require ('conf.php');
-require ($BACK_PATH . 'init.php');
-require ($BACK_PATH . 'template.php');
-$LANG->includeLLFile('EXT:lang/locallang_mod_file_list.xml');
-$LANG->includeLLFile('EXT:lang/locallang_misc.xml');
-require_once ($BACK_PATH . 'class.file_list.inc');
-$BE_USER->modAccess($MCONF, 1);
-
-
-
-
-
-
-
-/**
- * Script Class for creating the list of files in the File > Filelist module
- *
- * @author     Kasper Skårhøj <kasperYYYY@typo3.com>
- * @package TYPO3
- * @subpackage core
- */
-class SC_file_list {
-       var $MCONF=array();                     // Module configuration
-       var $MOD_MENU=array();
-       var $MOD_SETTINGS=array();
-
-
-               // Internal:
-       var $content;   // Accumulated HTML output
-
-       /**
-        * Document template object
-        *
-        * @var template
-        */
-       var $doc;
-
-               // Internal, static: GPvars:
-       var $id;                // "id" -> the path to list.
-       /* @var t3lib_file_Folder $folderObject */
-       protected $folderObject;
-       /* @var t3lib_FlashMessage $errorMessage */
-       protected $errorMessage;
-       var $pointer;   // Pointer to listing
-       var $table;             // "Table"
-       var $imagemode; // Thumbnail mode.
-       var $cmd;
-       var $overwriteExistingFiles;
-
-
-       /**
-        * Initialize variables, file object
-        * Incoming GET vars include id, pointer, table, imagemode
-        *
-        * @return      void
-        */
-       function init() {
-
-                       // Setting GPvars:
-               $this->id = $combinedIdentifier = t3lib_div::_GP('id');
-               
-               $this->pointer = t3lib_div::_GP('pointer');
-               $this->table = t3lib_div::_GP('table');
-               $this->imagemode = t3lib_div::_GP('imagemode');
-               $this->cmd = t3lib_div::_GP('cmd');
-               $this->overwriteExistingFiles = t3lib_div::_GP('overwriteExistingFiles');
-
-                       // Setting module name:
-               $this->MCONF = $GLOBALS['MCONF'];
-
-                       // create the folder object
-               try {
-                       if ($combinedIdentifier) {
-                               $fileFactory = t3lib_div::makeInstance('t3lib_file_Factory');
-                               $this->folderObject = $fileFactory->getFolderObjectFromCombinedIdentifier($combinedIdentifier);
-                                       // disallow the rendering of the processing folder (e.g. could be called manually)
-                                       // and all folders without any defined storage
-                               if ($this->folderObject &&
-                                               ($this->folderObject->getStorage()->getUid() == 0 || trim($this->folderObject->getStorage()->getProcessingFolder()->getIdentifier(), '/') == trim($this->folderObject->getIdentifier(), '/'))
-                               ) {
-                                       $this->folderObject = NULL;
-                               }
-                       } else {
-                               // take the first object of the first storage
-                               $fileStorages = $GLOBALS['BE_USER']->getFileStorages();
-                               $fileStorage = reset($fileStorages);
-                               if ($fileStorage) {
-                                               // Validating the input "id" (the path, directory!) and
-                                               // checking it against the mounts of the user. - now done in the controller
-                                       $this->folderObject = $fileStorage->getRootLevelFolder();
-                               } else {
-                                       $this->folderObject = NULL;
-                               }
-                       }
-               } catch (t3lib_file_exception_FolderDoesNotExistException $fileException) {
-                               // set folder object to null and throw a message later on
-                       $this->folderObject = NULL;
-                       $this->errorMessage = t3lib_div::makeInstance('t3lib_FlashMessage', sprintf($GLOBALS['LANG']->getLL('folderNotFoundMessage', TRUE), htmlspecialchars($this->id)), $GLOBALS['LANG']->getLL('folderNotFoundTitle', TRUE), t3lib_FlashMessage::ERROR);
-               }
-
-
-                       // Configure the "menu" - which is used internally to save the values of sorting, displayThumbs etc.
-               $this->menuConfig();
-       }
-
-       /**
-        * Setting the menu/session variables
-        *
-        * @return      void
-        */
-       function menuConfig() {
-                       // MENU-ITEMS:
-                       // If array, then it's a selector box menu
-                       // If empty string it's just a variable, that'll be saved.
-                       // Values NOT in this array will not be saved in the settings-array for the module.
-               $this->MOD_MENU = array(
-                       'sort' => '',
-                       'reverse' => '',
-                       'displayThumbs' => '',
-                       'clipBoard' => '',
-                       'bigControlPanel' => ''
-               );
-
-                       // CLEANSE SETTINGS
-               $this->MOD_SETTINGS = t3lib_BEfunc::getModuleData($this->MOD_MENU, t3lib_div::_GP('SET'), $this->MCONF['name']);
-       }
-
-       /**
-        * Main function, creating the listing
-        *
-        * @return      void
-        */
-       function main() {
-                       // Initialize the template object
-               $this->doc = t3lib_div::makeInstance('template');
-               $this->doc->backPath = $GLOBALS['BACK_PATH'];
-               $this->doc->setModuleTemplate('templates/file_list.html');
-               $this->doc->getPageRenderer()->loadPrototype();
-
-                       // There there was access to this file path, continue, make the list
-               if ($this->folderObject) {
-                               // include the initialization for the flash uploader
-                       if ($GLOBALS['BE_USER']->uc['enableFlashUploader']) {
-
-                               $this->doc->JScodeArray['flashUploader'] = '
-                                       if (top.TYPO3.FileUploadWindow.isFlashAvailable()) {
-                                               document.observe("dom:loaded", function() {
-                                                               // monitor the button
-                                                       $("button-upload").observe("click", initFlashUploader);
-
-                                                       function initFlashUploader(event) {
-                                                                       // set the page specific options for the flashUploader
-                                                               var flashUploadOptions = {
-                                                                       uploadURL:           top.TS.PATH_typo3 + "ajax.php",
-                                                                       uploadFileSizeLimit: "' . t3lib_div::getMaxUploadFileSize() . '",
-                                                                       uploadFileTypes: {
-                                                                               allow:  "' . $GLOBALS['TYPO3_CONF_VARS']['BE']['fileExtensions']['webspace']['allow'] . '",
-                                                                               deny: "' . $GLOBALS['TYPO3_CONF_VARS']['BE']['fileExtensions']['webspace']['deny'] . '"
-                                                                       },
-                                                                       uploadFilePostName:  "upload_1",
-                                                                       uploadPostParams: {
-                                                                               "file[upload][1][target]": "' . ($this->folderObject ? $this->folderObject->getCombinedIdentifier() : ''). '",
-                                                                               "file[upload][1][data]": 1,
-                                                                               "file[upload][1][charset]": "utf-8",
-                                                                               "ajaxID": "TYPO3_tcefile::process"
-                                                                       }
-                                                               };
-
-                                                                       // get the flashUploaderWindow instance from the parent frame
-                                                               var flashUploader = top.TYPO3.FileUploadWindow.getInstance(flashUploadOptions);
-                                                               // add an additional function inside the container to show the checkbox option
-                                                               var infoComponent = new top.Ext.Panel({
-                                                                       autoEl: { tag: "div" },
-                                                                       height: "auto",
-                                                                       bodyBorder: false,
-                                                                       border: false,
-                                                                       hideBorders: true,
-                                                                       cls: "t3-upload-window-infopanel",
-                                                                       id: "t3-upload-window-infopanel-addition",
-                                                                       html: \'<label for="overrideExistingFilesCheckbox"><input id="overrideExistingFilesCheckbox" type="checkbox" onclick="setFlashPostOptionOverwriteExistingFiles(this);" />\' + top.String.format(top.TYPO3.LLL.fileUpload.infoComponentOverrideFiles) + \'</label>\'
-                                                               });
-                                                               flashUploader.add(infoComponent);
-
-                                                                       // do a reload of this frame once all uploads are done
-                                                               flashUploader.on("totalcomplete", function() {
-                                                                       window.location.reload();
-                                                               });
-
-                                                                       // this is the callback function that delivers the additional post parameter to the flash application
-                                                               top.setFlashPostOptionOverwriteExistingFiles = function(checkbox) {
-                                                                       var uploader = top.TYPO3.getInstance("FileUploadWindow");
-                                                                       if (uploader.isVisible()) {
-                                                                               uploader.swf.addPostParam("overwriteExistingFiles", (checkbox.checked == true ? 1 : 0));
-                                                                       }
-                                                               };
-
-                                                               event.stop();
-                                                       };
-                                               });
-                                       }
-                               ';
-                       }
-                               // Create filelisting object
-                       $this->filelist = t3lib_div::makeInstance('fileList');
-                       $this->filelist->backPath = $GLOBALS['BACK_PATH'];
-
-                               // Apply predefined values for hidden checkboxes
-                               // Set predefined value for DisplayBigControlPanel:
-                       if ($GLOBALS['BE_USER']->getTSConfigVal('options.file_list.enableDisplayBigControlPanel') === 'activated') {
-                               $this->MOD_SETTINGS['bigControlPanel'] = TRUE;
-                       } elseif ($GLOBALS['BE_USER']->getTSConfigVal('options.file_list.enableDisplayBigControlPanel') === 'deactivated') {
-                               $this->MOD_SETTINGS['bigControlPanel'] = FALSE;
-                       }
-
-                               // Set predefined value for DisplayThumbnails:
-                       if ($GLOBALS['BE_USER']->getTSConfigVal('options.file_list.enableDisplayThumbnails') === 'activated') {
-                               $this->MOD_SETTINGS['displayThumbs'] = TRUE;
-                       } elseif ($GLOBALS['BE_USER']->getTSConfigVal('options.file_list.enableDisplayThumbnails') === 'deactivated') {
-                               $this->MOD_SETTINGS['displayThumbs'] = FALSE;
-                       }
-
-                               // Set predefined value for Clipboard:
-                       if ($GLOBALS['BE_USER']->getTSConfigVal('options.file_list.enableClipBoard') === 'activated') {
-                               $this->MOD_SETTINGS['clipBoard'] = TRUE;
-                       } elseif ($GLOBALS['BE_USER']->getTSConfigVal('options.file_list.enableClipBoard') === 'deactivated') {
-                               $this->MOD_SETTINGS['clipBoard'] = FALSE;
-                       }
-
-                               // if user never opened the list module, set the value for displayThumbs
-                       if (!isset($this->MOD_SETTINGS['displayThumbs'])) {
-                               $this->MOD_SETTINGS['displayThumbs'] = $GLOBALS['BE_USER']->uc['thumbnailsByDefault'];
-                       }
-                       $this->filelist->thumbs = $this->MOD_SETTINGS['displayThumbs'];
-
-                               // Create clipboard object and initialize that
-                       $this->filelist->clipObj = t3lib_div::makeInstance('t3lib_clipboard');
-                       $this->filelist->clipObj->fileMode=1;
-                       $this->filelist->clipObj->initializeClipboard();
-
-                       $CB = t3lib_div::_GET('CB');
-                       if ($this->cmd=='setCB') $CB['el'] = $this->filelist->clipObj->cleanUpCBC(array_merge(t3lib_div::_POST('CBH'), t3lib_div::_POST('CBC')), '_FILE');
-                       if (!$this->MOD_SETTINGS['clipBoard'])  $CB['setP']='normal';
-                       $this->filelist->clipObj->setCmd($CB);
-                       $this->filelist->clipObj->cleanCurrent();
-                       $this->filelist->clipObj->endClipboard();       // Saves
-
-                               // If the "cmd" was to delete files from the list (clipboard thing), do that:
-                       if ($this->cmd=='delete') {
-                               $items = $this->filelist->clipObj->cleanUpCBC(t3lib_div::_POST('CBC'), '_FILE', 1);
-                               if (count($items)) {
-                                               // Make command array:
-                                       $FILE=array();
-                                       foreach ($items as $v) {
-                                               $FILE['delete'][]=array('data'=>$v);
-                                       }
-
-                                               // Init file processing object for deleting and pass the cmd array.
-                                       $fileProcessor = t3lib_div::makeInstance('t3lib_extFileFunctions');
-                                       $fileProcessor->init($GLOBALS['FILEMOUNTS'], $GLOBALS['TYPO3_CONF_VARS']['BE']['fileExtensions']);
-                                       $fileProcessor->init_actionPerms($GLOBALS['BE_USER']->getFileoperationPermissions());
-                                       $fileProcessor->dontCheckForUnique = $this->overwriteExistingFiles ? 1 : 0;
-                                       $fileProcessor->start($FILE);
-                                       $fileProcessor->processData();
-
-                                       $fileProcessor->printLogErrorMessages();
-                               }
-                       }
-
-                       if (!isset($this->MOD_SETTINGS['sort'])) {
-                                       // Set default sorting
-                               $this->MOD_SETTINGS['sort'] = 'file';
-                               $this->MOD_SETTINGS['reverse'] = 0;
-                       }
-
-                               // Start up filelisting object, include settings.
-                       $this->pointer = t3lib_utility_Math::forceIntegerInRange($this->pointer, 0, 100000);
-                       $this->filelist->start($this->folderObject, $this->pointer, $this->MOD_SETTINGS['sort'], $this->MOD_SETTINGS['reverse'], $this->MOD_SETTINGS['clipBoard'], $this->MOD_SETTINGS['bigControlPanel']);
-
-                               // Generate the list
-                       $this->filelist->generateList();
-
-                               // Write the footer
-                       $this->filelist->writeBottom();
-
-                               // Set top JavaScript:
-                       $this->doc->JScode=$this->doc->wrapScriptTags('
-
-                       if (top.fsMod) top.fsMod.recentIds["file"] = unescape("'.rawurlencode($this->id).'");
-                       function jumpToUrl(URL) {       //
-                               window.location.href = URL;
-                       }
-
-                       '.$this->filelist->CBfunctions()        // ... and add clipboard JavaScript functions
-                       );
-
-                               // This will return content necessary for the context sensitive clickmenus to work: bodytag events, JavaScript functions and DIV-layers.
-                       $this->doc->getContextMenuCode();
-
-                               // Setting up the buttons and markers for docheader
-                       list($buttons, $otherMarkers) = $this->filelist->getButtonsAndOtherMarkers($this->folderObject);
-
-                               // add the folder info to the marker array
-                       $otherMarkers['FOLDER_INFO'] = $this->filelist->getFolderInfo();
-
-                       $docHeaderButtons = array_merge($this->getButtons(), $buttons);
-
-                               // Build the <body> for the module
-
-                               // Create output
-                       $pageContent='';
-                       $pageContent.= '<form action="'.htmlspecialchars($this->filelist->listURL()).'" method="post" name="dblistForm">';
-                       $pageContent.= $this->filelist->HTMLcode;
-                       $pageContent.= '<input type="hidden" name="cmd" /></form>';
-
-
-                       if ($this->filelist->HTMLcode)  {       // Making listing options:
-
-                               $pageContent.='
-
-                                       <!--
-                                               Listing options for extended view, clipboard and thumbnails
-                                       -->
-                                       <div id="typo3-listOptions">
-                               ';
-
-                                       // Add "display bigControlPanel" checkbox:
-                               if ($GLOBALS['BE_USER']->getTSConfigVal('options.file_list.enableDisplayBigControlPanel') === 'selectable') {
-                                       $pageContent .= t3lib_BEfunc::getFuncCheck(
-                                               $this->id,
-                                               'SET[bigControlPanel]',
-                                               $this->MOD_SETTINGS['bigControlPanel'],
-                                               'file_list.php',
-                                               '',
-                                               'id="bigControlPanel"'
-                                       ) . '<label for="bigControlPanel"> ' . $GLOBALS['LANG']->getLL('bigControlPanel', TRUE) . '</label><br />';
-                               }
-
-                                       // Add "display thumbnails" checkbox:
-                               if ($GLOBALS['BE_USER']->getTSConfigVal('options.file_list.enableDisplayThumbnails') === 'selectable') {
-                                       $pageContent .= t3lib_BEfunc::getFuncCheck(
-                                               $this->id,
-                                               'SET[displayThumbs]',
-                                               $this->MOD_SETTINGS['displayThumbs'],
-                                               'file_list.php',
-                                               '',
-                                               'id="checkDisplayThumbs"'
-                                       ) . ' <label for="checkDisplayThumbs">' . $GLOBALS['LANG']->getLL('displayThumbs', TRUE) . '</label><br />';
-                               }
-
-                                       // Add "clipboard" checkbox:
-                               if ($GLOBALS['BE_USER']->getTSConfigVal('options.file_list.enableClipBoard') === 'selectable') {
-                                       $pageContent .= t3lib_BEfunc::getFuncCheck(
-                                               $this->id,
-                                               'SET[clipBoard]',
-                                               $this->MOD_SETTINGS['clipBoard'],
-                                               'file_list.php',
-                                               '',
-                                               'id="checkClipBoard"'
-                                       ) . ' <label for="checkClipBoard">' . $GLOBALS['LANG']->getLL('clipBoard', TRUE) . '</label>';
-                               }
-
-                               $pageContent.='
-                                       </div>
-                               ';
-
-
-                                       // Set clipboard:
-                               if ($this->MOD_SETTINGS['clipBoard']) {
-                                       $pageContent.=$this->filelist->clipObj->printClipboard();
-                                       $pageContent.= t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'filelist_clipboard', $GLOBALS['BACK_PATH']);
-                               }
-                       }
-
-                       $markerArray = array(
-                               'CSH' => $docHeaderButtons['csh'],
-                               'FUNC_MENU' => t3lib_BEfunc::getFuncMenu($this->id, 'SET[function]', $this->MOD_SETTINGS['function'], $this->MOD_MENU['function']),
-                               'CONTENT' => $pageContent
-                       );
-
-                       $this->content = $this->doc->moduleBody(array(), $docHeaderButtons, array_merge($markerArray, $otherMarkers));
-                               // Renders the module page
-                       $this->content = $this->doc->render(
-                               $GLOBALS['LANG']->getLL('files'),
-                               $this->content
-                       );
-
-               } else {
-
-                       $content = '';
-                       if ($this->errorMessage) {
-                               $content = $this->doc->moduleBody(array(), array_merge(array('LEVEL_UP' => '', 'REFRESH' => ''), $this->getButtons()), array('CSH' => '', 'TITLE' => '', 'FOLDER_INFO' => '', 'PAGE_ICON' => '', 'FUNC_MENU' => '', 'CONTENT' => $this->errorMessage->render()));
-                       }
-
-                               // Create output - no access (no warning though)
-                       $this->content = $this->doc->render(
-                               $GLOBALS['LANG']->getLL('files'),
-                               $content
-                       );
-               }
-
-
-       }
-
-       /**
-        * Outputting the accumulated content to screen
-        *
-        * @return      void
-        */
-       function printContent() {
-               echo $this->content;
-       }
-
-       /**
-        * Create the panel of buttons for submitting the form or otherwise perform operations.
-        *
-        * @return      array   all available buttons as an assoc. array
-        */
-       function getButtons() {
-               $buttons = array(
-                       'csh' => '',
-                       'shortcut' => '',
-                       'upload' => '',
-                       'new' => '',
-               );
-
-                       // Add shortcut
-               if ($GLOBALS['BE_USER']->mayMakeShortcut()) {
-                       $buttons['shortcut'] = $this->doc->makeShortcutIcon('pointer,id,target,table', implode(',', array_keys($this->MOD_MENU)), $this->MCONF['name']);
-               }
-
-                       // FileList Module CSH:
-               $buttons['csh'] = t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'filelist_module', $GLOBALS['BACK_PATH'], '', TRUE);
-
-                       // upload button (only if upload to this directory is allowed)
-               if ($this->folderObject && $this->folderObject->getStorage()->checkUserActionPermission('upload', 'File') && $this->folderObject->checkActionPermission('write')) {
-                       $buttons['upload'] = '<a href="' . $GLOBALS['BACK_PATH'] . 'file_upload.php?target=' . rawurlencode($this->folderObject->getCombinedIdentifier()) .
-                               '&amp;returnUrl=' . rawurlencode($this->filelist->listURL()) . '" id="button-upload" title="' .
-                               $GLOBALS['LANG']->makeEntities($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:cm.upload', 1)) . '">' .
-                               t3lib_iconWorks::getSpriteIcon('actions-edit-upload') .
-                       '</a>';
-               }
-
-                       // new folder button
-               if ($this->folderObject && $this->folderObject->checkActionPermission('add')) {
-                       $buttons['new'] = '<a href="' . $GLOBALS['BACK_PATH'] . 'file_newfolder.php?target=' . rawurlencode($this->folderObject->getCombinedIdentifier()) .
-                               '&amp;returnUrl=' . rawurlencode($this->filelist->listURL()) . '" title="' .
-                               $GLOBALS['LANG']->makeEntities($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:cm.new', 1)) . '">' .
-                               t3lib_iconWorks::getSpriteIcon('actions-document-new') .
-                       '</a>';
-               }
-
-               return $buttons;
-       }
-}
-
-// Make instance:
-$SOBE = t3lib_div::makeInstance('SC_file_list');
-$SOBE->init();
-$SOBE->main();
-$SOBE->printContent();
-
-?>
\ No newline at end of file
diff --git a/typo3/sysext/filelist/mod1/index.php b/typo3/sysext/filelist/mod1/index.php
new file mode 100644 (file)
index 0000000..81898dd
--- /dev/null
@@ -0,0 +1,487 @@
+<?php
+/***************************************************************
+*  Copyright notice
+*
+*  (c) 1999-2011 Kasper Skårhøj (kasperYYYY@typo3.com)
+*  All rights reserved
+*
+*  This script is part of the TYPO3 project. The TYPO3 project is
+*  free software; you can redistribute it and/or modify
+*  it under the terms of the GNU General Public License as published by
+*  the Free Software Foundation; either version 2 of the License, or
+*  (at your option) any later version.
+*
+*  The GNU General Public License can be found at
+*  http://www.gnu.org/copyleft/gpl.html.
+*  A copy is found in the textfile GPL.txt and important notices to the license
+*  from the author is found in LICENSE.txt distributed with these scripts.
+*
+*
+*  This script is distributed in the hope that it will be useful,
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+*  GNU General Public License for more details.
+*
+*  This copyright notice MUST APPEAR in all copies of the script!
+***************************************************************/
+/**
+ * Web>File: File listing
+ *
+ * Revised for TYPO3 3.6 2/2003 by Kasper Skårhøj
+ *
+ * @author     Kasper Skårhøj <kasperYYYY@typo3.com>
+ */
+
+$LANG->includeLLFile('EXT:lang/locallang_mod_file_list.xml');
+$LANG->includeLLFile('EXT:lang/locallang_misc.xml');
+require_once(PATH_typo3 . 'class.file_list.inc');
+$BE_USER->modAccess($MCONF, 1);
+
+/**
+ * Script Class for creating the list of files in the File > Filelist module
+ *
+ * @author     Kasper Skårhøj <kasperYYYY@typo3.com>
+ * @package TYPO3
+ * @subpackage core
+ */
+class SC_file_list {
+       var $MCONF=array();                     // Module configuration
+       var $MOD_MENU=array();
+       var $MOD_SETTINGS=array();
+
+
+               // Internal:
+       var $content;   // Accumulated HTML output
+
+       /**
+        * Document template object
+        *
+        * @var template
+        */
+       var $doc;
+
+               // Internal, static: GPvars:
+       var $id;                // "id" -> the path to list.
+       /* @var t3lib_file_Folder $folderObject */
+       protected $folderObject;
+       /* @var t3lib_FlashMessage $errorMessage */
+       protected $errorMessage;
+       var $pointer;   // Pointer to listing
+       var $table;             // "Table"
+       var $imagemode; // Thumbnail mode.
+       var $cmd;
+       var $overwriteExistingFiles;
+
+
+       /**
+        * Initialize variables, file object
+        * Incoming GET vars include id, pointer, table, imagemode
+        *
+        * @return      void
+        */
+       function init() {
+
+                       // Setting GPvars:
+               $this->id = $combinedIdentifier = t3lib_div::_GP('id');
+
+               $this->pointer = t3lib_div::_GP('pointer');
+               $this->table = t3lib_div::_GP('table');
+               $this->imagemode = t3lib_div::_GP('imagemode');
+               $this->cmd = t3lib_div::_GP('cmd');
+               $this->overwriteExistingFiles = t3lib_div::_GP('overwriteExistingFiles');
+
+                       // Setting module name:
+               $this->MCONF = $GLOBALS['MCONF'];
+
+                       // create the folder object
+               try {
+                       if ($combinedIdentifier) {
+                               $fileFactory = t3lib_div::makeInstance('t3lib_file_Factory');
+                               $this->folderObject = $fileFactory->getFolderObjectFromCombinedIdentifier($combinedIdentifier);
+                                       // disallow the rendering of the processing folder (e.g. could be called manually)
+                                       // and all folders without any defined storage
+                               if ($this->folderObject &&
+                                               ($this->folderObject->getStorage()->getUid() == 0 || trim($this->folderObject->getStorage()->getProcessingFolder()->getIdentifier(), '/') == trim($this->folderObject->getIdentifier(), '/'))
+                               ) {
+                                       $this->folderObject = NULL;
+                               }
+                       } else {
+                               // take the first object of the first storage
+                               $fileStorages = $GLOBALS['BE_USER']->getFileStorages();
+                               $fileStorage = reset($fileStorages);
+                               if ($fileStorage) {
+                                               // Validating the input "id" (the path, directory!) and
+                                               // checking it against the mounts of the user. - now done in the controller
+                                       $this->folderObject = $fileStorage->getRootLevelFolder();
+                               } else {
+                                       $this->folderObject = NULL;
+                               }
+                       }
+               } catch (t3lib_file_exception_FolderDoesNotExistException $fileException) {
+                               // set folder object to null and throw a message later on
+                       $this->folderObject = NULL;
+                       $this->errorMessage = t3lib_div::makeInstance('t3lib_FlashMessage', sprintf($GLOBALS['LANG']->getLL('folderNotFoundMessage', TRUE), htmlspecialchars($this->id)), $GLOBALS['LANG']->getLL('folderNotFoundTitle', TRUE), t3lib_FlashMessage::ERROR);
+               }
+
+
+                       // Configure the "menu" - which is used internally to save the values of sorting, displayThumbs etc.
+               $this->menuConfig();
+       }
+
+       /**
+        * Setting the menu/session variables
+        *
+        * @return      void
+        */
+       function menuConfig() {
+                       // MENU-ITEMS:
+                       // If array, then it's a selector box menu
+                       // If empty string it's just a variable, that'll be saved.
+                       // Values NOT in this array will not be saved in the settings-array for the module.
+               $this->MOD_MENU = array(
+                       'sort' => '',
+                       'reverse' => '',
+                       'displayThumbs' => '',
+                       'clipBoard' => '',
+                       'bigControlPanel' => ''
+               );
+
+                       // CLEANSE SETTINGS
+               $this->MOD_SETTINGS = t3lib_BEfunc::getModuleData($this->MOD_MENU, t3lib_div::_GP('SET'), $this->MCONF['name']);
+       }
+
+       /**
+        * Main function, creating the listing
+        *
+        * @return      void
+        */
+       function main() {
+                       // Initialize the template object
+               $this->doc = t3lib_div::makeInstance('template');
+               $this->doc->backPath = $GLOBALS['BACK_PATH'];
+               $this->doc->setModuleTemplate('templates/file_list.html');
+               $this->doc->getPageRenderer()->loadPrototype();
+
+                       // There there was access to this file path, continue, make the list
+               if ($this->folderObject) {
+                               // include the initialization for the flash uploader
+                       if ($GLOBALS['BE_USER']->uc['enableFlashUploader']) {
+
+                               $this->doc->JScodeArray['flashUploader'] = '
+                                       if (top.TYPO3.FileUploadWindow.isFlashAvailable()) {
+                                               document.observe("dom:loaded", function() {
+                                                               // monitor the button
+                                                       $("button-upload").observe("click", initFlashUploader);
+
+                                                       function initFlashUploader(event) {
+                                                                       // set the page specific options for the flashUploader
+                                                               var flashUploadOptions = {
+                                                                       uploadURL:           top.TS.PATH_typo3 + "ajax.php",
+                                                                       uploadFileSizeLimit: "' . t3lib_div::getMaxUploadFileSize() . '",
+                                                                       uploadFileTypes: {
+                                                                               allow:  "' . $GLOBALS['TYPO3_CONF_VARS']['BE']['fileExtensions']['webspace']['allow'] . '",
+                                                                               deny: "' . $GLOBALS['TYPO3_CONF_VARS']['BE']['fileExtensions']['webspace']['deny'] . '"
+                                                                       },
+                                                                       uploadFilePostName:  "upload_1",
+                                                                       uploadPostParams: {
+                                                                               "file[upload][1][target]": "' . ($this->folderObject ? $this->folderObject->getCombinedIdentifier() : ''). '",
+                                                                               "file[upload][1][data]": 1,
+                                                                               "file[upload][1][charset]": "utf-8",
+                                                                               "ajaxID": "TYPO3_tcefile::process"
+                                                                       }
+                                                               };
+
+                                                                       // get the flashUploaderWindow instance from the parent frame
+                                                               var flashUploader = top.TYPO3.FileUploadWindow.getInstance(flashUploadOptions);
+                                                               // add an additional function inside the container to show the checkbox option
+                                                               var infoComponent = new top.Ext.Panel({
+                                                                       autoEl: { tag: "div" },
+                                                                       height: "auto",
+                                                                       bodyBorder: false,
+                                                                       border: false,
+                                                                       hideBorders: true,
+                                                                       cls: "t3-upload-window-infopanel",
+                                                                       id: "t3-upload-window-infopanel-addition",
+                                                                       html: \'<label for="overrideExistingFilesCheckbox"><input id="overrideExistingFilesCheckbox" type="checkbox" onclick="setFlashPostOptionOverwriteExistingFiles(this);" />\' + top.String.format(top.TYPO3.LLL.fileUpload.infoComponentOverrideFiles) + \'</label>\'
+                                                               });
+                                                               flashUploader.add(infoComponent);
+
+                                                                       // do a reload of this frame once all uploads are done
+                                                               flashUploader.on("totalcomplete", function() {
+                                                                       window.location.reload();
+                                                               });
+
+                                                                       // this is the callback function that delivers the additional post parameter to the flash application
+                                                               top.setFlashPostOptionOverwriteExistingFiles = function(checkbox) {
+                                                                       var uploader = top.TYPO3.getInstance("FileUploadWindow");
+                                                                       if (uploader.isVisible()) {
+                                                                               uploader.swf.addPostParam("overwriteExistingFiles", (checkbox.checked == true ? 1 : 0));
+                                                                       }
+                                                               };
+
+                                                               event.stop();
+                                                       };
+                                               });
+                                       }
+                               ';
+                       }
+                               // Create filelisting object
+                       $this->filelist = t3lib_div::makeInstance('fileList');
+                       $this->filelist->backPath = $GLOBALS['BACK_PATH'];
+
+                               // Apply predefined values for hidden checkboxes
+                               // Set predefined value for DisplayBigControlPanel:
+                       if ($GLOBALS['BE_USER']->getTSConfigVal('options.file_list.enableDisplayBigControlPanel') === 'activated') {
+                               $this->MOD_SETTINGS['bigControlPanel'] = TRUE;
+                       } elseif ($GLOBALS['BE_USER']->getTSConfigVal('options.file_list.enableDisplayBigControlPanel') === 'deactivated') {
+                               $this->MOD_SETTINGS['bigControlPanel'] = FALSE;
+                       }
+
+                               // Set predefined value for DisplayThumbnails:
+                       if ($GLOBALS['BE_USER']->getTSConfigVal('options.file_list.enableDisplayThumbnails') === 'activated') {
+                               $this->MOD_SETTINGS['displayThumbs'] = TRUE;
+                       } elseif ($GLOBALS['BE_USER']->getTSConfigVal('options.file_list.enableDisplayThumbnails') === 'deactivated') {
+                               $this->MOD_SETTINGS['displayThumbs'] = FALSE;
+                       }
+
+                               // Set predefined value for Clipboard:
+                       if ($GLOBALS['BE_USER']->getTSConfigVal('options.file_list.enableClipBoard') === 'activated') {
+                               $this->MOD_SETTINGS['clipBoard'] = TRUE;
+                       } elseif ($GLOBALS['BE_USER']->getTSConfigVal('options.file_list.enableClipBoard') === 'deactivated') {
+                               $this->MOD_SETTINGS['clipBoard'] = FALSE;
+                       }
+
+                               // if user never opened the list module, set the value for displayThumbs
+                       if (!isset($this->MOD_SETTINGS['displayThumbs'])) {
+                               $this->MOD_SETTINGS['displayThumbs'] = $GLOBALS['BE_USER']->uc['thumbnailsByDefault'];
+                       }
+                       $this->filelist->thumbs = $this->MOD_SETTINGS['displayThumbs'];
+
+                               // Create clipboard object and initialize that
+                       $this->filelist->clipObj = t3lib_div::makeInstance('t3lib_clipboard');
+                       $this->filelist->clipObj->fileMode=1;
+                       $this->filelist->clipObj->initializeClipboard();
+
+                       $CB = t3lib_div::_GET('CB');
+                       if ($this->cmd=='setCB') $CB['el'] = $this->filelist->clipObj->cleanUpCBC(array_merge(t3lib_div::_POST('CBH'), t3lib_div::_POST('CBC')), '_FILE');
+                       if (!$this->MOD_SETTINGS['clipBoard'])  $CB['setP']='normal';
+                       $this->filelist->clipObj->setCmd($CB);
+                       $this->filelist->clipObj->cleanCurrent();
+                       $this->filelist->clipObj->endClipboard();       // Saves
+
+                               // If the "cmd" was to delete files from the list (clipboard thing), do that:
+                       if ($this->cmd=='delete') {
+                               $items = $this->filelist->clipObj->cleanUpCBC(t3lib_div::_POST('CBC'), '_FILE', 1);
+                               if (count($items)) {
+                                               // Make command array:
+                                       $FILE=array();
+                                       foreach ($items as $v) {
+                                               $FILE['delete'][]=array('data'=>$v);
+                                       }
+
+                                               // Init file processing object for deleting and pass the cmd array.
+                                       $fileProcessor = t3lib_div::makeInstance('t3lib_extFileFunctions');
+                                       $fileProcessor->init($GLOBALS['FILEMOUNTS'], $GLOBALS['TYPO3_CONF_VARS']['BE']['fileExtensions']);
+                                       $fileProcessor->init_actionPerms($GLOBALS['BE_USER']->getFileoperationPermissions());
+                                       $fileProcessor->dontCheckForUnique = $this->overwriteExistingFiles ? 1 : 0;
+                                       $fileProcessor->start($FILE);
+                                       $fileProcessor->processData();
+
+                                       $fileProcessor->printLogErrorMessages();
+                               }
+                       }
+
+                       if (!isset($this->MOD_SETTINGS['sort'])) {
+                                       // Set default sorting
+                               $this->MOD_SETTINGS['sort'] = 'file';
+                               $this->MOD_SETTINGS['reverse'] = 0;
+                       }
+
+                               // Start up filelisting object, include settings.
+                       $this->pointer = t3lib_utility_Math::forceIntegerInRange($this->pointer, 0, 100000);
+                       $this->filelist->start($this->folderObject, $this->pointer, $this->MOD_SETTINGS['sort'], $this->MOD_SETTINGS['reverse'], $this->MOD_SETTINGS['clipBoard'], $this->MOD_SETTINGS['bigControlPanel']);
+
+                               // Generate the list
+                       $this->filelist->generateList();
+
+                               // Write the footer
+                       $this->filelist->writeBottom();
+
+                               // Set top JavaScript:
+                       $this->doc->JScode=$this->doc->wrapScriptTags('
+
+                       if (top.fsMod) top.fsMod.recentIds["file"] = unescape("'.rawurlencode($this->id).'");
+                       function jumpToUrl(URL) {       //
+                               window.location.href = URL;
+                       }
+
+                       '.$this->filelist->CBfunctions()        // ... and add clipboard JavaScript functions
+                       );
+
+                               // This will return content necessary for the context sensitive clickmenus to work: bodytag events, JavaScript functions and DIV-layers.
+                       $this->doc->getContextMenuCode();
+
+                               // Setting up the buttons and markers for docheader
+                       list($buttons, $otherMarkers) = $this->filelist->getButtonsAndOtherMarkers($this->folderObject);
+
+                               // add the folder info to the marker array
+                       $otherMarkers['FOLDER_INFO'] = $this->filelist->getFolderInfo();
+
+                       $docHeaderButtons = array_merge($this->getButtons(), $buttons);
+
+                               // Build the <body> for the module
+
+                               // Create output
+                       $pageContent='';
+                       $pageContent.= '<form action="'.htmlspecialchars($this->filelist->listURL()).'" method="post" name="dblistForm">';
+                       $pageContent.= $this->filelist->HTMLcode;
+                       $pageContent.= '<input type="hidden" name="cmd" /></form>';
+
+
+                       if ($this->filelist->HTMLcode)  {       // Making listing options:
+
+                               $pageContent.='
+
+                                       <!--
+                                               Listing options for extended view, clipboard and thumbnails
+                                       -->
+                                       <div id="typo3-listOptions">
+                               ';
+
+                                       // Add "display bigControlPanel" checkbox:
+                               if ($GLOBALS['BE_USER']->getTSConfigVal('options.file_list.enableDisplayBigControlPanel') === 'selectable') {
+                                       $pageContent .= t3lib_BEfunc::getFuncCheck(
+                                               $this->id,
+                                               'SET[bigControlPanel]',
+                                               $this->MOD_SETTINGS['bigControlPanel'],
+                                               '',
+                                               '',
+                                               'id="bigControlPanel"'
+                                       ) . '<label for="bigControlPanel"> ' . $GLOBALS['LANG']->getLL('bigControlPanel', TRUE) . '</label><br />';
+                               }
+
+                                       // Add "display thumbnails" checkbox:
+                               if ($GLOBALS['BE_USER']->getTSConfigVal('options.file_list.enableDisplayThumbnails') === 'selectable') {
+                                       $pageContent .= t3lib_BEfunc::getFuncCheck(
+                                               $this->id,
+                                               'SET[displayThumbs]',
+                                               $this->MOD_SETTINGS['displayThumbs'],
+                                               '',
+                                               '',
+                                               'id="checkDisplayThumbs"'
+                                       ) . ' <label for="checkDisplayThumbs">' . $GLOBALS['LANG']->getLL('displayThumbs', TRUE) . '</label><br />';
+                               }
+
+                                       // Add "clipboard" checkbox:
+                               if ($GLOBALS['BE_USER']->getTSConfigVal('options.file_list.enableClipBoard') === 'selectable') {
+                                       $pageContent .= t3lib_BEfunc::getFuncCheck(
+                                               $this->id,
+                                               'SET[clipBoard]',
+                                               $this->MOD_SETTINGS['clipBoard'],
+                                               '',
+                                               '',
+                                               'id="checkClipBoard"'
+                                       ) . ' <label for="checkClipBoard">' . $GLOBALS['LANG']->getLL('clipBoard', TRUE) . '</label>';
+                               }
+
+                               $pageContent.='
+                                       </div>
+                               ';
+
+
+                                       // Set clipboard:
+                               if ($this->MOD_SETTINGS['clipBoard']) {
+                                       $pageContent.=$this->filelist->clipObj->printClipboard();
+                                       $pageContent.= t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'filelist_clipboard', $GLOBALS['BACK_PATH']);
+                               }
+                       }
+
+                       $markerArray = array(
+                               'CSH' => $docHeaderButtons['csh'],
+                               'FUNC_MENU' => t3lib_BEfunc::getFuncMenu($this->id, 'SET[function]', $this->MOD_SETTINGS['function'], $this->MOD_MENU['function']),
+                               'CONTENT' => $pageContent
+                       );
+
+                       $this->content = $this->doc->moduleBody(array(), $docHeaderButtons, array_merge($markerArray, $otherMarkers));
+                               // Renders the module page
+                       $this->content = $this->doc->render(
+                               $GLOBALS['LANG']->getLL('files'),
+                               $this->content
+                       );
+
+               } else {
+
+                       $content = '';
+                       if ($this->errorMessage) {
+                               $content = $this->doc->moduleBody(array(), array_merge(array('LEVEL_UP' => '', 'REFRESH' => ''), $this->getButtons()), array('CSH' => '', 'TITLE' => '', 'FOLDER_INFO' => '', 'PAGE_ICON' => '', 'FUNC_MENU' => '', 'CONTENT' => $this->errorMessage->render()));
+                       }
+
+                               // Create output - no access (no warning though)
+                       $this->content = $this->doc->render(
+                               $GLOBALS['LANG']->getLL('files'),
+                               $content
+                       );
+               }
+
+
+       }
+
+       /**
+        * Outputting the accumulated content to screen
+        *
+        * @return      void
+        */
+       function printContent() {
+               echo $this->content;
+       }
+
+       /**
+        * Create the panel of buttons for submitting the form or otherwise perform operations.
+        *
+        * @return      array   all available buttons as an assoc. array
+        */
+       function getButtons() {
+               $buttons = array(
+                       'csh' => '',
+                       'shortcut' => '',
+                       'upload' => '',
+                       'new' => '',
+               );
+
+                       // Add shortcut
+               if ($GLOBALS['BE_USER']->mayMakeShortcut()) {
+                       $buttons['shortcut'] = $this->doc->makeShortcutIcon('pointer,id,target,table', implode(',', array_keys($this->MOD_MENU)), $this->MCONF['name']);
+               }
+
+                       // FileList Module CSH:
+               $buttons['csh'] = t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'filelist_module', $GLOBALS['BACK_PATH'], '', TRUE);
+
+                       // upload button (only if upload to this directory is allowed)
+               if ($this->folderObject && $this->folderObject->getStorage()->checkUserActionPermission('upload', 'File') && $this->folderObject->checkActionPermission('write')) {
+                       $buttons['upload'] = '<a href="' . $GLOBALS['BACK_PATH'] . 'file_upload.php?target=' . rawurlencode($this->folderObject->getCombinedIdentifier()) .
+                               '&amp;returnUrl=' . rawurlencode($this->filelist->listURL()) . '" id="button-upload" title="' .
+                               $GLOBALS['LANG']->makeEntities($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:cm.upload', 1)) . '">' .
+                               t3lib_iconWorks::getSpriteIcon('actions-edit-upload') .
+                       '</a>';
+               }
+
+                       // new folder button
+               if ($this->folderObject && $this->folderObject->checkActionPermission('add')) {
+                       $buttons['new'] = '<a href="' . $GLOBALS['BACK_PATH'] . 'file_newfolder.php?target=' . rawurlencode($this->folderObject->getCombinedIdentifier()) .
+                               '&amp;returnUrl=' . rawurlencode($this->filelist->listURL()) . '" title="' .
+                               $GLOBALS['LANG']->makeEntities($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:cm.new', 1)) . '">' .
+                               t3lib_iconWorks::getSpriteIcon('actions-document-new') .
+                       '</a>';
+               }
+
+               return $buttons;
+       }
+}
+
+// Make instance:
+$SOBE = t3lib_div::makeInstance('SC_file_list');
+$SOBE->init();
+$SOBE->main();
+$SOBE->printContent();
+
+?>
\ No newline at end of file