|
TYPO3 API
SVNRelease
|
00001 <?php 00002 /*************************************************************** 00003 * Copyright notice 00004 * 00005 * (c) 1999-2011 Kasper Skårhøj (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 10121 2011-01-18 20:15:30Z ohader $ 00031 * Revised for TYPO3 3.6 2/2003 by Kasper Skårhøj 00032 * XHTML compliant 00033 * 00034 * @author Kasper Skårhøj <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 Skårhøj <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 top.TYPO3.Backend.ContentContainer.setUrl(theUrl); 00199 00200 '.($this->doHighlight ? 'Tree.highlightActiveItem("file", highlightID + "_" + bank);' : '').' 00201 '.(!$CLIENT['FORMSTYLE'] ? '' : 'if (linkObj) linkObj.blur(); ').' 00202 return false; 00203 } 00204 '.($this->cMR ? " jumpTo(top.fsMod.recentIds['file'],'');" : '') 00205 ); 00206 } 00207 00208 00209 /** 00210 * Main function, rendering the folder tree 00211 * 00212 * @return void 00213 */ 00214 function main() { 00215 global $LANG,$CLIENT; 00216 00217 // Produce browse-tree: 00218 $tree = $this->foldertree->getBrowsableTree(); 00219 00220 // Outputting page tree: 00221 $this->content.= $tree; 00222 00223 // Adding javascript for drag & drop activation and highlighting 00224 $this->content .=$this->doc->wrapScriptTags(' 00225 '.($this->doHighlight ? 'Tree.highlightActiveItem("", top.fsMod.navFrameHighlightedID["file"]);' : '').' 00226 '.(!$this->doc->isCMlayers() ? 'Tree.activateDragDrop = false;' : 'Tree.registerDragDropHandlers();') 00227 ); 00228 00229 // Setting up the buttons and markers for docheader 00230 $docHeaderButtons = $this->getButtons(); 00231 $markers = array( 00232 'IMG_RESET' => '<img' . t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'], 'gfx/close_gray.gif', ' width="16" height="16"') . 00233 ' id="treeFilterReset" alt="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:labels.resetFilter') . '" ' . 00234 'title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:labels.resetFilter') . '" />', 00235 'CONTENT' => $this->content 00236 ); 00237 00238 $subparts = array(); 00239 00240 // Possible filter/search like in page tree 00241 $subparts['###SECOND_ROW###'] = ''; 00242 00243 // Build the <body> for the module 00244 $this->content = $this->doc->startPage('TYPO3 Folder Tree'); 00245 $this->content.= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers, $subparts); 00246 $this->content.= $this->doc->endPage(); 00247 $this->content = $this->doc->insertStylesAndJS($this->content); 00248 } 00249 00250 /** 00251 * Outputting the accumulated content to screen 00252 * 00253 * @return void 00254 */ 00255 function printContent() { 00256 echo $this->content; 00257 } 00258 00259 /** 00260 * Create the panel of buttons for submitting the form or otherwise perform operations. 00261 * 00262 * @return array all available buttons as an assoc. array 00263 */ 00264 protected function getButtons() { 00265 $buttons = array( 00266 'csh' => '', 00267 'refresh' => '', 00268 ); 00269 00270 // Refresh 00271 $buttons['refresh'] = '<a href="' . htmlspecialchars(t3lib_div::getIndpEnv('REQUEST_URI')) . '">' . 00272 t3lib_iconWorks::getSpriteIcon('actions-system-refresh') . 00273 '</a>'; 00274 00275 // CSH 00276 $buttons['csh'] = str_replace('typo3-csh-inline','typo3-csh-inline show-right',t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'filetree', $GLOBALS['BACK_PATH'])); 00277 00278 return $buttons; 00279 } 00280 00281 /********************************** 00282 * 00283 * AJAX Calls 00284 * 00285 **********************************/ 00286 00287 /** 00288 * Makes the AJAX call to expand or collapse the foldertree. 00289 * Called by typo3/ajax.php 00290 * 00291 * @param array $params: additional parameters (not used here) 00292 * @param TYPO3AJAX $ajaxObj: The TYPO3AJAX object of this request 00293 * @return void 00294 */ 00295 public function ajaxExpandCollapse($params, $ajaxObj) { 00296 global $LANG; 00297 00298 $this->init(); 00299 $tree = $this->foldertree->getBrowsableTree(); 00300 if (!$this->foldertree->ajaxStatus) { 00301 $ajaxObj->setError($tree); 00302 } else { 00303 $ajaxObj->addContent('tree', $tree); 00304 } 00305 } 00306 } 00307 00308 00309 if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['typo3/alt_file_navframe.php'])) { 00310 include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['typo3/alt_file_navframe.php']); 00311 } 00312 00313 00314 // Make instance if it is not an AJAX call 00315 if (!(TYPO3_REQUESTTYPE & TYPO3_REQUESTTYPE_AJAX)) { 00316 $SOBE = t3lib_div::makeInstance('SC_alt_file_navframe'); 00317 $SOBE->init(); 00318 $SOBE->initPage(); 00319 $SOBE->main(); 00320 $SOBE->printContent(); 00321 } 00322 00323 ?>
1.8.0