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