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