(bugfix) Fixed Image Generation bug. Call in t3lib_div now uses the IM wrapper to...
[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 * 72: class localFolderTree extends t3lib_folderTree
42 * 81: function localFolderTree()
43 * 92: function wrapIcon($icon,&$row)
44 * 121: function wrapTitle($title,$row,$bank=0)
45 *
46 *
47 * 146: class SC_alt_file_navframe
48 * 163: function init()
49 * 253: function main()
50 * 284: function printContent()
51 *
52 * TOTAL FUNCTIONS: 6
53 * (This index is automatically created/updated by the extension "extdeveval")
54 *
55 */
56
57 $BACK_PATH = '';
58 require('init.php');
59 require('template.php');
60 require_once('class.filelistfoldertree.php');
61
62
63 /**
64 * Main script class for rendering of the folder tree
65 *
66 * @author Kasper Skaarhoj <kasperYYYY@typo3.com>
67 * @package TYPO3
68 * @subpackage core
69 */
70 class SC_alt_file_navframe {
71
72 // Internal, dynamic:
73 var $content; // Content accumulates in this variable.
74 var $foldertree; // Folder tree object.
75
76 /**
77 * document template object
78 *
79 * @var template
80 */
81 var $doc;
82 var $backPath;
83
84 // Internal, static: GPvar:
85 var $ajax; // Is set, if an AJAX call should be handled.
86 var $currentSubScript;
87 var $cMR;
88
89
90 /**
91 * Initialiation of the script class
92 *
93 * @return void
94 */
95 function init() {
96 global $BE_USER,$BACK_PATH,$CLIENT;
97
98 // Setting backPath
99 $this->backPath = $BACK_PATH;
100
101 // Setting GPvars:
102 $this->ajax = t3lib_div::_GP('ajax');
103 $this->currentSubScript = t3lib_div::_GP('currentSubScript');
104 $this->cMR = t3lib_div::_GP('cMR');
105
106 // Create folder tree object:
107 $this->foldertree = t3lib_div::makeInstance('filelistFolderTree');
108 $this->foldertree->ext_IconMode = $BE_USER->getTSConfigVal('options.folderTree.disableIconLinkToContextmenu');
109 $this->foldertree->thisScript = 'alt_file_navframe.php';
110
111 // Use template rendering only if this is a non-AJAX call:
112 if (!$this->ajax) {
113 // Setting highlight mode:
114 $this->doHighlight = !$BE_USER->getTSConfigVal('options.pageTree.disableTitleHighlight');
115
116 // Create template object:
117 $this->doc = t3lib_div::makeInstance('template');
118 $this->doc->backPath = $BACK_PATH;
119 $this->doc->docType = 'xhtml_trans';
120
121 // Adding javascript code for AJAX (prototype), drag&drop and the pagetree
122 $this->doc->JScode = '
123 <script type="text/javascript" src="'.$this->backPath.'contrib/prototype/prototype.js"></script>
124 <script type="text/javascript" src="'.$this->backPath.'tree.js"></script>'."\n";
125
126 // Setting JavaScript for menu.
127 $this->doc->JScode .= $this->doc->wrapScriptTags(
128 ($this->currentSubScript?'top.currentSubScript=unescape("'.rawurlencode($this->currentSubScript).'");':'').'
129
130 // setting prefs for pagetree and drag & drop
131 Tree.thisScript = "'.$this->foldertree->thisScript.'";
132 DragDrop.changeURL = "'.$this->backPath.'alt_clickmenu.php";
133 DragDrop.backPath = "'.t3lib_div::shortMD5(''.'|'.$GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey']).'";
134 DragDrop.table = "folders";
135
136 // Function, loading the list frame from navigation tree:
137 function jumpTo(id, linkObj, highlightID, bank) {
138 var theUrl = top.TS.PATH_typo3 + top.currentSubScript + "?id=" + id;
139 top.fsMod.currentBank = bank;
140
141 if (top.condensedMode) top.content.location.href = theUrl;
142 else parent.list_frame.location.href = theUrl;
143
144 '.($this->doHighlight ? 'Tree.highlightActiveItem("file", highlightID + "_" + bank);' : '').'
145 '.(!$GLOBALS['CLIENT']['FORMSTYLE'] ? '' : 'if (linkObj) linkObj.blur(); ').'
146 return false;
147 }
148 '.($this->cMR ? " jumpTo(top.fsMod.recentIds['file'],'');" : '')
149 );
150
151 // Click menu code is added:
152 $CMparts=$this->doc->getContextMenuCode();
153 $this->doc->bodyTagAdditions = $CMparts[1];
154 $this->doc->JScode.= $CMparts[0];
155 $this->doc->postCode.= $CMparts[2];
156 }
157 }
158
159 /**
160 * Main function, rendering the folder tree
161 *
162 * @return void
163 */
164 function main() {
165 global $LANG,$CLIENT;
166
167 // Produce browse-tree:
168 $tree = $this->foldertree->getBrowsableTree();
169
170 // Output only the tree if this is an AJAX call:
171 if ($this->ajax) {
172 $this->content = $LANG->csConvObj->utf8_encode($tree, $LANG->charSet);
173 return;
174 }
175
176 $this->content = $this->doc->startPage('TYPO3 Folder Tree');
177
178 // Outputting page tree:
179 $this->content.= $tree;
180
181 // Outputting refresh-link
182 $this->content.= '
183 <p class="c-refresh">
184 <a href="'.htmlspecialchars(t3lib_div::getIndpEnv('REQUEST_URI')).'">'.
185 '<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="" />'.
186 $LANG->sL('LLL:EXT:lang/locallang_core.php:labels.refresh',1).'</a>
187 </p>
188 <br />';
189
190 // CSH icon:
191 $this->content.= t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'filetree', $GLOBALS['BACK_PATH']);
192
193 // Adding javascript for drag & drop activation and highlighting
194 $this->content .=$this->doc->wrapScriptTags('
195 '.($this->doHighlight ? 'Tree.highlightActiveItem("", top.fsMod.navFrameHighlightedID["file"]);' : '').'
196 '.(!$this->doc->isCMlayers() ? 'Tree.activateDragDrop = false;' : 'Tree.registerDragDropHandlers();')
197 );
198
199 }
200
201 /**
202 * Outputting the accumulated content to screen
203 *
204 * @return void
205 */
206 function printContent() {
207 // If we handle an AJAX call, send headers:
208 if ($this->ajax) {
209 header('X-JSON: ('.($this->foldertree->ajaxStatus?'true':'false').')');
210 header('Content-type: text/html; charset=utf-8');
211 // If it's the regular call to fully output the tree:
212 } else {
213 $this->content.= $this->doc->endPage();
214 $this->content = $this->doc->insertStylesAndJS($this->content);
215 }
216 echo $this->content;
217 }
218 }
219
220 // Include extension?
221 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/alt_file_navframe.php']) {
222 include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/alt_file_navframe.php']);
223 }
224
225
226
227
228
229
230
231
232
233
234
235
236 // Make instance:
237 $SOBE = t3lib_div::makeInstance('SC_alt_file_navframe');
238 $SOBE->init();
239 $SOBE->main();
240 $SOBE->printContent();
241 ?>