614c3719cd82fb124c3f967324f8a0d2f95bc533
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")
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
{
74 var $active_tempMountPoint = 0; // Temporary mount point (record), if any
77 // Internal, static: GPvar:
78 var $ajax; // Is set, if an AJAX call should be handled.
79 var $currentSubScript;
81 var $setTempDBmount; // If not '' (blank) then it will clear (0) or set (>0) Temporary DB mount.
84 * Initialiation of the class
89 global $BE_USER,$BACK_PATH;
92 $this->backPath
= $BACK_PATH;
93 $this->doc
->backPath
= $BACK_PATH;
96 $this->ajax
= t3lib_div
::_GP('ajax');
97 $this->cMR
= t3lib_div
::_GP('cMR');
98 $this->currentSubScript
= t3lib_div
::_GP('currentSubScript');
99 $this->setTempDBmount
= t3lib_div
::_GP('setTempDBmount');
101 // Create page tree object:
102 $this->pagetree
= t3lib_div
::makeInstance('webPageTree');
103 $this->pagetree
->ext_IconMode
= $BE_USER->getTSConfigVal('options.pageTree.disableIconLinkToContextmenu');
104 $this->pagetree
->ext_showPageId
= $BE_USER->getTSConfigVal('options.pageTree.showPageIdWithTitle');
105 $this->pagetree
->thisScript
= 'alt_db_navframe.php';
106 $this->pagetree
->addField('alias');
107 $this->pagetree
->addField('shortcut');
108 $this->pagetree
->addField('shortcut_mode');
109 $this->pagetree
->addField('mount_pid');
110 $this->pagetree
->addField('mount_pid_ol');
111 $this->pagetree
->addField('nav_hide');
112 $this->pagetree
->addField('url');
114 // Temporary DB mounts:
115 $this->initializeTemporaryDBmount();
117 // Use template rendering only if this is a non-AJAX call:
119 // Setting highlight mode:
120 $this->doHighlight
= !$BE_USER->getTSConfigVal('options.pageTree.disableTitleHighlight');
122 // If highlighting is active, define the CSS class for the active item depending on the workspace
123 if ($this->doHighlight
) {
124 if ($BE_USER->workspace
=== 0) $hlClass = 'active';
125 else $hlClass = 'active active-ws wsver'.$BE_USER->workspace
;
128 // Create template object:
129 $this->doc
= t3lib_div
::makeInstance('template');
130 $this->doc
->docType
= 'xhtml_trans';
132 // Adding javascript code for AJAX (prototype), drag&drop and the pagetree
133 $this->doc
->JScode
= '
134 <script type="text/javascript" src="'.$this->backPath
.'contrib/prototype/prototype.js"></script>
135 <script type="text/javascript" src="'.$this->backPath
.'tree.js"></script>'."\n";
137 $this->doc
->JScode
.= $this->doc
->wrapScriptTags(
138 ($this->currentSubScript?
'top.currentSubScript=unescape("'.rawurlencode($this->currentSubScript
).'");':'').'
139 // setting prefs for pagetree and drag & drop
140 Tree.thisScript = "'.$this->pagetree
->thisScript
.'";
141 '.($this->doHighlight ?
'Tree.highlightClass = "'.$hlClass.'";' : '').'
143 DragDrop.changeURL = "'.$this->backPath
.'alt_clickmenu.php";
144 DragDrop.backPath = "'.t3lib_div
::shortMD5(''.'|'.$GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey']).'";
145 DragDrop.table = "pages";
147 // Function, loading the list frame from navigation tree:
148 function jumpTo(id, linkObj, highlightID, bank) { //
149 var theUrl = top.TS.PATH_typo3 + top.currentSubScript + "?id=" + id;
150 top.fsMod.currentBank = bank;
152 if (top.condensedMode) top.content.location.href = theUrl;
153 else parent.list_frame.location.href=theUrl;
155 '.($this->doHighlight ?
'Tree.highlightActiveItem("web", highlightID + "_" + bank);' : '').'
156 '.(!$GLOBALS['CLIENT']['FORMSTYLE'] ?
'' : 'if (linkObj) linkObj.blur(); ').'
159 '.($this->cMR?
"jumpTo(top.fsMod.recentIds['web'],'');":'').'
162 // Click menu code is added:
163 $CMparts=$this->doc
->getContextMenuCode();
164 $this->doc
->bodyTagAdditions
= $CMparts[1];
165 $this->doc
->JScode
.= $CMparts[0];
166 $this->doc
->postCode
.= $CMparts[2];
172 * Main function, rendering the browsable page tree
177 global $LANG,$CLIENT;
179 // Produce browse-tree:
180 $tree = $this->pagetree
->getBrowsableTree();
182 // Output only the tree if this is an AJAX call:
184 $this->content
= $LANG->csConvObj
->utf8_encode($tree, $LANG->charSet
);
189 $this->content
= $this->doc
->startPage('TYPO3 Page Tree');
191 // Outputting workspace info
192 if ($GLOBALS['BE_USER']->workspace
!==0 ||
$GLOBALS['BE_USER']->getTSConfigVal('options.pageTree.onlineWorkspaceInfo')) {
193 switch($GLOBALS['BE_USER']->workspace
) {
195 $wsTitle = ' '.$this->doc
->icons(2).'['.$LANG->sL('LLL:EXT:lang/locallang_misc.xml:shortcut_onlineWS',1).']';
198 $wsTitle = '['.$LANG->sL('LLL:EXT:lang/locallang_misc.xml:shortcut_offlineWS',1).']';
201 $wsTitle = '['.$GLOBALS['BE_USER']->workspace
.'] '.htmlspecialchars($GLOBALS['BE_USER']->workspaceRec
['title']);
206 <div class="bgColor4 workspace-info">'.
207 '<a href="'.htmlspecialchars('mod/user/ws/index.php').'" target="content">'.
208 '<img'.t3lib_iconWorks
::skinImg('','gfx/i/sys_workspace.png','width="18" height="16"').' align="top" alt="" />'.
214 // Outputting Temporary DB mount notice:
215 if ($this->active_tempMountPoint
) {
217 <div class="bgColor4 c-notice">
218 <img'.t3lib_iconWorks
::skinImg('','gfx/icon_note.gif','width="18" height="16"').' align="top" alt="" />'.
219 '<a href="'.htmlspecialchars(t3lib_div
::linkThisScript(array('setTempDBmount' => 0))).'">'.
220 $LANG->sl('LLL:EXT:lang/locallang_core.php:labels.temporaryDBmount',1).
222 '.$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>
227 // Outputting page tree:
228 $this->content
.= $tree;
230 // Outputting refresh-link
232 <p class="c-refresh">
233 <a href="'.htmlspecialchars(t3lib_div
::getIndpEnv('REQUEST_URI')).'">'.
234 '<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="" />'.
235 $LANG->sL('LLL:EXT:lang/locallang_core.php:labels.refresh',1).'</a>
240 $this->content
.= t3lib_BEfunc
::cshItem('xMOD_csh_corebe', 'pagetree', $GLOBALS['BACK_PATH']);
242 // Adding javascript for drag & drop activation and highlighting
243 $this->content
.=$this->doc
->wrapScriptTags('
244 '.($this->doHighlight ?
'Tree.highlightActiveItem("",top.fsMod.navFrameHighlightedID["web"]);' : '').'
245 '.(!$this->doc
->isCMlayers() ?
'Tree.activateDragDrop = false;' : 'Tree.registerDragDropHandlers();')
250 * Outputting the accumulated content to screen
254 function printContent() {
255 // If we handle an AJAX call, send headers:
257 header('Content-type: text/html; charset=utf-8');
258 // If it's the regular call to fully output the tree:
260 $this->content
.= $this->doc
->endPage();
261 $this->content
= $this->doc
->insertStylesAndJS($this->content
);
270 /**********************************
272 * Temporary DB mounts
274 **********************************/
277 * Getting temporary DB mount
281 function initializeTemporaryDBmount(){
284 // Set/Cancel Temporary DB Mount:
285 if (strlen($this->setTempDBmount
)) {
286 $set = t3lib_div
::intInRange($this->setTempDBmount
,0);
287 if ($set>0 && $BE_USER->isInWebMount($set)) { // Setting...:
288 $this->settingTemporaryMountPoint($set);
290 $this->settingTemporaryMountPoint(0);
294 // Getting temporary mount point ID:
295 $temporaryMountPoint = intval($BE_USER->getSessionData('pageTree_temporaryMountPoint'));
297 // If mount point ID existed and is within users real mount points, then set it temporarily:
298 if ($temporaryMountPoint > 0 && $BE_USER->isInWebMount($temporaryMountPoint)) {
299 if ($this->active_tempMountPoint
= t3lib_BEfunc
::readPageAccess($temporaryMountPoint, $BE_USER->getPagePermsClause(1))) {
300 $this->pagetree
->MOUNTS
= array($temporaryMountPoint);
303 // Clear temporary mount point as we have no access to it any longer
304 $this->settingTemporaryMountPoint(0);
311 * Setting temporary page id as DB mount
313 * @param integer The page id to set as DB mount
316 function settingTemporaryMountPoint($pageId) {
319 // Setting temporary mount point ID:
320 $BE_USER->setAndSaveSessionData('pageTree_temporaryMountPoint',intval($pageId));
325 // Include extension?
326 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE
]['XCLASS']['typo3/alt_db_navframe.php']) {
327 include_once($TYPO3_CONF_VARS[TYPO3_MODE
]['XCLASS']['typo3/alt_db_navframe.php']);
335 $SOBE = t3lib_div
::makeInstance('SC_alt_db_navframe');
338 $SOBE->printContent();