alt_file_navframe.php

Go to the documentation of this file.
00001 <?php
00002 /***************************************************************
00003 *  Copyright notice
00004 *
00005 *  (c) 1999-2010 Kasper Skaarhoj (kasperYYYY@typo3.com)
00006 *  All rights reserved
00007 *
00008 *  This script is part of the TYPO3 project. The TYPO3 project is
00009 *  free software; you can redistribute it and/or modify
00010 *  it under the terms of the GNU General Public License as published by
00011 *  the Free Software Foundation; either version 2 of the License, or
00012 *  (at your option) any later version.
00013 *
00014 *  The GNU General Public License can be found at
00015 *  http://www.gnu.org/copyleft/gpl.html.
00016 *  A copy is found in the textfile GPL.txt and important notices to the license
00017 *  from the author is found in LICENSE.txt distributed with these scripts.
00018 *
00019 *
00020 *  This script is distributed in the hope that it will be useful,
00021 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00022 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00023 *  GNU General Public License for more details.
00024 *
00025 *  This copyright notice MUST APPEAR in all copies of the script!
00026 ***************************************************************/
00027 /**
00028  * Folder tree in the File main module.
00029  *
00030  * $Id: alt_file_navframe.php 8156 2010-07-11 12:42:05Z psychomieze $
00031  * Revised for TYPO3 3.6 2/2003 by Kasper Skaarhoj
00032  * XHTML compliant
00033  *
00034  * @author  Kasper Skaarhoj <kasperYYYY@typo3.com>
00035  */
00036 /**
00037  * [CLASS/FUNCTION INDEX of SCRIPT]
00038  *
00039  *
00040  *
00041  *   72: class localFolderTree extends t3lib_folderTree
00042  *   81:     function localFolderTree()
00043  *   92:     function wrapIcon($icon,&$row)
00044  *  121:     function wrapTitle($title,$row,$bank=0)
00045  *
00046  *
00047  *  146: class SC_alt_file_navframe
00048  *  163:     function init()
00049  *  253:     function main()
00050  *  284:     function printContent()
00051  *
00052  * TOTAL FUNCTIONS: 6
00053  * (This index is automatically created/updated by the extension "extdeveval")
00054  *
00055  */
00056 
00057 $BACK_PATH = '';
00058 require_once('init.php');
00059 require('template.php');
00060 require_once('class.filelistfoldertree.php');
00061 
00062 
00063 /**
00064  * Main script class for rendering of the folder tree
00065  *
00066  * @author  Kasper Skaarhoj <kasperYYYY@typo3.com>
00067  * @package TYPO3
00068  * @subpackage core
00069  */
00070 class SC_alt_file_navframe {
00071 
00072         // Internal, dynamic:
00073     var $content;       // Content accumulates in this variable.
00074     var $foldertree;    // Folder tree object.
00075 
00076     /**
00077      * document template object
00078      *
00079      * @var template
00080      */
00081     var $doc;
00082     var $backPath;
00083 
00084         // Internal, static: GPvar:
00085     var $currentSubScript;
00086     var $cMR;
00087 
00088 
00089     /**
00090      * Initialiation of the script class
00091      *
00092      * @return  void
00093      */
00094     function init() {
00095         global $BE_USER, $BACK_PATH;
00096 
00097             // Setting backPath
00098         $this->backPath = $BACK_PATH;
00099 
00100             // Setting GPvars:
00101         $this->currentSubScript = t3lib_div::_GP('currentSubScript');
00102         $this->cMR = t3lib_div::_GP('cMR');
00103 
00104             // Create folder tree object:
00105         $this->foldertree = t3lib_div::makeInstance('filelistFolderTree');
00106         $this->foldertree->ext_IconMode = $BE_USER->getTSConfigVal('options.folderTree.disableIconLinkToContextmenu');
00107         $this->foldertree->thisScript = 'alt_file_navframe.php';
00108     }
00109 
00110 
00111     /**
00112      * initialization for the visual parts of the class
00113      * Use template rendering only if this is a non-AJAX call
00114      *
00115      * @return  void
00116      */
00117     public function initPage() {
00118         global $BE_USER, $BACK_PATH, $CLIENT;
00119 
00120             // Setting highlight mode:
00121         $this->doHighlight = !$BE_USER->getTSConfigVal('options.pageTree.disableTitleHighlight');
00122 
00123             // Create template object:
00124         $this->doc = t3lib_div::makeInstance('template');
00125         $this->doc->backPath = $BACK_PATH;
00126         $this->doc->setModuleTemplate('templates/alt_file_navframe.html');
00127         $this->doc->showFlashMessages = FALSE;
00128 
00129             // Adding javascript code for AJAX (prototype), drag&drop and the filetree as well as the click menu code
00130         $this->doc->getDragDropCode('folders');
00131         $this->doc->getContextMenuCode();
00132 
00133             // Setting JavaScript for menu.
00134         $this->doc->JScode .= $this->doc->wrapScriptTags(
00135 
00136         ($this->currentSubScript?'top.currentSubScript=unescape("'.rawurlencode($this->currentSubScript).'");':'').'
00137 
00138         function initFlashUploader(path) {
00139             path = decodeURIComponent(path);
00140             var flashUploadOptions = {
00141                 uploadURL: top.TS.PATH_typo3 + "ajax.php",
00142                 uploadFileSizeLimit: "' . t3lib_div::getMaxUploadFileSize() . '",
00143                 uploadFileTypes: {
00144                     allow:  "' . $GLOBALS['TYPO3_CONF_VARS']['BE']['fileExtensions']['webspace']['allow'] . '",
00145                     deny: "' . $GLOBALS['TYPO3_CONF_VARS']['BE']['fileExtensions']['webspace']['deny'] . '"
00146                 },
00147                 uploadFilePostName: "upload_1",
00148                 uploadPostParams: {
00149                     "file[upload][1][target]": path,
00150                     "file[upload][1][data]": 1,
00151                     "file[upload][1][charset]": "utf-8",
00152                     "ajaxID": "TYPO3_tcefile::process"
00153                 }
00154             };
00155 
00156                 // get the flashUploaderWindow instance from the parent frame
00157             var flashUploader = top.TYPO3.FileUploadWindow.getInstance(flashUploadOptions);
00158                 // add an additional function inside the container to show the checkbox option
00159             var infoComponent = new top.Ext.Panel({
00160                 autoEl: { tag: "div" },
00161                 height: "auto",
00162                 bodyBorder: false,
00163                 border: false,
00164                 hideBorders: true,
00165                 cls: "t3-upload-window-infopanel",
00166                 id: "t3-upload-window-infopanel-addition",
00167                 html: \'<label for="overrideExistingFilesCheckbox"><input id="overrideExistingFilesCheckbox" type="checkbox" onclick="setFlashPostOptionOverwriteExistingFiles(this);" />\' + top.String.format(top.TYPO3.LLL.fileUpload.infoComponentOverrideFiles) + \'</label>\'
00168             });
00169             flashUploader.add(infoComponent);
00170 
00171                 // do a reload of this frame once all uploads are done
00172             flashUploader.on("totalcomplete", function() {
00173                 jumpTo (top.rawurlencode(path), "", "", "");
00174             });
00175 
00176                 // this is the callback function that delivers the additional post parameter to the flash application
00177             top.setFlashPostOptionOverwriteExistingFiles = function(checkbox) {
00178                 var uploader = top.TYPO3.getInstance("FileUploadWindow");
00179                 if (uploader.isVisible()) {
00180                     uploader.swf.addPostParam("overwriteExistingFiles", (checkbox.checked == true ? 1 : 0));
00181                 }
00182             };
00183         }
00184 
00185 
00186         // setting prefs for foldertree
00187         Tree.ajaxID = "SC_alt_file_navframe::expandCollapse";
00188 
00189         // Function, loading the list frame from navigation tree:
00190         function jumpTo(id, linkObj, highlightID, bank) {
00191             var theUrl = top.TS.PATH_typo3 + top.currentSubScript ;
00192             if (theUrl.indexOf("?") != -1) {
00193                 theUrl += "&id=" + id
00194             } else {
00195                 theUrl += "?id=" + id
00196             }
00197             top.fsMod.currentBank = bank;
00198 
00199             if (top.TYPO3.configuration.condensedMode) {
00200                 top.content.location.href = theUrl;
00201             } else {
00202                 parent.list_frame.location.href=theUrl;
00203             }
00204 
00205             '.($this->doHighlight ? 'Tree.highlightActiveItem("file", highlightID + "_" + bank);' : '').'
00206             '.(!$CLIENT['FORMSTYLE'] ? '' : 'if (linkObj) linkObj.blur(); ').'
00207             return false;
00208         }
00209         '.($this->cMR ? " jumpTo(top.fsMod.recentIds['file'],'');" : '')
00210         );
00211     }
00212 
00213 
00214     /**
00215      * Main function, rendering the folder tree
00216      *
00217      * @return  void
00218      */
00219     function main() {
00220         global $LANG,$CLIENT;
00221 
00222             // Produce browse-tree:
00223         $tree = $this->foldertree->getBrowsableTree();
00224 
00225             // Outputting page tree:
00226         $this->content.= $tree;
00227 
00228             // Adding javascript for drag & drop activation and highlighting
00229         $this->content .=$this->doc->wrapScriptTags('
00230             '.($this->doHighlight ? 'Tree.highlightActiveItem("", top.fsMod.navFrameHighlightedID["file"]);' : '').'
00231             '.(!$this->doc->isCMlayers() ? 'Tree.activateDragDrop = false;' : 'Tree.registerDragDropHandlers();')
00232         );
00233 
00234             // Setting up the buttons and markers for docheader
00235         $docHeaderButtons = $this->getButtons();
00236         $markers = array(
00237             'IMG_RESET' => '<img' . t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'], 'gfx/close_gray.gif', ' width="16" height="16"') .
00238             ' id="treeFilterReset" alt="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:labels.resetFilter') . '" ' .
00239             'title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:labels.resetFilter') . '" />',
00240             'CONTENT' => $this->content
00241         );
00242 
00243         $subparts = array();
00244 
00245             // Possible filter/search like in page tree
00246         $subparts['###SECOND_ROW###'] = '';
00247 
00248             // Build the <body> for the module
00249         $this->content = $this->doc->startPage('TYPO3 Folder Tree');
00250         $this->content.= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers, $subparts);
00251         $this->content.= $this->doc->endPage();
00252         $this->content = $this->doc->insertStylesAndJS($this->content);
00253     }
00254 
00255     /**
00256      * Outputting the accumulated content to screen
00257      *
00258      * @return  void
00259      */
00260     function printContent() {
00261         echo $this->content;
00262     }
00263 
00264     /**
00265      * Create the panel of buttons for submitting the form or otherwise perform operations.
00266      *
00267      * @return  array   all available buttons as an assoc. array
00268      */
00269     protected function getButtons() {
00270         $buttons = array(
00271             'csh' => '',
00272             'refresh' => '',
00273         );
00274 
00275             // Refresh
00276         $buttons['refresh'] = '<a href="' . htmlspecialchars(t3lib_div::getIndpEnv('REQUEST_URI')) . '">' .
00277                 t3lib_iconWorks::getSpriteIcon('actions-system-refresh') .
00278         '</a>';
00279 
00280             // CSH
00281         $buttons['csh'] = str_replace('typo3-csh-inline','typo3-csh-inline show-right',t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'filetree', $GLOBALS['BACK_PATH']));
00282 
00283         return $buttons;
00284     }
00285 
00286     /**********************************
00287      *
00288      * AJAX Calls
00289      *
00290      **********************************/
00291 
00292     /**
00293      * Makes the AJAX call to expand or collapse the foldertree.
00294      * Called by typo3/ajax.php
00295      *
00296      * @param   array       $params: additional parameters (not used here)
00297      * @param   TYPO3AJAX   $ajaxObj: The TYPO3AJAX object of this request
00298      * @return  void
00299      */
00300     public function ajaxExpandCollapse($params, $ajaxObj) {
00301         global $LANG;
00302 
00303         $this->init();
00304         $tree = $this->foldertree->getBrowsableTree();
00305         if (!$this->foldertree->ajaxStatus) {
00306             $ajaxObj->setError($tree);
00307         } else  {
00308             $ajaxObj->addContent('tree', $tree);
00309         }
00310     }
00311 }
00312 
00313 
00314 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/alt_file_navframe.php']) {
00315     include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/alt_file_navframe.php']);
00316 }
00317 
00318 
00319 // Make instance if it is not an AJAX call
00320 if (!(TYPO3_REQUESTTYPE & TYPO3_REQUESTTYPE_AJAX)) {
00321     $SOBE = t3lib_div::makeInstance('SC_alt_file_navframe');
00322     $SOBE->init();
00323     $SOBE->initPage();
00324     $SOBE->main();
00325     $SOBE->printContent();
00326 }
00327 
00328 ?>

Generated on Sat Jul 24 04:17:28 2010 for TYPO3 API by  doxygen 1.4.7