Documentation TYPO3 par Ameos

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 ***************************************************************/
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                         // Add Page ID:
00120                 if ($this->ext_showPageId)      {
00121                         $pageIdStr = '['.$row['uid'].']&nbsp;';
00122                 } else {
00123                         $pageIdStr = '';
00124                 }
00125 
00126                 return $thePageIcon.$lockIcon.$pageIdStr;
00127         }
00128 
00137         function wrapStop($str,$row)    {
00138                 if ($row['php_tree_stop'])      {
00139                         $str.='<a href="'.htmlspecialchars(t3lib_div::linkThisScript(array('setTempDBmount' => $row['uid']))).'" class="typo3-red">+</a> ';
00140                 }
00141                 return $str;
00142         }
00143 
00153         function wrapTitle($title,$row,$bank=0) {
00154                 $aOnClick = 'return jumpTo(\''.$this->getJumpToParam($row).'\',this,\''.$this->domIdPrefix.$this->getId($row).'_'.$bank.'\');';
00155                 $CSM = '';
00156                 if ($GLOBALS['TYPO3_CONF_VARS']['BE']['useOnContextMenuHandler'])       {
00157                         $CSM = ' oncontextmenu="'.htmlspecialchars($GLOBALS['TBE_TEMPLATE']->wrapClickMenuOnIcon('','pages',$row['uid'],0,'&bank='.$this->bank,'',TRUE)).'"';
00158                 }
00159                 return '<a href="#" onclick="'.htmlspecialchars($aOnClick).'"'.$CSM.'>'.$title.'</a>';
00160         }
00161 }
00162 
00163 
00164 
00165 
00166 
00167 
00168 
00169 
00170 
00171 
00172 
00173 
00181 class SC_alt_db_navframe {
00182 
00183                 // Internal:
00184         var $content;
00185         var $pagetree;
00186         var $doc;
00187         var $active_tempMountPoint = 0;         // Temporary mount point (record), if any
00188 
00189                 // Internal, static: GPvar:
00190         var $currentSubScript;
00191         var $cMR;
00192         var $setTempDBmount;                    // If not '' (blank) then it will clear (0) or set (>0) Temporary DB mount.
00193 
00199         function init() {
00200                 global $BE_USER,$BACK_PATH;
00201 
00202                         // Setting GPvars:
00203                 $this->currentSubScript = t3lib_div::_GP('currentSubScript');
00204                 $this->cMR = t3lib_div::_GP('cMR');
00205                 $this->setTempDBmount = t3lib_div::_GP('setTempDBmount');
00206 
00207                         // Create page tree object:
00208                 $this->pagetree = t3lib_div::makeInstance('localPageTree');
00209                 $this->pagetree->ext_IconMode = $BE_USER->getTSConfigVal('options.pageTree.disableIconLinkToContextmenu');
00210                 $this->pagetree->ext_showPageId = $BE_USER->getTSConfigVal('options.pageTree.showPageIdWithTitle');
00211                 $this->pagetree->thisScript = 'alt_db_navframe.php';
00212                 $this->pagetree->addField('alias');
00213                 $this->pagetree->addField('shortcut');
00214                 $this->pagetree->addField('shortcut_mode');
00215                 $this->pagetree->addField('mount_pid');
00216                 $this->pagetree->addField('mount_pid_ol');
00217                 $this->pagetree->addField('nav_hide');
00218                 $this->pagetree->addField('url');
00219 
00220 #               $this->settingTemporaryMountPoint(11);
00221                         // Temporary DB mounts:
00222                 $this->initializeTemporaryDBmount();
00223 
00224                         // Setting highlight mode:
00225                 $this->doHighlight = !$BE_USER->getTSConfigVal('options.pageTree.disableTitleHighlight');
00226 
00227                         // Create template object:
00228                 $this->doc = t3lib_div::makeInstance('template');
00229                 $this->doc->docType='xhtml_trans';
00230 
00231                         // Setting backPath
00232                 $this->doc->backPath = $BACK_PATH;
00233 
00234                         // Setting JavaScript for menu.
00235                 $this->doc->JScode=$this->doc->wrapScriptTags(
00236         ($this->currentSubScript?'top.currentSubScript=unescape("'.rawurlencode($this->currentSubScript).'");':'').'
00237 
00238                 // Function, loading the list frame from navigation tree:
00239         function jumpTo(id,linkObj,highLightID) {       //
00240                 var theUrl = top.TS.PATH_typo3+top.currentSubScript+"?id="+id;
00241 
00242                 if (top.condensedMode)  {
00243                         top.content.document.location=theUrl;
00244                 } else {
00245                         parent.list_frame.document.location=theUrl;
00246                 }
00247 
00248                 '.($this->doHighlight?'hilight_row("web",highLightID);':'').'
00249 
00250                 '.(!$GLOBALS['CLIENT']['FORMSTYLE'] ? '' : 'if (linkObj) {linkObj.blur();}').'
00251                 return false;
00252         }
00253 
00254                 // 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.)
00255                 // See t3lib_BEfunc::getSetUpdateSignal()
00256         function refresh_nav()  {       //
00257                 window.setTimeout("_refresh_nav();",0);
00258         }
00259         function _refresh_nav() {       //
00260                 document.location="'.$this->pagetree->thisScript.'?unique='.time().'";
00261         }
00262 
00263                 // Highlighting rows in the page tree:
00264         function hilight_row(frameSetModule,highLightID) {      //
00265 
00266                         // Remove old:
00267                 theObj = document.getElementById(top.fsMod.navFrameHighlightedID[frameSetModule]);
00268                 if (theObj)     {
00269                         theObj.style.backgroundColor="";
00270                 }
00271 
00272                         // Set new:
00273                 top.fsMod.navFrameHighlightedID[frameSetModule] = highLightID;
00274                 theObj = document.getElementById(highLightID);
00275                 if (theObj)     {
00276                         theObj.style.backgroundColor="'.t3lib_div::modifyHTMLColorAll($this->doc->bgColor,-20).'";
00277                 }
00278         }
00279 
00280         '.($this->cMR?"jumpTo(top.fsMod.recentIds['web'],'');":'').';
00281                 ');
00282 
00283                         // Click menu code is added:
00284                 $CMparts=$this->doc->getContextMenuCode();
00285                 $this->doc->bodyTagAdditions = $CMparts[1];
00286                 $this->doc->JScode.= $CMparts[0];
00287                 $this->doc->postCode.= $CMparts[2];
00288         }
00289 
00295         function main() {
00296                 global $LANG,$CLIENT;
00297 
00298                         // Produce browse-tree:
00299                 $tree = $this->pagetree->getBrowsableTree();
00300 
00301                         // Start page:
00302                 $this->content = '';
00303                 $this->content.= $this->doc->startPage('Page tree');
00304 
00305                         // Outputting Temporary DB mount notice:
00306                 if ($this->active_tempMountPoint)       {
00307                         $this->content.= '
00308                                 <div class="bgColor4 c-notice">
00309                                         <img'.t3lib_iconWorks::skinImg('','gfx/icon_note.gif','width="18" height="16"').' align="top" alt="" />'.
00310                                         '<a href="'.htmlspecialchars(t3lib_div::linkThisScript(array('setTempDBmount' => 0))).'">'.
00311                                         $LANG->sl('LLL:EXT:lang/locallang_core.php:labels.temporaryDBmount',1).
00312                                         '</a><br/>
00313                                         '.$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>
00314                                 </div>
00315                         ';
00316                 }
00317 
00318                         // Outputting page tree:
00319                 $this->content.= $tree;
00320 
00321                         // Outputting refresh-link
00322                 $refreshUrl = t3lib_div::getIndpEnv('REQUEST_URI');
00323                 $this->content.= '
00324                         <p class="c-refresh">
00325                                 <a href="'.htmlspecialchars($refreshUrl).'">'.
00326                                 '<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="" />'.
00327                                 '</a><a href="'.htmlspecialchars($refreshUrl).'">'.
00328                                 $LANG->sL('LLL:EXT:lang/locallang_core.php:labels.refresh',1).'</a>
00329                         </p>
00330                         <br />';
00331 
00332                         // CSH icon:
00333                 $this->content.= t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'pagetree', $GLOBALS['BACK_PATH']);
00334 
00335                         // Adding highlight - JavaScript
00336                 if ($this->doHighlight) $this->content .=$this->doc->wrapScriptTags('
00337                         hilight_row("",top.fsMod.navFrameHighlightedID["web"]);
00338                 ');
00339         }
00340 
00346         function printContent() {
00347                 $this->content.= $this->doc->endPage();
00348                 echo $this->content;
00349         }
00350 
00351 
00352 
00353 
00354 
00355 
00356 
00357 
00358 
00359 
00360 
00361 
00362         /**********************************
00363          *
00364          * Temporary DB mounts
00365          *
00366          **********************************/
00367 
00373         function initializeTemporaryDBmount(){
00374                 global $BE_USER;
00375 
00376                         // Set/Cancel Temporary DB Mount:
00377                 if (strlen($this->setTempDBmount))      {
00378                         $set = t3lib_div::intInRange($this->setTempDBmount,0);
00379                         if ($set>0 && $BE_USER->isInWebMount($set))     {       // Setting...:
00380                                 $this->settingTemporaryMountPoint($set);
00381                         } else {        // Clear:
00382                                 $this->settingTemporaryMountPoint(0);
00383                         }
00384                 }
00385 
00386                         // Getting temporary mount point ID:
00387                 $temporaryMountPoint = intval($BE_USER->getSessionData('pageTree_temporaryMountPoint'));
00388 
00389                         // If mount point ID existed and is within users real mount points, then set it temporarily:
00390                 if ($temporaryMountPoint > 0 && $BE_USER->isInWebMount($temporaryMountPoint))   {
00391                         $this->pagetree->MOUNTS = array($temporaryMountPoint);
00392                         $this->active_tempMountPoint = t3lib_BEfunc::readPageAccess($temporaryMountPoint, $BE_USER->getPagePermsClause(1));
00393                 }
00394         }
00395 
00402         function settingTemporaryMountPoint($pageId)    {
00403                 global $BE_USER;
00404 
00405                         // Setting temporary mount point ID:
00406                 $BE_USER->setAndSaveSessionData('pageTree_temporaryMountPoint',intval($pageId));
00407         }
00408 }
00409 
00410 // Include extension?
00411 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/alt_db_navframe.php'])       {
00412         include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/alt_db_navframe.php']);
00413 }
00414 
00415 
00416 
00417 
00418 
00419 
00420 
00421 
00422 
00423 
00424 
00425 
00426 // Make instance:
00427 $SOBE = t3lib_div::makeInstance('SC_alt_db_navframe');
00428 $SOBE->init();
00429 $SOBE->main();
00430 $SOBE->printContent();
00431 
00432 ?>


Généré par Les spécialistes TYPO3 avec  doxygen 1.4.6