Changed lots of stuff...
[Packages/TYPO3.CMS.git] / typo3 / alt_file_navframe.php
1 <?php
2 /***************************************************************
3 * Copyright notice
4 *
5 * (c) 1999-2004 Kasper Skaarhoj (kasper@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 <kasper@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 * 170: function main()
44 * 198: 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 <kasper@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) { //
113 var theUrl = top.TS.PATH_typo3+top.currentSubScript+"?id="+id;
114
115 if (top.condensedMode) {
116 top.content.document.location=theUrl;
117 } else {
118 parent.list_frame.document.location=theUrl;
119 }
120
121 '.($this->doHighlight?'hilight_row("file",highLightID);':'').'
122 '.(!$CLIENT['FORMSTYLE'] ? '' : 'if (linkObj) {linkObj.blur();}').'
123 return false;
124 }
125
126
127 // 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.)
128 // See t3lib_BEfunc::getSetUpdateSignal()
129 function refresh_nav() { //
130 window.setTimeout("_refresh_nav();",0);
131 }
132 function _refresh_nav() { //
133 document.location="'.$this->pagetree->thisScript.'?unique='.time().'";
134 }
135
136 // Highlighting rows in the folder tree:
137 function hilight_row(frameSetModule,highLightID) { //
138
139 // Remove old:
140 theObj = document.getElementById(top.fsMod.navFrameHighlightedID[frameSetModule]);
141 if (theObj) {
142 theObj.style.backgroundColor="";
143 }
144
145 // Set new:
146 top.fsMod.navFrameHighlightedID[frameSetModule] = highLightID;
147 theObj = document.getElementById(highLightID);
148 if (theObj) {
149 theObj.style.backgroundColor="'.t3lib_div::modifyHTMLColorAll($this->doc->bgColor,-20).'";
150 }
151 }
152
153 '.($this->cMR?"jumpTo(top.fsMod.recentIds['file'],'');":'').';
154 ');
155
156 // Click menu code is added:
157 $CMparts=$this->doc->getContextMenuCode();
158 $this->doc->bodyTagAdditions = $CMparts[1];
159 $this->doc->JScode.=$CMparts[0];
160 $this->doc->postCode.= $CMparts[2];
161 }
162
163 /**
164 * Main function, rendering the folder tree
165 *
166 * @return void
167 */
168 function main() {
169 global $LANG,$CLIENT;
170
171 // Produce browse-tree:
172 $tree=$this->foldertree->getBrowsableTree();
173
174 $this->content='';
175 $this->content.=$this->doc->startPage('Folder tree');
176 $this->content.=$tree;
177 $this->content.='
178 <p class="c-refresh">
179 <a href="'.htmlspecialchars(t3lib_div::getIndpEnv('REQUEST_URI')).'">'.
180 '<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="" />'.
181 $LANG->sL('LLL:EXT:lang/locallang_core.php:labels.refresh',1).'</a>
182 </p>
183 <br />';
184
185 // Adding highlight - JavaScript
186 if ($this->doHighlight) $this->content .=$this->doc->wrapScriptTags('
187 hilight_row("",top.fsMod.navFrameHighlightedID["file"]);
188 ');
189 }
190
191 /**
192 * Outputting the accumulated content to screen
193 *
194 * @return void
195 */
196 function printContent() {
197 $this->content.= $this->doc->endPage();
198 echo $this->content;
199 }
200 }
201
202 // Include extension?
203 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/alt_file_navframe.php']) {
204 include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/alt_file_navframe.php']);
205 }
206
207
208
209
210
211
212
213
214
215
216
217
218 // Make instance:
219 $SOBE = t3lib_div::makeInstance('SC_alt_file_navframe');
220 $SOBE->init();
221 $SOBE->main();
222 $SOBE->printContent();
223 ?>