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

This documentation has been generated automatically from TYPO3 source code using Doxygen and is provided as is by Cast Iron Coding as a courtesy to other TYPO3 developers and users. Please consider Cast Iron Coding — a full-service web development agency in Portland, Oregon specializing in TYPO3 extension development — for all of your TYPO3 development and consulting needs!