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