Added more comments, $Id$ keywords etc for the whole core of TYPO3.
[Packages/TYPO3.CMS.git] / typo3 / alt_file_navframe.php
1 <?php
2 /***************************************************************
3 * Copyright notice
4 *
5 * (c) 1999-2003 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 (almost)
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 * 78: function init()
43 * 161: function main()
44 * 196: 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
63 *
64 * @author Kasper Skaarhoj <kasper@typo3.com>
65 * @package TYPO3
66 * @subpackage core
67 */
68 class SC_alt_file_navframe {
69 var $content;
70 var $foldertree;
71 var $doc;
72
73 /**
74 * Initialiation
75 *
76 * @return void
77 */
78 function init() {
79 global $BE_USER,$LANG,$BACK_PATH,$TCA,$HTTP_GET_VARS,$HTTP_POST_VARS,$CLIENT,$TYPO3_CONF_VARS;
80
81 $this->foldertree = t3lib_div::makeInstance('t3lib_folderTree');
82 $this->foldertree->ext_IconMode = $BE_USER->getTSConfigVal('options.folderTree.disableIconLinkToContextmenu');
83 $this->foldertree->thisScript = 'alt_file_navframe.php';
84
85 $currentSubScript = t3lib_div::GPvar('currentSubScript');
86
87 $this->doHighlight = !$BE_USER->getTSConfigVal('options.pageTree.disableTitleHighlight');
88
89 // Create template object:
90 $this->doc = t3lib_div::makeInstance('template');
91
92 // Hmmm, setting "xhtml_trans" for the page will unfortunately break the Context Sensitive menu in Mozilla! But apart from that - and duplicate ID's for same page in different mounts - the document checks out well as XHTML
93 # $this->doc->docType='xhtml_trans';
94
95 // Setting backPath
96 $this->doc->backPath = $BACK_PATH;
97
98 // Setting JavaScript for menu.
99 $this->doc->JScode=$this->doc->wrapScriptTags(
100 ($currentSubScript?'top.currentSubScript=unescape("'.rawurlencode($currentSubScript).'");':'').'
101 function jumpTo(id,linkObj,intId) { //
102 var theUrl = top.TS.PATH_typo3+top.currentSubScript+"?id="+id;
103 if (top.condensedMode) {
104 top.content.document.location=theUrl;
105 } else {
106 parent.list_frame.document.location=theUrl;
107 }
108
109 // intId is md5 of the path
110 // top.fsMod.recentIds["file"] is the path itself
111 // therefore de-highlighting does not work
112 // intId is generated in class.t3lib_foldertree.php function getId() and used in wrapTitle() and wrapIcon()
113
114 '.($this->doHighlight?'hilight_row("folder"+top.fsMod.recentIds["file"],"folder"+intId);':'').'
115 '.(!$CLIENT['FORMSTYLE'] ? '' : 'if (linkObj) {linkObj.blur();}').'
116 return false;
117 }
118 function hilight_row(old_rowid,new_rowid) { //
119 if(document.all) {
120 if(document.all.item(old_rowid)) {
121 document.all.item(old_rowid).style.backgroundColor="";
122 }
123 if(document.all.item(new_rowid)) {
124 document.all.item(new_rowid).style.backgroundColor="'.
125 t3lib_div::modifyHTMLColorAll($this->doc->bgColor,-20).
126 '";
127 }
128 } else {
129 if(document.getElementsByName) {
130 old_row_obj = document.getElementsByName(old_rowid)[0];
131 new_row_obj = document.getElementsByName(new_rowid)[0];
132 bgc = document.createAttribute("bgcolor");
133 bgc.value="'.
134 t3lib_div::modifyHTMLColorAll($this->doc->bgColor,-20).
135 '";
136 if(old_row_obj) {
137 old_row_obj.removeAttribute("bgcolor");
138 }
139 if(new_row_obj) {
140 new_row_obj.setAttributeNode(bgc);
141 }
142 }
143 }
144 }
145
146 '.(t3lib_div::GPvar('cMR')?"jumpTo(top.fsMod.recentIds['file'],'');":"").';
147 ');
148
149 // Click menu code is added:
150 $CMparts=$this->doc->getContextMenuCode();
151 $this->doc->bodyTagAdditions = $CMparts[1];
152 $this->doc->JScode.=$CMparts[0];
153 $this->doc->postCode.= $CMparts[2];
154 }
155
156 /**
157 * Main
158 *
159 * @return void
160 */
161 function main() {
162 global $BE_USER,$LANG,$BACK_PATH,$TCA,$HTTP_GET_VARS,$HTTP_POST_VARS,$CLIENT,$TYPO3_CONF_VARS;
163
164 // Produce browse-tree:
165 $tree=$this->foldertree->getBrowsableTree();
166 /*
167 if ($CLIENT['BROWSER']=='konqu') {
168 // Where <nobr> does not work, this will secure non-breaks in lines:
169 $tree = '<table border=0 cellspacing=0 cellpadding=0><tr><td nowrap>'.$tree.'</td></tr></table>';
170 }
171 */
172
173 $this->content="";
174 $this->content.=$this->doc->startPage('Folder tree');
175 $this->content.=$tree;
176 $this->content.='<br />
177 <a href="'.htmlspecialchars(t3lib_div::getIndpEnv('REQUEST_URI')).'">'.
178 '<img src="gfx/refresh_n.gif" width="14" height="14" hspace="4" border="0" align="top" 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>
180 <br /><br />';
181
182 // Adding highlight - JavaScript
183 if ($this->doHighlight) $this->content .=$this->doc->wrapScriptTags('
184 if(top.fsMod.recentIds["file"] != "") {
185 rowid="folder"+top.fsMod.recentIds["file"];
186 hilight_row("",rowid);
187 }
188 ');
189 }
190
191 /**
192 * Output tree.
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 ?>