[TASK] Remove superfluous parenthesis in sysexts
[Packages/TYPO3.CMS.git] / typo3 / sysext / tstemplate_objbrowser / Classes / Controller / TypoScriptTemplateObjectBrowserModuleFunctionController.php
1 <?php
2 namespace TYPO3\CMS\TstemplateObjbrowser\Controller;
3
4 /**
5 * This class displays the submodule "TypoScript Object Browser" inside the Web > Template module
6 *
7 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
8 * @package TYPO3
9 * @subpackage tx_tstemplateobjbrowser
10 */
11 class TypoScriptTemplateObjectBrowserModuleFunctionController extends \TYPO3\CMS\Backend\Module\AbstractFunctionModule {
12
13 /**
14 * Init
15 *
16 * @param object $pObj
17 * @param array $conf
18 * @return void
19 * @todo Define visibility
20 */
21 public function init(&$pObj, $conf) {
22 parent::init($pObj, $conf);
23 $this->pObj->modMenu_dontValidateList .= ',ts_browser_toplevel_setup,ts_browser_toplevel_const,ts_browser_TLKeys_setup,ts_browser_TLKeys_const';
24 $this->pObj->modMenu_setDefaultList .= ',ts_browser_fixedLgd,ts_browser_showComments';
25 }
26
27 /**
28 * Mod menu
29 *
30 * @return array
31 * @todo Define visibility
32 */
33 public function modMenu() {
34 $modMenu = array(
35 'ts_browser_type' => array(
36 'const' => $GLOBALS['LANG']->getLL('constants'),
37 'setup' => $GLOBALS['LANG']->getLL('setup')
38 ),
39 'ts_browser_toplevel_setup' => array(
40 '0' => $GLOBALS['LANG']->csConvObj->conv_case($GLOBALS['LANG']->charSet, $GLOBALS['LANG']->getLL('all'), 'toUpper')
41 ),
42 'ts_browser_toplevel_const' => array(
43 '0' => $GLOBALS['LANG']->csConvObj->conv_case($GLOBALS['LANG']->charSet, $GLOBALS['LANG']->getLL('all'), 'toUpper')
44 ),
45 'ts_browser_const' => array(
46 '0' => $GLOBALS['LANG']->getLL('plainSubstitution'),
47 'subst' => $GLOBALS['LANG']->getLL('substitutedGreen'),
48 'const' => $GLOBALS['LANG']->getLL('unsubstitutedGreen')
49 ),
50 'ts_browser_regexsearch' => '1',
51 'ts_browser_fixedLgd' => '1',
52 'ts_browser_showComments' => '1',
53 'ts_browser_alphaSort' => '1'
54 );
55 foreach (array('setup', 'const') as $bType) {
56 $addKey = \TYPO3\CMS\Core\Utility\GeneralUtility::_GET('addKey');
57 // If any plus-signs were clicked, it's registred.
58 if (is_array($addKey)) {
59 reset($addKey);
60 if (current($addKey)) {
61 $this->pObj->MOD_SETTINGS['ts_browser_TLKeys_' . $bType][key($addKey)] = key($addKey);
62 } else {
63 unset($this->pObj->MOD_SETTINGS['ts_browser_TLKeys_' . $bType][key($addKey)]);
64 }
65 $GLOBALS['BE_USER']->pushModuleData($this->pObj->MCONF['name'], $this->pObj->MOD_SETTINGS);
66 }
67 if (count($this->pObj->MOD_SETTINGS['ts_browser_TLKeys_' . $bType])) {
68 $modMenu['ts_browser_toplevel_' . $bType]['-'] = '---';
69 $modMenu['ts_browser_toplevel_' . $bType] = $modMenu[('ts_browser_toplevel_' . $bType)] + $this->pObj->MOD_SETTINGS[('ts_browser_TLKeys_' . $bType)];
70 }
71 }
72 return $modMenu;
73 }
74
75 /**
76 * Verify TS objects
77 *
78 * @param array $propertyArray
79 * @param string $parentType
80 * @param string $parentValue
81 * @return array
82 * @todo Define visibility
83 */
84 public function verify_TSobjects($propertyArray, $parentType, $parentValue) {
85 $TSobjTable = array(
86 'PAGE' => array(
87 'prop' => array(
88 'typeNum' => 'int',
89 '1,2,3' => 'COBJ',
90 'bodyTag' => 'string'
91 )
92 ),
93 'TEXT' => array(
94 'prop' => array(
95 'value' => 'string'
96 )
97 ),
98 'HTML' => array(
99 'prop' => array(
100 'value' => 'stdWrap'
101 )
102 ),
103 'stdWrap' => array(
104 'prop' => array(
105 'field' => 'string',
106 'current' => 'boolean'
107 )
108 )
109 );
110 $TSobjDataTypes = array(
111 'COBJ' => 'TEXT,CONTENT',
112 'PAGE' => 'PAGE',
113 'stdWrap' => ''
114 );
115 if ($parentType) {
116 if (isset($TSobjDataTypes[$parentType]) && (!$TSobjDataTypes[$parentType] || \TYPO3\CMS\Core\Utility\GeneralUtility::inlist($TSobjDataTypes[$parentType], $parentValue))) {
117 $ObjectKind = $parentValue;
118 } else {
119 // Object kind is "" if it should be known.
120 $ObjectKind = '';
121 }
122 } else {
123 // If parentType is not given, then it can be anything. Free.
124 $ObjectKind = $parentValue;
125 }
126 if ($ObjectKind && is_array($TSobjTable[$ObjectKind])) {
127 $result = array();
128 if (is_array($propertyArray)) {
129 foreach ($propertyArray as $key => $val) {
130 if (\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($key)) {
131 // If num-arrays
132 $result[$key] = $TSobjTable[$ObjectKind]['prop']['1,2,3'];
133 } else {
134 // standard
135 $result[$key] = $TSobjTable[$ObjectKind]['prop'][$key];
136 }
137 }
138 }
139 return $result;
140 }
141 }
142
143 /**
144 * Initialize editor
145 *
146 * @param integer $pageId
147 * @param integer $template_uid
148 * @return integer
149 * @todo Define visibility
150 */
151 public function initialize_editor($pageId, $template_uid = 0) {
152 // Initializes the module. Done in this function because we may need to re-initialize if data is submitted!
153 global $tmpl, $tplRow, $theConstants;
154 // Defined global here!
155 $tmpl = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\TypoScript\\ExtendedTemplateService');
156 // Do not log time-performance information
157 $tmpl->tt_track = 0;
158 $tmpl->init();
159 // Gets the rootLine
160 $sys_page = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\Page\\PageRepository');
161 $rootLine = $sys_page->getRootLine($pageId);
162 // This generates the constants/config + hierarchy info for the template.
163 $tmpl->runThroughTemplates($rootLine, $template_uid);
164 // Get the row of the first VISIBLE template of the page. whereclause like the frontend.
165 $tplRow = $tmpl->ext_getFirstTemplate($pageId, $template_uid);
166 // IF there was a template...
167 if (is_array($tplRow)) {
168 return 1;
169 }
170 }
171
172 /**
173 * Main
174 *
175 * @return string
176 * @todo Define visibility
177 */
178 public function main() {
179 global $BACK_PATH;
180 global $tmpl, $tplRow, $theConstants;
181 $POST = \TYPO3\CMS\Core\Utility\GeneralUtility::_POST();
182 // Checking for more than one template an if, set a menu...
183 $manyTemplatesMenu = $this->pObj->templateMenu();
184 $template_uid = 0;
185 if ($manyTemplatesMenu) {
186 $template_uid = $this->pObj->MOD_SETTINGS['templatesOnPage'];
187 }
188 // BUGBUG: Should we check if the uset may at all read and write template-records???
189 $bType = $this->pObj->MOD_SETTINGS['ts_browser_type'];
190 $existTemplate = $this->initialize_editor($this->pObj->id, $template_uid);
191 // initialize
192 if ($existTemplate) {
193 $theOutput .= $this->pObj->doc->section($GLOBALS['LANG']->getLL('currentTemplate'), ' <img ' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg($GLOBALS['BACK_PATH'], \TYPO3\CMS\Backend\Utility\IconUtility::getIcon('sys_template', $tplRow)) . ' align="top" /> <strong>' . $this->pObj->linkWrapTemplateTitle($tplRow['title'], ($bType == 'setup' ? 'config' : 'constants')) . '</strong>' . htmlspecialchars((trim($tplRow['sitetitle']) ? ' (' . $tplRow['sitetitle'] . ')' : '')));
194 if ($manyTemplatesMenu) {
195 $theOutput .= $this->pObj->doc->section('', $manyTemplatesMenu);
196 }
197 $theOutput .= $this->pObj->doc->spacer(10);
198 if ($POST['add_property'] || $POST['update_value'] || $POST['clear_object']) {
199 // add property
200 $line = '';
201 if (is_array($POST['data'])) {
202 $name = key($POST['data']);
203 if ($POST['data'][$name]['name'] !== '') {
204 // Workaround for this special case: User adds a key and submits by pressing the return key. The form however will use "add_property" which is the name of the first submit button in this form.
205 unset($POST['update_value']);
206 $POST['add_property'] = 'Add';
207 }
208 if ($POST['add_property']) {
209 $property = trim($POST['data'][$name]['name']);
210 if (preg_replace('/[^a-zA-Z0-9_\\.]*/', '', $property) != $property) {
211 $badPropertyMessage = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', $GLOBALS['LANG']->getLL('noSpaces') . '<br />' . $GLOBALS['LANG']->getLL('nothingUpdated'), $GLOBALS['LANG']->getLL('badProperty'), \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR);
212 \TYPO3\CMS\Core\Messaging\FlashMessageQueue::addMessage($badPropertyMessage);
213 } else {
214 $pline = $name . '.' . $property . ' = ' . trim($POST['data'][$name]['propertyValue']);
215 $propertyAddedMessage = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', htmlspecialchars($pline), $GLOBALS['LANG']->getLL('propertyAdded'));
216 \TYPO3\CMS\Core\Messaging\FlashMessageQueue::addMessage($propertyAddedMessage);
217 $line .= LF . $pline;
218 }
219 } elseif ($POST['update_value']) {
220 $pline = $name . ' = ' . trim($POST['data'][$name]['value']);
221 $updatedMessage = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', htmlspecialchars($pline), $GLOBALS['LANG']->getLL('valueUpdated'));
222 \TYPO3\CMS\Core\Messaging\FlashMessageQueue::addMessage($updatedMessage);
223 $line .= LF . $pline;
224 } elseif ($POST['clear_object']) {
225 if ($POST['data'][$name]['clearValue']) {
226 $pline = $name . ' >';
227 $objectClearedMessage = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', htmlspecialchars($pline), $GLOBALS['LANG']->getLL('objectCleared'));
228 \TYPO3\CMS\Core\Messaging\FlashMessageQueue::addMessage($objectClearedMessage);
229 $line .= LF . $pline;
230 }
231 }
232 }
233 if ($line) {
234 $saveId = $tplRow['_ORIG_uid'] ? $tplRow['_ORIG_uid'] : $tplRow['uid'];
235 // Set the data to be saved
236 $recData = array();
237 $field = $bType == 'setup' ? 'config' : 'constants';
238 $recData['sys_template'][$saveId][$field] = $tplRow[$field] . $line;
239 // Create new tce-object
240 $tce = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\DataHandler\\DataHandler');
241 $tce->stripslashes_values = 0;
242 // Initialize
243 $tce->start($recData, array());
244 // Saved the stuff
245 $tce->process_datamap();
246 // Clear the cache (note: currently only admin-users can clear the cache in tce_main.php)
247 $tce->clear_cacheCmd('all');
248 // re-read the template ...
249 $this->initialize_editor($this->pObj->id, $template_uid);
250 }
251 }
252 }
253 $tsbr = \TYPO3\CMS\Core\Utility\GeneralUtility::_GET('tsbr');
254 $update = 0;
255 if (is_array($tsbr)) {
256 // If any plus-signs were clicked, it's registred.
257 $this->pObj->MOD_SETTINGS['tsbrowser_depthKeys_' . $bType] = $tmpl->ext_depthKeys($tsbr, $this->pObj->MOD_SETTINGS['tsbrowser_depthKeys_' . $bType]);
258 $update = 1;
259 }
260 if ($POST['Submit']) {
261 // If any POST-vars are send, update the condition array
262 $this->pObj->MOD_SETTINGS['tsbrowser_conditions'] = $POST['conditions'];
263 $update = 1;
264 }
265 if ($update) {
266 $GLOBALS['BE_USER']->pushModuleData($this->pObj->MCONF['name'], $this->pObj->MOD_SETTINGS);
267 }
268 $tmpl->matchAlternative = $this->pObj->MOD_SETTINGS['tsbrowser_conditions'];
269 $tmpl->matchAlternative[] = 'dummydummydummydummydummydummydummydummydummydummydummy';
270 // This is just here to make sure that at least one element is in the array so that the tsparser actually uses this array to match.
271 $tmpl->constantMode = $this->pObj->MOD_SETTINGS['ts_browser_const'];
272 if ($this->pObj->sObj && $tmpl->constantMode) {
273 $tmpl->constantMode = 'untouched';
274 }
275 $tmpl->regexMode = $this->pObj->MOD_SETTINGS['ts_browser_regexsearch'];
276 $tmpl->fixedLgd = $this->pObj->MOD_SETTINGS['ts_browser_fixedLgd'];
277 $tmpl->linkObjects = TRUE;
278 $tmpl->ext_regLinenumbers = TRUE;
279 $tmpl->ext_regComments = $this->pObj->MOD_SETTINGS['ts_browser_showComments'];
280 $tmpl->bType = $bType;
281 $tmpl->resourceCheck = 1;
282 $tmpl->removeFromGetFilePath = PATH_site;
283 if ($this->pObj->MOD_SETTINGS['ts_browser_type'] == 'const') {
284 $tmpl->ext_constants_BRP = intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('breakPointLN'));
285 } else {
286 $tmpl->ext_config_BRP = intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('breakPointLN'));
287 }
288 $tmpl->generateConfig();
289 if ($bType == 'setup') {
290 $theSetup = $tmpl->setup;
291 } else {
292 $theSetup = $tmpl->setup_constants;
293 }
294 // EDIT A VALUE:
295 if ($this->pObj->sObj) {
296 list($theSetup, $theSetupValue) = $tmpl->ext_getSetup($theSetup, $this->pObj->sObj ? $this->pObj->sObj : '');
297 if ($existTemplate) {
298 // Value
299 $out = '';
300 $out .= htmlspecialchars($this->pObj->sObj) . ' =<br />';
301 $out .= '<input type="Text" name="data[' . htmlspecialchars($this->pObj->sObj) . '][value]" value="' . htmlspecialchars($theSetupValue) . '"' . $GLOBALS['TBE_TEMPLATE']->formWidth(40) . ' />';
302 $out .= '<input type="Submit" name="update_value" value="' . $GLOBALS['LANG']->getLL('updateButton') . '" />';
303 $theOutput .= $this->pObj->doc->section($GLOBALS['LANG']->getLL('editProperty'), $out, 0, 0);
304 // Property
305 if (\TYPO3\CMS\Core\Extension\ExtensionManager::isLoaded('tsconfig_help')) {
306 $url = $BACK_PATH . 'wizard_tsconfig.php?mode=tsref&onlyProperty=1';
307 $params = array();
308 $params['formName'] = 'editForm';
309 $params['itemName'] = 'data[' . htmlspecialchars($this->pObj->sObj) . '][name]';
310 $params['itemValue'] = 'data[' . htmlspecialchars($this->pObj->sObj) . '][propertyValue]';
311 $TSicon = '<a href="#" onClick="vHWin=window.open(\'' . $url . \TYPO3\CMS\Core\Utility\GeneralUtility::implodeArrayForUrl('', array('P' => $params)) . '\',\'popUp' . $md5ID . '\',\'height=500,width=780,status=0,menubar=0,scrollbars=1\');vHWin.focus();return false;"><img src="' . $BACK_PATH . 'gfx/wizard_tsconfig_s.gif" width="22" height="16" border="0" class="absmiddle" hspace=2 title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:tsRef') . '"></a>';
312 } else {
313 $TSicon = '';
314 }
315 $out = '';
316 $out = '<nobr>' . htmlspecialchars($this->pObj->sObj) . '.';
317 $out .= '<input type="Text" name="data[' . htmlspecialchars($this->pObj->sObj) . '][name]"' . $GLOBALS['TBE_TEMPLATE']->formWidth(20) . ' />' . $TSicon . ' = </nobr><br />';
318 $out .= '<input type="Text" name="data[' . htmlspecialchars($this->pObj->sObj) . '][propertyValue]"' . $GLOBALS['TBE_TEMPLATE']->formWidth(40) . ' />';
319 $out .= '<input type="Submit" name="add_property" value="' . $GLOBALS['LANG']->getLL('addButton') . '" />';
320 $theOutput .= $this->pObj->doc->spacer(20);
321 $theOutput .= $this->pObj->doc->section($GLOBALS['LANG']->getLL('addProperty'), $out, 0, 0);
322 // clear
323 $out = '';
324 $out = htmlspecialchars($this->pObj->sObj) . ' <strong>' . $GLOBALS['LANG']->csConvObj->conv_case($GLOBALS['LANG']->charSet, $GLOBALS['LANG']->getLL('clear'), 'toUpper') . '</strong> &nbsp;&nbsp;';
325 $out .= '<input type="Checkbox" name="data[' . htmlspecialchars($this->pObj->sObj) . '][clearValue]" value="1" />';
326 $out .= '<input type="Submit" name="clear_object" value="' . $GLOBALS['LANG']->getLL('clearButton') . '" />';
327 $theOutput .= $this->pObj->doc->spacer(20);
328 $theOutput .= $this->pObj->doc->section($GLOBALS['LANG']->getLL('clearObject'), $out, 0, 0);
329 $theOutput .= $this->pObj->doc->spacer(10);
330 } else {
331 $noTemplateMessage = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', $GLOBALS['LANG']->getLL('noCurrentTemplate'), $GLOBALS['LANG']->getLL('edit'), \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR);
332 \TYPO3\CMS\Core\Messaging\FlashMessageQueue::addMessage($noTemplateMessage);
333 }
334 // Links:
335 $out = '';
336 $urlParameters = array(
337 'id' => $this->pObj->id
338 );
339 $aHref = \TYPO3\CMS\Backend\Utility\BackendUtility::getModuleUrl('web_ts', $urlParameters);
340 if (!$this->pObj->MOD_SETTINGS[('ts_browser_TLKeys_' . $bType)][$this->pObj->sObj]) {
341 if (count($theSetup)) {
342 $out = '<a href="' . htmlspecialchars(($aHref . '&addKey[' . rawurlencode($this->pObj->sObj) . ']=1&SET[ts_browser_toplevel_' . $bType . ']=' . rawurlencode($this->pObj->sObj))) . '">';
343 $out .= sprintf($GLOBALS['LANG']->getLL('addKey'), htmlspecialchars($this->pObj->sObj));
344 }
345 } else {
346 $out = '<a href="' . htmlspecialchars(($aHref . '&addKey[' . rawurlencode($this->pObj->sObj) . ']=0&SET[ts_browser_toplevel_' . $bType . ']=0')) . '">';
347 $out .= sprintf($GLOBALS['LANG']->getLL('removeKey'), htmlspecialchars($this->pObj->sObj));
348 }
349 if ($out) {
350 $theOutput .= $this->pObj->doc->divider(5);
351 $theOutput .= $this->pObj->doc->section('', $out);
352 }
353 // back
354 $out = $GLOBALS['LANG']->getLL('back');
355 $out = '<a href="' . htmlspecialchars($aHref) . '"><strong>' . $out . '</strong></a>';
356 $theOutput .= $this->pObj->doc->divider(5);
357 $theOutput .= $this->pObj->doc->section('', $out);
358 } else {
359 $tmpl->tsbrowser_depthKeys = $this->pObj->MOD_SETTINGS['tsbrowser_depthKeys_' . $bType];
360 if (\TYPO3\CMS\Core\Utility\GeneralUtility::_POST('search') && \TYPO3\CMS\Core\Utility\GeneralUtility::_POST('search_field')) {
361 // If any POST-vars are send, update the condition array
362 $tmpl->tsbrowser_depthKeys = $tmpl->ext_getSearchKeys($theSetup, '', \TYPO3\CMS\Core\Utility\GeneralUtility::_POST('search_field'), array());
363 }
364 $menu = '<div class="tsob-menu"><label>' . $GLOBALS['LANG']->getLL('browse') . '</label>';
365 $menu .= \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncMenu($this->pObj->id, 'SET[ts_browser_type]', $bType, $this->pObj->MOD_MENU['ts_browser_type']);
366 $menu .= '<label for="ts_browser_toplevel_' . $bType . '">' . $GLOBALS['LANG']->getLL('objectList') . '</label>';
367 $menu .= \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncMenu($this->pObj->id, 'SET[ts_browser_toplevel_' . $bType . ']', $this->pObj->MOD_SETTINGS['ts_browser_toplevel_' . $bType], $this->pObj->MOD_MENU['ts_browser_toplevel_' . $bType]);
368 //search
369 $menu .= '<label for="search_field">' . $GLOBALS['LANG']->getLL('search') . '</label>';
370 $menu .= '<input type="Text" name="search_field" id="search_field" value="' . htmlspecialchars($POST['search_field']) . '"' . $GLOBALS['TBE_TEMPLATE']->formWidth(20) . '/>';
371 $menu .= '<input type="Submit" name="search" class="tsob-search-submit" value="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:search') . '" />';
372 $menu .= \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncCheck($this->pObj->id, 'SET[ts_browser_regexsearch]', $this->pObj->MOD_SETTINGS['ts_browser_regexsearch'], '', '', 'id="checkTs_browser_regexsearch"');
373 $menu .= '<label for="checkTs_browser_regexsearch">' . $GLOBALS['LANG']->getLL('regExp') . '</label>';
374 $menu .= '</div>';
375 $theOutput .= $this->pObj->doc->section('', '<nobr>' . $menu . '</nobr>');
376 $theKey = $this->pObj->MOD_SETTINGS['ts_browser_toplevel_' . $bType];
377 if (!$theKey || !str_replace('-', '', $theKey)) {
378 $theKey = '';
379 }
380 list($theSetup, $theSetupValue) = $tmpl->ext_getSetup($theSetup, $this->pObj->MOD_SETTINGS['ts_browser_toplevel_' . $bType] ? $this->pObj->MOD_SETTINGS['ts_browser_toplevel_' . $bType] : '');
381 $tree = $tmpl->ext_getObjTree($theSetup, $theKey, '', '', $theSetupValue, $this->pObj->MOD_SETTINGS['ts_browser_alphaSort']);
382 $tree = $tmpl->substituteCMarkers($tree);
383 $urlParameters = array(
384 'id' => $this->pObj->id
385 );
386 $aHref = \TYPO3\CMS\Backend\Utility\BackendUtility::getModuleUrl('web_ts', $urlParameters);
387 // Parser Errors:
388 $pEkey = $bType == 'setup' ? 'config' : 'constants';
389 if (count($tmpl->parserErrors[$pEkey])) {
390 $errMsg = array();
391 $templateAnalyzerInstalled = \TYPO3\CMS\Core\Extension\ExtensionManager::isLoaded('tstemplate_analyzer');
392 foreach ($tmpl->parserErrors[$pEkey] as $inf) {
393 $errorLink = '';
394 if ($templateAnalyzerInstalled) {
395 $errorLink = ' <a href="' . htmlspecialchars(($aHref . '&SET[function]=tx_tstemplateanalyzer&template=all&SET[ts_analyzer_checkLinenum]=1#line-' . $inf[2])) . '">' . $GLOBALS['LANG']->getLL('errorShowDetails') . '</a>';
396 }
397 $errMsg[] = $inf[1] . ': &nbsp; &nbsp;' . $inf[0] . $errorLink;
398 }
399 $theOutput .= $this->pObj->doc->spacer(10);
400 $flashMessage = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', implode($errMsg, '<br />'), $GLOBALS['LANG']->getLL('errorsWarnings'), \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR);
401 $theOutput .= $flashMessage->render();
402 }
403 if (isset($this->pObj->MOD_SETTINGS['ts_browser_TLKeys_' . $bType][$theKey])) {
404 $remove = '<td width="1%" nowrap><a href="' . htmlspecialchars(($aHref . '&addKey[' . $theKey . ']=0&SET[ts_browser_toplevel_' . $bType . ']=0')) . '"><strong>' . $GLOBALS['LANG']->getLL('removeKey') . '</strong></a></td>';
405 } else {
406 $remove = '';
407 }
408 $label = $theKey ? $theKey : ($bType == 'setup' ? $GLOBALS['LANG']->csConvObj->conv_case($GLOBALS['LANG']->charSet, $GLOBALS['LANG']->getLL('setupRoot'), 'toUpper') : $GLOBALS['LANG']->csConvObj->conv_case($GLOBALS['LANG']->charSet, $GLOBALS['LANG']->getLL('constantRoot'), 'toUpper'));
409 $theOutput .= $this->pObj->doc->spacer(15);
410 $theOutput .= $this->pObj->doc->sectionEnd();
411 $theOutput .= '<table border="0" id="typo3-objectBrowser">
412 <tr class="t3-row-header">
413 <td nowrap="nowrap" width="99%"><strong>' . $label . '</strong></td>' . $remove . '
414 </tr>
415 <tr>
416 <td class="bgColor4" nowrap="nowrap">' . $tree . '</td>' . ($remove ? '<td></td>' : '') . '
417 </tr>
418 </table>
419 ';
420 // second row options
421 $menu = '<div class="tsob-menu-row2">';
422 $menu .= \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncCheck($this->pObj->id, 'SET[ts_browser_showComments]', $this->pObj->MOD_SETTINGS['ts_browser_showComments'], '', '', 'id="checkTs_browser_showComments"');
423 $menu .= '<label for="checkTs_browser_showComments">' . $GLOBALS['LANG']->getLL('displayComments') . '</label>';
424 $menu .= \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncCheck($this->pObj->id, 'SET[ts_browser_alphaSort]', $this->pObj->MOD_SETTINGS['ts_browser_alphaSort'], '', '', 'id="checkTs_browser_alphaSort"');
425 $menu .= '<label for="checkTs_browser_alphaSort">' . $GLOBALS['LANG']->getLL('sortAlphabetically') . '</label>';
426 $menu .= \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncCheck($this->pObj->id, 'SET[ts_browser_fixedLgd]', $this->pObj->MOD_SETTINGS['ts_browser_fixedLgd'], '', '', 'id="checkTs_browser_fixedLgd"');
427 $menu .= '<label for="checkTs_browser_fixedLgd">' . $GLOBALS['LANG']->getLL('cropLines') . '</label>';
428 if ($bType == 'setup' && !$this->pObj->MOD_SETTINGS['ts_browser_fixedLgd']) {
429 $menu .= '<br /><br /><label>' . $GLOBALS['LANG']->getLL('displayConstants') . '</label>';
430 $menu .= \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncMenu($this->pObj->id, 'SET[ts_browser_const]', $this->pObj->MOD_SETTINGS['ts_browser_const'], $this->pObj->MOD_MENU['ts_browser_const']);
431 }
432 $menu .= '</div>';
433 $theOutput .= $this->pObj->doc->section($GLOBALS['LANG']->getLL('displayOptions'), '<nobr>' . $menu . '</nobr>', 0, 1);
434 // Conditions:
435 if (is_array($tmpl->sections)) {
436 $theOutput .= $this->pObj->doc->section($GLOBALS['LANG']->getLL('conditions'), '', 0, 1);
437 $out = '';
438 foreach ($tmpl->sections as $key => $val) {
439 $out .= '<tr><td nowrap class="tsob-conditions"><input type="checkbox" name="conditions[' . $key . ']" id="check' . $key . '" value="' . htmlspecialchars($val) . '"' . ($this->pObj->MOD_SETTINGS['tsbrowser_conditions'][$key] ? ' checked' : '') . ' />';
440 $out .= '<label for="check' . $key . '">' . $tmpl->substituteCMarkers(htmlspecialchars($val)) . '</label></td></tr>';
441 }
442 $theOutput .= '
443 <table border="0" cellpadding="0" cellspacing="0" class="bgColor4">' . $out . '
444 <td><br /><input type="Submit" name="Submit" value="' . $GLOBALS['LANG']->getLL('setConditions') . '" /></td>
445 </table>
446
447 ';
448 }
449 // Ending section:
450 $theOutput .= $this->pObj->doc->sectionEnd();
451 }
452 return $theOutput;
453 }
454
455 }
456
457
458 ?>