2 /***************************************************************
5 * (c) 1999-2005 Kasper Skaarhoj (kasperYYYY@typo3.com)
8 * This script is part of the TYPO3 project. The TYPO3 project is
9 * free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * The GNU General Public License can be found at
15 * http://www.gnu.org/copyleft/gpl.html.
16 * A copy is found in the textfile GPL.txt and important notices to the license
17 * from the author is found in LICENSE.txt distributed with these scripts.
20 * This script is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
25 * This copyright notice MUST APPEAR in all copies of the script!
26 ***************************************************************/
28 * Folder tree in the File main module.
31 * Revised for TYPO3 3.6 2/2003 by Kasper Skaarhoj
34 * @author Kasper Skaarhoj <kasperYYYY@typo3.com>
37 * [CLASS/FUNCTION INDEX of SCRIPT]
41 * 72: class localFolderTree extends t3lib_folderTree
42 * 81: function localFolderTree()
43 * 92: function wrapIcon($icon,&$row)
44 * 121: function wrapTitle($title,$row,$bank=0)
47 * 146: class SC_alt_file_navframe
48 * 163: function init()
49 * 253: function main()
50 * 284: function printContent()
53 * (This index is automatically created/updated by the extension "extdeveval")
58 require_once('init.php');
59 require('template.php');
60 require_once('class.filelistfoldertree.php');
64 * Main script class for rendering of the folder tree
66 * @author Kasper Skaarhoj <kasperYYYY@typo3.com>
70 class SC_alt_file_navframe
{
73 var $content; // Content accumulates in this variable.
74 var $foldertree; // Folder tree object.
77 * document template object
84 // Internal, static: GPvar:
85 var $currentSubScript;
90 * Initialiation of the script class
95 global $BE_USER, $BACK_PATH;
98 $this->backPath
= $BACK_PATH;
101 $this->currentSubScript
= t3lib_div
::_GP('currentSubScript');
102 $this->cMR
= t3lib_div
::_GP('cMR');
104 // Create folder tree object:
105 $this->foldertree
= t3lib_div
::makeInstance('filelistFolderTree');
106 $this->foldertree
->ext_IconMode
= $BE_USER->getTSConfigVal('options.folderTree.disableIconLinkToContextmenu');
107 $this->foldertree
->thisScript
= 'alt_file_navframe.php';
112 * initialization for the visual parts of the class
113 * Use template rendering only if this is a non-AJAX call
117 public function initPage() {
118 global $BE_USER, $BACK_PATH, $CLIENT;
120 // Setting highlight mode:
121 $this->doHighlight
= !$BE_USER->getTSConfigVal('options.pageTree.disableTitleHighlight');
123 // Create template object:
124 $this->doc
= t3lib_div
::makeInstance('template');
125 $this->doc
->backPath
= $BACK_PATH;
126 $this->doc
->docType
= 'xhtml_trans';
128 // Adding javascript code for AJAX (prototype), drag&drop and the filetree as well as the click menu code
129 $this->doc
->getDragDropCode('folders');
130 $this->doc
->getContextMenuCode();
132 // Setting JavaScript for menu.
133 $this->doc
->JScode
.= $this->doc
->wrapScriptTags(
135 ($this->currentSubScript?
'top.currentSubScript=unescape("'.rawurlencode($this->currentSubScript
).'");':'').'
137 // setting prefs for foldertree
138 Tree.ajaxID = "SC_alt_file_navframe::expandCollapse";
140 // Function, loading the list frame from navigation tree:
141 function jumpTo(id, linkObj, highlightID, bank) {
142 var theUrl = top.TS.PATH_typo3 + top.currentSubScript + "?id=" + id;
143 top.fsMod.currentBank = bank;
145 if (top.condensedMode) top.content.location.href = theUrl;
146 else parent.list_frame.location.href = theUrl;
148 '.($this->doHighlight ?
'Tree.highlightActiveItem("file", highlightID + "_" + bank);' : '').'
149 '.(!$CLIENT['FORMSTYLE'] ?
'' : 'if (linkObj) linkObj.blur(); ').'
152 '.($this->cMR ?
" jumpTo(top.fsMod.recentIds['file'],'');" : '')
158 * Main function, rendering the folder tree
163 global $LANG,$CLIENT;
165 // Produce browse-tree:
166 $tree = $this->foldertree
->getBrowsableTree();
169 $this->content
= $this->doc
->startPage('TYPO3 Folder Tree');
171 // Outputting page tree:
172 $this->content
.= $tree;
174 // Outputting refresh-link
176 <p class="c-refresh">
177 <a href="'.htmlspecialchars(t3lib_div
::getIndpEnv('REQUEST_URI')).'">'.
178 '<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="" />'.
179 $LANG->sL('LLL:EXT:lang/locallang_core.php:labels.refresh',1).'</a>
184 $this->content
.= t3lib_BEfunc
::cshItem('xMOD_csh_corebe', 'filetree', $GLOBALS['BACK_PATH']);
186 // Adding javascript for drag & drop activation and highlighting
187 $this->content
.=$this->doc
->wrapScriptTags('
188 '.($this->doHighlight ?
'Tree.highlightActiveItem("", top.fsMod.navFrameHighlightedID["file"]);' : '').'
189 '.(!$this->doc
->isCMlayers() ?
'Tree.activateDragDrop = false;' : 'Tree.registerDragDropHandlers();')
196 * Outputting the accumulated content to screen
200 function printContent() {
201 $this->content
.= $this->doc
->endPage();
202 $this->content
= $this->doc
->insertStylesAndJS($this->content
);
207 /**********************************
211 **********************************/
214 * Makes the AJAX call to expand or collapse the foldertree.
215 * Called by typo3/ajax.php
217 * @param array $params: additional parameters (not used here)
218 * @param TYPO3AJAX &$ajaxObj: reference of the TYPO3AJAX object of this request
221 public function ajaxExpandCollapse($params, &$ajaxObj) {
225 $tree = $this->foldertree
->getBrowsableTree();
226 if (!$this->foldertree
->ajaxStatus
) {
227 $ajaxObj->setError($tree);
229 $ajaxObj->addContent('tree', $tree);
234 // Include extension?
235 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE
]['XCLASS']['typo3/alt_file_navframe.php']) {
236 include_once($TYPO3_CONF_VARS[TYPO3_MODE
]['XCLASS']['typo3/alt_file_navframe.php']);
240 // Make instance if it is not an AJAX call
241 if (!(TYPO3_REQUESTTYPE
& TYPO3_REQUESTTYPE_AJAX
)) {
242 $SOBE = t3lib_div
::makeInstance('SC_alt_file_navframe');
246 $SOBE->printContent();