TYPO3 API  SVNRelease
class.tx_tstemplateobjbrowser.php
Go to the documentation of this file.
00001 <?php
00002 /***************************************************************
00003 *  Copyright notice
00004 *
00005 *  (c) 1999-2011 Kasper Skårhøj (kasperYYYY@typo3.com)
00006 *  All rights reserved
00007 *
00008 *  This script is part of the TYPO3 project. The TYPO3 project is
00009 *  free software; you can redistribute it and/or modify
00010 *  it under the terms of the GNU General Public License as published by
00011 *  the Free Software Foundation; either version 2 of the License, or
00012 *  (at your option) any later version.
00013 *
00014 *  The GNU General Public License can be found at
00015 *  http://www.gnu.org/copyleft/gpl.html.
00016 *  A copy is found in the textfile GPL.txt and important notices to the license
00017 *  from the author is found in LICENSE.txt distributed with these scripts.
00018 *
00019 *
00020 *  This script is distributed in the hope that it will be useful,
00021 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00022 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00023 *  GNU General Public License for more details.
00024 *
00025 *  This copyright notice MUST APPEAR in all copies of the script!
00026 ***************************************************************/
00027 /**
00028  * [CLASS/FUNCTION INDEX of SCRIPT]
00029  *
00030  * $Id: class.tx_tstemplateobjbrowser.php 10120 2011-01-18 20:03:36Z ohader $
00031  */
00032 
00033 $GLOBALS['LANG']->includeLLFile('EXT:tstemplate_objbrowser/locallang.xml');
00034 
00035 /**
00036  * This class displays the submodule "TypoScript Object Browser" inside the Web > Template module
00037  *
00038  * @author      Kasper Skårhøj <kasperYYYY@typo3.com>
00039  * @package     TYPO3
00040  * @subpackage  tx_tstemplateobjbrowser
00041  */
00042 class tx_tstemplateobjbrowser extends t3lib_extobjbase {
00043 
00044     function init(&$pObj,$conf) {
00045         parent::init($pObj,$conf);
00046 
00047         $this->pObj->modMenu_dontValidateList.= ',ts_browser_toplevel_setup,ts_browser_toplevel_const,ts_browser_TLKeys_setup,ts_browser_TLKeys_const';
00048         $this->pObj->modMenu_setDefaultList.= ',ts_browser_fixedLgd,ts_browser_showComments';
00049     }
00050 
00051     function modMenu() {
00052         $modMenu = array (
00053             'ts_browser_type' => array(
00054                 'const' => $GLOBALS['LANG']->getLL('constants'),
00055                 'setup' => $GLOBALS['LANG']->getLL('setup')
00056             ),
00057             'ts_browser_toplevel_setup' => array(
00058                 '0' => $GLOBALS['LANG']->csConvObj->conv_case(
00059                     $GLOBALS['LANG']->charSet, $GLOBALS['LANG']->getLL('all'), 'toUpper'
00060                 )
00061             ),
00062             'ts_browser_toplevel_const' => array(
00063                 '0' => $GLOBALS['LANG']->csConvObj->conv_case(
00064                     $GLOBALS['LANG']->charSet, $GLOBALS['LANG']->getLL('all'), 'toUpper'
00065                 )
00066             ),
00067             'ts_browser_const' => array(
00068                 '0' => $GLOBALS['LANG']->getLL('plainSubstitution'),
00069                 'subst' => $GLOBALS['LANG']->getLL('substitutedGreen'),
00070                 'const' => $GLOBALS['LANG']->getLL('unsubstitutedGreen')
00071             ),
00072             'ts_browser_regexsearch' => '1',
00073             'ts_browser_fixedLgd' => '1',
00074             'ts_browser_showComments' => '1',
00075             'ts_browser_alphaSort' => '1',
00076         );
00077 
00078         foreach(array('setup','const') as $bType)   {
00079             $addKey = t3lib_div::_GET('addKey');
00080             if (is_array($addKey))  {       // If any plus-signs were clicked, it's registred.
00081                 reset($addKey);
00082                 if (current($addKey))   {
00083                     $this->pObj->MOD_SETTINGS['ts_browser_TLKeys_'.$bType][key($addKey)] = key($addKey);
00084                 } else {
00085                     unset($this->pObj->MOD_SETTINGS['ts_browser_TLKeys_'.$bType][key($addKey)]);
00086                 }
00087                 $GLOBALS['BE_USER']->pushModuleData($this->pObj->MCONF['name'],$this->pObj->MOD_SETTINGS);
00088             }
00089 
00090             if (count($this->pObj->MOD_SETTINGS['ts_browser_TLKeys_'.$bType]))  {
00091                 $modMenu['ts_browser_toplevel_'.$bType]['-']='---';
00092                 $modMenu['ts_browser_toplevel_'.$bType] = $modMenu['ts_browser_toplevel_'.$bType] + $this->pObj->MOD_SETTINGS['ts_browser_TLKeys_'.$bType];
00093             }
00094         }
00095 
00096         return $modMenu;
00097     }
00098 
00099     /**
00100      * [Describe function...]
00101      *
00102      * @param   [type]      $propertyArray: ...
00103      * @param   [type]      $parentType: ...
00104      * @param   [type]      $parentValue: ...
00105      * @return  [type]      ...
00106      */
00107     function verify_TSobjects($propertyArray,$parentType,$parentValue)  {
00108         $TSobjTable = array(
00109             "PAGE" => array(
00110                 "prop" => array (
00111                     "typeNum" => "int",
00112                     "1,2,3" => "COBJ",
00113                     "bodyTag" => "string"
00114                 )
00115             ),
00116             "TEXT" => array(
00117                 "prop" => array (
00118                     "value" => "string"
00119                 )
00120             ),
00121             "HTML" => array(
00122                 "prop" => array (
00123                     "value" => "stdWrap"
00124                 )
00125             ),
00126             "stdWrap" => array(
00127                 "prop" => array (
00128                     "field" => "string",
00129                     "current" => "boolean"
00130                 )
00131             ),
00132         );
00133         $TSobjDataTypes = array(
00134             "COBJ" => "TEXT,CONTENT",
00135             "PAGE" => "PAGE",
00136             "stdWrap" => ""
00137         );
00138 
00139         if ($parentType)    {
00140             if (isset($TSobjDataTypes[$parentType]) && (!$TSobjDataTypes[$parentType] || t3lib_div::inlist($TSobjDataTypes[$parentType],$parentValue))) {
00141                 $ObjectKind = $parentValue;
00142             } else {
00143                 $ObjectKind = "";   // Object kind is "" if it should be known.
00144             }
00145         } else {
00146             $ObjectKind = $parentValue; // If parentType is not given, then it can be anything. Free.
00147         }
00148 
00149         if ($ObjectKind && is_array($TSobjTable[$ObjectKind]))  {
00150             $result=array();
00151             if (is_array($propertyArray))       {
00152                 foreach ($propertyArray as $key => $val) {
00153                     if (t3lib_div::testInt($key))   {   // If num-arrays
00154                         $result[$key]=$TSobjTable[$ObjectKind]["prop"]["1,2,3"];
00155                     } else {    // standard
00156                         $result[$key]=$TSobjTable[$ObjectKind]["prop"][$key];
00157                     }
00158                 }
00159             }
00160             return $result;
00161         }
00162     }
00163 
00164     /**
00165      * [Describe function...]
00166      *
00167      * @param   [type]      $pageId: ...
00168      * @param   [type]      $template_uid: ...
00169      * @return  [type]      ...
00170      */
00171     function initialize_editor($pageId,$template_uid=0) {
00172             // Initializes the module. Done in this function because we may need to re-initialize if data is submitted!
00173         global $tmpl,$tplRow,$theConstants;
00174 
00175         $tmpl = t3lib_div::makeInstance("t3lib_tsparser_ext");  // Defined global here!
00176         $tmpl->tt_track = 0;    // Do not log time-performance information
00177         $tmpl->init();
00178 
00179                 // Gets the rootLine
00180         $sys_page = t3lib_div::makeInstance("t3lib_pageSelect");
00181         $rootLine = $sys_page->getRootLine($pageId);
00182         $tmpl->runThroughTemplates($rootLine,$template_uid);    // This generates the constants/config + hierarchy info for the template.
00183 
00184         $tplRow = $tmpl->ext_getFirstTemplate($pageId,$template_uid);   // Get the row of the first VISIBLE template of the page. whereclause like the frontend.
00185         if (is_array($tplRow))  {   // IF there was a template...
00186             return 1;
00187         }
00188     }
00189 
00190     /**
00191      * [Describe function...]
00192      *
00193      * @return  [type]      ...
00194      */
00195     function main() {
00196         global $SOBE,$BE_USER,$BACK_PATH,$TCA_DESCR,$TCA,$CLIENT,$TYPO3_CONF_VARS;
00197         global $tmpl,$tplRow,$theConstants;
00198 
00199         $POST = t3lib_div::_POST();
00200 
00201         // **************************
00202         // Checking for more than one template an if, set a menu...
00203         // **************************
00204         $manyTemplatesMenu = $this->pObj->templateMenu();
00205         $template_uid = 0;
00206         if ($manyTemplatesMenu) {
00207             $template_uid = $this->pObj->MOD_SETTINGS["templatesOnPage"];
00208         }
00209 
00210 
00211 
00212 
00213 
00214         // **************************
00215         // Main
00216         // **************************
00217 
00218         // BUGBUG: Should we check if the uset may at all read and write template-records???
00219         $bType= $this->pObj->MOD_SETTINGS["ts_browser_type"];
00220         $existTemplate = $this->initialize_editor($this->pObj->id,$template_uid);       // initialize
00221         if ($existTemplate) {
00222             $theOutput .= '<h4 style="margin-bottom:5px;">' . $GLOBALS['LANG']->getLL('currentTemplate') . ' <img ' .
00223                 t3lib_iconWorks::skinImg($BACK_PATH, t3lib_iconWorks::getIcon('sys_template', $tplRow)) . ' align="top" /> <strong>' .
00224                 $this->pObj->linkWrapTemplateTitle($tplRow["title"], ($bType == "setup" ? "config" : "constants")) . '</strong>' .
00225                 htmlspecialchars(trim($tplRow["sitetitle"]) ? ' - (' . $tplRow["sitetitle"] . ')' : '') . '</h4>';
00226             if ($manyTemplatesMenu) {
00227                 $theOutput.=$this->pObj->doc->section("",$manyTemplatesMenu);
00228                 $theOutput.=$this->pObj->doc->divider(5);
00229             }
00230 
00231             if ($POST["add_property"] || $POST["update_value"] || $POST["clear_object"])    {
00232                     // add property
00233                 $line="";
00234                 if (is_array($POST["data"]))    {
00235                     $name = key($POST["data"]);
00236                     if ($POST['data'][$name]['name']!=='') {
00237                             // 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.
00238                         unset($POST['update_value']);
00239                         $POST['add_property'] = 'Add';
00240                     }
00241                     if ($POST["add_property"])  {
00242                         $property = trim($POST['data'][$name]['name']);
00243                         if (preg_replace('/[^a-zA-Z0-9_\.]*/', '', $property) != $property) {
00244                             $badPropertyMessage = t3lib_div::makeInstance(
00245                                 't3lib_FlashMessage',
00246                                 $GLOBALS['LANG']->getLL('noSpaces') . '<br />'
00247                                     . $GLOBALS['LANG']->getLL('nothingUpdated'),
00248                                 $GLOBALS['LANG']->getLL('badProperty'),
00249                                 t3lib_FlashMessage::ERROR
00250                             );
00251                             t3lib_FlashMessageQueue::addMessage($badPropertyMessage);
00252                         } else {
00253                             $pline = $name . '.' . $property . ' = '
00254                                 . trim($POST['data'][$name]['propertyValue']);
00255 
00256                             $propertyAddedMessage = t3lib_div::makeInstance(
00257                                 't3lib_FlashMessage',
00258                                 htmlspecialchars($pline),
00259                                 $GLOBALS['LANG']->getLL('propertyAdded')
00260                             );
00261                             t3lib_FlashMessageQueue::addMessage($propertyAddedMessage);
00262 
00263                             $line.=LF.$pline;
00264                         }
00265                     } elseif ($POST['update_value']) {
00266                         $pline = $name . " = " . trim($POST['data'][$name]['value']);
00267 
00268                         $updatedMessage = t3lib_div::makeInstance(
00269                             't3lib_FlashMessage',
00270                             htmlspecialchars($pline),
00271                             $GLOBALS['LANG']->getLL('valueUpdated')
00272                         );
00273                         t3lib_FlashMessageQueue::addMessage($updatedMessage);
00274 
00275                         $line .= LF . $pline;
00276                     } elseif ($POST['clear_object']) {
00277                         if ($POST['data'][$name]['clearValue']) {
00278                             $pline = $name . ' >';
00279 
00280                             $objectClearedMessage = t3lib_div::makeInstance(
00281                                 't3lib_FlashMessage',
00282                                 htmlspecialchars($pline),
00283                                 $GLOBALS['LANG']->getLL('objectCleared')
00284                             );
00285                             t3lib_FlashMessageQueue::addMessage($objectClearedMessage);
00286 
00287                             $line .= LF . $pline;
00288                         }
00289                     }
00290                 }
00291                 if ($line)  {
00292                     $saveId = $tplRow['_ORIG_uid'] ? $tplRow['_ORIG_uid'] : $tplRow['uid'];
00293                         // Set the data to be saved
00294                     $recData=array();
00295                     $field =$bType=="setup"?"config":"constants";
00296                     $recData["sys_template"][$saveId][$field] = $tplRow[$field].$line;
00297                         // Create new  tce-object
00298                     $tce = t3lib_div::makeInstance("t3lib_TCEmain");
00299                     $tce->stripslashes_values=0;
00300                         // Initialize
00301                     $tce->start($recData,Array());
00302                         // Saved the stuff
00303                     $tce->process_datamap();
00304                         // Clear the cache (note: currently only admin-users can clear the cache in tce_main.php)
00305                     $tce->clear_cacheCmd("all");
00306 
00307                         // re-read the template ...
00308                     $this->initialize_editor($this->pObj->id,$template_uid);
00309                 }
00310             }
00311         }
00312 
00313         $tsbr = t3lib_div::_GET('tsbr');
00314         $update=0;
00315         if (is_array($tsbr))    {       // If any plus-signs were clicked, it's registred.
00316             $this->pObj->MOD_SETTINGS["tsbrowser_depthKeys_".$bType] = $tmpl->ext_depthKeys($tsbr, $this->pObj->MOD_SETTINGS["tsbrowser_depthKeys_".$bType]);
00317             $update=1;
00318         }
00319 
00320         if ($POST["Submit"])    {       // If any POST-vars are send, update the condition array
00321             $this->pObj->MOD_SETTINGS["tsbrowser_conditions"] = $POST["conditions"];
00322             $update=1;
00323         }
00324         if ($update)    { $GLOBALS["BE_USER"]->pushModuleData($this->pObj->MCONF["name"],$this->pObj->MOD_SETTINGS); }
00325 
00326 
00327         $tmpl->matchAlternative = $this->pObj->MOD_SETTINGS['tsbrowser_conditions'];
00328         $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.
00329 
00330         $tmpl->constantMode = $this->pObj->MOD_SETTINGS["ts_browser_const"];
00331         if ($this->pObj->sObj && $tmpl->constantMode)   {$tmpl->constantMode = "untouched";}
00332 
00333         $tmpl->regexMode = $this->pObj->MOD_SETTINGS["ts_browser_regexsearch"];
00334         $tmpl->fixedLgd=$this->pObj->MOD_SETTINGS["ts_browser_fixedLgd"];
00335         $tmpl->linkObjects = TRUE;
00336         $tmpl->ext_regLinenumbers = TRUE;
00337         $tmpl->ext_regComments = $this->pObj->MOD_SETTINGS['ts_browser_showComments'];;
00338         $tmpl->bType=$bType;
00339         $tmpl->resourceCheck=1;
00340         $tmpl->uplPath = PATH_site.$tmpl->uplPath;
00341         $tmpl->removeFromGetFilePath = PATH_site;
00342         //debug($tmpl->uplPath);
00343 
00344         if ($this->pObj->MOD_SETTINGS["ts_browser_type"]=="const")  {
00345             $tmpl->ext_constants_BRP=intval(t3lib_div::_GP("breakPointLN"));
00346         } else {
00347             $tmpl->ext_config_BRP=intval(t3lib_div::_GP("breakPointLN"));
00348         }
00349         $tmpl->generateConfig();
00350 
00351         if ($bType=="setup")    {
00352             $theSetup = $tmpl->setup;
00353         } else {
00354             $theSetup = $tmpl->setup_constants;
00355         }
00356 
00357             // EDIT A VALUE:
00358         if ($this->pObj->sObj)  {
00359             list($theSetup,$theSetupValue) = $tmpl->ext_getSetup($theSetup, ($this->pObj->sObj?$this->pObj->sObj:""));
00360 
00361             if ($existTemplate) {
00362                     // Value
00363                 $out = '';
00364                 $out.= htmlspecialchars($this->pObj->sObj) . ' =<br />';
00365                 $out .= '<input type="Text" name="data[' . htmlspecialchars($this->pObj->sObj) . '][value]" value="' . htmlspecialchars($theSetupValue) . '"' . $GLOBALS['TBE_TEMPLATE']->formWidth(40) . ' />';
00366                 $out .= '<input type="Submit" name="update_value" value="' . $GLOBALS['LANG']->getLL('updateButton') . '" />';
00367                 $theOutput .= $this->pObj->doc->section($GLOBALS['LANG']->getLL('editProperty'), $out, 0, 0);
00368 
00369                     // Property
00370                 if (t3lib_extMgm::isLoaded("tsconfig_help"))    {
00371                     $url=$BACK_PATH."wizard_tsconfig.php?mode=tsref&onlyProperty=1";
00372                     $params=array();
00373                     $params["formName"]="editForm";
00374                     $params["itemName"]="data[" . htmlspecialchars($this->pObj->sObj) . "][name]";
00375                     $params["itemValue"]="data[" . htmlspecialchars($this->pObj->sObj) . "][propertyValue]";
00376                     $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>';
00377                 } else $TSicon="";
00378                 $out = '';
00379                 $out = '<nobr>' . htmlspecialchars($this->pObj->sObj) . '.';
00380                 $out .= '<input type="Text" name="data[' . htmlspecialchars($this->pObj->sObj) . '][name]"' . $GLOBALS['TBE_TEMPLATE']->formWidth(20) . ' />' . $TSicon . ' = </nobr><br />';
00381                 $out .= '<input type="Text" name="data[' . htmlspecialchars($this->pObj->sObj) . '][propertyValue]"' . $GLOBALS['TBE_TEMPLATE']->formWidth(40) . ' />';
00382                 $out .= '<input type="Submit" name="add_property" value="' . $GLOBALS['LANG']->getLL('addButton') . '" />';
00383 
00384                 $theOutput .= $this->pObj->doc->spacer(20);
00385                 $theOutput .= $this->pObj->doc->section($GLOBALS['LANG']->getLL('addProperty'), $out, 0, 0);
00386 
00387                     // clear
00388                 $out = '';
00389                 $out = htmlspecialchars($this->pObj->sObj) . " <strong>" .
00390                     $GLOBALS['LANG']->csConvObj->conv_case(
00391                         $GLOBALS['LANG']->charSet, $GLOBALS['LANG']->getLL('clear'), 'toUpper'
00392                     ) . "</strong> &nbsp;&nbsp;";
00393                 $out .= '<input type="Checkbox" name="data[' . htmlspecialchars($this->pObj->sObj) . '][clearValue]" value="1" />';
00394                 $out .= '<input type="Submit" name="clear_object" value="' . $GLOBALS['LANG']->getLL('clearButton') . '" />';
00395                 $theOutput .= $this->pObj->doc->spacer(20);
00396                 $theOutput .= $this->pObj->doc->section($GLOBALS['LANG']->getLL('clearObject'), $out, 0, 0);
00397 
00398                 $theOutput .= $this->pObj->doc->spacer(10);
00399             } else {
00400                 $noTemplateMessage = t3lib_div::makeInstance(
00401                     't3lib_FlashMessage',
00402                     $GLOBALS['LANG']->getLL('noCurrentTemplate'),
00403                     $GLOBALS['LANG']->getLL('edit'),
00404                     t3lib_FlashMessage::ERROR
00405                 );
00406 
00407                 t3lib_FlashMessageQueue::addMessage($noTemplateMessage);
00408             }
00409                 // Links:
00410             $out = '';
00411             if (!$this->pObj->MOD_SETTINGS['ts_browser_TLKeys_'.$bType][$this->pObj->sObj]) {
00412                 if (count($theSetup))   {
00413                     $out = '<a href="index.php?id=' . $this->pObj->id . '&addKey[' . rawurlencode($this->pObj->sObj) . ']=1&SET[ts_browser_toplevel_' . $bType . ']=' . rawurlencode($this->pObj->sObj) . '">';
00414                     $out .= sprintf($GLOBALS['LANG']->getLL('addKey'), htmlspecialchars($this->pObj->sObj));
00415                 }
00416             } else {
00417                 $out = '<a href="index.php?id=' . $this->pObj->id . '&addKey[' . rawurlencode($this->pObj->sObj) . ']=0&SET[ts_browser_toplevel_' . $bType . ']=0">';
00418                 $out .= sprintf($GLOBALS['LANG']->getLL('removeKey'), htmlspecialchars($this->pObj->sObj));
00419             }
00420             if ($out)   {
00421                 $theOutput.=$this->pObj->doc->divider(5);
00422                 $theOutput.=$this->pObj->doc->section("",$out);
00423             }
00424 
00425                 // back
00426             $out = $GLOBALS['LANG']->getLL('back');
00427             $out = '<a href="index.php?id='.$this->pObj->id.'"><strong>'.$out.'</strong></a>';
00428             $theOutput.=$this->pObj->doc->divider(5);
00429             $theOutput.=$this->pObj->doc->section("",$out);
00430 
00431         } else {
00432             $tmpl->tsbrowser_depthKeys=$this->pObj->MOD_SETTINGS["tsbrowser_depthKeys_".$bType];
00433 
00434             if (t3lib_div::_POST('search') && t3lib_div::_POST('search_field')) {       // If any POST-vars are send, update the condition array
00435                 $tmpl->tsbrowser_depthKeys = $tmpl->ext_getSearchKeys($theSetup, '', t3lib_div::_POST('search_field'), array());
00436             }
00437 
00438             $menu = '<div class="tsob-menu"><label>' . $GLOBALS['LANG']->getLL('browse') . '</label>';
00439             $menu .= t3lib_BEfunc::getFuncMenu($this->pObj->id, 'SET[ts_browser_type]', $bType, $this->pObj->MOD_MENU['ts_browser_type']);
00440             $menu .= '<label for="ts_browser_toplevel_' . $bType . '">' . $GLOBALS['LANG']->getLL('objectList') . '</label>';
00441             $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]);
00442 
00443             //search
00444             $menu .= '<label for="search_field">' . $GLOBALS['LANG']->getLL('search') .'</label>';
00445             $menu .= '<input type="Text" name="search_field" id="search_field" value="' . htmlspecialchars($POST['search_field']) . '"' . $GLOBALS['TBE_TEMPLATE']->formWidth(20) . '/>';
00446             $menu .= '<input type="Submit" name="search" class="tsob-search-submit" value="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:search') . '" />';
00447             $menu .= t3lib_BEfunc::getFuncCheck($this->pObj->id, 'SET[ts_browser_regexsearch]', $this->pObj->MOD_SETTINGS['ts_browser_regexsearch'], '', '', 'id="checkTs_browser_regexsearch"');
00448             $menu .= '<label for="checkTs_browser_regexsearch">' . $GLOBALS['LANG']->getLL('regExp') . '</label>';
00449             $menu .= '</div>';
00450 
00451             $theOutput .= $this->pObj->doc->section('', '<nobr>' . $menu . '</nobr>');
00452             $theKey=$this->pObj->MOD_SETTINGS["ts_browser_toplevel_".$bType];
00453             if (!$theKey || !str_replace("-","",$theKey))   {$theKey="";}
00454             list($theSetup,$theSetupValue) = $tmpl->ext_getSetup($theSetup, ($this->pObj->MOD_SETTINGS['ts_browser_toplevel_'.$bType]?$this->pObj->MOD_SETTINGS['ts_browser_toplevel_'.$bType]:''));
00455             $tree = $tmpl->ext_getObjTree($theSetup, $theKey, '', '', $theSetupValue, $this->pObj->MOD_SETTINGS['ts_browser_alphaSort']);
00456             $tree = $tmpl->substituteCMarkers($tree);
00457 
00458 
00459 
00460                 // Parser Errors:
00461             $pEkey = ($bType=="setup"?"config":"constants");
00462             if (count($tmpl->parserErrors[$pEkey])) {
00463                 $errMsg=array();
00464                 foreach ($tmpl->parserErrors[$pEkey] as $inf) {
00465                     $errMsg[]=($inf[1]).": &nbsp; &nbsp;".$inf[0];
00466                 }
00467                 $theOutput .= $this->pObj->doc->spacer(10);
00468 
00469                 $flashMessage = t3lib_div::makeInstance(
00470                         't3lib_FlashMessage',
00471                         implode($errMsg, '<br />'),
00472                         $GLOBALS['LANG']->getLL('errorsWarnings'),
00473                         t3lib_FlashMessage::ERROR
00474                     );
00475                 $theOutput .= $flashMessage->render();
00476             }
00477 
00478 
00479 
00480             if (isset($this->pObj->MOD_SETTINGS["ts_browser_TLKeys_".$bType][$theKey])) {
00481                 $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>';
00482             } else {
00483                 $remove = '';
00484             }
00485             $label = $theKey ? $theKey :
00486                 ($bType == 'setup' ?
00487                     $GLOBALS['LANG']->csConvObj->conv_case($GLOBALS['LANG']->charSet, $GLOBALS['LANG']->getLL('setupRoot'), 'toUpper') :
00488                     $GLOBALS['LANG']->csConvObj->conv_case($GLOBALS['LANG']->charSet, $GLOBALS['LANG']->getLL('constantRoot'), 'toUpper')
00489                 );
00490             $theOutput .= $this->pObj->doc->spacer(15);
00491             $theOutput .= $this->pObj->doc->sectionEnd();
00492             $theOutput .= '<table border="0" cellpadding="1" cellspacing="0" id="typo3-objectBrowser" width="100%">
00493                     <tr>
00494                         <td><img src="clear.gif" width="4px" height="1px" /></td>
00495                         <td class="bgColor2">
00496                             <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>
00497                         </td>
00498                     </tr>
00499                     <tr>
00500                         <td><img src="clear.gif" width="4px" height="1px" /></td>
00501                         <td class="bgColor2">
00502                             <table border="0" cellpadding="0" cellspacing="0" class="bgColor4" width="100%"><tr><td nowrap="nowrap">' . $tree . '</td></tr></table></td>
00503                     </tr>
00504                 </table>
00505             ';
00506 
00507             // second row options
00508             $menu = '<div class="tsob-menu-row2">';
00509             $menu .= t3lib_BEfunc::getFuncCheck($this->pObj->id, 'SET[ts_browser_showComments]', $this->pObj->MOD_SETTINGS['ts_browser_showComments'], '', '', 'id="checkTs_browser_showComments"');
00510             $menu .= '<label for="checkTs_browser_showComments">' . $GLOBALS['LANG']->getLL('displayComments') . '</label>';
00511             $menu .= t3lib_BEfunc::getFuncCheck($this->pObj->id, 'SET[ts_browser_alphaSort]', $this->pObj->MOD_SETTINGS['ts_browser_alphaSort'], '', '', 'id="checkTs_browser_alphaSort"');
00512             $menu .= '<label for="checkTs_browser_alphaSort">' . $GLOBALS['LANG']->getLL('sortAlphabetically') . '</label>';
00513             $menu .= t3lib_BEfunc::getFuncCheck($this->pObj->id, 'SET[ts_browser_fixedLgd]', $this->pObj->MOD_SETTINGS["ts_browser_fixedLgd"], '', '', 'id="checkTs_browser_fixedLgd"');
00514             $menu .= '<label for="checkTs_browser_fixedLgd">' . $GLOBALS['LANG']->getLL('cropLines') . '</label>';
00515             if ($bType == 'setup' && !$this->pObj->MOD_SETTINGS['ts_browser_fixedLgd']) {
00516                 $menu .= '<br /><br /><label>' . $GLOBALS['LANG']->getLL('displayConstants') . '</label>';
00517                 $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']);
00518 
00519             }
00520             $menu .= '</div>';
00521 
00522             $theOutput .= $this->pObj->doc->section($GLOBALS['LANG']->getLL('displayOptions'), '<nobr>' . $menu . '</nobr>', 0, 1);
00523 
00524                 // Conditions:
00525             if (is_array($tmpl->sections))  {
00526                 $theOutput .= $this->pObj->doc->section($GLOBALS['LANG']->getLL('conditions'), '', 0, 1);
00527 
00528                 $out = '';
00529                 foreach ($tmpl->sections as $key => $val) {
00530                     $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" : "") . ' />';
00531                     $out .= '<label for="check' .$key . '">' . $tmpl->substituteCMarkers(htmlspecialchars($val)) . '</label></td></tr>';
00532                 }
00533                 $theOutput.='
00534                                 <table border="0" cellpadding="0" cellspacing="0" class="bgColor4">'.$out.'
00535                         <td><br /><input type="Submit" name="Submit" value="' . $GLOBALS['LANG']->getLL('setConditions') . '" /></td>
00536                                 </table>
00537 
00538                 ';
00539             }
00540 
00541                 // Ending section:
00542             $theOutput .= $this->pObj->doc->sectionEnd();
00543         }
00544         return $theOutput;
00545     }
00546 }
00547 
00548 if (defined("TYPO3_MODE") && $TYPO3_CONF_VARS[TYPO3_MODE]["XCLASS"]["ext/tstemplate_objbrowser/class.tx_tstemplateobjbrowser.php"]) {
00549     include_once($TYPO3_CONF_VARS[TYPO3_MODE]["XCLASS"]["ext/tstemplate_objbrowser/class.tx_tstemplateobjbrowser.php"]);
00550 }
00551 
00552 ?>