"TYPO3 4.0.1: typo3_src-4.0.1/typo3/alt_db_navframe.php Source File", "datetime" => "Sat Dec 2 19:22:20 2006", "date" => "2 Dec 2006", "doxygenversion" => "1.4.6", "projectname" => "TYPO3 4.0.1", "projectnumber" => "4.0.1" ); get_header($doxygen_vars); ?>
00001 <?php 00002 /*************************************************************** 00003 * Copyright notice 00004 * 00005 * (c) 1999-2005 Kasper Skaarhoj (kasperYYYY@typo3.com) 00006 * All rights reserved 00007 * 00008 * This script is part of the TYPO3 project. The TYPO3 project is 00009 * free software; you can redistribute it and/or modify 00010 * it under the terms of the GNU General Public License as published by 00011 * the Free Software Foundation; either version 2 of the License, or 00012 * (at your option) any later version. 00013 * 00014 * The GNU General Public License can be found at 00015 * http://www.gnu.org/copyleft/gpl.html. 00016 * A copy is found in the textfile GPL.txt and important notices to the license 00017 * from the author is found in LICENSE.txt distributed with these scripts. 00018 * 00019 * 00020 * This script is distributed in the hope that it will be useful, 00021 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00022 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00023 * GNU General Public License for more details. 00024 * 00025 * This copyright notice MUST APPEAR in all copies of the script! 00026 ***************************************************************/ 00063 $BACK_PATH=''; 00064 require('init.php'); 00065 require('template.php'); 00066 require_once(PATH_t3lib.'class.t3lib_browsetree.php'); 00067 00068 00069 00078 class localPageTree extends t3lib_browseTree { 00079 00080 var $ext_showPageId; 00081 var $ext_IconMode; 00082 00088 function localPageTree() { 00089 $this->init(); 00090 } 00091 00099 function wrapIcon($icon,&$row) { 00100 // If the record is locked, present a warning sign. 00101 if ($lockInfo=t3lib_BEfunc::isRecordLocked('pages',$row['uid'])) { 00102 $aOnClick = 'alert('.$GLOBALS['LANG']->JScharCode($lockInfo['msg']).');return false;'; 00103 $lockIcon='<a href="#" onclick="'.htmlspecialchars($aOnClick).'">'. 00104 '<img'.t3lib_iconWorks::skinImg('','gfx/recordlock_warning3.gif','width="17" height="12"').' title="'.htmlspecialchars($lockInfo['msg']).'" alt="" />'. 00105 '</a>'; 00106 } else $lockIcon = ''; 00107 00108 // Add title attribute to input icon tag 00109 $thePageIcon = $this->addTagAttributes($icon, $this->titleAttrib.'="'.$this->getTitleAttrib($row).'"'); 00110 00111 // Wrap icon in click-menu link. 00112 if (!$this->ext_IconMode) { 00113 $thePageIcon = $GLOBALS['TBE_TEMPLATE']->wrapClickMenuOnIcon($thePageIcon,'pages',$row['uid'],0,'&bank='.$this->bank); 00114 } elseif (!strcmp($this->ext_IconMode,'titlelink')) { 00115 $aOnClick = 'return jumpTo(\''.$this->getJumpToParam($row).'\',this,\''.$this->treeName.'\');'; 00116 $thePageIcon='<a href="#" onclick="'.htmlspecialchars($aOnClick).'">'.$thePageIcon.'</a>'; 00117 } 00118 00119 // Wrap icon in a drag/drop span. 00120 $spanOnDrag = htmlspecialchars('return dragElement("'.$row['uid'].'")'); 00121 $spanOnDrop = htmlspecialchars('return dropElement("'.$row['uid'].'")'); 00122 $dragDropIcon = '<span id="dragIconID_'.$row['uid'].'" ondragstart="'.$spanOnDrag.'" onmousedown="'.$spanOnDrag.'" onmouseup="'.$spanOnDrop.'">'.$thePageIcon.'</span>'; 00123 00124 // Add Page ID: 00125 if ($this->ext_showPageId) { 00126 $pageIdStr = '['.$row['uid'].'] '; 00127 } else { 00128 $pageIdStr = ''; 00129 } 00130 00131 return $dragDropIcon.$lockIcon.$pageIdStr; 00132 } 00133 00142 function wrapStop($str,$row) { 00143 if ($row['php_tree_stop']) { 00144 $str.='<a href="'.htmlspecialchars(t3lib_div::linkThisScript(array('setTempDBmount' => $row['uid']))).'" class="typo3-red">+</a> '; 00145 } 00146 return $str; 00147 } 00148 00158 function wrapTitle($title,$row,$bank=0) { 00159 $aOnClick = 'return jumpTo(\''.$this->getJumpToParam($row).'\',this,\''.$this->domIdPrefix.$this->getId($row).'\','.$bank.');'; 00160 $CSM = ''; 00161 if ($GLOBALS['TYPO3_CONF_VARS']['BE']['useOnContextMenuHandler']) { 00162 $CSM = ' oncontextmenu="'.htmlspecialchars($GLOBALS['TBE_TEMPLATE']->wrapClickMenuOnIcon('','pages',$row['uid'],0,'&bank='.$this->bank,'',TRUE)).'"'; 00163 } 00164 $thePageTitle='<a href="#" onclick="'.htmlspecialchars($aOnClick).'"'.$CSM.'>'.$title.'</a>'; 00165 00166 // Wrap title in a drag/drop span. 00167 $spanOnDrag = htmlspecialchars('return dragElement("'.$row['uid'].'")'); 00168 $spanOnDrop = htmlspecialchars('return dropElement("'.$row['uid'].'")'); 00169 $dragDropTitle = '<span id="dragTitleID_'.$row['uid'].'" ondragstart="'.$spanOnDrag.'" onmousedown="'.$spanOnDrag.'" onmouseup="'.$spanOnDrop.'">'.$thePageTitle.'</span>'; 00170 return $dragDropTitle; 00171 } 00172 } 00173 00174 00175 00176 00177 00178 00179 00180 00181 00182 00183 00184 00192 class SC_alt_db_navframe { 00193 00194 // Internal: 00195 var $content; 00196 var $pagetree; 00197 var $doc; 00198 var $active_tempMountPoint = 0; // Temporary mount point (record), if any 00199 00200 // Internal, static: GPvar: 00201 var $currentSubScript; 00202 var $cMR; 00203 var $setTempDBmount; // If not '' (blank) then it will clear (0) or set (>0) Temporary DB mount. 00204 00210 function init() { 00211 global $BE_USER,$BACK_PATH; 00212 00213 // Setting GPvars: 00214 $this->currentSubScript = t3lib_div::_GP('currentSubScript'); 00215 $this->cMR = t3lib_div::_GP('cMR'); 00216 $this->setTempDBmount = t3lib_div::_GP('setTempDBmount'); 00217 00218 // Create page tree object: 00219 $this->pagetree = t3lib_div::makeInstance('localPageTree'); 00220 $this->pagetree->ext_IconMode = $BE_USER->getTSConfigVal('options.pageTree.disableIconLinkToContextmenu'); 00221 $this->pagetree->ext_showPageId = $BE_USER->getTSConfigVal('options.pageTree.showPageIdWithTitle'); 00222 $this->pagetree->thisScript = 'alt_db_navframe.php'; 00223 $this->pagetree->addField('alias'); 00224 $this->pagetree->addField('shortcut'); 00225 $this->pagetree->addField('shortcut_mode'); 00226 $this->pagetree->addField('mount_pid'); 00227 $this->pagetree->addField('mount_pid_ol'); 00228 $this->pagetree->addField('nav_hide'); 00229 $this->pagetree->addField('url'); 00230 00231 # $this->settingTemporaryMountPoint(11); 00232 // Temporary DB mounts: 00233 $this->initializeTemporaryDBmount(); 00234 00235 // Setting highlight mode: 00236 $this->doHighlight = !$BE_USER->getTSConfigVal('options.pageTree.disableTitleHighlight') && $BE_USER->workspace===0; 00237 00238 // Create template object: 00239 $this->doc = t3lib_div::makeInstance('template'); 00240 $this->doc->docType='xhtml_trans'; 00241 00242 // Setting backPath 00243 $this->doc->backPath = $BACK_PATH; 00244 00245 // Setting JavaScript for menu. 00246 $this->doc->JScode=$this->doc->wrapScriptTags( 00247 ($this->currentSubScript?'top.currentSubScript=unescape("'.rawurlencode($this->currentSubScript).'");':'').' 00248 00249 // Function, loading the list frame from navigation tree: 00250 function jumpTo(id,linkObj,highLightID,bank) { // 00251 var theUrl = top.TS.PATH_typo3+top.currentSubScript+"?id="+id; 00252 top.fsMod.currentBank = bank; 00253 00254 if (top.condensedMode) { 00255 top.content.location.href=theUrl; 00256 } else { 00257 parent.list_frame.location.href=theUrl; 00258 } 00259 00260 '.($this->doHighlight?'hilight_row("web",highLightID+"_"+bank);':'').' 00261 00262 '.(!$GLOBALS['CLIENT']['FORMSTYLE'] ? '' : 'if (linkObj) {linkObj.blur();}').' 00263 return false; 00264 } 00265 00266 // 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.) 00267 // See t3lib_BEfunc::getSetUpdateSignal() 00268 function refresh_nav() { // 00269 window.setTimeout("_refresh_nav();",0); 00270 } 00271 function _refresh_nav() { // 00272 window.location.href="'.$this->pagetree->thisScript.'?unique='.time().'"; 00273 } 00274 00275 // Highlighting rows in the page tree: 00276 function hilight_row(frameSetModule,highLightID) { // 00277 00278 // Remove old: 00279 theObj = document.getElementById(top.fsMod.navFrameHighlightedID[frameSetModule]); 00280 if (theObj) { 00281 theObj.className = ""; 00282 } 00283 00284 // Set new: 00285 top.fsMod.navFrameHighlightedID[frameSetModule] = highLightID; 00286 theObj = document.getElementById(highLightID); 00287 if (theObj) { 00288 theObj.className = "navFrameHL"; 00289 } 00290 } 00291 00292 '.($this->cMR?"jumpTo(top.fsMod.recentIds['web'],'');":'').'; 00293 '); 00294 00295 // Click menu code is added: 00296 $CMparts=$this->doc->getContextMenuCode(); 00297 $this->doc->bodyTagAdditions = $CMparts[1]; 00298 $this->doc->JScode.= $CMparts[0]; 00299 $this->doc->postCode.= $CMparts[2]; 00300 00301 // Drag and Drop code is added: 00302 $DDparts=$this->doc->getDragDropCode('pages'); 00303 // ignore the $DDparts[1] for now 00304 $this->doc->JScode.= $DDparts[0]; 00305 $this->doc->postCode.= $DDparts[2]; 00306 } 00307 00313 function main() { 00314 global $LANG,$CLIENT; 00315 00316 // Produce browse-tree: 00317 $tree = $this->pagetree->getBrowsableTree(); 00318 00319 // Start page: 00320 $this->content = ''; 00321 $this->content.= $this->doc->startPage('Page tree'); 00322 00323 // Outputting workspace info 00324 if ($GLOBALS['BE_USER']->workspace!==0 || $GLOBALS['BE_USER']->getTSConfigVal('options.pageTree.onlineWorkspaceInfo')) { 00325 switch($GLOBALS['BE_USER']->workspace) { 00326 case 0: 00327 $wsTitle = ' '.$this->doc->icons(2).'['.$LANG->sL('LLL:EXT:lang/locallang_misc.xml:shortcut_onlineWS',1).']'; 00328 break; 00329 case -1: 00330 $wsTitle = '['.$LANG->sL('LLL:EXT:lang/locallang_misc.xml:shortcut_offlineWS',1).']'; 00331 break; 00332 default: 00333 $wsTitle = '['.$GLOBALS['BE_USER']->workspace.'] '.htmlspecialchars($GLOBALS['BE_USER']->workspaceRec['title']); 00334 break; 00335 } 00336 00337 $this->content.= ' 00338 <div class="bgColor4 workspace-info">'. 00339 '<a href="'.htmlspecialchars('mod/user/ws/index.php').'" target="content">'. 00340 '<img'.t3lib_iconWorks::skinImg('','gfx/i/sys_workspace.png','width="18" height="16"').' align="top" alt="" />'. 00341 '</a>'.$wsTitle.' 00342 </div> 00343 '; 00344 } 00345 00346 // Outputting Temporary DB mount notice: 00347 if ($this->active_tempMountPoint) { 00348 $this->content.= ' 00349 <div class="bgColor4 c-notice"> 00350 <img'.t3lib_iconWorks::skinImg('','gfx/icon_note.gif','width="18" height="16"').' align="top" alt="" />'. 00351 '<a href="'.htmlspecialchars(t3lib_div::linkThisScript(array('setTempDBmount' => 0))).'">'. 00352 $LANG->sl('LLL:EXT:lang/locallang_core.php:labels.temporaryDBmount',1). 00353 '</a><br/> 00354 '.$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> 00355 </div> 00356 '; 00357 } 00358 00359 // Outputting page tree: 00360 $this->content.= $tree; 00361 00362 // Outputting refresh-link 00363 $refreshUrl = t3lib_div::getIndpEnv('REQUEST_URI'); 00364 $this->content.= ' 00365 <p class="c-refresh"> 00366 <a href="'.htmlspecialchars($refreshUrl).'">'. 00367 '<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="" />'. 00368 '</a><a href="'.htmlspecialchars($refreshUrl).'">'. 00369 $LANG->sL('LLL:EXT:lang/locallang_core.php:labels.refresh',1).'</a> 00370 </p> 00371 <br />'; 00372 00373 // CSH icon: 00374 $this->content.= t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'pagetree', $GLOBALS['BACK_PATH']); 00375 00376 // Adding highlight - JavaScript 00377 if ($this->doHighlight) $this->content .=$this->doc->wrapScriptTags(' 00378 hilight_row("",top.fsMod.navFrameHighlightedID["web"]); 00379 '); 00380 } 00381 00387 function printContent() { 00388 $this->content.= $this->doc->endPage(); 00389 $this->content = $this->doc->insertStylesAndJS($this->content); 00390 echo $this->content; 00391 } 00392 00393 00394 00395 00396 00397 00398 00399 00400 00401 00402 00403 00404 /********************************** 00405 * 00406 * Temporary DB mounts 00407 * 00408 **********************************/ 00409 00415 function initializeTemporaryDBmount(){ 00416 global $BE_USER; 00417 00418 // Set/Cancel Temporary DB Mount: 00419 if (strlen($this->setTempDBmount)) { 00420 $set = t3lib_div::intInRange($this->setTempDBmount,0); 00421 if ($set>0 && $BE_USER->isInWebMount($set)) { // Setting...: 00422 $this->settingTemporaryMountPoint($set); 00423 } else { // Clear: 00424 $this->settingTemporaryMountPoint(0); 00425 } 00426 } 00427 00428 // Getting temporary mount point ID: 00429 $temporaryMountPoint = intval($BE_USER->getSessionData('pageTree_temporaryMountPoint')); 00430 00431 // If mount point ID existed and is within users real mount points, then set it temporarily: 00432 if ($temporaryMountPoint > 0 && $BE_USER->isInWebMount($temporaryMountPoint)) { 00433 if ($this->active_tempMountPoint = t3lib_BEfunc::readPageAccess($temporaryMountPoint, $BE_USER->getPagePermsClause(1))) { 00434 $this->pagetree->MOUNTS = array($temporaryMountPoint); 00435 } 00436 else { 00437 // Clear temporary mount point as we have no access to it any longer 00438 $this->settingTemporaryMountPoint(0); 00439 } 00440 } 00441 } 00442 00449 function settingTemporaryMountPoint($pageId) { 00450 global $BE_USER; 00451 00452 // Setting temporary mount point ID: 00453 $BE_USER->setAndSaveSessionData('pageTree_temporaryMountPoint',intval($pageId)); 00454 } 00455 } 00456 00457 // Include extension? 00458 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/alt_db_navframe.php']) { 00459 include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/alt_db_navframe.php']); 00460 } 00461 00462 00463 00464 00465 00466 00467 00468 00469 00470 00471 00472 00473 // Make instance: 00474 $SOBE = t3lib_div::makeInstance('SC_alt_db_navframe'); 00475 $SOBE->init(); 00476 $SOBE->main(); 00477 $SOBE->printContent(); 00478 00479 ?>