ee059b0f310d2071996a20146a88f346e67b69c6
[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' => t3lib_div::strtoupper($GLOBALS['LANG']->getLL('all'))
59 ),
60 'ts_browser_toplevel_const' => array(
61 '0' => t3lib_div::strtoupper($GLOBALS['LANG']->getLL('all'))
62 ),
63 'ts_browser_const' => array(
64 '0' => $GLOBALS['LANG']->getLL('plainSubstitution'),
65 'subst' => $GLOBALS['LANG']->getLL('substitutedGreen'),
66 'const' => $GLOBALS['LANG']->getLL('unsubstitutedGreen')
67 ),
68 'ts_browser_regexsearch' => '1',
69 'ts_browser_fixedLgd' => '1',
70 'ts_browser_showComments' => '1',
71 'ts_browser_alphaSort' => '1',
72 );
73
74 foreach(array('setup','const') as $bType) {
75 $addKey = t3lib_div::_GET('addKey');
76 if (is_array($addKey)) { // If any plus-signs were clicked, it's registred.
77 reset($addKey);
78 if (current($addKey)) {
79 $this->pObj->MOD_SETTINGS['ts_browser_TLKeys_'.$bType][key($addKey)] = key($addKey);
80 } else {
81 unset($this->pObj->MOD_SETTINGS['ts_browser_TLKeys_'.$bType][key($addKey)]);
82 }
83 $GLOBALS['BE_USER']->pushModuleData($this->pObj->MCONF['name'],$this->pObj->MOD_SETTINGS);
84 }
85
86 if (count($this->pObj->MOD_SETTINGS['ts_browser_TLKeys_'.$bType])) {
87 $modMenu['ts_browser_toplevel_'.$bType]['-']='---';
88 $modMenu['ts_browser_toplevel_'.$bType] = $modMenu['ts_browser_toplevel_'.$bType] + $this->pObj->MOD_SETTINGS['ts_browser_TLKeys_'.$bType];
89 }
90 }
91
92 return $modMenu;
93 }
94
95 /**
96 * [Describe function...]
97 *
98 * @param [type] $propertyArray: ...
99 * @param [type] $parentType: ...
100 * @param [type] $parentValue: ...
101 * @return [type] ...
102 */
103 function verify_TSobjects($propertyArray,$parentType,$parentValue) {
104 $TSobjTable = array(
105 "PAGE" => array(
106 "prop" => array (
107 "typeNum" => "int",
108 "1,2,3" => "COBJ",
109 "bodyTag" => "string"
110 )
111 ),
112 "TEXT" => array(
113 "prop" => array (
114 "value" => "string"
115 )
116 ),
117 "HTML" => array(
118 "prop" => array (
119 "value" => "stdWrap"
120 )
121 ),
122 "stdWrap" => array(
123 "prop" => array (
124 "field" => "string",
125 "current" => "boolean"
126 )
127 ),
128 );
129 $TSobjDataTypes = array(
130 "COBJ" => "TEXT,CONTENT",
131 "PAGE" => "PAGE",
132 "stdWrap" => ""
133 );
134
135 if ($parentType) {
136 if (isset($TSobjDataTypes[$parentType]) && (!$TSobjDataTypes[$parentType] || t3lib_div::inlist($TSobjDataTypes[$parentType],$parentValue))) {
137 $ObjectKind = $parentValue;
138 } else {
139 $ObjectKind = ""; // Object kind is "" if it should be known.
140 }
141 } else {
142 $ObjectKind = $parentValue; // If parentType is not given, then it can be anything. Free.
143 }
144
145 if ($ObjectKind && is_array($TSobjTable[$ObjectKind])) {
146 $result=array();
147 if (is_array($propertyArray)) {
148 reset($propertyArray);
149 while(list($key,$val)=each($propertyArray)) {
150 if (t3lib_div::testInt($key)) { // If num-arrays
151 $result[$key]=$TSobjTable[$ObjectKind]["prop"]["1,2,3"];
152 } else { // standard
153 $result[$key]=$TSobjTable[$ObjectKind]["prop"][$key];
154 }
155 }
156 }
157 return $result;
158 }
159 }
160
161 /**
162 * [Describe function...]
163 *
164 * @param [type] $pageId: ...
165 * @param [type] $template_uid: ...
166 * @return [type] ...
167 */
168 function initialize_editor($pageId,$template_uid=0) {
169 // Initializes the module. Done in this function because we may need to re-initialize if data is submitted!
170 global $tmpl,$tplRow,$theConstants;
171
172 $tmpl = t3lib_div::makeInstance("t3lib_tsparser_ext"); // Defined global here!
173 $tmpl->tt_track = 0; // Do not log time-performance information
174 $tmpl->init();
175
176 // Gets the rootLine
177 $sys_page = t3lib_div::makeInstance("t3lib_pageSelect");
178 $rootLine = $sys_page->getRootLine($pageId);
179 $tmpl->runThroughTemplates($rootLine,$template_uid); // This generates the constants/config + hierarchy info for the template.
180
181 $tplRow = $tmpl->ext_getFirstTemplate($pageId,$template_uid); // Get the row of the first VISIBLE template of the page. whereclause like the frontend.
182 if (is_array($tplRow)) { // IF there was a template...
183 return 1;
184 }
185 }
186
187 /**
188 * [Describe function...]
189 *
190 * @return [type] ...
191 */
192 function main() {
193 global $SOBE,$BE_USER,$BACK_PATH,$TCA_DESCR,$TCA,$CLIENT,$TYPO3_CONF_VARS;
194 global $tmpl,$tplRow,$theConstants;
195
196 $POST = t3lib_div::_POST();
197
198 // **************************
199 // Checking for more than one template an if, set a menu...
200 // **************************
201 $manyTemplatesMenu = $this->pObj->templateMenu();
202 $template_uid = 0;
203 if ($manyTemplatesMenu) {
204 $template_uid = $this->pObj->MOD_SETTINGS["templatesOnPage"];
205 }
206
207
208
209
210
211 // **************************
212 // Main
213 // **************************
214
215 // BUGBUG: Should we check if the uset may at all read and write template-records???
216 $bType= $this->pObj->MOD_SETTINGS["ts_browser_type"];
217 $existTemplate = $this->initialize_editor($this->pObj->id,$template_uid); // initialize
218 if ($existTemplate) {
219 $theOutput .= '<h4 style="margin-bottom:5px;">' . $GLOBALS['LANG']->getLL('currentTemplate') . ' <img ' .
220 t3lib_iconWorks::skinImg($BACK_PATH, t3lib_iconWorks::getIcon('sys_template', $tplRow)) . ' align="top" /> <b>' .
221 $this->pObj->linkWrapTemplateTitle($tplRow["title"], ($bType == "setup" ? "config" : "constants")) . '</b>' .
222 htmlspecialchars(trim($tplRow["sitetitle"]) ? ' - (' . $tplRow["sitetitle"] . ')' : '') . '</h4>';
223 if ($manyTemplatesMenu) {
224 $theOutput.=$this->pObj->doc->section("",$manyTemplatesMenu);
225 $theOutput.=$this->pObj->doc->divider(5);
226 }
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 $this->pObj->doc->pushFlashMessage($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 $this->pObj->doc->pushFlashMessage($propertyAddedMessage);
259
260 $line.=chr(10).$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 $this->pObj->doc->pushFlashMessage($updatedMessage);
271
272 $line .= chr(10) . $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 $this->pObj->doc->pushFlashMessage($objectClearedMessage);
283
284 $line .= chr(10) . $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 //debug($tmpl->uplPath);
340
341 if ($this->pObj->MOD_SETTINGS["ts_browser_type"]=="const") {
342 $tmpl->ext_constants_BRP=intval(t3lib_div::_GP("breakPointLN"));
343 } else {
344 $tmpl->ext_config_BRP=intval(t3lib_div::_GP("breakPointLN"));
345 }
346 $tmpl->generateConfig();
347
348 if ($bType=="setup") {
349 $theSetup = $tmpl->setup;
350 } else {
351 $theSetup = $tmpl->setup_constants;
352 }
353
354 // EDIT A VALUE:
355 if ($this->pObj->sObj) {
356 list($theSetup,$theSetupValue) = $tmpl->ext_getSetup($theSetup, ($this->pObj->sObj?$this->pObj->sObj:""));
357
358 if ($existTemplate) {
359 // Value
360 $out = '';
361 $out.= $this->pObj->sObj.' =<br />';
362 $out .= '<input type="Text" name="data[' . $this->pObj->sObj . '][value]" value="' . htmlspecialchars($theSetupValue) . '"' . $GLOBALS['TBE_TEMPLATE']->formWidth(40) . ' />';
363 $out .= '<input type="Submit" name="update_value" value="' . $GLOBALS['LANG']->getLL('updateButton') . '" />';
364 $theOutput .= $this->pObj->doc->section($GLOBALS['LANG']->getLL('editProperty'), $out, 0, 0);
365
366 // Property
367 if (t3lib_extMgm::isLoaded("tsconfig_help")) {
368 $url=$BACK_PATH."wizard_tsconfig.php?mode=tsref&onlyProperty=1";
369 $params=array();
370 $params["formName"]="editForm";
371 $params["itemName"]="data[".$this->pObj->sObj."][name]";
372 $params["itemValue"]="data[".$this->pObj->sObj."][propertyValue]";
373 $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>';
374 } else $TSicon="";
375 $out = '';
376 $out = '<nobr>' . $this->pObj->sObj . '.';
377 $out .= '<input type="Text" name="data[' . $this->pObj->sObj . '][name]"' . $GLOBALS['TBE_TEMPLATE']->formWidth(20) . ' />' . $TSicon . ' = </nobr><br />';
378 $out .= '<input type="Text" name="data[' . $this->pObj->sObj . '][propertyValue]"' . $GLOBALS['TBE_TEMPLATE']->formWidth(40) . ' />';
379 $out .= '<input type="Submit" name="add_property" value="' . $GLOBALS['LANG']->getLL('addButton') . '" />';
380
381 $theOutput .= $this->pObj->doc->spacer(20);
382 $theOutput .= $this->pObj->doc->section($GLOBALS['LANG']->getLL('addProperty'), $out, 0, 0);
383
384 // clear
385 $out = '';
386 $out = $this->pObj->sObj." <b>" . t3lib_div::strtoupper($GLOBALS['LANG']->getLL('clear')) . "</b> &nbsp;&nbsp;";
387 $out .= '<input type="Checkbox" name="data[' . $this->pObj->sObj . '][clearValue]" value="1" />';
388 $out .= '<input type="Submit" name="clear_object" value="' . $GLOBALS['LANG']->getLL('clearButton') . '" />';
389 $theOutput .= $this->pObj->doc->spacer(20);
390 $theOutput .= $this->pObj->doc->section($GLOBALS['LANG']->getLL('clearObject'), $out, 0, 0);
391
392 $theOutput .= $this->pObj->doc->spacer(10);
393 } else {
394 $noTemplateMessage = t3lib_div::makeInstance(
395 't3lib_FlashMessage',
396 $GLOBALS['LANG']->getLL('noCurrentTemplate'),
397 $GLOBALS['LANG']->getLL('edit'),
398 t3lib_FlashMessage::ERROR
399 );
400
401 $this->pObj->doc->pushFlashMessage($noTemplateMessage);
402 }
403 // Links:
404 $out = '';
405 if (!$this->pObj->MOD_SETTINGS['ts_browser_TLKeys_'.$bType][$this->pObj->sObj]) {
406 if (count($theSetup)) {
407 $out = '<a href="index.php?id=' . $this->pObj->id . '&addKey[' . $this->pObj->sObj . ']=1&SET[ts_browser_toplevel_' . $bType . ']=' . rawurlencode($this->pObj->sObj) . '">';
408 $out .= sprintf($GLOBALS['LANG']->getLL('addKey'), $this->pObj->sObj);
409 }
410 } else {
411 $out = '<a href="index.php?id=' . $this->pObj->id . '&addKey[' . $this->pObj->sObj . ']=0&SET[ts_browser_toplevel_' . $bType . ']=0">';
412 $out .= sprintf($GLOBALS['LANG']->getLL('removeKey'), $this->pObj->sObj);
413 }
414 if ($out) {
415 $theOutput.=$this->pObj->doc->divider(5);
416 $theOutput.=$this->pObj->doc->section("",$out);
417 }
418
419 // back
420 $out = $GLOBALS['LANG']->getLL('back');
421 $out = '<a href="index.php?id='.$this->pObj->id.'"><b>'.$out.'</b></a>';
422 $theOutput.=$this->pObj->doc->divider(5);
423 $theOutput.=$this->pObj->doc->section("",$out);
424
425 } else {
426 $tmpl->tsbrowser_depthKeys=$this->pObj->MOD_SETTINGS["tsbrowser_depthKeys_".$bType];
427
428 if (t3lib_div::_POST('search') && t3lib_div::_POST('search_field')) { // If any POST-vars are send, update the condition array
429 $tmpl->tsbrowser_depthKeys = $tmpl->ext_getSearchKeys($theSetup, '', t3lib_div::_POST('search_field'), array());
430 }
431
432 $menu = '<div class="tsob-menu"><label>' . $GLOBALS['LANG']->getLL('browse') . '</label>';
433 $menu .= t3lib_BEfunc::getFuncMenu($this->pObj->id, 'SET[ts_browser_type]', $bType, $this->pObj->MOD_MENU['ts_browser_type']);
434 $menu .= '<label for="ts_browser_toplevel_' . $bType . '">' . $GLOBALS['LANG']->getLL('objectList') . '</label>';
435 $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]);
436
437 //search
438 $menu .= '<label for="search_field">' . $GLOBALS['LANG']->getLL('search') .'</label>';
439 $menu .= '<input type="Text" name="search_field" id="search_field" value="' . htmlspecialchars($POST['search_field']) . '"' . $GLOBALS['TBE_TEMPLATE']->formWidth(20) . '/>';
440 $menu .= '<input type="Submit" name="search" class="tsob-search-submit" value="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:search') . '" />';
441 $menu .= t3lib_BEfunc::getFuncCheck($this->pObj->id, 'SET[ts_browser_regexsearch]', $this->pObj->MOD_SETTINGS['ts_browser_regexsearch'], '', '', 'id="checkTs_browser_regexsearch"');
442 $menu .= '<label for="checkTs_browser_regexsearch">' . $GLOBALS['LANG']->getLL('regExp') . '</label>';
443 $menu .= '</div>';
444
445 $theOutput .= $this->pObj->doc->section('', '<nobr>' . $menu . '</nobr>');
446 $theKey=$this->pObj->MOD_SETTINGS["ts_browser_toplevel_".$bType];
447 if (!$theKey || !str_replace("-","",$theKey)) {$theKey="";}
448 list($theSetup,$theSetupValue) = $tmpl->ext_getSetup($theSetup, ($this->pObj->MOD_SETTINGS['ts_browser_toplevel_'.$bType]?$this->pObj->MOD_SETTINGS['ts_browser_toplevel_'.$bType]:''));
449 $tree = $tmpl->ext_getObjTree($theSetup, $theKey, '', '', $theSetupValue, $this->pObj->MOD_SETTINGS['ts_browser_alphaSort']);
450 $tree = $tmpl->substituteCMarkers($tree);
451
452
453
454 // Parser Errors:
455 $pEkey = ($bType=="setup"?"config":"constants");
456 if (count($tmpl->parserErrors[$pEkey])) {
457 reset($tmpl->parserErrors[$pEkey]);
458 $errMsg=array();
459 while(list(,$inf)=each($tmpl->parserErrors[$pEkey])) {
460 $errMsg[]=($inf[1]).": &nbsp; &nbsp;".$inf[0];
461 }
462 $theOutput .= $this->pObj->doc->spacer(10);
463 $theOutput .= $this->pObj->doc->section($GLOBALS['TBE_TEMPLATE']->rfw($GLOBALS['LANG']->getLL('errorsWarnings')), implode($errMsg, "<br />"), 0, 1, 0, 1);
464 }
465
466
467
468 if (isset($this->pObj->MOD_SETTINGS["ts_browser_TLKeys_".$bType][$theKey])) {
469 $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>';
470 } else {
471 $remove = '';
472 }
473 $label = $theKey ? $theKey : ($bType == 'setup' ? t3lib_div::strtoupper($GLOBALS['LANG']->getLL('setupRoot')) : t3lib_div::strtoupper($GLOBALS['LANG']->getLL('constantRoot')));
474 $theOutput .= $this->pObj->doc->spacer(15);
475 $theOutput .= $this->pObj->doc->sectionEnd();
476 $theOutput .= '<table border="0" cellpadding="1" cellspacing="0" id="typo3-objectBrowser" width="100%">
477 <tr>
478 <td><img src=clear.gif width=4 height=1></td>
479 <td class="bgColor2">
480 <table border=0 cellpadding=0 cellspacing=0 class="bgColor5" width="100%"><tr><td nowrap width="99%"><b>'.$label.'</b></td>'.$remove.'</tr></table>
481 </td>
482 </tr>
483 <tr>
484 <td><img src=clear.gif width=4 height=1></td>
485 <td class="bgColor2">
486 <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>
487 </tr>
488 </table>
489 ';
490
491 // second row options
492 $menu = '<div class="tsob-menu-row2">';
493 $menu .= t3lib_BEfunc::getFuncCheck($this->pObj->id, 'SET[ts_browser_showComments]', $this->pObj->MOD_SETTINGS['ts_browser_showComments'], '', '', 'id="checkTs_browser_showComments"');
494 $menu .= '<label for="checkTs_browser_showComments">' . $GLOBALS['LANG']->getLL('displayComments') . '</label>';
495 $menu .= t3lib_BEfunc::getFuncCheck($this->pObj->id, 'SET[ts_browser_alphaSort]', $this->pObj->MOD_SETTINGS['ts_browser_alphaSort'], '', '', 'id="checkTs_browser_alphaSort"');
496 $menu .= '<label for="checkTs_browser_alphaSort">' . $GLOBALS['LANG']->getLL('sortAlphabetically') . '</label>';
497 $menu .= t3lib_BEfunc::getFuncCheck($this->pObj->id, 'SET[ts_browser_fixedLgd]', $this->pObj->MOD_SETTINGS["ts_browser_fixedLgd"], '', '', 'id="checkTs_browser_fixedLgd"');
498 $menu .= '<label for="checkTs_browser_fixedLgd">' . $GLOBALS['LANG']->getLL('cropLines') . '</label>';
499 if ($bType == 'setup' && !$this->pObj->MOD_SETTINGS['ts_browser_fixedLgd']) {
500 $menu .= '<br /><br /><label>' . $GLOBALS['LANG']->getLL('displayConstants') . '</label>';
501 $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']);
502
503 }
504 $menu .= '</div>';
505
506 $theOutput .= $this->pObj->doc->section($GLOBALS['LANG']->getLL('displayOptions'), '<nobr>' . $menu . '</nobr>', 0, 1);
507
508 // Conditions:
509 if (is_array($tmpl->sections)) {
510 $theOutput .= $this->pObj->doc->section($GLOBALS['LANG']->getLL('conditions'), '', 0, 1);
511
512 $out = '';
513 reset($tmpl->sections);
514 while(list($key,$val)=each($tmpl->sections)) {
515 $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" : "") . ' />';
516 $out .= '<label for="check' .$key . '">' . $tmpl->substituteCMarkers(htmlspecialchars($val)) . '</label></td></tr>';
517 }
518 $theOutput.='
519 <table border="0" cellpadding="0" cellspacing="0" class="bgColor4">'.$out.'
520 <td><br /><input type="Submit" name="Submit" value="' . $GLOBALS['LANG']->getLL('setConditions') . '" /></td>
521 </table>
522
523 ';
524 }
525
526 // Ending section:
527 $theOutput .= $this->pObj->doc->sectionEnd();
528 }
529 return $theOutput;
530 }
531 }
532
533 if (defined("TYPO3_MODE") && $TYPO3_CONF_VARS[TYPO3_MODE]["XCLASS"]["ext/tstemplate_objbrowser/class.tx_tstemplateobjbrowser.php"]) {
534 include_once($TYPO3_CONF_VARS[TYPO3_MODE]["XCLASS"]["ext/tstemplate_objbrowser/class.tx_tstemplateobjbrowser.php"]);
535 }
536
537 ?>