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