* Added "rtehtmlarea" as a system extension
[Packages/TYPO3.CMS.git] / typo3 / alt_file_navframe.php
1 <?php
2 /***************************************************************
3 * Copyright notice
4 *
5 * (c) 1999-2005 Kasper Skaarhoj (kasperYYYY@typo3.com)
6 * All rights reserved
7 *
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.
13 *
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.
18 *
19 *
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.
24 *
25 * This copyright notice MUST APPEAR in all copies of the script!
26 ***************************************************************/
27 /**
28 * Folder tree in the File main module.
29 *
30 * $Id$
31 * Revised for TYPO3 3.6 2/2003 by Kasper Skaarhoj
32 * XHTML compliant
33 *
34 * @author Kasper Skaarhoj <kasperYYYY@typo3.com>
35 */
36 /**
37 * [CLASS/FUNCTION INDEX of SCRIPT]
38 *
39 *
40 *
41 * 68: class SC_alt_file_navframe
42 * 85: function init()
43 * 168: function main()
44 * 199: function printContent()
45 *
46 * TOTAL FUNCTIONS: 3
47 * (This index is automatically created/updated by the extension "extdeveval")
48 *
49 */
50
51
52 $BACK_PATH='';
53 require ('init.php');
54 require ('template.php');
55 require_once (PATH_t3lib.'class.t3lib_foldertree.php');
56
57
58
59
60
61 /**
62 * Main script class for rendering of the folder tree
63 *
64 * @author Kasper Skaarhoj <kasperYYYY@typo3.com>
65 * @package TYPO3
66 * @subpackage core
67 */
68 class SC_alt_file_navframe {
69
70 // Internal, dynamic:
71 var $content; // Content accumulates in this variable.
72 var $foldertree; // Folder tree object.
73 var $doc; // Template object.
74
75 // Internal, static: GPvar:
76 var $currentSubScript;
77 var $cMR;
78
79
80 /**
81 * Initialiation of the script class
82 *
83 * @return void
84 */
85 function init() {
86 global $BE_USER,$BACK_PATH,$CLIENT;
87
88 // Setting GPvars:
89 $this->currentSubScript = t3lib_div::_GP('currentSubScript');
90 $this->cMR = t3lib_div::_GP('cMR');
91
92 // Create folder tree object:
93 $this->foldertree = t3lib_div::makeInstance('t3lib_folderTree');
94 $this->foldertree->ext_IconMode = $BE_USER->getTSConfigVal('options.folderTree.disableIconLinkToContextmenu');
95 $this->foldertree->thisScript = 'alt_file_navframe.php';
96
97 // Setting highlight mode:
98 $this->doHighlight = !$BE_USER->getTSConfigVal('options.pageTree.disableTitleHighlight');
99
100 // Create template object:
101 $this->doc = t3lib_div::makeInstance('template');
102 $this->doc->docType='xhtml_trans';
103
104 // Setting backPath
105 $this->doc->backPath = $BACK_PATH;
106
107 // Setting JavaScript for menu.
108 $this->doc->JScode=$this->doc->wrapScriptTags(
109 ($this->currentSubScript?'top.currentSubScript=unescape("'.rawurlencode($this->currentSubScript).'");':'').'
110
111 // Function, loading the list frame from navigation tree:
112 function jumpTo(id,linkObj,highLightID,bank) { //
113 var theUrl = top.TS.PATH_typo3+top.currentSubScript+"?id="+id;
114 top.fsMod.currentBank = bank;
115
116 if (top.condensedMode) {
117 top.content.document.location=theUrl;
118 } else {
119 parent.list_frame.document.location=theUrl;
120 }
121
122 '.($this->doHighlight?'hilight_row("file",highLightID+"_"+bank);':'').'
123 '.(!$CLIENT['FORMSTYLE'] ? '' : 'if (linkObj) {linkObj.blur();}').'
124 return false;
125 }
126
127
128 // 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.)
129 // See t3lib_BEfunc::getSetUpdateSignal()
130 function refresh_nav() { //
131 window.setTimeout("_refresh_nav();",0);
132 }
133 function _refresh_nav() { //
134 document.location="'.$this->pagetree->thisScript.'?unique='.time().'";
135 }
136
137 // Highlighting rows in the folder tree:
138 function hilight_row(frameSetModule,highLightID) { //
139
140 // Remove old:
141 theObj = document.getElementById(top.fsMod.navFrameHighlightedID[frameSetModule]);
142 if (theObj) {
143 theObj.style.backgroundColor="";
144 }
145
146 // Set new:
147 top.fsMod.navFrameHighlightedID[frameSetModule] = highLightID;
148 theObj = document.getElementById(highLightID);
149 if (theObj) {
150 theObj.style.backgroundColor="'.t3lib_div::modifyHTMLColorAll($this->doc->bgColor,-20).'";
151 }
152 }
153
154 '.($this->cMR?"jumpTo(top.fsMod.recentIds['file'],'');":'').';
155 ');
156
157 // Click menu code is added:
158 $CMparts=$this->doc->getContextMenuCode();
159 $this->doc->bodyTagAdditions = $CMparts[1];
160 $this->doc->JScode.=$CMparts[0];
161 $this->doc->postCode.= $CMparts[2];
162 }
163
164 /**
165 * Main function, rendering the folder tree
166 *
167 * @return void
168 */
169 function main() {
170 global $LANG,$CLIENT;
171
172 // Produce browse-tree:
173 $tree = $this->foldertree->getBrowsableTree();
174
175 $this->content = '';
176 $this->content.= $this->doc->startPage('Folder tree');
177 $this->content.= $tree;
178 $refreshUrl = t3lib_div::getIndpEnv('REQUEST_URI');
179 $this->content.= '
180 <p class="c-refresh">
181 <a href="'.htmlspecialchars($refreshUrl).'">'.
182 '<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="" />'.
183 '</a><a href="'.htmlspecialchars($refreshUrl).'">'.
184 $LANG->sL('LLL:EXT:lang/locallang_core.php:labels.refresh',1).'</a>
185 </p>
186 <br />';
187 $this->content.= t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'filetree', $GLOBALS['BACK_PATH']);
188
189 // Adding highlight - JavaScript
190 if ($this->doHighlight) $this->content .=$this->doc->wrapScriptTags('
191 hilight_row("",top.fsMod.navFrameHighlightedID["file"]);
192 ');
193 }
194
195 /**
196 * Outputting the accumulated content to screen
197 *
198 * @return void
199 */
200 function printContent() {
201 $this->content.= $this->doc->endPage();
202 echo $this->content;
203 }
204 }
205
206 // Include extension?
207 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/alt_file_navframe.php']) {
208 include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/alt_file_navframe.php']);
209 }
210
211
212
213
214
215
216
217
218
219
220
221
222 // Make instance:
223 $SOBE = t3lib_div::makeInstance('SC_alt_file_navframe');
224 $SOBE->init();
225 $SOBE->main();
226 $SOBE->printContent();
227 ?>