[-FEATURE] Remove restricted class prefixes
[Packages/TYPO3.CMS.git] / typo3 / sysext / info_pagetsconfig / class.tx_infopagetsconfig_webinfo.php
1 <?php
2 /***************************************************************
3 * Copyright notice
4 *
5 * (c) 1999-2011 Kasper Skårhøj (kasperYYYY@typo3.com)
6 * All rights reserved
7 *
8 * This script is part of the TYPO3 project. The TYPO3 project is
9 * free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * The GNU General Public License can be found at
15 * http://www.gnu.org/copyleft/gpl.html.
16 * A copy is found in the textfile GPL.txt and important notices to the license
17 * from the author is found in LICENSE.txt distributed with these scripts.
18 *
19 *
20 * This script is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
24 *
25 * This copyright notice MUST APPEAR in all copies of the script!
26 ***************************************************************/
27 /**
28 * Contains class for Page TSconfig wizard
29 *
30 * Revised for TYPO3 3.7 June/2004 by Kasper Skårhøj
31 * XHTML compliant
32 *
33 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
34 */
35 /**
36 * Page TSconfig viewer
37 *
38 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
39 * @package TYPO3
40 * @subpackage tx_infopagetsconfig
41 */
42 class tx_infopagetsconfig_webinfo extends t3lib_extobjbase {
43
44 /**
45 * Function menu initialization
46 *
47 * @return array Menu array
48 */
49 function modMenu() {
50 global $LANG;
51
52 $modMenuAdd = array(
53 'tsconf_parts' => array(
54 0 => $LANG->getLL('tsconf_parts_0'),
55 1 => $LANG->getLL('tsconf_parts_1'),
56 '1a' => $LANG->getLL('tsconf_parts_1a'),
57 '1b' => $LANG->getLL('tsconf_parts_1b'),
58 '1c' => $LANG->getLL('tsconf_parts_1c'),
59 '1d' => $LANG->getLL('tsconf_parts_1d'),
60 '1e' => $LANG->getLL('tsconf_parts_1e'),
61 '1f' => $LANG->getLL('tsconf_parts_1f'),
62 '1g' => $LANG->getLL('tsconf_parts_1g'),
63 2 => 'RTE.',
64 5 => 'TCEFORM.',
65 6 => 'TCEMAIN.',
66 3 => 'TSFE.',
67 4 => 'user.',
68 99 => $LANG->getLL('tsconf_configFields')
69 ),
70 'tsconf_alphaSort' => '1',
71 );
72
73 if (!$GLOBALS['BE_USER']->isAdmin()) {
74 unset($modMenuAdd['tsconf_parts'][99]);
75 }
76 return $modMenuAdd;
77 }
78
79 /**
80 * Main function of class
81 *
82 * @return string HTML output
83 */
84 function main() {
85 global $LANG;
86
87 $menu = t3lib_BEfunc::getFuncMenu($this->pObj->id, 'SET[tsconf_parts]', $this->pObj->MOD_SETTINGS['tsconf_parts'], $this->pObj->MOD_MENU['tsconf_parts']);
88 $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"');
89 $menu .= '<br /><br />';
90
91 $theOutput = $this->pObj->doc->header($LANG->getLL('tsconf_title'));
92
93 if ($this->pObj->MOD_SETTINGS['tsconf_parts']==99) {
94 $TSparts = t3lib_BEfunc::getPagesTSconfig($this->pObj->id, '', 1);
95 $lines = array();
96 $pUids = array();
97
98 foreach ($TSparts as $k => $v) {
99 if ($k != 'uid_0') {
100 if ($k=='defaultPageTSconfig') {
101 $pTitle = '<strong>'.$GLOBALS['LANG']->getLL('editTSconfig_default', 1).'</strong>';
102 $editIcon = '';
103 } else {
104 $pUids[] = substr($k, 4);
105 $row = t3lib_BEfunc::getRecordWSOL('pages', substr($k, 4));
106 $pTitle = $this->pObj->doc->getHeader('pages', $row, '', 0);
107
108 $editIdList = substr($k, 4);
109 $params = '&edit[pages]['.$editIdList.']=edit&columnsOnly=TSconfig';
110 $onclickUrl = t3lib_BEfunc::editOnClick($params, $GLOBALS['BACK_PATH'], '');
111 $editIcon = '<a href="#" onclick="'.htmlspecialchars($onclickUrl).'" title="'.$GLOBALS['LANG']->getLL('editTSconfig', 1).'">'.
112 t3lib_iconWorks::getSpriteIcon('actions-document-open') .
113 '</a>';
114 }
115
116 $TScontent = nl2br(htmlspecialchars(trim($v).chr(10)));
117
118 $tsparser = t3lib_div::makeInstance('t3lib_TSparser');
119 $tsparser->lineNumberOffset=0;
120 $TScontent = $tsparser->doSyntaxHighlight(trim($v) .LF, '', 0);
121
122 $lines[]='
123 <tr><td nowrap="nowrap" class="bgColor5">'.$pTitle.'</td></tr>
124 <tr><td nowrap="nowrap" class="bgColor4">'.$TScontent.$editIcon.'</td></tr>
125 <tr><td>&nbsp;</td></tr>
126 ';
127 }
128 }
129
130 if (count($pUids)) {
131 $params = '&edit[pages]['.implode(',', $pUids).']=edit&columnsOnly=TSconfig';
132 $onclickUrl = t3lib_BEfunc::editOnClick($params, $GLOBALS['BACK_PATH'], '');
133 $editIcon = '<a href="#" onclick="'.htmlspecialchars($onclickUrl).'" title="'.$GLOBALS['LANG']->getLL('editTSconfig_all', 1).'">'.
134 t3lib_iconWorks::getSpriteIcon('actions-document-open') .
135 '<strong>'.$GLOBALS['LANG']->getLL('editTSconfig_all', 1).'</strong>'.
136 '</a>';
137 } else {
138 $editIcon = '';
139 }
140
141 $theOutput .= $this->pObj->doc->section('',
142 t3lib_BEfunc::cshItem('_MOD_' . $GLOBALS['MCONF']['name'], 'tsconfig_edit', $GLOBALS['BACK_PATH'], '|<br />') .
143 $menu.
144 '
145 <br /><br />
146
147 <!-- Edit fields: -->
148 <table border="0" cellpadding="0" cellspacing="1">' . implode('', $lines) . '</table><br />' . $editIcon,
149 0,
150 1
151 );
152 } else {
153 // Defined global here!
154 $tmpl = t3lib_div::makeInstance('t3lib_tsparser_ext');
155 // Do not log time-performance information
156 $tmpl->tt_track = 0;
157
158 $tmpl->fixedLgd = 0;
159 $tmpl->linkObjects = 0;
160 $tmpl->bType = '';
161 $tmpl->ext_expandAllNotes = 1;
162 $tmpl->ext_noPMicons = 1;
163
164 switch($this->pObj->MOD_SETTINGS['tsconf_parts']) {
165 case '1':
166 $modTSconfig = t3lib_BEfunc::getModTSconfig($this->pObj->id, 'mod');
167 break;
168 case '1a':
169 $modTSconfig = $GLOBALS['BE_USER']->getTSConfig('mod.web_layout', t3lib_BEfunc::getPagesTSconfig($this->pObj->id));
170 break;
171 case '1b':
172 $modTSconfig = $GLOBALS['BE_USER']->getTSConfig('mod.web_view', t3lib_BEfunc::getPagesTSconfig($this->pObj->id));
173 break;
174 case '1c':
175 $modTSconfig = $GLOBALS['BE_USER']->getTSConfig('mod.web_modules', t3lib_BEfunc::getPagesTSconfig($this->pObj->id));
176 break;
177 case '1d':
178 $modTSconfig = $GLOBALS['BE_USER']->getTSConfig('mod.web_list', t3lib_BEfunc::getPagesTSconfig($this->pObj->id));
179 break;
180 case '1e':
181 $modTSconfig = $GLOBALS['BE_USER']->getTSConfig('mod.web_info', t3lib_BEfunc::getPagesTSconfig($this->pObj->id));
182 break;
183 case '1f':
184 $modTSconfig = $GLOBALS['BE_USER']->getTSConfig('mod.web_func', t3lib_BEfunc::getPagesTSconfig($this->pObj->id));
185 break;
186 case '1g':
187 $modTSconfig = $GLOBALS['BE_USER']->getTSConfig('mod.web_ts', t3lib_BEfunc::getPagesTSconfig($this->pObj->id));
188 break;
189 case '2':
190 $modTSconfig = $GLOBALS['BE_USER']->getTSConfig('RTE', t3lib_BEfunc::getPagesTSconfig($this->pObj->id));
191 break;
192 case '5':
193 $modTSconfig = $GLOBALS['BE_USER']->getTSConfig('TCEFORM', t3lib_BEfunc::getPagesTSconfig($this->pObj->id));
194 break;
195 case '6':
196 $modTSconfig = $GLOBALS['BE_USER']->getTSConfig('TCEMAIN', t3lib_BEfunc::getPagesTSconfig($this->pObj->id));
197 break;
198 case '3':
199 $modTSconfig = $GLOBALS['BE_USER']->getTSConfig('TSFE', t3lib_BEfunc::getPagesTSconfig($this->pObj->id));
200 break;
201 case '4':
202 $modTSconfig = $GLOBALS['BE_USER']->getTSConfig('user', t3lib_BEfunc::getPagesTSconfig($this->pObj->id));
203 break;
204 default:
205 $modTSconfig['properties'] = t3lib_BEfunc::getPagesTSconfig($this->pObj->id);
206 break;
207 }
208 $modTSconfig = $modTSconfig['properties'];
209
210 if (!is_array($modTSconfig)) {
211 $modTSconfig = array();
212 }
213
214 $theOutput .= $this->pObj->doc->section('',
215 t3lib_BEfunc::cshItem('_MOD_' . $GLOBALS['MCONF']['name'], 'tsconfig_hierarchy', $GLOBALS['BACK_PATH'], '|<br />') .
216 $menu.
217 '
218
219 <!-- Page TSconfig Tree: -->
220 <table border="0" cellpadding="0" cellspacing="0">
221 <tr>
222 <td nowrap="nowrap">'.$tmpl->ext_getObjTree($modTSconfig, '', '', '', '', $this->pObj->MOD_SETTINGS['tsconf_alphaSort']).'</td>
223 </tr>
224 </table>',
225 0,
226 1
227 );
228 }
229
230 // Return output:
231 return $theOutput;
232 }
233 }
234 ?>