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