* Raising Extbase and Fluid version numbers to 0.9.12
[Packages/TYPO3.CMS.git] / typo3 / alt_file_navframe.php
old mode 100755 (executable)
new mode 100644 (file)
index 769d468..6a42563
@@ -2,7 +2,7 @@
 /***************************************************************
 *  Copyright notice
 *
-*  (c) 1999-2008 Kasper Skaarhoj (kasperYYYY@typo3.com)
+*  (c) 1999-2009 Kasper Skaarhoj (kasperYYYY@typo3.com)
 *  All rights reserved
 *
 *  This script is part of the TYPO3 project. The TYPO3 project is
@@ -124,6 +124,7 @@ class SC_alt_file_navframe {
                $this->doc = t3lib_div::makeInstance('template');
                $this->doc->backPath = $BACK_PATH;
                $this->doc->setModuleTemplate('templates/alt_file_navframe.html');
+               $this->doc->showFlashMessages = FALSE;
 
                        // Adding javascript code for AJAX (prototype), drag&drop and the filetree as well as the click menu code
                $this->doc->getDragDropCode('folders');
@@ -134,16 +135,72 @@ class SC_alt_file_navframe {
 
                ($this->currentSubScript?'top.currentSubScript=unescape("'.rawurlencode($this->currentSubScript).'");':'').'
 
+               function initFlashUploader(path) {
+                       path = decodeURIComponent(path);
+                       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]": path,
+                                       "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() {
+                               jumpTo (top.rawurlencode(path), "", "", "");
+                       });
+
+                               // 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));
+                               }
+                       };
+               }
+
+
                // setting prefs for foldertree
                Tree.ajaxID = "SC_alt_file_navframe::expandCollapse";
 
                // Function, loading the list frame from navigation tree:
                function jumpTo(id, linkObj, highlightID, bank) {
-                       var theUrl = top.TS.PATH_typo3 + top.currentSubScript + "?id=" + id;
+                       var theUrl = top.TS.PATH_typo3 + top.currentSubScript ;
+                       if (theUrl.indexOf("?") != -1) {
+                               theUrl += "&id=" + id
+                       } else {
+                               theUrl += "?id=" + id
+                       }
                        top.fsMod.currentBank = bank;
 
-                       if (top.condensedMode) top.content.location.href = theUrl;
-                       else                   parent.list_frame.location.href = theUrl;
+                       if (top.condensedMode) {
+                               top.content.location.href = theUrl;
+                       } else {
+                               parent.list_frame.location.href=theUrl;
+                       }
 
                        '.($this->doHighlight ? 'Tree.highlightActiveItem("file", highlightID + "_" + bank);' : '').'
                        '.(!$CLIENT['FORMSTYLE'] ? '' : 'if (linkObj) linkObj.blur(); ').'
@@ -177,7 +234,9 @@ class SC_alt_file_navframe {
                        // Setting up the buttons and markers for docheader
                $docHeaderButtons = $this->getButtons();
                $markers = array(
-                       'IMG_RESET' => '<img' . t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'], 'gfx/close_gray.gif', ' width="16" height="16"') . ' id="treeFilterReset" alt="Reset Filter" />',
+                       'IMG_RESET' => '<img' . t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'], 'gfx/close_gray.gif', ' width="16" height="16"') .
+                       ' id="treeFilterReset" alt="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:labels.resetFilter') . '" ' .
+                       'title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:labels.resetFilter') . '" />',
                        'CONTENT' => $this->content
                );
 
@@ -234,10 +293,10 @@ class SC_alt_file_navframe {
         * Called by typo3/ajax.php
         *
         * @param       array           $params: additional parameters (not used here)
-        * @param       TYPO3AJAX       &$ajaxObj: reference of the TYPO3AJAX object of this request
+        * @param       TYPO3AJAX       $ajaxObj: The TYPO3AJAX object of this request
         * @return      void
         */
-       public function ajaxExpandCollapse($params, &$ajaxObj)  {
+       public function ajaxExpandCollapse($params, $ajaxObj) {
                global $LANG;
 
                $this->init();
@@ -265,4 +324,4 @@ if (!(TYPO3_REQUESTTYPE & TYPO3_REQUESTTYPE_AJAX)) {
        $SOBE->printContent();
 }
 
-?>
\ No newline at end of file
+?>