2 /***************************************************************
5 * (c) 1999-2005 Kasper Skaarhoj (kasperYYYY@typo3.com)
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.
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.
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.
25 * This copyright notice MUST APPEAR in all copies of the script!
26 ***************************************************************/
28 * Page navigation tree for the Web module
31 * Revised for TYPO3 3.6 2/2003 by Kasper Skaarhoj
34 * @author Kasper Skaarhoj <kasperYYYY@typo3.com>
37 * [CLASS/FUNCTION INDEX of SCRIPT]
40 * 192: class SC_alt_db_navframe
41 * 210: function init()
42 * 313: function main()
43 * 387: function printContent()
45 * SECTION: Temporary DB mounts
46 * 415: function initializeTemporaryDBmount()
47 * 449: function settingTemporaryMountPoint($pageId)
50 * (This index is automatically created/updated by the extension "extdeveval")
56 require_once('init.php');
57 require('template.php');
58 require_once('class.webpagetree.php');
62 * Main script class for the page tree navigation frame
64 * @author Kasper Skaarhoj <kasperYYYY@typo3.com>
68 class SC_alt_db_navframe
{
75 * document template object
80 var $active_tempMountPoint = 0; // Temporary mount point (record), if any
83 // Internal, static: GPvar:
84 var $currentSubScript;
86 var $setTempDBmount; // If not '' (blank) then it will clear (0) or set (>0) Temporary DB mount.
90 * Initialiation of the class
95 global $BE_USER,$BACK_PATH;
98 $this->backPath
= $BACK_PATH;
101 $this->cMR
= t3lib_div
::_GP('cMR');
102 $this->currentSubScript
= t3lib_div
::_GP('currentSubScript');
103 $this->setTempDBmount
= t3lib_div
::_GP('setTempDBmount');
105 // Create page tree object:
106 $this->pagetree
= t3lib_div
::makeInstance('webPageTree');
107 $this->pagetree
->ext_IconMode
= $BE_USER->getTSConfigVal('options.pageTree.disableIconLinkToContextmenu');
108 $this->pagetree
->ext_showPageId
= $BE_USER->getTSConfigVal('options.pageTree.showPageIdWithTitle');
109 $this->pagetree
->ext_showNavTitle
= $BE_USER->getTSConfigVal('options.pageTree.showNavTitle');
110 $this->pagetree
->ext_separateNotinmenuPages
= $BE_USER->getTSConfigVal('options.pageTree.separateNotinmenuPages');
111 $this->pagetree
->ext_alphasortNotinmenuPages
= $BE_USER->getTSConfigVal('options.pageTree.alphasortNotinmenuPages');
112 $this->pagetree
->thisScript
= 'alt_db_navframe.php';
113 $this->pagetree
->addField('alias');
114 $this->pagetree
->addField('shortcut');
115 $this->pagetree
->addField('shortcut_mode');
116 $this->pagetree
->addField('mount_pid');
117 $this->pagetree
->addField('mount_pid_ol');
118 $this->pagetree
->addField('nav_hide');
119 $this->pagetree
->addField('nav_title');
120 $this->pagetree
->addField('url');
122 // Temporary DB mounts:
123 $this->initializeTemporaryDBmount();
128 * initialization for the visual parts of the class
129 * Use template rendering only if this is a non-AJAX call
133 public function initPage() {
136 // Setting highlight mode:
137 $this->doHighlight
= !$BE_USER->getTSConfigVal('options.pageTree.disableTitleHighlight');
139 // If highlighting is active, define the CSS class for the active item depending on the workspace
140 if ($this->doHighlight
) {
141 $hlClass = ($BE_USER->workspace
=== 0 ?
'active' : 'active active-ws wsver'.$BE_USER->workspace
);
144 // Create template object:
145 $this->doc
= t3lib_div
::makeInstance('template');
146 $this->doc
->backPath
= $BACK_PATH;
147 $this->doc
->docType
= 'xhtml_trans';
150 // Adding javascript code for AJAX (prototype), drag&drop and the pagetree as well as the click menu code
151 $this->doc
->getDragDropCode('pages');
152 $this->doc
->getContextMenuCode();
155 $this->doc
->JScode
.= $this->doc
->wrapScriptTags(
156 ($this->currentSubScript?
'top.currentSubScript=unescape("'.rawurlencode($this->currentSubScript
).'");':'').'
157 // setting prefs for pagetree and drag & drop
158 '.($this->doHighlight ?
'Tree.highlightClass = "'.$hlClass.'";' : '').'
160 // Function, loading the list frame from navigation tree:
161 function jumpTo(id, linkObj, highlightID, bank) { //
162 var theUrl = top.TS.PATH_typo3 + top.currentSubScript + "?id=" + id;
163 top.fsMod.currentBank = bank;
165 if (top.condensedMode) top.content.location.href = theUrl;
166 else parent.list_frame.location.href=theUrl;
168 '.($this->doHighlight ?
'Tree.highlightActiveItem("web", highlightID + "_" + bank);' : '').'
169 '.(!$GLOBALS['CLIENT']['FORMSTYLE'] ?
'' : 'if (linkObj) linkObj.blur(); ').'
172 '.($this->cMR?
"jumpTo(top.fsMod.recentIds['web'],'');":'').'
175 $this->doc
->bodyTagId
= 'bodyTag';
180 * Main function, rendering the browsable page tree
185 global $LANG,$CLIENT;
187 // Produce browse-tree:
188 $tree = $this->pagetree
->getBrowsableTree();
191 $this->content
= $this->doc
->startPage('TYPO3 Page Tree');
193 // Outputting workspace info
194 if ($GLOBALS['BE_USER']->workspace
!==0 ||
$GLOBALS['BE_USER']->getTSConfigVal('options.pageTree.onlineWorkspaceInfo')) {
195 switch($GLOBALS['BE_USER']->workspace
) {
197 $wsTitle = ' '.$this->doc
->icons(2).'['.$LANG->sL('LLL:EXT:lang/locallang_misc.xml:shortcut_onlineWS',1).']';
200 $wsTitle = '['.$LANG->sL('LLL:EXT:lang/locallang_misc.xml:shortcut_offlineWS',1).']';
203 $wsTitle = '['.$GLOBALS['BE_USER']->workspace
.'] '.htmlspecialchars($GLOBALS['BE_USER']->workspaceRec
['title']);
208 <div class="bgColor4 workspace-info">'.
209 '<a href="'.htmlspecialchars('mod/user/ws/index.php').'" target="content">'.
210 '<img'.t3lib_iconWorks
::skinImg('','gfx/i/sys_workspace.png','width="18" height="16"').' align="top" alt="" />'.
216 if (!$GLOBALS['BE_USER']->getTSConfigVal('options.pageTree.hideFilter')) {
218 <div class="bgColor4">
219 Filter: <input type="text" value="" name="_livesearch" id="_livesearch" onkeyup="filter(this.value);"/>
224 // Outputting Temporary DB mount notice:
225 if ($this->active_tempMountPoint
) {
227 <div class="bgColor4 c-notice">
228 <img'.t3lib_iconWorks
::skinImg('','gfx/icon_note.gif','width="18" height="16"').' align="top" alt="" />'.
229 '<a href="'.htmlspecialchars(t3lib_div
::linkThisScript(array('setTempDBmount' => 0))).'">'.
230 $LANG->sl('LLL:EXT:lang/locallang_core.php:labels.temporaryDBmount',1).
232 '.$LANG->sl('LLL:EXT:lang/locallang_core.php:labels.path',1).': <span title="'.htmlspecialchars($this->active_tempMountPoint
['_thePathFull']).'">'.htmlspecialchars(t3lib_div
::fixed_lgd_cs($this->active_tempMountPoint
['_thePath'],-50)).'</span>
237 // Outputting page tree:
238 $this->content
.= $tree;
240 // Outputting refresh-link
242 <p class="c-refresh">
243 <a href="'.htmlspecialchars(t3lib_div
::getIndpEnv('REQUEST_URI')).'">'.
244 '<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="" />'.
245 $LANG->sL('LLL:EXT:lang/locallang_core.php:labels.refresh',1).'</a>
250 $this->content
.= t3lib_BEfunc
::cshItem('xMOD_csh_corebe', 'pagetree', $GLOBALS['BACK_PATH']);
252 // Adding javascript for drag & drop activation and highlighting
253 $this->content
.= $this->doc
->wrapScriptTags('
254 '.($this->doHighlight ?
'Tree.highlightActiveItem("",top.fsMod.navFrameHighlightedID["web"]);' : '').'
255 '.(!$this->doc
->isCMlayers() ?
'Tree.activateDragDrop = false;' : 'Tree.registerDragDropHandlers();')
260 * Outputting the accumulated content to screen
264 function printContent() {
265 $this->content
.= $this->doc
->endPage();
266 $this->content
= $this->doc
->insertStylesAndJS($this->content
);
274 /**********************************
276 * Temporary DB mounts
278 **********************************/
281 * Getting temporary DB mount
285 function initializeTemporaryDBmount(){
288 // Set/Cancel Temporary DB Mount:
289 if (strlen($this->setTempDBmount
)) {
290 $set = t3lib_div
::intInRange($this->setTempDBmount
,0);
291 if ($set>0 && $BE_USER->isInWebMount($set)) { // Setting...:
292 $this->settingTemporaryMountPoint($set);
294 $this->settingTemporaryMountPoint(0);
298 // Getting temporary mount point ID:
299 $temporaryMountPoint = intval($BE_USER->getSessionData('pageTree_temporaryMountPoint'));
301 // If mount point ID existed and is within users real mount points, then set it temporarily:
302 if ($temporaryMountPoint > 0 && $BE_USER->isInWebMount($temporaryMountPoint)) {
303 if ($this->active_tempMountPoint
= t3lib_BEfunc
::readPageAccess($temporaryMountPoint, $BE_USER->getPagePermsClause(1))) {
304 $this->pagetree
->MOUNTS
= array($temporaryMountPoint);
307 // Clear temporary mount point as we have no access to it any longer
308 $this->settingTemporaryMountPoint(0);
315 * Setting temporary page id as DB mount
317 * @param integer The page id to set as DB mount
320 function settingTemporaryMountPoint($pageId) {
321 $GLOBALS['BE_USER']->setAndSaveSessionData('pageTree_temporaryMountPoint',intval($pageId));
325 /**********************************
329 **********************************/
332 * Makes the AJAX call to expand or collapse the pagetree.
333 * Called by typo3/ajax.php
335 * @param array additional parameters (not used here)
336 * @param object the TYPO3AJAX object of this request
338 public function ajaxExpandCollapse($params, &$ajaxObj) {
342 $tree = $this->pagetree
->getBrowsableTree();
343 if (!$this->pagetree
->ajaxStatus
) {
344 $ajaxObj->setError($tree);
346 $ajaxObj->addContent('tree', $tree);
352 // Include extension?
353 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE
]['XCLASS']['typo3/alt_db_navframe.php']) {
354 include_once($TYPO3_CONF_VARS[TYPO3_MODE
]['XCLASS']['typo3/alt_db_navframe.php']);
358 // Make instance if it is not an AJAX call
359 if (!(TYPO3_REQUESTTYPE
& TYPO3_REQUESTTYPE_AJAX
)) {
360 $SOBE = t3lib_div
::makeInstance('SC_alt_db_navframe');
364 $SOBE->printContent();