Added $Id$ keywords, cleaned up comment tags
[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 * @author Kasper Skaarhoj <kasper@typo3.com>
31 * @package TYPO3
32 * @subpackage core
33 *
34 * Revised for TYPO3 3.6 2/2003 by Kasper Skaarhoj
35 * XHTML compliant (almost)
36 */
37
38
39 $BACK_PATH='';
40 require ('init.php');
41 require ('template.php');
42 require_once (PATH_t3lib.'class.t3lib_foldertree.php');
43
44
45
46
47 // ***************************
48 // Script Classes
49 // ***************************
50
51
52 # require_once(t3lib_extMgm::extPath('cc_debug').'class.tx_ccdebug.php');
53 /**
54 * Main script class
55 */
56 class SC_alt_file_navframe {
57 var $content;
58 var $foldertree;
59 var $doc;
60
61 /**
62 * Initialiation
63 */
64 function init() {
65 global $BE_USER,$LANG,$BACK_PATH,$TCA,$HTTP_GET_VARS,$HTTP_POST_VARS,$CLIENT,$TYPO3_CONF_VARS;
66
67 $this->foldertree = t3lib_div::makeInstance('t3lib_folderTree');
68 $this->foldertree->ext_IconMode = $BE_USER->getTSConfigVal('options.folderTree.disableIconLinkToContextmenu');
69 $this->foldertree->thisScript = 'alt_file_navframe.php';
70
71 $currentSubScript = t3lib_div::GPvar('currentSubScript');
72
73 $this->doHighlight = !$BE_USER->getTSConfigVal('options.pageTree.disableTitleHighlight');
74
75 // Create template object:
76 $this->doc = t3lib_div::makeInstance('template');
77
78 // 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
79 # $this->doc->docType='xhtml_trans';
80
81 // Setting backPath
82 $this->doc->backPath = $BACK_PATH;
83
84 // Setting JavaScript for menu.
85 $this->doc->JScode=$this->doc->wrapScriptTags(
86 ($currentSubScript?'top.currentSubScript=unescape("'.rawurlencode($currentSubScript).'");':'').'
87 function jumpTo(id,linkObj,intId) {
88 var theUrl = top.TS.PATH_typo3+top.currentSubScript+"?id="+id;
89 if (top.condensedMode) {
90 top.content.document.location=theUrl;
91 } else {
92 parent.list_frame.document.location=theUrl;
93 }
94
95 // intId is md5 of the path
96 // top.fsMod.recentIds["file"] is the path itself
97 // therefore de-highlighting does not work
98 // intId is generated in class.t3lib_foldertree.php function getId() and used in wrapTitle() and wrapIcon()
99
100 '.($this->doHighlight?'hilight_row("folder"+top.fsMod.recentIds["file"],"folder"+intId);':'').'
101 '.(!$CLIENT['FORMSTYLE'] ? '' : 'if (linkObj) {linkObj.blur();}').'
102 return false;
103 }
104 function hilight_row(old_rowid,new_rowid) {
105 if(document.all) {
106 if(document.all.item(old_rowid)) {
107 document.all.item(old_rowid).style.backgroundColor="";
108 }
109 if(document.all.item(new_rowid)) {
110 document.all.item(new_rowid).style.backgroundColor="'.
111 t3lib_div::modifyHTMLColorAll($this->doc->bgColor,-20).
112 '";
113 }
114 } else {
115 if(document.getElementsByName) {
116 old_row_obj = document.getElementsByName(old_rowid)[0];
117 new_row_obj = document.getElementsByName(new_rowid)[0];
118 bgc = document.createAttribute("bgcolor");
119 bgc.value="'.
120 t3lib_div::modifyHTMLColorAll($this->doc->bgColor,-20).
121 '";
122 if(old_row_obj) {
123 old_row_obj.removeAttribute("bgcolor");
124 }
125 if(new_row_obj) {
126 new_row_obj.setAttributeNode(bgc);
127 }
128 }
129 }
130 }
131
132 '.(t3lib_div::GPvar('cMR')?"jumpTo(top.fsMod.recentIds['file'],'');":"").';
133 ');
134
135 // Click menu code is added:
136 $CMparts=$this->doc->getContextMenuCode();
137 $this->doc->bodyTagAdditions = $CMparts[1];
138 $this->doc->JScode.=$CMparts[0];
139 $this->doc->postCode.= $CMparts[2];
140 }
141
142 /**
143 * Main
144 */
145 function main() {
146 global $BE_USER,$LANG,$BACK_PATH,$TCA,$HTTP_GET_VARS,$HTTP_POST_VARS,$CLIENT,$TYPO3_CONF_VARS;
147
148 // Produce browse-tree:
149 $tree=$this->foldertree->getBrowsableTree();
150 /*
151 if ($CLIENT['BROWSER']=='konqu') {
152 // Where <nobr> does not work, this will secure non-breaks in lines:
153 $tree = '<table border=0 cellspacing=0 cellpadding=0><tr><td nowrap>'.$tree.'</td></tr></table>';
154 }
155 */
156
157 $this->content="";
158 $this->content.=$this->doc->startPage('Folder tree');
159 $this->content.=$tree;
160 $this->content.='<br />
161 <a href="'.htmlspecialchars(t3lib_div::getIndpEnv('REQUEST_URI')).'">'.
162 '<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="" />'.
163 $LANG->sL('LLL:EXT:lang/locallang_core.php:labels.refresh',1).'</a>
164 <br /><br />';
165
166 // Adding highlight - JavaScript
167 if ($this->doHighlight) $this->content .=$this->doc->wrapScriptTags('
168 if(top.fsMod.recentIds["file"] != "") {
169 rowid="folder"+top.fsMod.recentIds["file"];
170 hilight_row("",rowid);
171 }
172 ');
173 }
174
175 /**
176 * Output tree.
177 */
178 function printContent() {
179 $this->content.= $this->doc->endPage();
180 echo $this->content;
181 }
182 }
183
184 // Include extension?
185 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/alt_file_navframe.php']) {
186 include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/alt_file_navframe.php']);
187 }
188
189
190
191
192
193
194
195
196
197
198
199
200 // Make instance:
201 $SOBE = t3lib_div::makeInstance('SC_alt_file_navframe');
202 $SOBE->init();
203 $SOBE->main();
204 $SOBE->printContent();
205 ?>