TYPO3 API  SVNRelease
class.tslib_adminpanel.php
Go to the documentation of this file.
00001 <?php
00002 /***************************************************************
00003 *  Copyright notice
00004 *
00005 *  (c) 2008-2011 Jeff Segars <jeff@webempoweredchurch.org>
00006 *  (c) 2008-2011 David Slayback <dave@webempoweredchurch.org>
00007 *  All rights reserved
00008 *
00009 *  This script is part of the TYPO3 project. The TYPO3 project is
00010 *  free software; you can redistribute it and/or modify
00011 *  it under the terms of the GNU General Public License as published by
00012 *  the Free Software Foundation; either version 2 of the License, or
00013 *  (at your option) any later version.
00014 *
00015 *  The GNU General Public License can be found at
00016 *  http://www.gnu.org/copyleft/gpl.html.
00017 *  A copy is found in the textfile GPL.txt and important notices to the license
00018 *  from the author is found in LICENSE.txt distributed with these scripts.
00019 *
00020 *
00021 *  This script is distributed in the hope that it will be useful,
00022 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00023 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00024 *  GNU General Public License for more details.
00025 *
00026 *  This copyright notice MUST APPEAR in all copies of the scri.pt!
00027 ***************************************************************/
00028 /**
00029  * View class for the admin panel in frontend editing.
00030  *
00031  * $Id: class.tslib_adminpanel.php 10555 2011-02-22 22:13:29Z steffenk $
00032  *
00033  * @author  Jeff Segars <jeff@webempoweredchurch.org>
00034  * @author  David Slayback <dave@webempoweredchurch.org>
00035  * @author Dmitry Dulepov <dmitry@typo3.org>
00036  * @package TYPO3
00037  * @subpackage tslib
00038  */
00039 class tslib_AdminPanel {
00040 
00041     /**
00042      * Determines whether the update button should be shown.
00043      *
00044      * @var boolean
00045      */
00046     protected $extNeedUpdate = false;
00047 
00048     /**
00049      * Force preview?
00050      *
00051      * @var boolean
00052      */
00053     protected $ext_forcePreview = false;
00054 
00055     /**
00056      * Comma separated list of page UIDs to be published.
00057      *
00058      * @var string
00059      */
00060     protected $extPublishList = '';
00061 
00062     public function __construct() {
00063         $this->initialize();
00064     }
00065 
00066     /*****************************************************
00067      *
00068      * Admin Panel Configuration/Initialization
00069      *
00070      ****************************************************/
00071 
00072     /**
00073      * Initializes settings for the admin panel.
00074      *
00075      * @return  void
00076      */
00077     public function initialize() {
00078         $this->saveConfigOptions();
00079 
00080                 // Setting some values based on the admin panel
00081         $GLOBALS['TSFE']->forceTemplateParsing = $this->extGetFeAdminValue('tsdebug', 'forceTemplateParsing');
00082         $GLOBALS['TSFE']->displayEditIcons = $this->extGetFeAdminValue('edit', 'displayIcons');
00083         $GLOBALS['TSFE']->displayFieldEditIcons = $this->extGetFeAdminValue('edit', 'displayFieldIcons');
00084 
00085         if ($this->extGetFeAdminValue('tsdebug', 'displayQueries')) {
00086             if ($GLOBALS['TYPO3_DB']->explainOutput == 0) {     // do not override if the value is already set in t3lib_db
00087                     // Enable execution of EXPLAIN SELECT queries
00088                 $GLOBALS['TYPO3_DB']->explainOutput = 3;
00089             }
00090         }
00091 
00092         if (t3lib_div::_GP('ADMCMD_editIcons')) {
00093             $GLOBALS['TSFE']->displayFieldEditIcons=1;
00094             $GLOBALS['BE_USER']->uc['TSFE_adminConfig']['edit_editNoPopup'] = 1;
00095         }
00096 
00097         if (t3lib_div::_GP('ADMCMD_simUser')) {
00098             $GLOBALS['BE_USER']->uc['TSFE_adminConfig']['preview_simulateUserGroup']=intval(t3lib_div::_GP('ADMCMD_simUser'));
00099             $this->ext_forcePreview = true;
00100         }
00101 
00102         if (t3lib_div::_GP('ADMCMD_simTime')) {
00103             $GLOBALS['BE_USER']->uc['TSFE_adminConfig']['preview_simulateDate']=intval(t3lib_div::_GP('ADMCMD_simTime'));
00104             $this->ext_forcePreview = true;
00105         }
00106 
00107         if ($GLOBALS['TSFE']->forceTemplateParsing || $GLOBALS['TSFE']->displayEditIcons || $GLOBALS['TSFE']->displayFieldEditIcons) {
00108             $GLOBALS['TSFE']->set_no_cache();
00109         }
00110     }
00111 
00112     /**
00113      * Obtains header data for the admin panel.
00114      *
00115      * @return string
00116      */
00117     public function getAdminPanelHeaderData() {
00118         $result = '';
00119 
00120         // Include BE styles
00121         $GLOBALS['TSFE']->includeTCA();
00122 
00123         if(!empty($GLOBALS['TBE_STYLES']['stylesheets']['admPanel'])) {
00124             $result =   '<link rel="stylesheet" type="text/css" href="' .
00125                 htmlspecialchars(t3lib_div::locationHeaderUrl($GLOBALS['TBE_STYLES']['stylesheets']['admPanel'])) .
00126                 '" />';
00127         }
00128         return $result;
00129     }
00130 
00131     /**
00132      * Checks if a Admin Panel section ("module") is available for the user. If so, true is returned.
00133      *
00134      * @param   string      The module key, eg. "edit", "preview", "info" etc.
00135      * @return  boolean
00136      */
00137     public function isAdminModuleEnabled($key) {
00138         $result = false;
00139 
00140             // Returns true if the module checked is "preview" and the forcePreview flag is set.
00141         if ($key == 'preview' && $this->ext_forcePreview) {
00142             $result = true;
00143         }
00144 
00145             // If key is not set, only "all" is checked
00146         if ($GLOBALS['BE_USER']->extAdminConfig['enable.']['all']) {
00147             $result = true;
00148         }
00149 
00150         if ($GLOBALS['BE_USER']->extAdminConfig['enable.'][$key]) {
00151             $result = true;
00152         }
00153 
00154         return $result;
00155     }
00156 
00157     /**
00158      * Saves any change in settings made in the Admin Panel.
00159      * Called from index_ts.php right after access check for the Admin Panel
00160      *
00161      * @return  void
00162      */
00163     public function saveConfigOptions() {
00164         $input = t3lib_div::_GP('TSFE_ADMIN_PANEL');
00165         if (is_array($input)) {
00166                 // Setting
00167             $GLOBALS['BE_USER']->uc['TSFE_adminConfig'] = array_merge(!is_array($GLOBALS['BE_USER']->uc['TSFE_adminConfig']) ? array() : $GLOBALS['BE_USER']->uc['TSFE_adminConfig'], $input);          // Candidate for t3lib_div::array_merge() if integer-keys will some day make trouble...
00168             unset($GLOBALS['BE_USER']->uc['TSFE_adminConfig']['action']);
00169 
00170                 // Actions:
00171             if ($input['action']['clearCache'] && $this->isAdminModuleEnabled('cache')) {
00172                 $GLOBALS['BE_USER']->extPageInTreeInfo=array();
00173                 $theStartId = intval($input['cache_clearCacheId']);
00174                 $GLOBALS['TSFE']->clearPageCacheContent_pidList($GLOBALS['BE_USER']->extGetTreeList($theStartId, $this->extGetFeAdminValue('cache', 'clearCacheLevels'), 0, $GLOBALS['BE_USER']->getPagePermsClause(1)) . $theStartId);
00175             }
00176             if ($input['action']['publish'] && $this->isAdminModuleEnabled('publish')) {
00177                 $theStartId = intval($input['publish_id']);
00178                 $this->extPublishList = $GLOBALS['BE_USER']->extGetTreeList($theStartId, $this->extGetFeAdminValue('publish', 'levels'), 0, $GLOBALS['BE_USER']->getPagePermsClause(1)) . $theStartId;
00179             }
00180 
00181                 // Saving
00182             $GLOBALS['BE_USER']->writeUC();
00183         }
00184         $GLOBALS['TT']->LR = $this->extGetFeAdminValue('tsdebug', 'LR');
00185 
00186         if ($this->extGetFeAdminValue('cache', 'noCache')) {
00187             $GLOBALS['TSFE']->set_no_cache();
00188         }
00189 
00190             // Hook for post processing the frontend admin configuration. Added with TYPO3 4.2, so naming is now incorrect but preserves compatibility.
00191             // @deprecated  since TYPO3 4.3
00192         if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tsfebeuserauth.php']['extSaveFeAdminConfig-postProc'])) {
00193             t3lib_div::deprecationLog('Frontend admin post processing hook extSaveFeAdminConfig-postProc is deprecated since TYPO3 4.3.');
00194             $_params = array('input' => &$input, 'pObj' => &$this);
00195             foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tsfebeuserauth.php']['extSaveFeAdminConfig-postProc'] as $_funcRef) {
00196                 t3lib_div::callUserFunction($_funcRef, $_params, $this);
00197             }
00198         }
00199     }
00200 
00201     /**
00202      * Returns the value for a Admin Panel setting. You must specify both the module-key and the internal setting key.
00203      *
00204      * @param   string      Module key
00205      * @param   string      Setting key
00206      * @return  string      The setting value
00207      */
00208     public function extGetFeAdminValue($sectionName, $val = '') {
00209             // Check if module is enabled.
00210         if ($this->isAdminModuleEnabled($sectionName)) {
00211                 // Exceptions where the values can be overridden from backend:
00212                 // deprecated
00213             if ($sectionName . '_' . $val == 'edit_displayIcons' && $GLOBALS['BE_USER']->extAdminConfig['module.']['edit.']['forceDisplayIcons']) {
00214                 return true;
00215             }
00216             if ($sectionName . '_' . $val == 'edit_displayFieldIcons' && $GLOBALS['BE_USER']->extAdminConfig['module.']['edit.']['forceDisplayFieldIcons']) {
00217                 return true;
00218             }
00219 
00220                 // override all settings with user TSconfig
00221             if ($val && $GLOBALS['BE_USER']->extAdminConfig['override.'][$sectionName . '.'][$val]) {
00222                 return $GLOBALS['BE_USER']->extAdminConfig['override.'][$sectionName . '.'][$val];
00223             }
00224             if ($GLOBALS['BE_USER']->extAdminConfig['override.'][$sectionName]) {
00225                 return $GLOBALS['BE_USER']->extAdminConfig['override.'][$sectionName];
00226             }
00227 
00228             $retVal = $val ? $GLOBALS['BE_USER']->uc['TSFE_adminConfig'][$sectionName . '_' . $val] : 1;
00229 
00230             if ($sectionName == 'preview' && $this->ext_forcePreview) {
00231                 return (!$val ? true : $retVal);
00232             }
00233                 // regular check:
00234             if ($this->isAdminModuleOpen($sectionName)) {   // See if the menu is expanded!
00235                 return $retVal;
00236             }
00237 
00238                 // Hook for post processing the frontend admin configuration. Added with TYPO3 4.2, so naming is now incorrect but preserves compatibility.
00239                 // @deprecated  since TYPO3 4.3
00240             if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tsfebeuserauth.php']['extEditAction-postProc'])) {
00241                 t3lib_div::deprecationLog('Frontend admin post processing hook extEditAction-postProc is deprecated since TYPO3 4.3.');
00242                 $params = array('cmd' => &$cmd, 'tce' => &$this->tce, 'pObj' => &$this);
00243                 foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tsfebeuserauth.php']['extEditAction-postProc'] as $funcRef) {
00244                     t3lib_div::callUserFunction($funcRef, $params, $this);
00245                 }
00246             }
00247         }
00248     }
00249 
00250     /**
00251      * Enables the force preview option.
00252      *
00253      * @return  void
00254      */
00255     public function forcePreview() {
00256         $this->ext_forcePreview = true;
00257     }
00258 
00259     /**
00260      * Returns the comma-separated list of page UIDs to be published.
00261      *
00262      * @return  string
00263      */
00264     public function getExtPublishList() {
00265         return $this->extPublishList;
00266     }
00267 
00268     /**
00269      * Returns true if admin panel module is open
00270      *
00271      * @param   string      Module key
00272      * @return  boolean     True, if the admin panel is open for the specified admin panel module key.
00273      */
00274     public function isAdminModuleOpen($pre) {
00275         return $GLOBALS['BE_USER']->uc['TSFE_adminConfig']['display_top'] && $GLOBALS['BE_USER']->uc['TSFE_adminConfig']['display_' . $pre];
00276     }
00277 
00278     /*****************************************************
00279      *
00280      * Admin Panel Rendering
00281      *
00282      ****************************************************/
00283 
00284     /**
00285      * Creates and returns the HTML code for the Admin Panel in the TSFE frontend.
00286      *
00287      * @return  string      HTML for the Admin Panel
00288      */
00289     public function display() {
00290         $GLOBALS['LANG']->includeLLFile('EXT:lang/locallang_tsfe.php');
00291 
00292         $moduleContent = '';
00293 
00294         if ($GLOBALS['BE_USER']->uc['TSFE_adminConfig']['display_top']) {
00295             if ($this->isAdminModuleEnabled('preview')) {
00296                 $moduleContent .= $this->getPreviewModule();
00297             }
00298             if ($this->isAdminModuleEnabled('cache')) {
00299                 $moduleContent .= $this->getCacheModule();
00300             }
00301             if ($this->isAdminModuleEnabled('publish')) {
00302                 $moduleContent .= $this->getPublishModule();
00303             }
00304             if ($this->isAdminModuleEnabled('edit')) {
00305                 $moduleContent .= $this->getEditModule();
00306             }
00307             if ($this->isAdminModuleEnabled('tsdebug')) {
00308                 $moduleContent .= $this->getTSDebugModule();
00309             }
00310             if ($this->isAdminModuleEnabled('info')) {
00311                 $moduleContent .= $this->getInfoModule();
00312             }
00313         }
00314 
00315         $row = $this->extGetLL('adminPanelTitle') . ': <span class="typo3-adminPanel-beuser">' .
00316             htmlspecialchars($GLOBALS['BE_USER']->user['username']) . '</span>';
00317 
00318         $isVisible = $GLOBALS['BE_USER']->uc['TSFE_adminConfig']['display_top'];
00319         $cssClassName = 'typo3-adminPanel-panel-' . ($isVisible ? 'open' : 'closed');
00320         $header = '<tr class="typo3-adminPanel-hRow">' .
00321                 '<td colspan="2" id="typo3-adminPanel-header" class="' . $cssClassName . '">' .
00322                     '<span class="typo3-adminPanel-header-title">' . $row . '</span>' .
00323                     $this->linkSectionHeader('top', '<span class="typo3-adminPanel-header-button"></span>', 'typo3-adminPanel-header-buttonWrapper') .
00324                     '<input type="hidden" name="TSFE_ADMIN_PANEL[display_top]" value="' . $GLOBALS['BE_USER']->uc['TSFE_adminConfig']['display_top'] . '" /></td>' .
00325             '</tr>';
00326 
00327         if ($moduleContent) {
00328             $footer = '<tr class="typo3-adminPanel-fRow">' .
00329                     '<td colspan="2" id="typo3-adminPanel-footer">' .
00330                         ($this->extNeedUpdate ? ' <input class="typo3-adminPanel-update" type="submit" value="' . $this->extGetLL('update') . '" />' : '') . '</td>' .
00331                 '</tr>';
00332         } else {
00333             $footer = '';
00334         }
00335 
00336         $query = !t3lib_div::_GET('id') ? ('<input type="hidden" name="id" value="' . $GLOBALS['TSFE']->id . '" />') : '';
00337             // the dummy field is needed for Firefox: to force a page reload on submit with must change the form value with JavaScript (see "onsubmit" attribute of the "form" element")
00338         $query .= '<input type="hidden" name="TSFE_ADMIN_PANEL[DUMMY]" value="" />';
00339         foreach (t3lib_div::_GET() as $key => $value) {
00340             if ($key != 'TSFE_ADMIN_PANEL') {
00341                 if (is_array($value)) {
00342                     $query .= $this->getHiddenFields($key, $value);
00343                 } else {
00344                     $query .= '<input type="hidden" name="' . htmlspecialchars($key) . '" value="' . htmlspecialchars($value) . '" />';
00345                 }
00346             }
00347         }
00348 
00349         $out = '
00350 <!--
00351     TYPO3 admin panel start
00352 -->
00353 <a id="TSFE_ADMIN"></a>
00354 <form id="TSFE_ADMIN_PANEL_FORM" name="TSFE_ADMIN_PANEL_FORM" action="' . htmlspecialchars(t3lib_div::getIndpEnv('TYPO3_REQUEST_SCRIPT')) . '#TSFE_ADMIN" method="get" onsubmit="document.forms.TSFE_ADMIN_PANEL_FORM[\'TSFE_ADMIN_PANEL[DUMMY]\'].value=Math.random().toString().substring(2,8)">' .
00355 $query . '<table class="typo3-adminPanel">' .
00356         $header . $moduleContent . $footer . '</table></form>';
00357 
00358         if ($GLOBALS['BE_USER']->uc['TSFE_adminConfig']['display_top']) {
00359             $out .= '<script type="text/javascript" src="t3lib/jsfunc.evalfield.js"></script>';
00360             $out .= '<script type="text/javascript">/*<![CDATA[*/' . t3lib_div::minifyJavaScript('
00361                 var evalFunc = new evalFunc();
00362                     // TSFEtypo3FormFieldSet()
00363                 function TSFEtypo3FormFieldSet(theField, evallist, is_in, checkbox, checkboxValue) {    //
00364                     var theFObj = new evalFunc_dummy (evallist,is_in, checkbox, checkboxValue);
00365                     var theValue = document.TSFE_ADMIN_PANEL_FORM[theField].value;
00366                     if (checkbox && theValue==checkboxValue) {
00367                         document.TSFE_ADMIN_PANEL_FORM[theField+"_hr"].value="";
00368                         alert(theField);
00369                         document.TSFE_ADMIN_PANEL_FORM[theField+"_cb"].checked = "";
00370                     } else {
00371                         document.TSFE_ADMIN_PANEL_FORM[theField+"_hr"].value = evalFunc.outputObjValue(theFObj, theValue);
00372                         if (document.TSFE_ADMIN_PANEL_FORM[theField+"_cb"]) {
00373                             document.TSFE_ADMIN_PANEL_FORM[theField+"_cb"].checked = "on";
00374                         }
00375                     }
00376                 }
00377                     // TSFEtypo3FormFieldGet()
00378                 function TSFEtypo3FormFieldGet(theField, evallist, is_in, checkbox, checkboxValue, checkbox_off) {  //
00379                     var theFObj = new evalFunc_dummy (evallist,is_in, checkbox, checkboxValue);
00380                     if (checkbox_off) {
00381                         document.TSFE_ADMIN_PANEL_FORM[theField].value=checkboxValue;
00382                     }else{
00383                         document.TSFE_ADMIN_PANEL_FORM[theField].value = evalFunc.evalObjValue(theFObj, document.TSFE_ADMIN_PANEL_FORM[theField+"_hr"].value);
00384                     }
00385                     TSFEtypo3FormFieldSet(theField, evallist, is_in, checkbox, checkboxValue);
00386                 }') . '/*]]>*/</script><script language="javascript" type="text/javascript">' .
00387                 $this->extJSCODE . '</script>';
00388         }
00389 
00390         $out .= '<script src="' . t3lib_div::locationHeaderUrl('t3lib/js/adminpanel.js') . '" type="text/javascript"></script><script type="text/javascript">/*<![CDATA[*/' .
00391             'typo3AdminPanel = new TYPO3AdminPanel();typo3AdminPanel.init("typo3-adminPanel-header", "TSFE_ADMIN_PANEL_FORM");' .
00392             '/*]]>*/</script>
00393 <!--
00394     TYPO3 admin panel end
00395 -->
00396 ';
00397 
00398         return $out;
00399     }
00400 
00401     /**
00402      * Fetches recursively all GET parameters as hidden fields.
00403      * Called from display()
00404      *
00405      * @param   string      current key
00406      * @param   mixed       current value
00407      * @return  string      hidden fields
00408      * @see display()
00409      */
00410     protected function getHiddenFields($key, array $val) {
00411         $out = '';
00412         foreach ($val as $k => $v) {
00413             if (is_array($v)) {
00414                 $out .= $this->getHiddenFields($key . '[' . $k . ']', $v);
00415             } else {
00416                 $out .= '<input type="hidden" name="' . htmlspecialchars($key) . '[' . htmlspecialchars($k) . ']" value="' . htmlspecialchars($v) . '">' . LF;
00417             }
00418         }
00419         return $out;
00420     }
00421 
00422     /*****************************************************
00423      *
00424      * Creating sections of the Admin Panel
00425      *
00426      ****************************************************/
00427 
00428     /**
00429      * Creates the content for the "preview" section ("module") of the Admin Panel
00430      *
00431      * @return  string      HTML content for the section. Consists of a string with table-rows with four columns.
00432      * @see display()
00433      */
00434     protected function getPreviewModule() {
00435         $out = $this->extGetHead('preview');
00436         if ($GLOBALS['BE_USER']->uc['TSFE_adminConfig']['display_preview']) {
00437             $this->extNeedUpdate = true;
00438             $out .= $this->extGetItem('preview_showHiddenPages', '', '<input type="hidden" name="TSFE_ADMIN_PANEL[preview_showHiddenPages]" value="0" /><input type="checkbox" name="TSFE_ADMIN_PANEL[preview_showHiddenPages]" value="1"' . ($GLOBALS['BE_USER']->uc['TSFE_adminConfig']['preview_showHiddenPages'] ? ' checked="checked"' : '') . ' />');
00439             $out .= $this->extGetItem('preview_showHiddenRecords', '', '<input type="hidden" name="TSFE_ADMIN_PANEL[preview_showHiddenRecords]" value="0" /><input type="checkbox" name="TSFE_ADMIN_PANEL[preview_showHiddenRecords]" value="1"' . ($GLOBALS['BE_USER']->uc['TSFE_adminConfig']['preview_showHiddenRecords'] ? ' checked="checked"' : '') . ' />');
00440 
00441                 // Simulate date
00442             $out .= $this->extGetItem('preview_simulateDate', '<input type="text" name="TSFE_ADMIN_PANEL[preview_simulateDate]_hr" onchange="TSFEtypo3FormFieldGet(\'TSFE_ADMIN_PANEL[preview_simulateDate]\', \'datetime\', \'\', 1,0);" /><input type="hidden" name="TSFE_ADMIN_PANEL[preview_simulateDate]" value="' . $GLOBALS['BE_USER']->uc['TSFE_adminConfig']['preview_simulateDate'] . '" />');
00443             $this->extJSCODE .= 'TSFEtypo3FormFieldSet("TSFE_ADMIN_PANEL[preview_simulateDate]", "datetime", "", 0, 0);';
00444 
00445                 // Simulate fe_user:
00446             $options = '<option value="0">&nbsp;</option>';
00447             $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
00448                         'fe_groups.uid, fe_groups.title',
00449                         'fe_groups,pages',
00450                         'pages.uid=fe_groups.pid AND pages.deleted=0 ' . t3lib_BEfunc::deleteClause('fe_groups') . ' AND ' . $GLOBALS['BE_USER']->getPagePermsClause(1)
00451                     );
00452             while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
00453                 $options .= '<option value="' . $row['uid'] . '"' . ($GLOBALS['BE_USER']->uc['TSFE_adminConfig']['preview_simulateUserGroup'] == $row['uid'] ? ' selected="selected"' : '') . '>' . htmlspecialchars('[' . $row['uid'] . '] ' . $row['title']) . '</option>';
00454             }
00455             $out .= $this->extGetItem('preview_simulateUserGroup', '<select name="TSFE_ADMIN_PANEL[preview_simulateUserGroup]">' . $options . '</select>');
00456         }
00457 
00458         return $out;
00459     }
00460 
00461     /**
00462      * Creates the content for the "cache" section ("module") of the Admin Panel
00463      *
00464      * @return  string      HTML content for the section. Consists of a string with table-rows with four columns.
00465      * @see display()
00466      */
00467     protected function getCacheModule() {
00468         $out = $this->extGetHead('cache');
00469         if ($GLOBALS['BE_USER']->uc['TSFE_adminConfig']['display_cache']) {
00470             $this->extNeedUpdate = true;
00471             $out .= $this->extGetItem('cache_noCache', '', '<input type="hidden" name="TSFE_ADMIN_PANEL[cache_noCache]" value="0" /><input type="checkbox" name="TSFE_ADMIN_PANEL[cache_noCache]" value="1"' . ($GLOBALS['BE_USER']->uc['TSFE_adminConfig']['cache_noCache'] ? ' checked="checked"' : '') . ' />');
00472             $levels = $GLOBALS['BE_USER']->uc['TSFE_adminConfig']['cache_clearCacheLevels'];
00473             $options = '';
00474             $options .= '<option value="0"' . ($levels == 0 ? ' selected="selected"' : '') . '>' . $this->extGetLL('div_Levels_0') . '</option>';
00475             $options .= '<option value="1"' . ($levels == 1 ? ' selected="selected"' : '') . '>' . $this->extGetLL('div_Levels_1') . '</option>';
00476             $options .= '<option value="2"' . ($levels == 2 ? ' selected="selected"' : '') . '>' . $this->extGetLL('div_Levels_2') . '</option>';
00477             $out .= $this->extGetItem('cache_clearLevels', '<select name="TSFE_ADMIN_PANEL[cache_clearCacheLevels]">' . $options . '</select>' .
00478                     '<input type="hidden" name="TSFE_ADMIN_PANEL[cache_clearCacheId]" value="' . $GLOBALS['TSFE']->id . '" /> <input type="submit" value="' . $this->extGetLL('update') . '" />');
00479 
00480                 // Generating tree:
00481             $depth = $this->extGetFeAdminValue('cache', 'clearCacheLevels');
00482             $outTable = '';
00483             $GLOBALS['BE_USER']->extPageInTreeInfo = array();
00484             $GLOBALS['BE_USER']->extPageInTreeInfo[] = array($GLOBALS['TSFE']->page['uid'], htmlspecialchars($GLOBALS['TSFE']->page['title']), $depth+1);
00485             $GLOBALS['BE_USER']->extGetTreeList($GLOBALS['TSFE']->id, $depth, 0, $GLOBALS['BE_USER']->getPagePermsClause(1));
00486             foreach ($GLOBALS['BE_USER']->extPageInTreeInfo as $row) {
00487                 $outTable .= '<tr>' .
00488                         '<td><img src="typo3/gfx/clear.gif" width="' . (($depth+1-$row[2])*18) . '" height="1" alt="" /><img ' .
00489                         t3lib_iconWorks::skinImg(TYPO3_mainDir, 'gfx/i/pages.gif', 'width="18" height="16"') . ' align="top" alt="" /> ' . htmlspecialchars($row[1]) .
00490                         '</td><td>' . $GLOBALS['BE_USER']->extGetNumberOfCachedPages($row[0]) . '</td></tr>';
00491             }
00492 
00493             $outTable = '<br /><table>' . $outTable . '</table>';
00494             $outTable .= '<input type="submit" name="TSFE_ADMIN_PANEL[action][clearCache]" value="' . $this->extGetLL('cache_doit') . '" />';
00495 
00496             $out .= $this->extGetItem('cache_cacheEntries', $outTable);
00497         }
00498 
00499         return $out;
00500     }
00501 
00502     /**
00503      * Creates the content for the "publish" section ("module") of the Admin Panel
00504      *
00505      * @param   string      Optional start-value; The generated content is added to this variable.
00506      * @return  string      HTML content for the section. Consists of a string with table-rows with four columns.
00507      * @see display()
00508      */
00509     protected function getPublishModule() {
00510         $out = $this->extGetHead('publish');
00511         if ($GLOBALS['BE_USER']->uc['TSFE_adminConfig']['display_publish']) {
00512             $this->extNeedUpdate = true;
00513             $levels = $GLOBALS['BE_USER']->uc['TSFE_adminConfig']['publish_levels'];
00514             $options = '';
00515             $options .= '<option value="0"' . ($levels == 0 ? ' selected="selected"' : '') . '>' . $this->extGetLL('div_Levels_0') . '</option>';
00516             $options .= '<option value="1"' . ($levels ? ' selected="selected"' : '') . '>' . $this->extGetLL('div_Levels_1') . '</option>';
00517             $options .= '<option value="2"' . ($levels == 2 ? ' selected="selected"' : '') . '>' . $this->extGetLL('div_Levels_2') . '</option>';
00518             $out .= $this->extGetItem('publish_levels', '<select name="TSFE_ADMIN_PANEL[publish_levels]">' . $options . '</select>' .
00519                     '<input type="hidden" name="TSFE_ADMIN_PANEL[publish_id]" value="' . $GLOBALS['TSFE']->id . '" />&nbsp;<input type="submit" value="' . $this->extGetLL('update') . '" />');
00520 
00521                 // Generating tree:
00522             $depth = $this->extGetFeAdminValue('publish', 'levels');
00523             $outTable = '';
00524             $GLOBALS['BE_USER']->extPageInTreeInfo = array();
00525             $GLOBALS['BE_USER']->extPageInTreeInfo[] = array($GLOBALS['TSFE']->page['uid'], htmlspecialchars($GLOBALS['TSFE']->page['title']), $depth+1);
00526             $GLOBALS['BE_USER']->extGetTreeList($GLOBALS['TSFE']->id, $depth, 0, $GLOBALS['BE_USER']->getPagePermsClause(1));
00527             foreach ($GLOBALS['BE_USER']->extPageInTreeInfo as $row) {
00528                 $outTable.= '<tr>' .
00529                         '<td style="white-space:nowrap;"><img src="typo3/gfx/clear.gif" width="' . (($depth + 1 - $row[2]) * 18) . '" height="1" alt="" /><img ' .
00530                         t3lib_iconWorks::skinImg(TYPO3_mainDir, 'gfx/i/pages.gif', 'width="18" height="16"') . ' align="top" border="0" alt="" />' . $row[1] .
00531                         '</td><td><img src="typo3/gfx/clear.gif" width="10" height="1" alt="" /></td><td>...</td></tr>';
00532             }
00533             $outTable = '<br /><table>' . $outTable . '</table>';
00534             $outTable .= '<input type="submit" name="TSFE_ADMIN_PANEL[action][publish]" value="' . $this->extGetLL('publish_doit') . '" />';
00535 
00536             $out .= $this->extGetItem('publish_tree', $outTable);
00537         }
00538 
00539         return $out;
00540     }
00541 
00542     /**
00543      * Creates the content for the "edit" section ("module") of the Admin Panel
00544      *
00545      * @return  string      HTML content for the section. Consists of a string with table-rows with four columns.
00546      * @see display()
00547      */
00548     protected function getEditModule() {
00549         $out = $this->extGetHead('edit');
00550         if ($GLOBALS['BE_USER']->uc['TSFE_adminConfig']['display_edit']) {
00551 
00552                 // If another page module was specified, replace the default Page module with the new one
00553             $newPageModule = trim($GLOBALS['BE_USER']->getTSConfigVal('options.overridePageModule'));
00554             $pageModule = t3lib_BEfunc::isModuleSetInTBE_MODULES($newPageModule) ? $newPageModule : 'web_layout';
00555 
00556             $this->extNeedUpdate = true;
00557             $out .= $this->extGetItem('edit_displayFieldIcons', '', '<input type="hidden" name="TSFE_ADMIN_PANEL[edit_displayFieldIcons]" value="0" /><input type="checkbox" name="TSFE_ADMIN_PANEL[edit_displayFieldIcons]" value="1"' . ($GLOBALS['BE_USER']->uc['TSFE_adminConfig']['edit_displayFieldIcons'] ? ' checked="checked"' : '') . ' />');
00558             $out .= $this->extGetItem('edit_displayIcons', '', '<input type="hidden" name="TSFE_ADMIN_PANEL[edit_displayIcons]" value="0" /><input type="checkbox" name="TSFE_ADMIN_PANEL[edit_displayIcons]" value="1"' . ($GLOBALS['BE_USER']->uc['TSFE_adminConfig']['edit_displayIcons'] ? ' checked="checked"' : '') . ' />');
00559             $out .= $this->extGetItem('edit_editFormsOnPage', '', '<input type="hidden" name="TSFE_ADMIN_PANEL[edit_editFormsOnPage]" value="0" /><input type="checkbox" name="TSFE_ADMIN_PANEL[edit_editFormsOnPage]" value="1"' . ($GLOBALS['BE_USER']->uc['TSFE_adminConfig']['edit_editFormsOnPage'] ? ' checked="checked"':'') . ' />');
00560             $out .= $this->extGetItem('edit_editNoPopup', '', '<input type="hidden" name="TSFE_ADMIN_PANEL[edit_editNoPopup]" value="0" /><input type="checkbox" name="TSFE_ADMIN_PANEL[edit_editNoPopup]" value="1"' . ($GLOBALS['BE_USER']->uc['TSFE_adminConfig']['edit_editNoPopup'] ? ' checked="checked"' : '') . ' />');
00561             $out .= $this->extGetItem('', $this->ext_makeToolBar());
00562 
00563             if (!t3lib_div::_GP('ADMCMD_view')) {
00564                 $out .= $this->extGetItem('', '<a href="#" onclick="' .
00565                     htmlspecialchars('
00566                         if (parent.opener && parent.opener.top && parent.opener.top.TS) {
00567                             parent.opener.top.fsMod.recentIds["web"]=' . intval($GLOBALS['TSFE']->page['uid']) . ';
00568                             if (parent.opener.top.content && parent.opener.top.content.nav_frame && parent.opener.top.content.nav_frame.refresh_nav) {
00569                                 parent.opener.top.content.nav_frame.refresh_nav();
00570                             }
00571                             parent.opener.top.goToModule("' . $pageModule . '");
00572                             parent.opener.top.focus();
00573                         } else {
00574                             vHWin=window.open(\'' . TYPO3_mainDir.t3lib_BEfunc::getBackendScript() . '\',\'' . md5('Typo3Backend-' . $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename']) . '\',\'status=1,menubar=1,scrollbars=1,resizable=1\');
00575                             vHWin.focus();
00576                         }
00577                         return false;
00578                         ').
00579                     '">' . $this->extGetLL('edit_openAB') . '</a>');
00580             }
00581         }
00582 
00583         return $out;
00584     }
00585 
00586     /**
00587      * Creates the content for the "tsdebug" section ("module") of the Admin Panel
00588      *
00589      * @return  string      HTML content for the section. Consists of a string with table-rows with four columns.
00590      * @see display()
00591      */
00592     protected function getTSDebugModule() {
00593         $out = $this->extGetHead('tsdebug');
00594         if ($GLOBALS['BE_USER']->uc['TSFE_adminConfig']['display_tsdebug']) {
00595             $this->extNeedUpdate = true;
00596 
00597             $out .= $this->extGetItem('tsdebug_tree', '', '<input type="hidden" name="TSFE_ADMIN_PANEL[tsdebug_tree]" value="0" /><input type="checkbox" name="TSFE_ADMIN_PANEL[tsdebug_tree]" value="1"' . ($GLOBALS['BE_USER']->uc['TSFE_adminConfig']['tsdebug_tree'] ? ' checked="checked"' : '') . ' />');
00598             $out .= $this->extGetItem('tsdebug_displayTimes', '', '<input type="hidden" name="TSFE_ADMIN_PANEL[tsdebug_displayTimes]" value="0" /><input type="checkbox" name="TSFE_ADMIN_PANEL[tsdebug_displayTimes]" value="1"' . ($GLOBALS['BE_USER']->uc['TSFE_adminConfig']['tsdebug_displayTimes'] ? ' checked="checked"' : '') . ' />');
00599             $out .= $this->extGetItem('tsdebug_displayMessages', '', '<input type="hidden" name="TSFE_ADMIN_PANEL[tsdebug_displayMessages]" value="0" /><input type="checkbox" name="TSFE_ADMIN_PANEL[tsdebug_displayMessages]" value="1"' . ($GLOBALS['BE_USER']->uc['TSFE_adminConfig']['tsdebug_displayMessages'] ? ' checked="checked"':'') . ' />');
00600             $out .= $this->extGetItem('tsdebug_LR', '', '<input type="hidden" name="TSFE_ADMIN_PANEL[tsdebug_LR]" value="0" /><input type="checkbox" name="TSFE_ADMIN_PANEL[tsdebug_LR]" value="1"' . ($GLOBALS['BE_USER']->uc['TSFE_adminConfig']['tsdebug_LR'] ? ' checked="checked"' : '') . ' />');
00601             $out .= $this->extGetItem('tsdebug_displayContent', '', '<input type="hidden" name="TSFE_ADMIN_PANEL[tsdebug_displayContent]" value="0" /><input type="checkbox" name="TSFE_ADMIN_PANEL[tsdebug_displayContent]" value="1"' . ($GLOBALS['BE_USER']->uc['TSFE_adminConfig']['tsdebug_displayContent'] ? ' checked="checked"' : '') . ' />');
00602             $out .= $this->extGetItem('tsdebug_displayQueries', '', '<input type="hidden" name="TSFE_ADMIN_PANEL[tsdebug_displayQueries]" value="0" /><input type="checkbox" name="TSFE_ADMIN_PANEL[tsdebug_displayQueries]" value="1"' . ($GLOBALS['BE_USER']->uc['TSFE_adminConfig']['tsdebug_displayQueries'] ? ' checked="checked"' : '') . ' />');
00603             $out .= $this->extGetItem('tsdebug_forceTemplateParsing', '', '<input type="hidden" name="TSFE_ADMIN_PANEL[tsdebug_forceTemplateParsing]" value="0" /><input type="checkbox" name="TSFE_ADMIN_PANEL[tsdebug_forceTemplateParsing]" value="1"' . ($GLOBALS['BE_USER']->uc['TSFE_adminConfig']['tsdebug_forceTemplateParsing'] ? ' checked="checked"' : '') . ' />');
00604 
00605             $GLOBALS['TT']->printConf['flag_tree'] = $this->extGetFeAdminValue('tsdebug', 'tree');
00606             $GLOBALS['TT']->printConf['allTime'] = $this->extGetFeAdminValue('tsdebug', 'displayTimes');
00607             $GLOBALS['TT']->printConf['flag_messages'] = $this->extGetFeAdminValue('tsdebug', 'displayMessages');
00608             $GLOBALS['TT']->printConf['flag_content'] = $this->extGetFeAdminValue('tsdebug', 'displayContent');
00609             $GLOBALS['TT']->printConf['flag_queries'] = $this->extGetFeAdminValue('tsdebug', 'displayQueries');
00610 
00611             $out.= '<tr><td colspan="2">' . $GLOBALS['TT']->printTSlog() . '</td></tr>';
00612         }
00613 
00614         return $out;
00615     }
00616 
00617     /**
00618      * Creates the content for the "info" section ("module") of the Admin Panel
00619      *
00620      * @return  string      HTML content for the section. Consists of a string with table-rows with four columns.
00621      * @see display()
00622      */
00623     protected function getInfoModule() {
00624         $out = $this->extGetHead('info');
00625         if ($GLOBALS['BE_USER']->uc['TSFE_adminConfig']['display_info']) {
00626             $tableArr = array();
00627 
00628             if ($this->extGetFeAdminValue('cache', 'noCache')) {
00629                 $theBytes = 0;
00630                 $count = 0;
00631 
00632                 if (count($GLOBALS['TSFE']->imagesOnPage)) {
00633                     $tableArr[] = array('*Images on this page:*', '');
00634                     foreach ($GLOBALS['TSFE']->imagesOnPage as $file) {
00635                         $fs = @filesize($file);
00636                         $tableArr[] = array('&ndash; ' . $file, t3lib_div::formatSize($fs));
00637                         $theBytes+= $fs;
00638                         $count++;
00639                     }
00640                 }
00641                 $tableArr[] = array('', '');    // Add an empty line
00642 
00643                 $tableArr[] = array('*Total number of images:*', $count);
00644                 $tableArr[] = array('*Total image file sizes:*', t3lib_div::formatSize($theBytes));
00645                 $tableArr[] = array('*Document size:*', t3lib_div::formatSize(strlen($GLOBALS['TSFE']->content)));
00646                 $tableArr[] = array('*Total page load:*', t3lib_div::formatSize(strlen($GLOBALS['TSFE']->content)+$theBytes));
00647                 $tableArr[] = array('', '');
00648             }
00649 
00650             $tableArr[] = array('id:', $GLOBALS['TSFE']->id);
00651             $tableArr[] = array('type:', $GLOBALS['TSFE']->type);
00652             $tableArr[] = array('gr_list:', $GLOBALS['TSFE']->gr_list);
00653             $tableArr[] = array('no_cache:', $GLOBALS['TSFE']->no_cache ? 1 : 0);
00654             $tableArr[] = array('USER_INT objects:', count($GLOBALS['TSFE']->config['INTincScript']));
00655             $tableArr[] = array('fe_user, name:', $GLOBALS['TSFE']->fe_user->user['username']);
00656             $tableArr[] = array('fe_user, uid:', $GLOBALS['TSFE']->fe_user->user['uid']);
00657             $tableArr[] = array('', '');    // Add an empty line
00658 
00659                 // parsetime:
00660             $tableArr[] = array('*Total parsetime:*', $GLOBALS['TSFE']->scriptParseTime . ' ms');
00661 
00662             $table = '';
00663             foreach ($tableArr as $arr) {
00664                 if (strlen($arr[0])) {  // Put text wrapped by "*" between <strong> tags
00665                     $value1 = preg_replace('/^\*(.*)\*$/', '$1', $arr[0], -1, $count);
00666                     $value1 = ($count?'<strong>':'') . $value1 . ($count?'</strong>':'');
00667                 } else {
00668                     $value1 = '&nbsp;';
00669                 }
00670 
00671                 $value2 = strlen($arr[1]) ? $arr[1] : '&nbsp;';
00672                 $value2 = $value2;
00673 
00674                 $table .= '<tr class="typo3-adminPanel-itemRow">' .
00675                         '<td class="typo3-adminPanel-section-content-title">' . $value1 . '</td>' .
00676                         '<td class="typo3-adminPanel-section-content">' . $value2 . '</td>' .
00677                     '</tr>';
00678             }
00679 
00680             $out .= $table;
00681         }
00682 
00683         return $out;
00684     }
00685 
00686     /*****************************************************
00687      *
00688      * Admin Panel Layout Helper functions
00689      *
00690      ****************************************************/
00691 
00692     /**
00693      * Returns a row (with colspan=4) which is a header for a section in the Admin Panel.
00694      * It will have a plus/minus icon and a label which is linked so that it submits the form which surrounds the whole Admin Panel when clicked, alterting the TSFE_ADMIN_PANEL[display_' . $pre . '] value
00695      * See the functions get*Module
00696      *
00697      * @param   string      The suffix to the display_ label. Also selects the label from the LOCAL_LANG array.
00698      * @return  string      HTML table row.
00699      * @access private
00700      * @see extGetItem()
00701      */
00702     protected function extGetHead($sectionSuffix) {
00703         $settingName = 'display_' . $sectionSuffix;
00704         $isVisible = $GLOBALS['BE_USER']->uc['TSFE_adminConfig'][$settingName];
00705         $cssClassName = 'typo3-adminPanel-section-' . ($isVisible ? 'open' : 'closed');
00706 
00707         return '<tr class="typo3-adminPanel-section-title"><td colspan="2">' .
00708                 $this->linkSectionHeader($sectionSuffix, $this->extGetLL($sectionSuffix), $cssClassName) .
00709                 '<input type="hidden" name="TSFE_ADMIN_PANEL[' . $settingName .
00710                 ']" value="' . $isVisible . '" /></td></tr>';
00711     }
00712 
00713     /**
00714      * Wraps a string in a link which will open/close a certain part of the Admin Panel
00715      *
00716      * @param   string      The code for the display_ label/key
00717      * @param   string      Input string
00718      * @return  string      Linked input string
00719      * @access private
00720      * @see extGetHead()
00721      */
00722     protected function linkSectionHeader($sectionSuffix, $sectionTitle, $className = '') {
00723         return '<div class="typo3-adminPanel-label"><a href="javascript:void(0)" onclick="' .
00724             htmlspecialchars('document.TSFE_ADMIN_PANEL_FORM[\'TSFE_ADMIN_PANEL[display_' . $sectionSuffix . ']\'].value=' . ($GLOBALS['BE_USER']->uc['TSFE_adminConfig']['display_' . $sectionSuffix] ? '0' : '1') . ';document.TSFE_ADMIN_PANEL_FORM.submit();return false;') .
00725             '"' . ($className ? ' class="' . $className . '"' : '') . '>' . $sectionTitle . '</a></div>';
00726     }
00727 
00728     /**
00729      * Returns a row (with 4 columns) for content in a section of the Admin Panel.
00730      * It will take $pre as a key to a label to display and $element as the content to put into the forth cell.
00731      *
00732      * @param   string      Key to label
00733      * @param   string      The HTML content for the forth table cell.
00734      * @return  string      HTML table row.
00735      * @access private
00736      * @see extGetHead()
00737      */
00738     protected function extGetItem($title, $content = '', $checkboxContent = '') {
00739         $out = '<tr class="typo3-adminPanel-itemRow">' .
00740             '<td class="typo3-adminPanel-section-content">' . $checkboxContent . ($title ? $this->extGetLL($title) : '&nbsp;') . $content . '</td></tr>';
00741 
00742         return $out;
00743     }
00744 
00745     /**
00746      * Creates the tool bar links for the "edit" section of the Admin Panel.
00747      *
00748      * @return  string      A string containing images wrapped in <a>-tags linking them to proper functions.
00749      */
00750     public function ext_makeToolBar() {
00751             //  If mod.web_list.newContentWiz.overrideWithExtension is set, use that extension's create new content wizard instead:
00752         $tsConfig = t3lib_BEfunc::getModTSconfig($this->pageinfo['uid'],'mod.web_list');
00753         $tsConfig = $tsConfig ['properties']['newContentWiz.']['overrideWithExtension'];
00754         $newContentWizScriptPath = t3lib_extMgm::isLoaded($tsConfig) ? (t3lib_extMgm::extRelPath($tsConfig) . 'mod1/db_new_content_el.php') : (TYPO3_mainDir . 'sysext/cms/layout/db_new_content_el.php');
00755 
00756         $perms = $GLOBALS['BE_USER']->calcPerms($GLOBALS['TSFE']->page);
00757         $langAllowed = $GLOBALS['BE_USER']->checkLanguageAccess($GLOBALS['TSFE']->sys_language_uid);
00758 
00759         $id = $GLOBALS['TSFE']->id;
00760         $toolBar = '<a href="' . htmlspecialchars(TYPO3_mainDir . 'show_rechis.php?element=' . rawurlencode('pages:' . $id) . '&returnUrl=' . rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'))) . '#latest">' .
00761                     '<img ' . t3lib_iconWorks::skinImg(TYPO3_mainDir, 'gfx/history2.gif', 'width="13" height="12"') .
00762                     ' hspace="2" border="0" align="top" title="' . $this->extGetLL('edit_recordHistory') . '" alt="" /></a>';
00763 
00764         if (($perms & 16) && $langAllowed) {
00765             $params = '';
00766             if ($GLOBALS['TSFE']->sys_language_uid) {
00767                 $params = '&sys_language_uid=' . $GLOBALS['TSFE']->sys_language_uid;
00768             }
00769             $toolBar .= '<a href="' . htmlspecialchars($newContentWizScriptPath . '?id=' . $id . $params . '&returnUrl=' . rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'))) . '">' .
00770                     '<img ' . t3lib_iconWorks::skinImg(TYPO3_mainDir, 'gfx/new_record.gif', 'width="16" height="12"') . ' hspace="1" border="0" align="top" title="' . $this->extGetLL('edit_newContentElement') . '" alt="" /></a>';
00771         }
00772         if (($perms & 2)) {
00773             $toolBar .= '<a href="' . htmlspecialchars(TYPO3_mainDir . 'move_el.php?table=pages&uid=' . $id . '&returnUrl=' . rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'))) . '">' .
00774                     '<img ' . t3lib_iconWorks::skinImg(TYPO3_mainDir, 'gfx/move_page.gif', 'width="11" height="12') . ' hspace="2" border="0" align="top" title="' . $this->extGetLL('edit_move_page') . '" alt="" /></a>';
00775         }
00776         if (($perms & 8)) {
00777             $toolBar .= '<a href="' . htmlspecialchars(TYPO3_mainDir . 'db_new.php?id=' . $id . '&pagesOnly=1&returnUrl=' . rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'))) . '">' .
00778                     '<img ' . t3lib_iconWorks::skinImg(TYPO3_mainDir, 'gfx/new_page.gif', 'width="13" height="12"') . ' hspace="0" border="0" align="top" title="' . $this->extGetLL('edit_newPage') . '" alt="" /></a>';
00779         }
00780         if (($perms & 2)) {
00781             $params = '&edit[pages][' . $id . ']=edit';
00782             $toolBar .= '<a href="' . htmlspecialchars(TYPO3_mainDir . 'alt_doc.php?' . $params . '&noView=1&returnUrl=' . rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'))) . '">' .
00783                     '<img ' . t3lib_iconWorks::skinImg(TYPO3_mainDir, 'gfx/edit2.gif', 'width="11" height="12"') . 'hspace="2" border="0" align="top" title="' . $this->extGetLL('edit_editPageProperties') . '" alt="" /></a>';
00784 
00785             if ($GLOBALS['TSFE']->sys_language_uid && $langAllowed) {
00786                 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
00787                     'uid,pid,t3ver_state',  'pages_language_overlay',
00788                     'pid=' . intval($id) . ' AND sys_language_uid=' . $GLOBALS['TSFE']->sys_language_uid . $GLOBALS['TSFE']->sys_page->enableFields('pages_language_overlay'),
00789                     '', '', '1');
00790                 $row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res);
00791                 $GLOBALS['TSFE']->sys_page->versionOL('pages_language_overlay',$row);
00792                 if (is_array($row)) {
00793                     $params = '&edit[pages_language_overlay][' . $row['uid'] . ']=edit';
00794                     $toolBar .= '<a href="' . htmlspecialchars(TYPO3_mainDir . 'alt_doc.php?' . $params . '&noView=1&returnUrl=' . rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'))) . '">' .
00795                             '<img ' . t3lib_iconWorks::skinImg(TYPO3_mainDir, 'gfx/edit3.gif', 'width="11" height="12"') . ' hspace="2" border="0" align="top" title="' . $this->extGetLL('edit_editPageOverlay') . '" alt="" /></a>';
00796                 }
00797             }
00798         }
00799         if ($GLOBALS['BE_USER']->check('modules', 'web_list')) {
00800             $urlParams = array();
00801             $urlParams['id'] = $id;
00802             $urlParams['returnUrl'] = t3lib_div::getIndpEnv('REQUEST_URI');
00803             $toolBar .= '<a href="' . htmlspecialchars(TYPO3_mainDir . t3lib_BEfunc::getModuleUrl('web_list', $urlParams)) . '">' .
00804                     '<img ' . t3lib_iconWorks::skinImg(TYPO3_mainDir, 'gfx/list.gif', 'width="11" height="11"') . ' hspace="2" border="0" align="top" title="' . $this->extGetLL('edit_db_list') . '" alt="" /></a>';
00805         }
00806 
00807         return $toolBar;
00808     }
00809 
00810     /**
00811      * Returns the label for key, $key. If a translation for the language set in $GLOBALS['BE_USER']->uc['lang'] is found that is returned, otherwise the default value.
00812      * IF the global variable $LOCAL_LANG is NOT an array (yet) then this function loads the global $LOCAL_LANG array with the content of "sysext/lang/locallang_tsfe.php" so that the values therein can be used for labels in the Admin Panel
00813      *
00814      * FIXME The function should onvert to $TSFE->renderCharset, not to UTF8!
00815      *
00816      * @param   string      Key for a label in the $LOCAL_LANG array of "sysext/lang/locallang_tsfe.php"
00817      * @return  string      The value for the $key
00818      */
00819     protected function extGetLL($key) {
00820         $labelStr = htmlspecialchars($GLOBALS['LANG']->getLL($key));    // Label string in the default backend output charset.
00821 
00822             // Convert to utf-8, then to entities:
00823         if ($GLOBALS['LANG']->charSet != 'utf-8') {
00824             $labelStr = $GLOBALS['LANG']->csConvObj->utf8_encode($labelStr,$GLOBALS['LANG']->charSet);
00825         }
00826         $labelStr = $GLOBALS['LANG']->csConvObj->utf8_to_entities($labelStr);
00827 
00828             // Return the result:
00829         return $labelStr;
00830     }
00831 }
00832 
00833 if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['typo3/sysext/cms/tslib/class.tslib_adminpanel.php'])) {
00834     include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['typo3/sysext/cms/tslib/class.tslib_adminpanel.php']);
00835 }
00836 
00837 ?>