Tons of changes made to the CORE. All scripts has more a less been modified. Primaril...
[Packages/TYPO3.CMS.git] / typo3 / alt_db_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 * Page navigation tree for the Web 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 * 72: class localPageTree extends t3lib_browseTree
42 * 79: function localPageTree()
43 * 90: function wrapIcon($icon,&$row)
44 *
45 *
46 * 131: class SC_alt_db_navframe
47 * 147: function init()
48 * 237: function main()
49 * 265: function printContent()
50 *
51 * TOTAL FUNCTIONS: 5
52 * (This index is automatically created/updated by the extension "extdeveval")
53 *
54 */
55
56
57 $BACK_PATH='';
58 require ('init.php');
59 require ('template.php');
60 require_once (PATH_t3lib.'class.t3lib_browsetree.php');
61
62
63
64 /**
65 * Extension class for the t3lib_browsetree class, specially made for browsing pages in the Web module
66 *
67 * @author Kasper Skaarhoj <kasper@typo3.com>
68 * @package TYPO3
69 * @subpackage core
70 * @see class t3lib_browseTree
71 */
72 class localPageTree extends t3lib_browseTree {
73
74 /**
75 * Calls init functions
76 *
77 * @return void
78 */
79 function localPageTree() {
80 $this->init();
81 }
82
83 /**
84 * Wrapping icon in browse tree
85 *
86 * @param string Icon IMG code
87 * @param array Data row for element.
88 * @return string Page icon
89 */
90 function wrapIcon($icon,&$row) {
91 // If the record is locked, present a warning sign.
92 if ($lockInfo=t3lib_BEfunc::isRecordLocked('pages',$row['uid'])) {
93 $aOnClick = 'alert('.$GLOBALS['LANG']->JScharCode($lockInfo['msg']).');return false;';
94 $lockIcon='<a href="#" onclick="'.htmlspecialchars($aOnClick).'">'.
95 '<img'.t3lib_iconWorks::skinImg('','gfx/recordlock_warning3.gif','width="17" height="12"').' title="'.htmlspecialchars($lockInfo['msg']).'" alt="" />'.
96 '</a>';
97 } else $lockIcon="";
98
99 // Add title attribute to input icon tag
100 $thePageIcon = $this->addTagAttributes($icon, $this->titleAttrib.'="'.$this->getTitleAttrib($row).'"');
101
102 // Wrap icon in click-menu link.
103 if (!$this->ext_IconMode) {
104 $thePageIcon = $GLOBALS['TBE_TEMPLATE']->wrapClickMenuOnIcon($thePageIcon,'pages',$row['uid'],0);
105 } elseif (!strcmp($this->ext_IconMode,'titlelink')) {
106 $aOnClick = 'return jumpTo('.$this->getJumpToParm($row).',this,\''.$this->treeName.'\');';
107 $thePageIcon='<a href="#" onclick="'.htmlspecialchars($aOnClick).'">'.$thePageIcon.'</a>';
108 }
109 return $thePageIcon.$lockIcon;
110 }
111 }
112
113
114
115
116
117
118
119
120
121
122
123
124 /**
125 * Main script class for the page tree navigation frame
126 *
127 * @author Kasper Skaarhoj <kasper@typo3.com>
128 * @package TYPO3
129 * @subpackage core
130 */
131 class SC_alt_db_navframe {
132
133 // Internal:
134 var $content;
135 var $pagetree;
136 var $doc;
137
138 // Internal, static: GPvar:
139 var $currentSubScript;
140 var $cMR;
141
142 /**
143 * Initialiation of the class
144 *
145 * @return void
146 */
147 function init() {
148 global $BE_USER,$BACK_PATH;
149
150 // Setting GPvars:
151 $this->currentSubScript = t3lib_div::GPvar('currentSubScript');
152 $this->cMR = t3lib_div::GPvar('cMR');
153
154 // Create page tree object:
155 $this->pagetree = t3lib_div::makeInstance('localPageTree');
156 $this->pagetree->ext_IconMode = $BE_USER->getTSConfigVal('options.pageTree.disableIconLinkToContextmenu');
157 $this->pagetree->thisScript = 'alt_db_navframe.php';
158 $this->pagetree->addField('alias');
159 $this->pagetree->addField('shortcut');
160 $this->pagetree->addField('shortcut_mode');
161 $this->pagetree->addField('mount_pid');
162 $this->pagetree->addField('url');
163
164 // Setting highlight mode:
165 $this->doHighlight = !$BE_USER->getTSConfigVal('options.pageTree.disableTitleHighlight');
166
167 // Create template object:
168 $this->doc = t3lib_div::makeInstance('template');
169
170 // 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
171 $this->doc->docType='xhtml_trans';
172
173 // Setting backPath
174 $this->doc->backPath = $BACK_PATH;
175
176 // Setting JavaScript for menu.
177 $this->doc->JScode=$this->doc->wrapScriptTags(
178 ($this->currentSubScript?'top.currentSubScript=unescape("'.rawurlencode($this->currentSubScript).'");':'').'
179
180 // Function, loading the list frame from navigation tree:
181 function jumpTo(id,linkObj,highLightID) { //
182 var theUrl = top.TS.PATH_typo3+top.currentSubScript+"?id="+id;
183
184 if (top.condensedMode) {
185 top.content.document.location=theUrl;
186 } else {
187 parent.list_frame.document.location=theUrl;
188 }
189
190 '.($this->doHighlight?'hilight_row("web",highLightID);':'').'
191
192 '.(!$GLOBALS['CLIENT']['FORMSTYLE'] ? '' : 'if (linkObj) {linkObj.blur();}').'
193 return false;
194 }
195
196 // 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.)
197 // See t3lib_BEfunc::getSetUpdateSignal()
198 function refresh_nav() { //
199 window.setTimeout("_refresh_nav();",0);
200 }
201 function _refresh_nav() { //
202 document.location="'.$this->pagetree->thisScript.'?unique='.time().'";
203 }
204
205 // Highlighting rows in the page tree:
206 function hilight_row(frameSetModule,highLightID) { //
207
208 // Remove old:
209 theObj = document.getElementById(top.fsMod.navFrameHighlightedID[frameSetModule]);
210 if (theObj) {
211 theObj.style.backgroundColor="";
212 }
213
214 // Set new:
215 top.fsMod.navFrameHighlightedID[frameSetModule] = highLightID;
216 theObj = document.getElementById(highLightID);
217 if (theObj) {
218 theObj.style.backgroundColor="'.t3lib_div::modifyHTMLColorAll($this->doc->bgColor,-20).'";
219 }
220 }
221
222 '.($this->cMR?"jumpTo(top.fsMod.recentIds['web'],'');":'').';
223 ');
224
225 // Click menu code is added:
226 $CMparts=$this->doc->getContextMenuCode();
227 $this->doc->bodyTagAdditions = $CMparts[1];
228 $this->doc->JScode.=$CMparts[0];
229 $this->doc->postCode.= $CMparts[2];
230 }
231
232 /**
233 * Main function, rendering the browsable page tree
234 *
235 * @return void
236 */
237 function main() {
238 global $LANG,$CLIENT;
239
240 // Produce browse-tree:
241 $tree = $this->pagetree->getBrowsableTree();
242
243 $this->content='';
244 $this->content.=$this->doc->startPage('Page tree');
245 $this->content.=$tree;
246 $this->content.='
247 <p class="c-refresh">
248 <a href="'.htmlspecialchars(t3lib_div::getIndpEnv('REQUEST_URI')).'">'.
249 '<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="" />'.
250 $LANG->sL('LLL:EXT:lang/locallang_core.php:labels.refresh',1).'</a>
251 </p>
252 <br />';
253
254 // Adding highlight - JavaScript
255 if ($this->doHighlight) $this->content .=$this->doc->wrapScriptTags('
256 hilight_row("",top.fsMod.navFrameHighlightedID["web"]);
257 ');
258 }
259
260 /**
261 * Outputting the accumulated content to screen
262 *
263 * @return void
264 */
265 function printContent() {
266 $this->content.= $this->doc->endPage();
267 echo $this->content;
268 }
269 }
270
271 // Include extension?
272 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/alt_db_navframe.php']) {
273 include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/alt_db_navframe.php']);
274 }
275
276
277
278
279
280
281
282
283
284
285
286
287 // Make instance:
288 $SOBE = t3lib_div::makeInstance('SC_alt_db_navframe');
289 $SOBE->init();
290 $SOBE->main();
291 $SOBE->printContent();
292
293 ?>