[TASK] CGL violations FunctionCallArgumentSpacing in /typo3/sysext/t*/
[Packages/TYPO3.CMS.git] / typo3 / sysext / tstemplate_objbrowser / class.tx_tstemplateobjbrowser.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 $GLOBALS['LANG']->includeLLFile('EXT:tstemplate_objbrowser/locallang.xml');
29
30 /**
31 * This class displays the submodule "TypoScript Object Browser" inside the Web > Template module
32 *
33 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
34 * @package TYPO3
35 * @subpackage tx_tstemplateobjbrowser
36 */
37 class tx_tstemplateobjbrowser extends t3lib_extobjbase {
38
39 function init(&$pObj, $conf) {
40 parent::init($pObj, $conf);
41
42 $this->pObj->modMenu_dontValidateList.= ',ts_browser_toplevel_setup,ts_browser_toplevel_const,ts_browser_TLKeys_setup,ts_browser_TLKeys_const';
43 $this->pObj->modMenu_setDefaultList.= ',ts_browser_fixedLgd,ts_browser_showComments';
44 }
45
46 function modMenu() {
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(
54 $GLOBALS['LANG']->charSet, $GLOBALS['LANG']->getLL('all'), 'toUpper'
55 )
56 ),
57 'ts_browser_toplevel_const' => array(
58 '0' => $GLOBALS['LANG']->csConvObj->conv_case(
59 $GLOBALS['LANG']->charSet, $GLOBALS['LANG']->getLL('all'), 'toUpper'
60 )
61 ),
62 'ts_browser_const' => array(
63 '0' => $GLOBALS['LANG']->getLL('plainSubstitution'),
64 'subst' => $GLOBALS['LANG']->getLL('substitutedGreen'),
65 'const' => $GLOBALS['LANG']->getLL('unsubstitutedGreen')
66 ),
67 'ts_browser_regexsearch' => '1',
68 'ts_browser_fixedLgd' => '1',
69 'ts_browser_showComments' => '1',
70 'ts_browser_alphaSort' => '1',
71 );
72
73 foreach(array('setup', 'const') as $bType) {
74 $addKey = t3lib_div::_GET('addKey');
75 if (is_array($addKey)) { // If any plus-signs were clicked, it's registred.
76 reset($addKey);
77 if (current($addKey)) {
78 $this->pObj->MOD_SETTINGS['ts_browser_TLKeys_'.$bType][key($addKey)] = key($addKey);
79 } else {
80 unset($this->pObj->MOD_SETTINGS['ts_browser_TLKeys_'.$bType][key($addKey)]);
81 }
82 $GLOBALS['BE_USER']->pushModuleData($this->pObj->MCONF['name'], $this->pObj->MOD_SETTINGS);
83 }
84
85 if (count($this->pObj->MOD_SETTINGS['ts_browser_TLKeys_'.$bType])) {
86 $modMenu['ts_browser_toplevel_'.$bType]['-']='---';
87 $modMenu['ts_browser_toplevel_'.$bType] = $modMenu['ts_browser_toplevel_'.$bType] + $this->pObj->MOD_SETTINGS['ts_browser_TLKeys_'.$bType];
88 }
89 }
90
91 return $modMenu;
92 }
93
94 /**
95 * [Describe function...]
96 *
97 * @param [type] $propertyArray: ...
98 * @param [type] $parentType: ...
99 * @param [type] $parentValue: ...
100 * @return [type] ...
101 */
102 function verify_TSobjects($propertyArray, $parentType, $parentValue) {
103 $TSobjTable = array(
104 "PAGE" => array(
105 "prop" => array (
106 "typeNum" => "int",
107 "1,2,3" => "COBJ",
108 "bodyTag" => "string"
109 )
110 ),
111 "TEXT" => array(
112 "prop" => array (
113 "value" => "string"
114 )
115 ),
116 "HTML" => array(
117 "prop" => array (
118 "value" => "stdWrap"
119 )
120 ),
121 "stdWrap" => array(
122 "prop" => array (
123 "field" => "string",
124 "current" => "boolean"
125 )
126 ),
127 );
128 $TSobjDataTypes = array(
129 "COBJ" => "TEXT,CONTENT",
130 "PAGE" => "PAGE",
131 "stdWrap" => ""
132 );
133
134 if ($parentType) {
135 if (isset($TSobjDataTypes[$parentType]) && (!$TSobjDataTypes[$parentType] || t3lib_div::inlist($TSobjDataTypes[$parentType], $parentValue))) {
136 $ObjectKind = $parentValue;
137 } else {
138 $ObjectKind = ""; // Object kind is "" if it should be known.
139 }
140 } else {
141 $ObjectKind = $parentValue; // If parentType is not given, then it can be anything. Free.
142 }
143
144 if ($ObjectKind && is_array($TSobjTable[$ObjectKind])) {
145 $result=array();
146 if (is_array($propertyArray)) {
147 foreach ($propertyArray as $key => $val) {
148 if (t3lib_utility_Math::canBeInterpretedAsInteger($key)) { // If num-arrays
149 $result[$key]=$TSobjTable[$ObjectKind]["prop"]["1,2,3"];
150 } else { // standard
151 $result[$key]=$TSobjTable[$ObjectKind]["prop"][$key];
152 }
153 }
154 }
155 return $result;
156 }
157 }
158
159 /**
160 * [Describe function...]
161 *
162 * @param [type] $pageId: ...
163 * @param [type] $template_uid: ...
164 * @return [type] ...
165 */
166 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
170 $tmpl = t3lib_div::makeInstance("t3lib_tsparser_ext"); // Defined global here!
171 $tmpl->tt_track = 0; // Do not log time-performance information
172 $tmpl->init();
173
174 // Gets the rootLine
175 $sys_page = t3lib_div::makeInstance("t3lib_pageSelect");
176 $rootLine = $sys_page->getRootLine($pageId);
177 $tmpl->runThroughTemplates($rootLine, $template_uid); // This generates the constants/config + hierarchy info for the template.
178
179 $tplRow = $tmpl->ext_getFirstTemplate($pageId, $template_uid); // Get the row of the first VISIBLE template of the page. whereclause like the frontend.
180 if (is_array($tplRow)) { // IF there was a template...
181 return 1;
182 }
183 }
184
185 /**
186 * [Describe function...]
187 *
188 * @return [type] ...
189 */
190 function main() {
191 global $BACK_PATH;
192 global $tmpl,$tplRow,$theConstants;
193
194 $POST = t3lib_div::_POST();
195
196 // **************************
197 // Checking for more than one template an if, set a menu...
198 // **************************
199 $manyTemplatesMenu = $this->pObj->templateMenu();
200 $template_uid = 0;
201 if ($manyTemplatesMenu) {
202 $template_uid = $this->pObj->MOD_SETTINGS["templatesOnPage"];
203 }
204
205
206
207
208
209 // **************************
210 // Main
211 // **************************
212
213 // BUGBUG: Should we check if the uset may at all read and write template-records???
214 $bType= $this->pObj->MOD_SETTINGS["ts_browser_type"];
215 $existTemplate = $this->initialize_editor($this->pObj->id, $template_uid); // initialize
216 if ($existTemplate) {
217 $theOutput .= $this->pObj->doc->section(
218 $GLOBALS['LANG']->getLL('currentTemplate'),
219 ' <img ' . t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'], t3lib_iconWorks::getIcon('sys_template', $tplRow)) . ' align="top" /> <strong>' .
220 $this->pObj->linkWrapTemplateTitle($tplRow["title"], ($bType == "setup" ? "config" : "constants")) . '</strong>' .
221 htmlspecialchars(trim($tplRow["sitetitle"]) ? ' (' . $tplRow["sitetitle"] . ')' : '')
222 );
223 if ($manyTemplatesMenu) {
224 $theOutput.=$this->pObj->doc->section("", $manyTemplatesMenu);
225 }
226 $theOutput .= $this->pObj->doc->spacer(10);
227
228 if ($POST["add_property"] || $POST["update_value"] || $POST["clear_object"]) {
229 // add property
230 $line="";
231 if (is_array($POST["data"])) {
232 $name = key($POST["data"]);
233 if ($POST['data'][$name]['name']!=='') {
234 // 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.
235 unset($POST['update_value']);
236 $POST['add_property'] = 'Add';
237 }
238 if ($POST["add_property"]) {
239 $property = trim($POST['data'][$name]['name']);
240 if (preg_replace('/[^a-zA-Z0-9_\.]*/', '', $property) != $property) {
241 $badPropertyMessage = t3lib_div::makeInstance(
242 't3lib_FlashMessage',
243 $GLOBALS['LANG']->getLL('noSpaces') . '<br />'
244 . $GLOBALS['LANG']->getLL('nothingUpdated'),
245 $GLOBALS['LANG']->getLL('badProperty'),
246 t3lib_FlashMessage::ERROR
247 );
248 t3lib_FlashMessageQueue::addMessage($badPropertyMessage);
249 } else {
250 $pline = $name . '.' . $property . ' = '
251 . trim($POST['data'][$name]['propertyValue']);
252
253 $propertyAddedMessage = t3lib_div::makeInstance(
254 't3lib_FlashMessage',
255 htmlspecialchars($pline),
256 $GLOBALS['LANG']->getLL('propertyAdded')
257 );
258 t3lib_FlashMessageQueue::addMessage($propertyAddedMessage);
259
260 $line.=LF.$pline;
261 }
262 } elseif ($POST['update_value']) {
263 $pline = $name . " = " . trim($POST['data'][$name]['value']);
264
265 $updatedMessage = t3lib_div::makeInstance(
266 't3lib_FlashMessage',
267 htmlspecialchars($pline),
268 $GLOBALS['LANG']->getLL('valueUpdated')
269 );
270 t3lib_FlashMessageQueue::addMessage($updatedMessage);
271
272 $line .= LF . $pline;
273 } elseif ($POST['clear_object']) {
274 if ($POST['data'][$name]['clearValue']) {
275 $pline = $name . ' >';
276
277 $objectClearedMessage = t3lib_div::makeInstance(
278 't3lib_FlashMessage',
279 htmlspecialchars($pline),
280 $GLOBALS['LANG']->getLL('objectCleared')
281 );
282 t3lib_FlashMessageQueue::addMessage($objectClearedMessage);
283
284 $line .= LF . $pline;
285 }
286 }
287 }
288 if ($line) {
289 $saveId = $tplRow['_ORIG_uid'] ? $tplRow['_ORIG_uid'] : $tplRow['uid'];
290 // Set the data to be saved
291 $recData=array();
292 $field =$bType=="setup"?"config":"constants";
293 $recData["sys_template"][$saveId][$field] = $tplRow[$field].$line;
294 // Create new tce-object
295 $tce = t3lib_div::makeInstance("t3lib_TCEmain");
296 $tce->stripslashes_values=0;
297 // Initialize
298 $tce->start($recData, Array());
299 // Saved the stuff
300 $tce->process_datamap();
301 // Clear the cache (note: currently only admin-users can clear the cache in tce_main.php)
302 $tce->clear_cacheCmd("all");
303
304 // re-read the template ...
305 $this->initialize_editor($this->pObj->id, $template_uid);
306 }
307 }
308 }
309
310 $tsbr = t3lib_div::_GET('tsbr');
311 $update=0;
312 if (is_array($tsbr)) { // If any plus-signs were clicked, it's registred.
313 $this->pObj->MOD_SETTINGS["tsbrowser_depthKeys_".$bType] = $tmpl->ext_depthKeys($tsbr, $this->pObj->MOD_SETTINGS["tsbrowser_depthKeys_".$bType]);
314 $update=1;
315 }
316
317 if ($POST["Submit"]) { // If any POST-vars are send, update the condition array
318 $this->pObj->MOD_SETTINGS["tsbrowser_conditions"] = $POST["conditions"];
319 $update=1;
320 }
321 if ($update) { $GLOBALS["BE_USER"]->pushModuleData($this->pObj->MCONF["name"], $this->pObj->MOD_SETTINGS); }
322
323
324 $tmpl->matchAlternative = $this->pObj->MOD_SETTINGS['tsbrowser_conditions'];
325 $tmpl->matchAlternative[] = 'dummydummydummydummydummydummydummydummydummydummydummy'; // 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.
326
327 $tmpl->constantMode = $this->pObj->MOD_SETTINGS["ts_browser_const"];
328 if ($this->pObj->sObj && $tmpl->constantMode) {$tmpl->constantMode = "untouched";}
329
330 $tmpl->regexMode = $this->pObj->MOD_SETTINGS["ts_browser_regexsearch"];
331 $tmpl->fixedLgd=$this->pObj->MOD_SETTINGS["ts_browser_fixedLgd"];
332 $tmpl->linkObjects = TRUE;
333 $tmpl->ext_regLinenumbers = TRUE;
334 $tmpl->ext_regComments = $this->pObj->MOD_SETTINGS['ts_browser_showComments'];
335 $tmpl->bType=$bType;
336 $tmpl->resourceCheck=1;
337 $tmpl->uplPath = PATH_site.$tmpl->uplPath;
338 $tmpl->removeFromGetFilePath = PATH_site;
339
340 if ($this->pObj->MOD_SETTINGS["ts_browser_type"]=="const") {
341 $tmpl->ext_constants_BRP=intval(t3lib_div::_GP("breakPointLN"));
342 } else {
343 $tmpl->ext_config_BRP=intval(t3lib_div::_GP("breakPointLN"));
344 }
345 $tmpl->generateConfig();
346
347 if ($bType=="setup") {
348 $theSetup = $tmpl->setup;
349 } else {
350 $theSetup = $tmpl->setup_constants;
351 }
352
353 // EDIT A VALUE:
354 if ($this->pObj->sObj) {
355 list($theSetup, $theSetupValue) = $tmpl->ext_getSetup($theSetup, ($this->pObj->sObj?$this->pObj->sObj:""));
356
357 if ($existTemplate) {
358 // Value
359 $out = '';
360 $out.= htmlspecialchars($this->pObj->sObj) . ' =<br />';
361 $out .= '<input type="Text" name="data[' . htmlspecialchars($this->pObj->sObj) . '][value]" value="' . htmlspecialchars($theSetupValue) . '"' . $GLOBALS['TBE_TEMPLATE']->formWidth(40) . ' />';
362 $out .= '<input type="Submit" name="update_value" value="' . $GLOBALS['LANG']->getLL('updateButton') . '" />';
363 $theOutput .= $this->pObj->doc->section($GLOBALS['LANG']->getLL('editProperty'), $out, 0, 0);
364
365 // Property
366 if (t3lib_extMgm::isLoaded("tsconfig_help")) {
367 $url=$BACK_PATH."wizard_tsconfig.php?mode=tsref&onlyProperty=1";
368 $params=array();
369 $params["formName"]="editForm";
370 $params["itemName"]="data[" . htmlspecialchars($this->pObj->sObj) . "][name]";
371 $params["itemValue"]="data[" . htmlspecialchars($this->pObj->sObj) . "][propertyValue]";
372 $TSicon = '<a href="#" onClick="vHWin=window.open(\'' . $url . t3lib_div::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>';
373 } else $TSicon="";
374 $out = '';
375 $out = '<nobr>' . htmlspecialchars($this->pObj->sObj) . '.';
376 $out .= '<input type="Text" name="data[' . htmlspecialchars($this->pObj->sObj) . '][name]"' . $GLOBALS['TBE_TEMPLATE']->formWidth(20) . ' />' . $TSicon . ' = </nobr><br />';
377 $out .= '<input type="Text" name="data[' . htmlspecialchars($this->pObj->sObj) . '][propertyValue]"' . $GLOBALS['TBE_TEMPLATE']->formWidth(40) . ' />';
378 $out .= '<input type="Submit" name="add_property" value="' . $GLOBALS['LANG']->getLL('addButton') . '" />';
379
380 $theOutput .= $this->pObj->doc->spacer(20);
381 $theOutput .= $this->pObj->doc->section($GLOBALS['LANG']->getLL('addProperty'), $out, 0, 0);
382
383 // clear
384 $out = '';
385 $out = htmlspecialchars($this->pObj->sObj) . " <strong>" .
386 $GLOBALS['LANG']->csConvObj->conv_case(
387 $GLOBALS['LANG']->charSet, $GLOBALS['LANG']->getLL('clear'), 'toUpper'
388 ) . "</strong> &nbsp;&nbsp;";
389 $out .= '<input type="Checkbox" name="data[' . htmlspecialchars($this->pObj->sObj) . '][clearValue]" value="1" />';
390 $out .= '<input type="Submit" name="clear_object" value="' . $GLOBALS['LANG']->getLL('clearButton') . '" />';
391 $theOutput .= $this->pObj->doc->spacer(20);
392 $theOutput .= $this->pObj->doc->section($GLOBALS['LANG']->getLL('clearObject'), $out, 0, 0);
393
394 $theOutput .= $this->pObj->doc->spacer(10);
395 } else {
396 $noTemplateMessage = t3lib_div::makeInstance(
397 't3lib_FlashMessage',
398 $GLOBALS['LANG']->getLL('noCurrentTemplate'),
399 $GLOBALS['LANG']->getLL('edit'),
400 t3lib_FlashMessage::ERROR
401 );
402
403 t3lib_FlashMessageQueue::addMessage($noTemplateMessage);
404 }
405 // Links:
406 $out = '';
407 if (!$this->pObj->MOD_SETTINGS['ts_browser_TLKeys_'.$bType][$this->pObj->sObj]) {
408 if (count($theSetup)) {
409 $out = '<a href="index.php?id=' . $this->pObj->id . '&addKey[' . rawurlencode($this->pObj->sObj) . ']=1&SET[ts_browser_toplevel_' . $bType . ']=' . rawurlencode($this->pObj->sObj) . '">';
410 $out .= sprintf($GLOBALS['LANG']->getLL('addKey'), htmlspecialchars($this->pObj->sObj));
411 }
412 } else {
413 $out = '<a href="index.php?id=' . $this->pObj->id . '&addKey[' . rawurlencode($this->pObj->sObj) . ']=0&SET[ts_browser_toplevel_' . $bType . ']=0">';
414 $out .= sprintf($GLOBALS['LANG']->getLL('removeKey'), htmlspecialchars($this->pObj->sObj));
415 }
416 if ($out) {
417 $theOutput.=$this->pObj->doc->divider(5);
418 $theOutput.=$this->pObj->doc->section("", $out);
419 }
420
421 // back
422 $out = $GLOBALS['LANG']->getLL('back');
423 $out = '<a href="index.php?id='.$this->pObj->id.'"><strong>'.$out.'</strong></a>';
424 $theOutput.=$this->pObj->doc->divider(5);
425 $theOutput.=$this->pObj->doc->section("", $out);
426
427 } else {
428 $tmpl->tsbrowser_depthKeys=$this->pObj->MOD_SETTINGS["tsbrowser_depthKeys_".$bType];
429
430 if (t3lib_div::_POST('search') && t3lib_div::_POST('search_field')) { // If any POST-vars are send, update the condition array
431 $tmpl->tsbrowser_depthKeys = $tmpl->ext_getSearchKeys($theSetup, '', t3lib_div::_POST('search_field'), array());
432 }
433
434 $menu = '<div class="tsob-menu"><label>' . $GLOBALS['LANG']->getLL('browse') . '</label>';
435 $menu .= t3lib_BEfunc::getFuncMenu($this->pObj->id, 'SET[ts_browser_type]', $bType, $this->pObj->MOD_MENU['ts_browser_type']);
436 $menu .= '<label for="ts_browser_toplevel_' . $bType . '">' . $GLOBALS['LANG']->getLL('objectList') . '</label>';
437 $menu .= t3lib_BEfunc::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]);
438
439 //search
440 $menu .= '<label for="search_field">' . $GLOBALS['LANG']->getLL('search') .'</label>';
441 $menu .= '<input type="Text" name="search_field" id="search_field" value="' . htmlspecialchars($POST['search_field']) . '"' . $GLOBALS['TBE_TEMPLATE']->formWidth(20) . '/>';
442 $menu .= '<input type="Submit" name="search" class="tsob-search-submit" value="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:search') . '" />';
443 $menu .= t3lib_BEfunc::getFuncCheck($this->pObj->id, 'SET[ts_browser_regexsearch]', $this->pObj->MOD_SETTINGS['ts_browser_regexsearch'], '', '', 'id="checkTs_browser_regexsearch"');
444 $menu .= '<label for="checkTs_browser_regexsearch">' . $GLOBALS['LANG']->getLL('regExp') . '</label>';
445 $menu .= '</div>';
446
447 $theOutput .= $this->pObj->doc->section('', '<nobr>' . $menu . '</nobr>');
448 $theKey=$this->pObj->MOD_SETTINGS["ts_browser_toplevel_".$bType];
449 if (!$theKey || !str_replace("-", "", $theKey)) {$theKey="";}
450 list($theSetup,$theSetupValue) = $tmpl->ext_getSetup($theSetup, ($this->pObj->MOD_SETTINGS['ts_browser_toplevel_'.$bType]?$this->pObj->MOD_SETTINGS['ts_browser_toplevel_'.$bType]:''));
451 $tree = $tmpl->ext_getObjTree($theSetup, $theKey, '', '', $theSetupValue, $this->pObj->MOD_SETTINGS['ts_browser_alphaSort']);
452 $tree = $tmpl->substituteCMarkers($tree);
453
454
455
456 // Parser Errors:
457 $pEkey = ($bType=="setup"?"config":"constants");
458 if (count($tmpl->parserErrors[$pEkey])) {
459 $errMsg=array();
460 $templateAnalyzerInstalled = t3lib_extMgm::isLoaded('tstemplate_analyzer');
461
462 foreach ($tmpl->parserErrors[$pEkey] as $inf) {
463 $errorLink = '';
464 if ($templateAnalyzerInstalled) {
465 $errorLink = ' <a href="index.php?id=' . $this->pObj->id . '&SET[function]=tx_tstemplateanalyzer&template=all&SET[ts_analyzer_checkLinenum]=1#line-' . $inf[2] . '">'
466 . $GLOBALS['LANG']->getLL('errorShowDetails')
467 . '</a>';
468 }
469
470 $errMsg[] = ($inf[1]) . ": &nbsp; &nbsp;" . $inf[0] . $errorLink;
471 }
472 $theOutput .= $this->pObj->doc->spacer(10);
473
474 $flashMessage = t3lib_div::makeInstance(
475 't3lib_FlashMessage',
476 implode($errMsg, '<br />'),
477 $GLOBALS['LANG']->getLL('errorsWarnings'),
478 t3lib_FlashMessage::ERROR
479 );
480 $theOutput .= $flashMessage->render();
481 }
482
483
484
485 if (isset($this->pObj->MOD_SETTINGS["ts_browser_TLKeys_" . $bType][$theKey])) {
486 $remove = '<td width="1%" nowrap><a href="index.php?id=' . $this->pObj->id . '&addKey[' . $theKey . ']=0&SET[ts_browser_toplevel_' . $bType . ']=0"><strong>' . $GLOBALS['LANG']->getLL('removeKey') . '</strong></a></td>';
487 } else {
488 $remove = '';
489 }
490 $label = $theKey ? $theKey :
491 ($bType == 'setup' ?
492 $GLOBALS['LANG']->csConvObj->conv_case($GLOBALS['LANG']->charSet, $GLOBALS['LANG']->getLL('setupRoot'), 'toUpper') :
493 $GLOBALS['LANG']->csConvObj->conv_case($GLOBALS['LANG']->charSet, $GLOBALS['LANG']->getLL('constantRoot'), 'toUpper')
494 );
495 $theOutput .= $this->pObj->doc->spacer(15);
496 $theOutput .= $this->pObj->doc->sectionEnd();
497 $theOutput .= '<table border="0" id="typo3-objectBrowser">
498 <tr class="t3-row-header">
499 <td nowrap="nowrap" width="99%"><strong>' . $label . '</strong></td>' . $remove . '
500 </tr>
501 <tr>
502 <td class="bgColor4" nowrap="nowrap">' . $tree . '</td>' . ($remove ? '<td></td>' : '') . '
503 </tr>
504 </table>
505 ';
506
507 // second row options
508 $menu = '<div class="tsob-menu-row2">';
509 $menu .= t3lib_BEfunc::getFuncCheck($this->pObj->id, 'SET[ts_browser_showComments]', $this->pObj->MOD_SETTINGS['ts_browser_showComments'], '', '', 'id="checkTs_browser_showComments"');
510 $menu .= '<label for="checkTs_browser_showComments">' . $GLOBALS['LANG']->getLL('displayComments') . '</label>';
511 $menu .= t3lib_BEfunc::getFuncCheck($this->pObj->id, 'SET[ts_browser_alphaSort]', $this->pObj->MOD_SETTINGS['ts_browser_alphaSort'], '', '', 'id="checkTs_browser_alphaSort"');
512 $menu .= '<label for="checkTs_browser_alphaSort">' . $GLOBALS['LANG']->getLL('sortAlphabetically') . '</label>';
513 $menu .= t3lib_BEfunc::getFuncCheck($this->pObj->id, 'SET[ts_browser_fixedLgd]', $this->pObj->MOD_SETTINGS["ts_browser_fixedLgd"], '', '', 'id="checkTs_browser_fixedLgd"');
514 $menu .= '<label for="checkTs_browser_fixedLgd">' . $GLOBALS['LANG']->getLL('cropLines') . '</label>';
515 if ($bType == 'setup' && !$this->pObj->MOD_SETTINGS['ts_browser_fixedLgd']) {
516 $menu .= '<br /><br /><label>' . $GLOBALS['LANG']->getLL('displayConstants') . '</label>';
517 $menu .= t3lib_BEfunc::getFuncMenu($this->pObj->id, 'SET[ts_browser_const]', $this->pObj->MOD_SETTINGS['ts_browser_const'], $this->pObj->MOD_MENU['ts_browser_const']);
518
519 }
520 $menu .= '</div>';
521
522 $theOutput .= $this->pObj->doc->section($GLOBALS['LANG']->getLL('displayOptions'), '<nobr>' . $menu . '</nobr>', 0, 1);
523
524 // Conditions:
525 if (is_array($tmpl->sections)) {
526 $theOutput .= $this->pObj->doc->section($GLOBALS['LANG']->getLL('conditions'), '', 0, 1);
527
528 $out = '';
529 foreach ($tmpl->sections as $key => $val) {
530 $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" : "") . ' />';
531 $out .= '<label for="check' .$key . '">' . $tmpl->substituteCMarkers(htmlspecialchars($val)) . '</label></td></tr>';
532 }
533 $theOutput.='
534 <table border="0" cellpadding="0" cellspacing="0" class="bgColor4">'.$out.'
535 <td><br /><input type="Submit" name="Submit" value="' . $GLOBALS['LANG']->getLL('setConditions') . '" /></td>
536 </table>
537
538 ';
539 }
540
541 // Ending section:
542 $theOutput .= $this->pObj->doc->sectionEnd();
543 }
544 return $theOutput;
545 }
546 }
547 ?>