CSH changes, adding all the images in system extensions!
[Packages/TYPO3.CMS.git] / typo3 / sysext / info_pagetsconfig / class.tx_infopagetsconfig_webinfo.php
1 <?php
2 /***************************************************************
3 * Copyright notice
4 *
5 * (c) 1999-2004 Kasper Skaarhoj (kasper@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 <kasper@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 <kasper@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 );
104
105 if (!$GLOBALS['BE_USER']->isAdmin()) unset($modMenuAdd['tsconf_parts'][99]);
106 return $modMenuAdd;
107 }
108
109 /**
110 * Main function
111 *
112 * @return string HTML output
113 */
114 function main() {
115 global $LANG;
116
117 $menu = t3lib_BEfunc::getFuncMenu($this->pObj->id,'SET[tsconf_parts]',$this->pObj->MOD_SETTINGS['tsconf_parts'],$this->pObj->MOD_MENU['tsconf_parts']);
118
119 if ($this->pObj->MOD_SETTINGS['tsconf_parts']==99) {
120 $TSparts = t3lib_BEfunc::getPagesTSconfig($this->pObj->id,'',1);
121 $lines = array();
122 $pUids = array();
123
124 foreach($TSparts as $k => $v) {
125 if ($k!='uid_0') {
126 if ($k=='defaultPageTSconfig') {
127 $pTitle = '<strong>'.$GLOBALS['LANG']->getLL('editTSconfig_default',1).'</strong>';
128 $editIcon = '';
129 } else {
130 $pUids[] = substr($k,4);
131 $row = t3lib_BEfunc::getRecord('pages',substr($k,4));
132 $pTitle = $this->pObj->doc->getHeader('pages',$row,'',0);
133
134 $editIdList = substr($k,4);
135 $params = '&edit[pages]['.$editIdList.']=edit&columnsOnly=TSconfig';
136 $onclickUrl = t3lib_BEfunc::editOnClick($params,$GLOBALS['BACK_PATH'],'');
137 $editIcon = '<a href="#" onclick="'.htmlspecialchars($onclickUrl).'">'.
138 '<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="" />'.
139 '</a>';
140 }
141
142 $TScontent = nl2br(htmlspecialchars(trim($v).chr(10)));
143
144 $tsparser = t3lib_div::makeInstance('t3lib_TSparser');
145 $tsparser->lineNumberOffset=0;
146 $TScontent = $tsparser->doSyntaxHighlight(trim($v).chr(10),'',1);
147
148 $lines[]='
149 <tr><td nowrap="nowrap" class="bgColor5">'.$pTitle.'</td></tr>
150 <tr><td nowrap="nowrap" class="bgColor4">'.$TScontent.$editIcon.'</td></tr>
151 <tr><td>&nbsp;</td></tr>
152 ';
153 }
154 }
155
156 if (count($pUids)) {
157 $params = '&edit[pages]['.implode(',',$pUids).']=edit&columnsOnly=TSconfig';
158 $onclickUrl = t3lib_BEfunc::editOnClick($params,$GLOBALS['BACK_PATH'],'');
159 $editIcon = '<a href="#" onclick="'.htmlspecialchars($onclickUrl).'">'.
160 '<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="" />'.
161 '<strong>'.$GLOBALS['LANG']->getLL('editTSconfig_all',1).'</strong>'.
162 '</a>';
163 } else $editIcon = '';
164
165
166 $theOutput.= $this->pObj->doc->section($LANG->getLL('tsconf_title'),
167 t3lib_BEfunc::cshItem('_MOD_'.$GLOBALS['MCONF']['name'],'tsconfig_edit',$GLOBALS['BACK_PATH'],'|<br/>').
168 $menu.
169 '
170 <br /><br />
171
172 <!-- Edit fields: -->
173 <table border="0" cellpadding="0" cellspacing="1">'.implode('',$lines).'</table><br/>'.$editIcon,
174 0,
175 1
176 );
177 } else {
178 $tmpl = t3lib_div::makeInstance('t3lib_tsparser_ext'); // Defined global here!
179 $tmpl->tt_track = 0; // Do not log time-performance information
180
181 $tmpl->fixedLgd = 0;
182 $tmpl->linkObjects = 0;
183 $tmpl->bType = '';
184 $tmpl->ext_expandAllNotes = 1;
185 $tmpl->ext_noPMicons = 1;
186
187 switch($this->pObj->MOD_SETTINGS['tsconf_parts']) {
188 case '1':
189 $modTSconfig = t3lib_BEfunc::getModTSconfig($this->pObj->id,'mod');
190 break;
191 case '1a':
192 $modTSconfig = $GLOBALS['BE_USER']->getTSConfig('mod.web_layout',t3lib_BEfunc::getPagesTSconfig($this->pObj->id));
193 break;
194 case '1b':
195 $modTSconfig = $GLOBALS['BE_USER']->getTSConfig('mod.web_view',t3lib_BEfunc::getPagesTSconfig($this->pObj->id));
196 break;
197 case '1c':
198 $modTSconfig = $GLOBALS['BE_USER']->getTSConfig('mod.web_modules',t3lib_BEfunc::getPagesTSconfig($this->pObj->id));
199 break;
200 case '1d':
201 $modTSconfig = $GLOBALS['BE_USER']->getTSConfig('mod.web_list',t3lib_BEfunc::getPagesTSconfig($this->pObj->id));
202 break;
203 case '1e':
204 $modTSconfig = $GLOBALS['BE_USER']->getTSConfig('mod.web_info',t3lib_BEfunc::getPagesTSconfig($this->pObj->id));
205 break;
206 case '1f':
207 $modTSconfig = $GLOBALS['BE_USER']->getTSConfig('mod.web_func',t3lib_BEfunc::getPagesTSconfig($this->pObj->id));
208 break;
209 case '1g':
210 $modTSconfig = $GLOBALS['BE_USER']->getTSConfig('mod.web_ts',t3lib_BEfunc::getPagesTSconfig($this->pObj->id));
211 break;
212 case '2':
213 $modTSconfig = $GLOBALS['BE_USER']->getTSConfig('RTE',t3lib_BEfunc::getPagesTSconfig($this->pObj->id));
214 break;
215 case '5':
216 $modTSconfig = $GLOBALS['BE_USER']->getTSConfig('TCEFORM',t3lib_BEfunc::getPagesTSconfig($this->pObj->id));
217 break;
218 case '6':
219 $modTSconfig = $GLOBALS['BE_USER']->getTSConfig('TCEMAIN',t3lib_BEfunc::getPagesTSconfig($this->pObj->id));
220 break;
221 case '3':
222 $modTSconfig = $GLOBALS['BE_USER']->getTSConfig('TSFE',t3lib_BEfunc::getPagesTSconfig($this->pObj->id));
223 break;
224 case '4':
225 $modTSconfig = $GLOBALS['BE_USER']->getTSConfig('user',t3lib_BEfunc::getPagesTSconfig($this->pObj->id));
226 break;
227 default:
228 $modTSconfig['properties'] = t3lib_BEfunc::getPagesTSconfig($this->pObj->id);
229 break;
230 }
231 $modTSconfig = $modTSconfig['properties'];
232
233 if (!is_array($modTSconfig)) $modTSconfig = array();
234
235 $theOutput.= $this->pObj->doc->section($LANG->getLL('tsconf_title'),
236 t3lib_BEfunc::cshItem('_MOD_'.$GLOBALS['MCONF']['name'],'tsconfig_hierarchy',$GLOBALS['BACK_PATH'],'|<br/>').
237 $menu.
238 '
239
240 <!-- Page TSconfig Tree: -->
241 <table border="0" cellpadding="0" cellspacing="0">
242 <tr>
243 <td nowrap="nowrap">'.$tmpl->ext_getObjTree($modTSconfig,'','').'</td>
244 </tr>
245 </table>',
246 0,
247 1
248 );
249 }
250
251 // Return output:
252 return $theOutput;
253 }
254 }
255
256
257 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/info_pagetsconfig/class.tx_infopagetsconfig_webinfo.php']) {
258 include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/info_pagetsconfig/class.tx_infopagetsconfig_webinfo.php']);
259 }
260 ?>