TYPO3 API  SVNRelease
class.tx_infopagetsconfig_webinfo.php
Go to the documentation of this file.
00001 <?php
00002 /***************************************************************
00003 *  Copyright notice
00004 *
00005 *  (c) 1999-2011 Kasper Skårhøj (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 ***************************************************************/
00027 /**
00028  * Contains class for Page TSconfig wizard
00029  *
00030  * Revised for TYPO3 3.7 June/2004 by Kasper Skårhøj
00031  * XHTML compliant
00032  *
00033  * @author  Kasper Skårhøj <kasperYYYY@typo3.com>
00034  */
00035 /**
00036  * [CLASS/FUNCTION INDEX of SCRIPT]
00037  *
00038  *
00039  *
00040  *   74: class tx_infopagetsconfig_webinfo extends t3lib_extobjbase
00041  *   82:     function modMenu()
00042  *  114:     function main()
00043  *
00044  * TOTAL FUNCTIONS: 2
00045  * (This index is automatically created/updated by the extension "extdeveval")
00046  *
00047  */
00048 /**
00049  * Page TSconfig viewer
00050  *
00051  * @author  Kasper Skårhøj <kasperYYYY@typo3.com>
00052  * @package TYPO3
00053  * @subpackage tx_infopagetsconfig
00054  */
00055 class tx_infopagetsconfig_webinfo extends t3lib_extobjbase {
00056 
00057 
00058     /**
00059      * Function menu initialization
00060      *
00061      * @return  array       Menu array
00062      */
00063     function modMenu()  {
00064         global $LANG;
00065 
00066         $modMenuAdd = array(
00067             'tsconf_parts' => array(
00068                 0 => $LANG->getLL('tsconf_parts_0'),
00069                 1 => $LANG->getLL('tsconf_parts_1'),
00070                 '1a' => $LANG->getLL('tsconf_parts_1a'),
00071                 '1b' => $LANG->getLL('tsconf_parts_1b'),
00072                 '1c' => $LANG->getLL('tsconf_parts_1c'),
00073                 '1d' => $LANG->getLL('tsconf_parts_1d'),
00074                 '1e' => $LANG->getLL('tsconf_parts_1e'),
00075                 '1f' => $LANG->getLL('tsconf_parts_1f'),
00076                 '1g' => $LANG->getLL('tsconf_parts_1g'),
00077                 2 => 'RTE.',
00078                 5 => 'TCEFORM.',
00079                 6 => 'TCEMAIN.',
00080                 3 => 'TSFE.',
00081                 4 => 'user.',
00082                 99 => $LANG->getLL('tsconf_configFields')
00083             ),
00084             'tsconf_alphaSort' => '1',
00085         );
00086 
00087         if (!$GLOBALS['BE_USER']->isAdmin())    unset($modMenuAdd['tsconf_parts'][99]);
00088         return $modMenuAdd;
00089     }
00090 
00091     /**
00092      * Main function of class
00093      *
00094      * @return  string      HTML output
00095      */
00096     function main() {
00097         global $LANG;
00098 
00099         $menu = t3lib_BEfunc::getFuncMenu($this->pObj->id,'SET[tsconf_parts]',$this->pObj->MOD_SETTINGS['tsconf_parts'],$this->pObj->MOD_MENU['tsconf_parts']);
00100         $menu .= '<br /><label for="checkTsconf_alphaSort">' . $GLOBALS['LANG']->getLL('sort_alphabetic', true) . '</label> ' . t3lib_BEfunc::getFuncCheck($this->pObj->id, 'SET[tsconf_alphaSort]', $this->pObj->MOD_SETTINGS['tsconf_alphaSort'], '', '', 'id="checkTsconf_alphaSort"');
00101         $menu .= '<br /><br />';
00102 
00103         if ($this->pObj->MOD_SETTINGS['tsconf_parts']==99)  {
00104             $TSparts = t3lib_BEfunc::getPagesTSconfig($this->pObj->id,'',1);
00105             $lines = array();
00106             $pUids = array();
00107 
00108             foreach($TSparts as $k => $v)   {
00109                 if ($k!='uid_0')    {
00110                     if ($k=='defaultPageTSconfig')  {
00111                         $pTitle = '<strong>'.$GLOBALS['LANG']->getLL('editTSconfig_default',1).'</strong>';
00112                         $editIcon = '';
00113                     } else {
00114                         $pUids[] = substr($k,4);
00115                         $row = t3lib_BEfunc::getRecordWSOL('pages',substr($k,4));
00116                         $pTitle = $this->pObj->doc->getHeader('pages',$row,'',0);
00117 
00118                         $editIdList = substr($k,4);
00119                         $params = '&edit[pages]['.$editIdList.']=edit&columnsOnly=TSconfig';
00120                         $onclickUrl = t3lib_BEfunc::editOnClick($params,$GLOBALS['BACK_PATH'],'');
00121                         $editIcon = '<a href="#" onclick="'.htmlspecialchars($onclickUrl).'" title="'.$GLOBALS['LANG']->getLL('editTSconfig',1).'">'.
00122                                     t3lib_iconWorks::getSpriteIcon('actions-document-open') .
00123                                 '</a>';
00124                     }
00125 
00126                     $TScontent = nl2br(htmlspecialchars(trim($v).chr(10)));
00127 
00128                     $tsparser = t3lib_div::makeInstance('t3lib_TSparser');
00129                     $tsparser->lineNumberOffset=0;
00130                     $TScontent = $tsparser->doSyntaxHighlight(trim($v) .LF, '', 0);
00131 
00132                     $lines[]='
00133                         <tr><td nowrap="nowrap" class="bgColor5">'.$pTitle.'</td></tr>
00134                         <tr><td nowrap="nowrap" class="bgColor4">'.$TScontent.$editIcon.'</td></tr>
00135                         <tr><td>&nbsp;</td></tr>
00136                     ';
00137                 }
00138             }
00139 
00140             if (count($pUids))  {
00141                 $params = '&edit[pages]['.implode(',',$pUids).']=edit&columnsOnly=TSconfig';
00142                 $onclickUrl = t3lib_BEfunc::editOnClick($params,$GLOBALS['BACK_PATH'],'');
00143                 $editIcon = '<a href="#" onclick="'.htmlspecialchars($onclickUrl).'" title="'.$GLOBALS['LANG']->getLL('editTSconfig_all',1).'">'.
00144                             t3lib_iconWorks::getSpriteIcon('actions-document-open') .
00145                             '<strong>'.$GLOBALS['LANG']->getLL('editTSconfig_all',1).'</strong>'.
00146                         '</a>';
00147             } else $editIcon = '';
00148 
00149 
00150             $theOutput.= $this->pObj->doc->section($LANG->getLL('tsconf_title'),
00151                 t3lib_BEfunc::cshItem('_MOD_' . $GLOBALS['MCONF']['name'], 'tsconfig_edit', $GLOBALS['BACK_PATH'], '|<br />') .
00152                     $menu.
00153                     '
00154                     <br /><br />
00155 
00156                     <!-- Edit fields: -->
00157                     <table border="0" cellpadding="0" cellspacing="1">' . implode('', $lines) . '</table><br />' . $editIcon,
00158                 0,
00159                 1
00160             );
00161         } else {
00162             $tmpl = t3lib_div::makeInstance('t3lib_tsparser_ext');  // Defined global here!
00163             $tmpl->tt_track = 0;    // Do not log time-performance information
00164 
00165             $tmpl->fixedLgd = 0;
00166             $tmpl->linkObjects = 0;
00167             $tmpl->bType = '';
00168             $tmpl->ext_expandAllNotes = 1;
00169             $tmpl->ext_noPMicons = 1;
00170 
00171             switch($this->pObj->MOD_SETTINGS['tsconf_parts'])   {
00172                 case '1':
00173                     $modTSconfig = t3lib_BEfunc::getModTSconfig($this->pObj->id,'mod');
00174                 break;
00175                 case '1a':
00176                     $modTSconfig = $GLOBALS['BE_USER']->getTSConfig('mod.web_layout',t3lib_BEfunc::getPagesTSconfig($this->pObj->id));
00177                 break;
00178                 case '1b':
00179                     $modTSconfig = $GLOBALS['BE_USER']->getTSConfig('mod.web_view',t3lib_BEfunc::getPagesTSconfig($this->pObj->id));
00180                 break;
00181                 case '1c':
00182                     $modTSconfig = $GLOBALS['BE_USER']->getTSConfig('mod.web_modules',t3lib_BEfunc::getPagesTSconfig($this->pObj->id));
00183                 break;
00184                 case '1d':
00185                     $modTSconfig = $GLOBALS['BE_USER']->getTSConfig('mod.web_list',t3lib_BEfunc::getPagesTSconfig($this->pObj->id));
00186                 break;
00187                 case '1e':
00188                     $modTSconfig = $GLOBALS['BE_USER']->getTSConfig('mod.web_info',t3lib_BEfunc::getPagesTSconfig($this->pObj->id));
00189                 break;
00190                 case '1f':
00191                     $modTSconfig = $GLOBALS['BE_USER']->getTSConfig('mod.web_func',t3lib_BEfunc::getPagesTSconfig($this->pObj->id));
00192                 break;
00193                 case '1g':
00194                     $modTSconfig = $GLOBALS['BE_USER']->getTSConfig('mod.web_ts',t3lib_BEfunc::getPagesTSconfig($this->pObj->id));
00195                 break;
00196                 case '2':
00197                     $modTSconfig = $GLOBALS['BE_USER']->getTSConfig('RTE',t3lib_BEfunc::getPagesTSconfig($this->pObj->id));
00198                 break;
00199                 case '5':
00200                     $modTSconfig = $GLOBALS['BE_USER']->getTSConfig('TCEFORM',t3lib_BEfunc::getPagesTSconfig($this->pObj->id));
00201                 break;
00202                 case '6':
00203                     $modTSconfig = $GLOBALS['BE_USER']->getTSConfig('TCEMAIN',t3lib_BEfunc::getPagesTSconfig($this->pObj->id));
00204                 break;
00205                 case '3':
00206                     $modTSconfig = $GLOBALS['BE_USER']->getTSConfig('TSFE',t3lib_BEfunc::getPagesTSconfig($this->pObj->id));
00207                 break;
00208                 case '4':
00209                     $modTSconfig = $GLOBALS['BE_USER']->getTSConfig('user',t3lib_BEfunc::getPagesTSconfig($this->pObj->id));
00210                 break;
00211                 default:
00212                     $modTSconfig['properties'] = t3lib_BEfunc::getPagesTSconfig($this->pObj->id);
00213                 break;
00214             }
00215             $modTSconfig = $modTSconfig['properties'];
00216 
00217             if (!is_array($modTSconfig))    $modTSconfig = array();
00218 
00219             $theOutput.= $this->pObj->doc->section($LANG->getLL('tsconf_title'),
00220                     t3lib_BEfunc::cshItem('_MOD_' . $GLOBALS['MCONF']['name'], 'tsconfig_hierarchy', $GLOBALS['BACK_PATH'], '|<br />') .
00221                     $menu.
00222                     '
00223 
00224                     <!-- Page TSconfig Tree: -->
00225                     <table border="0" cellpadding="0" cellspacing="0">
00226                         <tr>
00227                             <td nowrap="nowrap">'.$tmpl->ext_getObjTree($modTSconfig,'','','','',$this->pObj->MOD_SETTINGS['tsconf_alphaSort']).'</td>
00228                         </tr>
00229                     </table>',
00230                 0,
00231                 1
00232             );
00233         }
00234 
00235             // Return output:
00236         return $theOutput;
00237     }
00238 }
00239 
00240 
00241 if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/info_pagetsconfig/class.tx_infopagetsconfig_webinfo.php'])) {
00242     include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/info_pagetsconfig/class.tx_infopagetsconfig_webinfo.php']);
00243 }
00244 ?>