Documentation TYPO3 par Ameos

alt_db_navframe.php

00001 <?php
00002 /***************************************************************
00003 *  Copyright notice
00004 *
00005 *  (c) 1999-2004 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 ***************************************************************/
00062 $BACK_PATH='';
00063 require('init.php');
00064 require('template.php');
00065 require_once(PATH_t3lib.'class.t3lib_browsetree.php');
00066 
00067 
00068 
00077 class localPageTree extends t3lib_browseTree {
00078 
00079         var $ext_showPageId;
00080         var $ext_IconMode;
00081 
00087         function localPageTree() {
00088                 $this->init();
00089         }
00090 
00098         function wrapIcon($icon,&$row)  {
00099                         // If the record is locked, present a warning sign.
00100                 if ($lockInfo=t3lib_BEfunc::isRecordLocked('pages',$row['uid']))        {
00101                         $aOnClick = 'alert('.$GLOBALS['LANG']->JScharCode($lockInfo['msg']).');return false;';
00102                         $lockIcon='<a href="#" onclick="'.htmlspecialchars($aOnClick).'">'.
00103                                 '<img'.t3lib_iconWorks::skinImg('','gfx/recordlock_warning3.gif','width="17" height="12"').' title="'.htmlspecialchars($lockInfo['msg']).'" alt="" />'.
00104                                 '</a>';
00105                 } else $lockIcon = '';
00106 
00107                         // Add title attribute to input icon tag
00108                 $thePageIcon = $this->addTagAttributes($icon, $this->titleAttrib.'="'.$this->getTitleAttrib($row).'"');
00109 
00110                         // Wrap icon in click-menu link.
00111                 if (!$this->ext_IconMode)       {
00112                         $thePageIcon = $GLOBALS['TBE_TEMPLATE']->wrapClickMenuOnIcon($thePageIcon,'pages',$row['uid'],0,'&bank='.$this->bank);
00113                 } elseif (!strcmp($this->ext_IconMode,'titlelink'))     {
00114                         $aOnClick = 'return jumpTo(\''.$this->getJumpToParam($row).'\',this,\''.$this->treeName.'\');';
00115                         $thePageIcon='<a href="#" onclick="'.htmlspecialchars($aOnClick).'">'.$thePageIcon.'</a>';
00116                 }
00117 
00118                         // Add Page ID:
00119                 if ($this->ext_showPageId)      {
00120                         $pageIdStr = '['.$row['uid'].']&nbsp;';
00121                 } else {
00122                         $pageIdStr = '';
00123                 }
00124 
00125                 return $thePageIcon.$lockIcon.$pageIdStr;
00126         }
00127 
00136         function wrapStop($str,$row)    {
00137                 if ($row['php_tree_stop'])      {
00138                         $str.='<a href="'.htmlspecialchars(t3lib_div::linkThisScript(array('setTempDBmount' => $row['uid']))).'" class="typo3-red">+</a> ';
00139                 }
00140                 return $str;
00141         }
00142 }
00143 
00144 
00145 
00146 
00147 
00148 
00149 
00150 
00151 
00152 
00153 
00154 
00162 class SC_alt_db_navframe {
00163 
00164                 // Internal:
00165         var $content;
00166         var $pagetree;
00167         var $doc;
00168         var $active_tempMountPoint = 0;         // Temporary mount point (record), if any
00169 
00170                 // Internal, static: GPvar:
00171         var $currentSubScript;
00172         var $cMR;
00173         var $setTempDBmount;                    // If not '' (blank) then it will clear (0) or set (>0) Temporary DB mount.
00174 
00180         function init() {
00181                 global $BE_USER,$BACK_PATH;
00182 
00183                         // Setting GPvars:
00184                 $this->currentSubScript = t3lib_div::_GP('currentSubScript');
00185                 $this->cMR = t3lib_div::_GP('cMR');
00186                 $this->setTempDBmount = t3lib_div::_GP('setTempDBmount');
00187 
00188                         // Create page tree object:
00189                 $this->pagetree = t3lib_div::makeInstance('localPageTree');
00190                 $this->pagetree->ext_IconMode = $BE_USER->getTSConfigVal('options.pageTree.disableIconLinkToContextmenu');
00191                 $this->pagetree->ext_showPageId = $BE_USER->getTSConfigVal('options.pageTree.showPageIdWithTitle');
00192                 $this->pagetree->thisScript = 'alt_db_navframe.php';
00193                 $this->pagetree->addField('alias');
00194                 $this->pagetree->addField('shortcut');
00195                 $this->pagetree->addField('shortcut_mode');
00196                 $this->pagetree->addField('mount_pid');
00197                 $this->pagetree->addField('mount_pid_ol');
00198                 $this->pagetree->addField('nav_hide');
00199                 $this->pagetree->addField('url');
00200 
00201 #               $this->settingTemporaryMountPoint(11);
00202                         // Temporary DB mounts:
00203                 $this->initializeTemporaryDBmount();
00204 
00205                         // Setting highlight mode:
00206                 $this->doHighlight = !$BE_USER->getTSConfigVal('options.pageTree.disableTitleHighlight');
00207 
00208                         // Create template object:
00209                 $this->doc = t3lib_div::makeInstance('template');
00210                 $this->doc->docType='xhtml_trans';
00211 
00212                         // Setting backPath
00213                 $this->doc->backPath = $BACK_PATH;
00214 
00215                         // Setting JavaScript for menu.
00216                 $this->doc->JScode=$this->doc->wrapScriptTags(
00217         ($this->currentSubScript?'top.currentSubScript=unescape("'.rawurlencode($this->currentSubScript).'");':'').'
00218 
00219                 // Function, loading the list frame from navigation tree:
00220         function jumpTo(id,linkObj,highLightID) {       //
00221                 var theUrl = top.TS.PATH_typo3+top.currentSubScript+"?id="+id;
00222 
00223                 if (top.condensedMode)  {
00224                         top.content.document.location=theUrl;
00225                 } else {
00226                         parent.list_frame.document.location=theUrl;
00227                 }
00228 
00229                 '.($this->doHighlight?'hilight_row("web",highLightID);':'').'
00230 
00231                 '.(!$GLOBALS['CLIENT']['FORMSTYLE'] ? '' : 'if (linkObj) {linkObj.blur();}').'
00232                 return false;
00233         }
00234 
00235                 // 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.)
00236                 // See t3lib_BEfunc::getSetUpdateSignal()
00237         function refresh_nav()  {       //
00238                 window.setTimeout("_refresh_nav();",0);
00239         }
00240         function _refresh_nav() {       //
00241                 document.location="'.$this->pagetree->thisScript.'?unique='.time().'";
00242         }
00243 
00244                 // Highlighting rows in the page tree:
00245         function hilight_row(frameSetModule,highLightID) {      //
00246 
00247                         // Remove old:
00248                 theObj = document.getElementById(top.fsMod.navFrameHighlightedID[frameSetModule]);
00249                 if (theObj)     {
00250                         theObj.style.backgroundColor="";
00251                 }
00252 
00253                         // Set new:
00254                 top.fsMod.navFrameHighlightedID[frameSetModule] = highLightID;
00255                 theObj = document.getElementById(highLightID);
00256                 if (theObj)     {
00257                         theObj.style.backgroundColor="'.t3lib_div::modifyHTMLColorAll($this->doc->bgColor,-20).'";
00258                 }
00259         }
00260 
00261         '.($this->cMR?"jumpTo(top.fsMod.recentIds['web'],'');":'').';
00262                 ');
00263 
00264                         // Click menu code is added:
00265                 $CMparts=$this->doc->getContextMenuCode();
00266                 $this->doc->bodyTagAdditions = $CMparts[1];
00267                 $this->doc->JScode.= $CMparts[0];
00268                 $this->doc->postCode.= $CMparts[2];
00269         }
00270 
00276         function main() {
00277                 global $LANG,$CLIENT;
00278 
00279                         // Produce browse-tree:
00280                 $tree = $this->pagetree->getBrowsableTree();
00281 
00282                         // Start page:
00283                 $this->content = '';
00284                 $this->content.= $this->doc->startPage('Page tree');
00285 
00286                         // Outputting Temporary DB mount notice:
00287                 if ($this->active_tempMountPoint)       {
00288                         $this->content.= '
00289                                 <div class="bgColor4 c-notice">
00290                                         <img'.t3lib_iconWorks::skinImg('','gfx/icon_note.gif','width="18" height="16"').' align="top" alt="" />'.
00291                                         '<a href="'.htmlspecialchars(t3lib_div::linkThisScript(array('setTempDBmount' => 0))).'">'.
00292                                         $LANG->sl('LLL:EXT:lang/locallang_core.php:labels.temporaryDBmount',1).
00293                                         '</a><br/>
00294                                         '.$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>
00295                                 </div>
00296                         ';
00297                 }
00298 
00299                         // Outputting page tree:
00300                 $this->content.= $tree;
00301 
00302                         // Outputting refresh-link
00303                 $refreshUrl = t3lib_div::getIndpEnv('REQUEST_URI');
00304                 $this->content.= '
00305                         <p class="c-refresh">
00306                                 <a href="'.htmlspecialchars($refreshUrl).'">'.
00307                                 '<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="" />'.
00308                                 '</a><a href="'.htmlspecialchars($refreshUrl).'">'.
00309                                 $LANG->sL('LLL:EXT:lang/locallang_core.php:labels.refresh',1).'</a>
00310                         </p>
00311                         <br />';
00312 
00313                         // CSH icon:
00314                 $this->content.= t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'pagetree', $GLOBALS['BACK_PATH']);
00315 
00316                         // Adding highlight - JavaScript
00317                 if ($this->doHighlight) $this->content .=$this->doc->wrapScriptTags('
00318                         hilight_row("",top.fsMod.navFrameHighlightedID["web"]);
00319                 ');
00320         }
00321 
00327         function printContent() {
00328                 $this->content.= $this->doc->endPage();
00329                 echo $this->content;
00330         }
00331 
00332 
00333 
00334 
00335 
00336 
00337 
00338 
00339 
00340 
00341 
00342 
00343         /**********************************
00344          *
00345          * Temporary DB mounts
00346          *
00347          **********************************/
00348 
00354         function initializeTemporaryDBmount(){
00355                 global $BE_USER;
00356 
00357                         // Set/Cancel Temporary DB Mount:
00358                 if (strlen($this->setTempDBmount))      {
00359                         $set = t3lib_div::intInRange($this->setTempDBmount,0);
00360                         if ($set>0 && $BE_USER->isInWebMount($set))     {       // Setting...:
00361                                 $this->settingTemporaryMountPoint($set);
00362                         } else {        // Clear:
00363                                 $this->settingTemporaryMountPoint(0);
00364                         }
00365                 }
00366 
00367                         // Getting temporary mount point ID:
00368                 $temporaryMountPoint = intval($BE_USER->getSessionData('pageTree_temporaryMountPoint'));
00369 
00370                         // If mount point ID existed and is within users real mount points, then set it temporarily:
00371                 if ($temporaryMountPoint > 0 && $BE_USER->isInWebMount($temporaryMountPoint))   {
00372                         $this->pagetree->MOUNTS = array($temporaryMountPoint);
00373                         $this->active_tempMountPoint = t3lib_BEfunc::readPageAccess($temporaryMountPoint, $BE_USER->getPagePermsClause(1));
00374                 }
00375         }
00376 
00383         function settingTemporaryMountPoint($pageId)    {
00384                 global $BE_USER;
00385 
00386                         // Setting temporary mount point ID:
00387                 $BE_USER->setAndSaveSessionData('pageTree_temporaryMountPoint',intval($pageId));
00388         }
00389 }
00390 
00391 // Include extension?
00392 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/alt_db_navframe.php'])       {
00393         include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/alt_db_navframe.php']);
00394 }
00395 
00396 
00397 
00398 
00399 
00400 
00401 
00402 
00403 
00404 
00405 
00406 
00407 // Make instance:
00408 $SOBE = t3lib_div::makeInstance('SC_alt_db_navframe');
00409 $SOBE->init();
00410 $SOBE->main();
00411 $SOBE->printContent();
00412 
00413 ?>


Généré par TYPO3 Ameos avec  doxygen 1.4.6