#9026: Label 'Sort alphabetically:' is hardcoded
[Packages/TYPO3.CMS.git] / typo3 / sysext / info_pagetsconfig / class.tx_infopagetsconfig_webinfo.php
1 <?php
2 /***************************************************************
3 * Copyright notice
4 *
5 * (c) 1999-2008 Kasper Skaarhoj (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 * [CLASS/FUNCTION INDEX of SCRIPT]
37 *
38 *
39 *
40 * 74: class tx_infopagetsconfig_webinfo extends t3lib_extobjbase
41 * 82: function modMenu()
42 * 114: function main()
43 *
44 * TOTAL FUNCTIONS: 2
45 * (This index is automatically created/updated by the extension "extdeveval")
46 *
47 */
48
49 require_once(PATH_t3lib.'class.t3lib_tsparser_ext.php');
50 require_once(PATH_t3lib.'class.t3lib_extobjbase.php');
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67 /**
68 * Page TSconfig viewer
69 *
70 * @author Kasper Skaarhoj <kasperYYYY@typo3.com>
71 * @package TYPO3
72 * @subpackage tx_infopagetsconfig
73 */
74 class tx_infopagetsconfig_webinfo extends t3lib_extobjbase {
75
76
77 /**
78 * Function menu initialization
79 *
80 * @return array Menu array
81 */
82 function modMenu() {
83 global $LANG;
84
85 $modMenuAdd = array(
86 'tsconf_parts' => array(
87 0 => $LANG->getLL('tsconf_parts_0'),
88 1 => $LANG->getLL('tsconf_parts_1'),
89 '1a' => $LANG->getLL('tsconf_parts_1a'),
90 '1b' => $LANG->getLL('tsconf_parts_1b'),
91 '1c' => $LANG->getLL('tsconf_parts_1c'),
92 '1d' => $LANG->getLL('tsconf_parts_1d'),
93 '1e' => $LANG->getLL('tsconf_parts_1e'),
94 '1f' => $LANG->getLL('tsconf_parts_1f'),
95 '1g' => $LANG->getLL('tsconf_parts_1g'),
96 2 => 'RTE.',
97 5 => 'TCEFORM.',
98 6 => 'TCEMAIN.',
99 3 => 'TSFE.',
100 4 => 'user.',
101 99 => $LANG->getLL('tsconf_configFields')
102 ),
103 'tsconf_alphaSort' => '1',
104 );
105
106 if (!$GLOBALS['BE_USER']->isAdmin()) unset($modMenuAdd['tsconf_parts'][99]);
107 return $modMenuAdd;
108 }
109
110 /**
111 * Main function of class
112 *
113 * @return string HTML output
114 */
115 function main() {
116 global $LANG;
117
118 $menu = t3lib_BEfunc::getFuncMenu($this->pObj->id,'SET[tsconf_parts]',$this->pObj->MOD_SETTINGS['tsconf_parts'],$this->pObj->MOD_MENU['tsconf_parts']);
119 $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"');
120 $menu .= '<br /><br />';
121
122 if ($this->pObj->MOD_SETTINGS['tsconf_parts']==99) {
123 $TSparts = t3lib_BEfunc::getPagesTSconfig($this->pObj->id,'',1);
124 $lines = array();
125 $pUids = array();
126
127 foreach($TSparts as $k => $v) {
128 if ($k!='uid_0') {
129 if ($k=='defaultPageTSconfig') {
130 $pTitle = '<strong>'.$GLOBALS['LANG']->getLL('editTSconfig_default',1).'</strong>';
131 $editIcon = '';
132 } else {
133 $pUids[] = substr($k,4);
134 $row = t3lib_BEfunc::getRecordWSOL('pages',substr($k,4));
135 $pTitle = $this->pObj->doc->getHeader('pages',$row,'',0);
136
137 $editIdList = substr($k,4);
138 $params = '&edit[pages]['.$editIdList.']=edit&columnsOnly=TSconfig';
139 $onclickUrl = t3lib_BEfunc::editOnClick($params,$GLOBALS['BACK_PATH'],'');
140 $editIcon = '<a href="#" onclick="'.htmlspecialchars($onclickUrl).'">'.
141 '<img'.t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'],'gfx/edit2.gif','width="11" height="12"').' vspace="2" align="top" title="'.$GLOBALS['LANG']->getLL('editTSconfig',1).'" alt="" />'.
142 '</a>';
143 }
144
145 $TScontent = nl2br(htmlspecialchars(trim($v).chr(10)));
146
147 $tsparser = t3lib_div::makeInstance('t3lib_TSparser');
148 $tsparser->lineNumberOffset=0;
149 $TScontent = $tsparser->doSyntaxHighlight(trim($v).chr(10),'',1);
150
151 $lines[]='
152 <tr><td nowrap="nowrap" class="bgColor5">'.$pTitle.'</td></tr>
153 <tr><td nowrap="nowrap" class="bgColor4">'.$TScontent.$editIcon.'</td></tr>
154 <tr><td>&nbsp;</td></tr>
155 ';
156 }
157 }
158
159 if (count($pUids)) {
160 $params = '&edit[pages]['.implode(',',$pUids).']=edit&columnsOnly=TSconfig';
161 $onclickUrl = t3lib_BEfunc::editOnClick($params,$GLOBALS['BACK_PATH'],'');
162 $editIcon = '<a href="#" onclick="'.htmlspecialchars($onclickUrl).'">'.
163 '<img'.t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'],'gfx/edit2.gif','width="11" height="12"').' vspace="2" align="top" title="'.$GLOBALS['LANG']->getLL('editTSconfig_all',1).'" alt="" />'.
164 '<strong>'.$GLOBALS['LANG']->getLL('editTSconfig_all',1).'</strong>'.
165 '</a>';
166 } else $editIcon = '';
167
168
169 $theOutput.= $this->pObj->doc->section($LANG->getLL('tsconf_title'),
170 t3lib_BEfunc::cshItem('_MOD_'.$GLOBALS['MCONF']['name'],'tsconfig_edit',$GLOBALS['BACK_PATH'],'|<br/>').
171 $menu.
172 '
173 <br /><br />
174
175 <!-- Edit fields: -->
176 <table border="0" cellpadding="0" cellspacing="1">'.implode('',$lines).'</table><br/>'.$editIcon,
177 0,
178 1
179 );
180 } else {
181 $tmpl = t3lib_div::makeInstance('t3lib_tsparser_ext'); // Defined global here!
182 $tmpl->tt_track = 0; // Do not log time-performance information
183
184 $tmpl->fixedLgd = 0;
185 $tmpl->linkObjects = 0;
186 $tmpl->bType = '';
187 $tmpl->ext_expandAllNotes = 1;
188 $tmpl->ext_noPMicons = 1;
189
190 switch($this->pObj->MOD_SETTINGS['tsconf_parts']) {
191 case '1':
192 $modTSconfig = t3lib_BEfunc::getModTSconfig($this->pObj->id,'mod');
193 break;
194 case '1a':
195 $modTSconfig = $GLOBALS['BE_USER']->getTSConfig('mod.web_layout',t3lib_BEfunc::getPagesTSconfig($this->pObj->id));
196 break;
197 case '1b':
198 $modTSconfig = $GLOBALS['BE_USER']->getTSConfig('mod.web_view',t3lib_BEfunc::getPagesTSconfig($this->pObj->id));
199 break;
200 case '1c':
201 $modTSconfig = $GLOBALS['BE_USER']->getTSConfig('mod.web_modules',t3lib_BEfunc::getPagesTSconfig($this->pObj->id));
202 break;
203 case '1d':
204 $modTSconfig = $GLOBALS['BE_USER']->getTSConfig('mod.web_list',t3lib_BEfunc::getPagesTSconfig($this->pObj->id));
205 break;
206 case '1e':
207 $modTSconfig = $GLOBALS['BE_USER']->getTSConfig('mod.web_info',t3lib_BEfunc::getPagesTSconfig($this->pObj->id));
208 break;
209 case '1f':
210 $modTSconfig = $GLOBALS['BE_USER']->getTSConfig('mod.web_func',t3lib_BEfunc::getPagesTSconfig($this->pObj->id));
211 break;
212 case '1g':
213 $modTSconfig = $GLOBALS['BE_USER']->getTSConfig('mod.web_ts',t3lib_BEfunc::getPagesTSconfig($this->pObj->id));
214 break;
215 case '2':
216 $modTSconfig = $GLOBALS['BE_USER']->getTSConfig('RTE',t3lib_BEfunc::getPagesTSconfig($this->pObj->id));
217 break;
218 case '5':
219 $modTSconfig = $GLOBALS['BE_USER']->getTSConfig('TCEFORM',t3lib_BEfunc::getPagesTSconfig($this->pObj->id));
220 break;
221 case '6':
222 $modTSconfig = $GLOBALS['BE_USER']->getTSConfig('TCEMAIN',t3lib_BEfunc::getPagesTSconfig($this->pObj->id));
223 break;
224 case '3':
225 $modTSconfig = $GLOBALS['BE_USER']->getTSConfig('TSFE',t3lib_BEfunc::getPagesTSconfig($this->pObj->id));
226 break;
227 case '4':
228 $modTSconfig = $GLOBALS['BE_USER']->getTSConfig('user',t3lib_BEfunc::getPagesTSconfig($this->pObj->id));
229 break;
230 default:
231 $modTSconfig['properties'] = t3lib_BEfunc::getPagesTSconfig($this->pObj->id);
232 break;
233 }
234 $modTSconfig = $modTSconfig['properties'];
235
236 if (!is_array($modTSconfig)) $modTSconfig = array();
237
238 $theOutput.= $this->pObj->doc->section($LANG->getLL('tsconf_title'),
239 t3lib_BEfunc::cshItem('_MOD_'.$GLOBALS['MCONF']['name'],'tsconfig_hierarchy',$GLOBALS['BACK_PATH'],'|<br/>').
240 $menu.
241 '
242
243 <!-- Page TSconfig Tree: -->
244 <table border="0" cellpadding="0" cellspacing="0">
245 <tr>
246 <td nowrap="nowrap">'.$tmpl->ext_getObjTree($modTSconfig,'','','','',$this->pObj->MOD_SETTINGS['tsconf_alphaSort']).'</td>
247 </tr>
248 </table>',
249 0,
250 1
251 );
252 }
253
254 // Return output:
255 return $theOutput;
256 }
257 }
258
259
260 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/info_pagetsconfig/class.tx_infopagetsconfig_webinfo.php']) {
261 include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/info_pagetsconfig/class.tx_infopagetsconfig_webinfo.php']);
262 }
263 ?>