/src/typo3_src-4.2.0alpha1/typo3/alt_db_navframe.php

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 ***************************************************************/
00055 $BACK_PATH = '';
00056 require('init.php');
00057 require('template.php');
00058 require_once('class.webpagetree.php');
00059 
00060 
00068 class SC_alt_db_navframe {
00069 
00070                 // Internal:
00071         var $content;
00072         var $pagetree;
00073 
00079         var $doc;
00080         var $active_tempMountPoint = 0;         // Temporary mount point (record), if any
00081         var $backPath;
00082 
00083                 // Internal, static: GPvar:
00084         var $ajax;                                                      // Is set, if an AJAX call should be handled.
00085         var $currentSubScript;
00086         var $cMR;
00087         var $setTempDBmount;                    // If not '' (blank) then it will clear (0) or set (>0) Temporary DB mount.
00088 
00094         function init() {
00095                 global $BE_USER,$BACK_PATH;
00096 
00097                         // Setting backPath
00098                 $this->backPath = $BACK_PATH;
00099 
00100                         // Setting GPvars:
00101                 $this->ajax = t3lib_div::_GP('ajax');
00102                 $this->cMR = t3lib_div::_GP('cMR');
00103                 $this->currentSubScript = t3lib_div::_GP('currentSubScript');
00104                 $this->setTempDBmount = t3lib_div::_GP('setTempDBmount');
00105 
00106                         // Create page tree object:
00107                 $this->pagetree = t3lib_div::makeInstance('webPageTree');
00108                 $this->pagetree->ext_IconMode = $BE_USER->getTSConfigVal('options.pageTree.disableIconLinkToContextmenu');
00109                 $this->pagetree->ext_showPageId = $BE_USER->getTSConfigVal('options.pageTree.showPageIdWithTitle');
00110                 $this->pagetree->ext_dontSeparateNotinmenuPages = $BE_USER->getTSConfigVal('options.pageTree.dontSeparateNotinmenuPages');
00111                 $this->pagetree->ext_dontAlphasortNotinmenuPages = $BE_USER->getTSConfigVal('options.pageTree.dontAlphasortNotinmenuPages');
00112                 $this->pagetree->thisScript = 'alt_db_navframe.php';
00113                 $this->pagetree->addField('alias');
00114                 $this->pagetree->addField('shortcut');
00115                 $this->pagetree->addField('shortcut_mode');
00116                 $this->pagetree->addField('mount_pid');
00117                 $this->pagetree->addField('mount_pid_ol');
00118                 $this->pagetree->addField('nav_hide');
00119                 $this->pagetree->addField('url');
00120 
00121                         // Temporary DB mounts:
00122                 $this->initializeTemporaryDBmount();
00123 
00124                         // Use template rendering only if this is a non-AJAX call:
00125                 if (!$this->ajax) {
00126                                 // Setting highlight mode:
00127                         $this->doHighlight = !$BE_USER->getTSConfigVal('options.pageTree.disableTitleHighlight');
00128 
00129                                 // If highlighting is active, define the CSS class for the active item depending on the workspace
00130                         if ($this->doHighlight) {
00131                                 if ($BE_USER->workspace === 0) $hlClass = 'active';
00132                                 else $hlClass = 'active active-ws wsver'.$BE_USER->workspace; 
00133                         }
00134 
00135                                 // Create template object:
00136                         $this->doc = t3lib_div::makeInstance('template');
00137                         $this->doc->backPath = $BACK_PATH;
00138                         $this->doc->docType = 'xhtml_trans';
00139 
00140                                 // Adding javascript code for AJAX (prototype), drag&drop and the pagetree
00141                         $this->doc->JScode  = '
00142                         <script type="text/javascript" src="'.$this->backPath.'contrib/prototype/prototype.js"></script>
00143                         <script type="text/javascript" src="'.$this->backPath.'tree.js"></script>'."\n";
00144 
00145                         $this->doc->JScode .= $this->doc->wrapScriptTags(
00146                         ($this->currentSubScript?'top.currentSubScript=unescape("'.rawurlencode($this->currentSubScript).'");':'').'
00147                         // setting prefs for pagetree and drag & drop
00148                         Tree.thisScript    = "'.$this->pagetree->thisScript.'";
00149                         '.($this->doHighlight ? 'Tree.highlightClass = "'.$hlClass.'";' : '').'
00150 
00151                         DragDrop.changeURL = "'.$this->backPath.'alt_clickmenu.php";
00152                         DragDrop.backPath  = "'.t3lib_div::shortMD5(''.'|'.$GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey']).'";
00153                         DragDrop.table     = "pages";
00154 
00155                         // Function, loading the list frame from navigation tree:
00156                         function jumpTo(id, linkObj, highlightID, bank) { //
00157                                 var theUrl = top.TS.PATH_typo3 + top.currentSubScript + "?id=" + id;
00158                                 top.fsMod.currentBank = bank;
00159 
00160                                 if (top.condensedMode) top.content.location.href = theUrl;
00161                                 else                   parent.list_frame.location.href=theUrl;
00162 
00163                                 '.($this->doHighlight ? 'Tree.highlightActiveItem("web", highlightID + "_" + bank);' : '').'
00164                                 '.(!$GLOBALS['CLIENT']['FORMSTYLE'] ? '' : 'if (linkObj) linkObj.blur(); ').'
00165                                 return false;
00166                         }
00167                         '.($this->cMR?"jumpTo(top.fsMod.recentIds['web'],'');":'').'
00168                         ');
00169 
00170                                 // Click menu code is added:
00171                         $CMparts=$this->doc->getContextMenuCode();
00172                         $this->doc->bodyTagAdditions = $CMparts[1];
00173                         $this->doc->bodyTagId = 'bodyTag';
00174                         $this->doc->JScode.= $CMparts[0];
00175                         $this->doc->postCode.= $CMparts[2];
00176                 }
00177         }
00178 
00179 
00185         function main() {
00186                 global $LANG,$CLIENT;
00187 
00188                         // Produce browse-tree:
00189                 $tree = $this->pagetree->getBrowsableTree();
00190 
00191                         // Output only the tree if this is an AJAX call:
00192                 if ($this->ajax) {
00193                         $this->content = $LANG->csConvObj->utf8_encode($tree, $LANG->charSet);
00194                         return;
00195                 }
00196 
00197                         // Start page:
00198                 $this->content = $this->doc->startPage('TYPO3 Page Tree');
00199                 
00200                         // Outputting workspace info
00201                 if ($GLOBALS['BE_USER']->workspace!==0 || $GLOBALS['BE_USER']->getTSConfigVal('options.pageTree.onlineWorkspaceInfo'))  {
00202                         switch($GLOBALS['BE_USER']->workspace)  {
00203                                 case 0:
00204                                         $wsTitle = '&nbsp;'.$this->doc->icons(2).'['.$LANG->sL('LLL:EXT:lang/locallang_misc.xml:shortcut_onlineWS',1).']';
00205                                 break;
00206                                 case -1:
00207                                         $wsTitle = '['.$LANG->sL('LLL:EXT:lang/locallang_misc.xml:shortcut_offlineWS',1).']';
00208                                 break;
00209                                 default:
00210                                         $wsTitle = '['.$GLOBALS['BE_USER']->workspace.'] '.htmlspecialchars($GLOBALS['BE_USER']->workspaceRec['title']);
00211                                 break;
00212                         }
00213 
00214                         $this->content.= '
00215                                 <div class="bgColor4 workspace-info">'.
00216                                         '<a href="'.htmlspecialchars('mod/user/ws/index.php').'" target="content">'.
00217                                         '<img'.t3lib_iconWorks::skinImg('','gfx/i/sys_workspace.png','width="18" height="16"').' align="top" alt="" />'.
00218                                         '</a>'.$wsTitle.'
00219                                 </div>
00220                         ';
00221                 }
00222 
00223                 if (!$GLOBALS['BE_USER']->getTSConfigVal('options.pageTree.hideFilter'))        {
00224                         $this->content.= '
00225                                         <div class="bgColor4">
00226                                                 Filter: <input type="text" value="" name="_livesearch" id="_livesearch" onkeyup="filter(this.value);"/>
00227                                         </div><br>
00228                         ';
00229                 }
00230 
00231                         // Outputting Temporary DB mount notice:
00232                 if ($this->active_tempMountPoint)       {
00233                         $this->content.= '
00234                                 <div class="bgColor4 c-notice">
00235                                         <img'.t3lib_iconWorks::skinImg('','gfx/icon_note.gif','width="18" height="16"').' align="top" alt="" />'.
00236                                         '<a href="'.htmlspecialchars(t3lib_div::linkThisScript(array('setTempDBmount' => 0))).'">'.
00237                                         $LANG->sl('LLL:EXT:lang/locallang_core.php:labels.temporaryDBmount',1).
00238                                         '</a><br/>
00239                                         '.$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>
00240                                 </div>
00241                         ';
00242                 }
00243 
00244                         // Outputting page tree:
00245                 $this->content.= $tree;
00246 
00247                         // Outputting refresh-link
00248                 $this->content.= '
00249                         <p class="c-refresh">
00250                                 <a href="'.htmlspecialchars(t3lib_div::getIndpEnv('REQUEST_URI')).'">'.
00251                                 '<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="" />'.
00252                                 $LANG->sL('LLL:EXT:lang/locallang_core.php:labels.refresh',1).'</a>
00253                         </p>
00254                         <br />';
00255 
00256                         // CSH icon:
00257                 $this->content.= t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'pagetree', $GLOBALS['BACK_PATH']);
00258 
00259                         // Adding javascript for drag & drop activation and highlighting
00260                 $this->content .=$this->doc->wrapScriptTags('
00261                         '.($this->doHighlight ? 'Tree.highlightActiveItem("",top.fsMod.navFrameHighlightedID["web"]);' : '').'
00262                         '.(!$this->doc->isCMlayers() ? 'Tree.activateDragDrop = false;' : 'Tree.registerDragDropHandlers();')
00263                 );
00264         }
00265 
00271         function printContent() {
00272                         // If we handle an AJAX call, send headers:
00273                 if ($this->ajax) {
00274                         header('X-JSON: ('.($this->pagetree->ajaxStatus?'true':'false').')');
00275                         header('Content-type: text/html; charset=utf-8');
00276                         // If it's the regular call to fully output the tree:
00277                 } else {
00278                         $this->content.= $this->doc->endPage();
00279                         $this->content = $this->doc->insertStylesAndJS($this->content);
00280                 }
00281                 echo $this->content;
00282         }
00283 
00284 
00285 
00286 
00287 
00288         /**********************************
00289          *
00290          * Temporary DB mounts
00291          *
00292          **********************************/
00293 
00299         function initializeTemporaryDBmount(){
00300                 global $BE_USER;
00301 
00302                         // Set/Cancel Temporary DB Mount:
00303                 if (strlen($this->setTempDBmount))      {
00304                         $set = t3lib_div::intInRange($this->setTempDBmount,0);
00305                         if ($set>0 && $BE_USER->isInWebMount($set))     {       // Setting...:
00306                                 $this->settingTemporaryMountPoint($set);
00307                         } else {        // Clear:
00308                                 $this->settingTemporaryMountPoint(0);
00309                         }
00310                 }
00311 
00312                         // Getting temporary mount point ID:
00313                 $temporaryMountPoint = intval($BE_USER->getSessionData('pageTree_temporaryMountPoint'));
00314 
00315                         // If mount point ID existed and is within users real mount points, then set it temporarily:
00316                 if ($temporaryMountPoint > 0 && $BE_USER->isInWebMount($temporaryMountPoint))   {
00317                         if ($this->active_tempMountPoint = t3lib_BEfunc::readPageAccess($temporaryMountPoint, $BE_USER->getPagePermsClause(1))) {
00318                                 $this->pagetree->MOUNTS = array($temporaryMountPoint);
00319                         }
00320                         else {
00321                                 // Clear temporary mount point as we have no access to it any longer
00322                                 $this->settingTemporaryMountPoint(0);
00323                         }
00324                 }
00325         }
00326 
00327 
00334         function settingTemporaryMountPoint($pageId)    {
00335                 global $BE_USER;
00336 
00337                         // Setting temporary mount point ID:
00338                 $BE_USER->setAndSaveSessionData('pageTree_temporaryMountPoint',intval($pageId));
00339         }
00340 }
00341 
00342 
00343 // Include extension?
00344 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/alt_db_navframe.php'])       {
00345         include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/alt_db_navframe.php']);
00346 }
00347 
00348 
00349 
00350 
00351 
00352 // Make instance:
00353 $SOBE = t3lib_div::makeInstance('SC_alt_db_navframe');
00354 $SOBE->init();
00355 $SOBE->main();
00356 $SOBE->printContent();
00357 
00358 ?>

This documentation has been generated automatically from TYPO3 source code using Doxygen and is provided as is by Cast Iron Coding as a courtesy to other TYPO3 developers and users. Please consider Cast Iron Coding — a full-service web development agency in Portland, Oregon specializing in TYPO3 extension development — for all of your TYPO3 development and consulting needs!