Documentation TYPO3 par Ameos

alt_file_navframe.php

00001 <?php
00002 /***************************************************************
00003 *  Copyright notice
00004 *
00005 *  (c) 1999-2005 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 ***************************************************************/
00057 $BACK_PATH = '';
00058 require('init.php');
00059 require('template.php');
00060 require_once('class.filelistfoldertree.php');
00061 
00062 
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         var $doc;                       // Template object.
00076         var $backPath;
00077 
00078                 // Internal, static: GPvar:
00079         var $ajax;                                                      // Is set, if an AJAX call should be handled.
00080         var $currentSubScript;
00081         var $cMR;
00082 
00083 
00089         function init() {
00090                 global $BE_USER,$BACK_PATH,$CLIENT;
00091 
00092                         // Setting backPath
00093                 $this->backPath = $BACK_PATH;
00094                 $this->doc->backPath = $BACK_PATH;
00095 
00096                         // Setting GPvars:
00097                 $this->ajax = t3lib_div::_GP('ajax');
00098                 $this->currentSubScript = t3lib_div::_GP('currentSubScript');
00099                 $this->cMR = t3lib_div::_GP('cMR');
00100 
00101                         // Create folder tree object:
00102                 $this->foldertree = t3lib_div::makeInstance('filelistFolderTree');
00103                 $this->foldertree->ext_IconMode = $BE_USER->getTSConfigVal('options.folderTree.disableIconLinkToContextmenu');
00104                 $this->foldertree->thisScript = 'alt_file_navframe.php';
00105 
00106                         // Use template rendering only if this is a non-AJAX call:
00107                 if (!$this->ajax) {
00108                                 // Setting highlight mode:
00109                         $this->doHighlight = !$BE_USER->getTSConfigVal('options.pageTree.disableTitleHighlight');
00110 
00111                                 // Create template object:
00112                         $this->doc = t3lib_div::makeInstance('template');
00113                         $this->doc->docType = 'xhtml_trans';
00114 
00115                                 // Adding javascript code for AJAX (prototype), drag&drop and the pagetree
00116                         $this->doc->JScode  = '
00117                         <script type="text/javascript" src="'.$this->backPath.'contrib/prototype/prototype.js"></script>
00118                         <script type="text/javascript" src="'.$this->backPath.'tree.js"></script>'."\n";
00119 
00120                                 // Setting JavaScript for menu.
00121                         $this->doc->JScode .= $this->doc->wrapScriptTags(
00122                         ($this->currentSubScript?'top.currentSubScript=unescape("'.rawurlencode($this->currentSubScript).'");':'').'
00123 
00124                         // setting prefs for pagetree and drag & drop
00125                         Tree.thisScript    = "'.$this->foldertree->thisScript.'";
00126                         DragDrop.changeURL = "'.$this->backPath.'alt_clickmenu.php";
00127                         DragDrop.backPath  = "'.t3lib_div::shortMD5(''.'|'.$GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey']).'";
00128                         DragDrop.table     = "folders";
00129 
00130                         // Function, loading the list frame from navigation tree:
00131                         function jumpTo(id, linkObj, highlightID, bank) {
00132                                 var theUrl = top.TS.PATH_typo3 + top.currentSubScript + "?id=" + id;
00133                                 top.fsMod.currentBank = bank;
00134 
00135                                 if (top.condensedMode) top.content.location.href = theUrl;
00136                                 else                   parent.list_frame.location.href = theUrl;
00137 
00138                                 '.($this->doHighlight ? 'Tree.highlightActiveItem("file", highlightID + "_" + bank);' : '').'
00139                                 '.(!$GLOBALS['CLIENT']['FORMSTYLE'] ? '' : 'if (linkObj) linkObj.blur(); ').'
00140                                 return false;
00141                         }
00142                         '.($this->cMR ? " jumpTo(top.fsMod.recentIds['file'],'');" : '')
00143                         );
00144 
00145                                 // Click menu code is added:
00146                         $CMparts=$this->doc->getContextMenuCode();
00147                         $this->doc->bodyTagAdditions = $CMparts[1];
00148                         $this->doc->JScode.= $CMparts[0];
00149                         $this->doc->postCode.= $CMparts[2];
00150                 }
00151         }
00152 
00158         function main() {
00159                 global $LANG,$CLIENT;
00160 
00161                         // Produce browse-tree:
00162                 $tree = $this->foldertree->getBrowsableTree();
00163 
00164                         // Output only the tree if this is an AJAX call:
00165                 if ($this->ajax) {
00166                         $this->content = $LANG->csConvObj->utf8_encode($tree, $LANG->charSet);
00167                         return;
00168                 }
00169 
00170                 $this->content = $this->doc->startPage('TYPO3 Folder Tree');
00171 
00172                         // Outputting page tree:
00173                 $this->content.= $tree;
00174 
00175                         // Outputting refresh-link
00176                 $this->content.= '
00177                         <p class="c-refresh">
00178                                 <a href="'.htmlspecialchars(t3lib_div::getIndpEnv('REQUEST_URI')).'">'.
00179                                 '<img'.t3lib_iconWorks::skinImg('','gfx/refresh_n.gif','width="14" height="14"').' title="'.$LANG->sL('LLL:EXT:lang/locallang_core.php:labels.refresh',1).'" alt="" />'.
00180                                 $LANG->sL('LLL:EXT:lang/locallang_core.php:labels.refresh',1).'</a>
00181                         </p>
00182                         <br />';
00183 
00184                         // CSH icon:
00185                 $this->content.= t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'filetree', $GLOBALS['BACK_PATH']);
00186 
00187                         // Adding javascript for drag & drop activation and highlighting
00188                 $this->content .=$this->doc->wrapScriptTags('
00189                         '.($this->doHighlight ? 'Tree.highlightActiveItem("", top.fsMod.navFrameHighlightedID["file"]);' : '').'
00190                         '.(!$this->doc->isCMlayers() ? 'Tree.activateDragDrop = false;' : 'Tree.registerDragDropHandlers();')
00191                 );
00192 
00193         }
00194 
00200         function printContent() {
00201                         // If we handle an AJAX call, send headers:
00202                 if ($this->ajax) {
00203                         header('X-JSON: ('.($this->foldertree->ajaxStatus?'true':'false').')');
00204                         header('Content-type: text/html; charset=utf-8');
00205                         // If it's the regular call to fully output the tree:
00206                 } else {
00207                         $this->content.= $this->doc->endPage();
00208                         $this->content = $this->doc->insertStylesAndJS($this->content);
00209                 }
00210                 echo $this->content;
00211         }
00212 }
00213 
00214 // Include extension?
00215 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/alt_file_navframe.php'])     {
00216         include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/alt_file_navframe.php']);
00217 }
00218 
00219 
00220 
00221 
00222 
00223 
00224 
00225 
00226 
00227 
00228 
00229 
00230 // Make instance:
00231 $SOBE = t3lib_div::makeInstance('SC_alt_file_navframe');
00232 $SOBE->init();
00233 $SOBE->main();
00234 $SOBE->printContent();
00235 ?>


Généré par TYPO3 Ameos avec  doxygen 1.4.6