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