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