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 ***************************************************************/
00058 $BACK_PATH='';
00059 require ('init.php');
00060 require ('template.php');
00061 require_once (PATH_t3lib.'class.t3lib_foldertree.php');
00062 
00063 
00072 class localFolderTree extends t3lib_folderTree {
00073 
00074         var $ext_IconMode;
00075 
00081         function localFolderTree() {
00082                 parent::t3lib_folderTree();
00083         }
00084 
00092         function wrapIcon($icon,&$row)  {
00093 
00094                         // Add title attribute to input icon tag
00095                 $theFolderIcon = $this->addTagAttributes($icon,($this->titleAttrib ? $this->titleAttrib.'="'.$this->getTitleAttrib($row).'"' : ''));
00096 
00097                         // Wrap icon in click-menu link.
00098                 if (!$this->ext_IconMode)       {
00099                         $theFolderIcon = $GLOBALS['TBE_TEMPLATE']->wrapClickMenuOnIcon($theFolderIcon,$row['path'],'',0);
00100                 } elseif (!strcmp($this->ext_IconMode,'titlelink'))     {
00101                         $aOnClick = 'return jumpTo(\''.$this->getJumpToParam($row).'\',this,\''.$this->domIdPrefix.$this->getId($row).'\','.$this->bank.');';
00102                         $theFolderIcon='<a href="#" onclick="'.htmlspecialchars($aOnClick).'">'.$theFolderIcon.'</a>';
00103                 }
00104                         // Wrap icon in a drag/drop span.
00105                 $spanOnDrag = htmlspecialchars('return dragElement("'.$this->getJumpToParam($row).'", "'.$row['uid'].'")');
00106                 $spanOnDrop = htmlspecialchars('return dropElement("'.$this->getJumpToParam($row).'")');
00107                 $dragDropIcon = '<span id="dragIconID_'.$row['uid'].'" ondragstart="'.$spanOnDrag.'" onmousedown="'.$spanOnDrag.'" onmouseup="'.$spanOnDrop.'">'.$theFolderIcon.'</span>';
00108 
00109                 return $dragDropIcon;
00110         }
00111 
00121         function wrapTitle($title,$row,$bank=0) {
00122                 $aOnClick = 'return jumpTo(\''.$this->getJumpToParam($row).'\',this,\''.$this->domIdPrefix.$this->getId($row).'\','.$bank.');';
00123                 $CSM = '';
00124                 if ($GLOBALS['TYPO3_CONF_VARS']['BE']['useOnContextMenuHandler'])       {
00125                         $CSM = ' oncontextmenu="'.htmlspecialchars($GLOBALS['TBE_TEMPLATE']->wrapClickMenuOnIcon('',$row['path'],'',0,'&bank='.$this->bank,'',TRUE)).'"';
00126                 }
00127                 $theFolderTitle='<a href="#" onclick="'.htmlspecialchars($aOnClick).'"'.$CSM.'>'.$title.'</a>';
00128 
00129                         // Wrap title in a drag/drop span.
00130                 $spanOnDrag = htmlspecialchars('return dragElement("'.$this->getJumpToParam($row).'","'.$row['uid'].'")');
00131                 $spanOnDrop = htmlspecialchars('return dropElement("'.$this->getJumpToParam($row).'")');
00132                 $dragDropTitle = '<span id="dragTitleID_'.$row['uid'].'" ondragstart="'.$spanOnDrag.'" onmousedown="'.$spanOnDrag.'" onmouseup="'.$spanOnDrop.'">'.$theFolderTitle.'</span>';
00133                 return $dragDropTitle;
00134         }
00135 }
00136 
00137 
00138 
00146 class SC_alt_file_navframe {
00147 
00148                 // Internal, dynamic:
00149         var $content;           // Content accumulates in this variable.
00150         var $foldertree;        // Folder tree object.
00151         var $doc;                       // Template object.
00152 
00153                 // Internal, static: GPvar:
00154         var $currentSubScript;
00155         var $cMR;
00156 
00157 
00163         function init() {
00164                 global $BE_USER,$BACK_PATH,$CLIENT;
00165 
00166                         // Setting GPvars:
00167                 $this->currentSubScript = t3lib_div::_GP('currentSubScript');
00168                 $this->cMR = t3lib_div::_GP('cMR');
00169 
00170                         // Create folder tree object:
00171                 $this->foldertree = t3lib_div::makeInstance('localFolderTree');
00172                 $this->foldertree->ext_IconMode = $BE_USER->getTSConfigVal('options.folderTree.disableIconLinkToContextmenu');
00173                 $this->foldertree->thisScript = 'alt_file_navframe.php';
00174 
00175                         // Setting highlight mode:
00176                 $this->doHighlight = !$BE_USER->getTSConfigVal('options.pageTree.disableTitleHighlight');
00177 
00178                         // Create template object:
00179                 $this->doc = t3lib_div::makeInstance('template');
00180                 $this->doc->docType='xhtml_trans';
00181 
00182                         // Setting backPath
00183                 $this->doc->backPath = $BACK_PATH;
00184 
00185                         // Setting JavaScript for menu.
00186                 $this->doc->JScode=$this->doc->wrapScriptTags(
00187         ($this->currentSubScript?'top.currentSubScript=unescape("'.rawurlencode($this->currentSubScript).'");':'').'
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+"?id="+id;
00192                 top.fsMod.currentBank = bank;
00193 
00194                 if (top.condensedMode)  {
00195                         top.content.location.href=theUrl;
00196                 } else {
00197                         parent.list_frame.location.href=theUrl;
00198                 }
00199 
00200         '.($this->doHighlight?'hilight_row("file",highLightID+"_"+bank);':'').'
00201                 '.(!$CLIENT['FORMSTYLE'] ? '' : 'if (linkObj) {linkObj.blur();}').'
00202                 return false;
00203         }
00204 
00205 
00206                 // Call this function, refresh_nav(), from another script in the backend if you want to refresh the navigation frame (eg. after having changed a page title or moved pages etc.)
00207                 // See t3lib_BEfunc::getSetUpdateSignal()
00208         function refresh_nav()  {       //
00209                 window.setTimeout("_refresh_nav();",0);
00210         }
00211         function _refresh_nav() {       //
00212                 window.location.href="'.$this->pagetree->thisScript.'?unique='.time().'";
00213         }
00214 
00215                 // Highlighting rows in the folder tree:
00216         function hilight_row(frameSetModule,highLightID) {      //
00217 
00218                         // Remove old:
00219                 theObj = document.getElementById(top.fsMod.navFrameHighlightedID[frameSetModule]);
00220                 if (theObj)     {
00221                         theObj.style.backgroundColor="";
00222                 }
00223 
00224                         // Set new:
00225                 top.fsMod.navFrameHighlightedID[frameSetModule] = highLightID;
00226                 theObj = document.getElementById(highLightID);
00227                 if (theObj)     {
00228                         theObj.style.backgroundColor="'.t3lib_div::modifyHTMLColorAll($this->doc->bgColor,-20).'";
00229                 }
00230         }
00231 
00232         '.($this->cMR?"jumpTo(top.fsMod.recentIds['file'],'');":'').';
00233                 ');
00234 
00235                         // Click menu code is added:
00236                 $CMparts=$this->doc->getContextMenuCode();
00237                 $this->doc->bodyTagAdditions = $CMparts[1];
00238                 $this->doc->JScode.=$CMparts[0];
00239                 $this->doc->postCode.= $CMparts[2];
00240 
00241                         // Drag and Drop code is added:
00242                 $DDparts=$this->doc->getDragDropCode('folders');
00243                         // ignore the $DDparts[1] for now
00244                 $this->doc->JScode.= $DDparts[0];
00245                 $this->doc->postCode.= $DDparts[2];
00246         }
00247 
00253         function main() {
00254                 global $LANG,$CLIENT;
00255 
00256                         // Produce browse-tree:
00257                 $tree = $this->foldertree->getBrowsableTree();
00258 
00259                 $this->content = '';
00260                 $this->content.= $this->doc->startPage('Folder tree');
00261                 $this->content.= $tree;
00262                 $refreshUrl = t3lib_div::getIndpEnv('REQUEST_URI');
00263                 $this->content.= '
00264                         <p class="c-refresh">
00265                                 <a href="'.htmlspecialchars($refreshUrl).'">'.
00266                                 '<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="" />'.
00267                                 '</a><a href="'.htmlspecialchars($refreshUrl).'">'.
00268                                 $LANG->sL('LLL:EXT:lang/locallang_core.php:labels.refresh',1).'</a>
00269                         </p>
00270                         <br />';
00271                 $this->content.= t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'filetree', $GLOBALS['BACK_PATH']);
00272 
00273                         // Adding highlight - JavaScript
00274                 if ($this->doHighlight) $this->content .=$this->doc->wrapScriptTags('
00275                         hilight_row("",top.fsMod.navFrameHighlightedID["file"]);
00276                 ');
00277         }
00278 
00284         function printContent() {
00285                 $this->content.= $this->doc->endPage();
00286                 $this->content = $this->doc->insertStylesAndJS($this->content);
00287                 echo $this->content;
00288         }
00289 }
00290 
00291 // Include extension?
00292 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/alt_file_navframe.php'])     {
00293         include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/alt_file_navframe.php']);
00294 }
00295 
00296 
00297 
00298 
00299 
00300 
00301 
00302 
00303 
00304 
00305 
00306 
00307 // Make instance:
00308 $SOBE = t3lib_div::makeInstance('SC_alt_file_navframe');
00309 $SOBE->init();
00310 $SOBE->main();
00311 $SOBE->printContent();
00312 ?>


Généré par L'expert TYPO3 avec  doxygen 1.4.6