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