* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
/**
- * @author Kasper Skaarhoj <kasperYYYY@typo3.com>
+ * [CLASS/FUNCTION INDEX of SCRIPT]
+ *
+ * $Id$
*/
+$GLOBALS['LANG']->includeLLFile('EXT:tstemplate_objbrowser/locallang.xml');
+
+/**
+ * This class displays the submodule "TypoScript Object Browser" inside the Web > Template module
+ *
+ * @author Kasper Skaarhoj <kasperYYYY@typo3.com>
+ * @package TYPO3
+ * @subpackage tx_tstemplateobjbrowser
+ */
class tx_tstemplateobjbrowser extends t3lib_extobjbase {
function init(&$pObj,$conf) {
parent::init($pObj,$conf);
$this->pObj->modMenu_setDefaultList.= ',ts_browser_fixedLgd,ts_browser_showComments';
}
- function modMenu() {
- global $LANG;
-
+ function modMenu() {
$modMenu = array (
- "ts_browser_type" => array(
- "const" => "Constants",
- "setup" => "Setup"
+ 'ts_browser_type' => array(
+ 'const' => $GLOBALS['LANG']->getLL('constants', true),
+ 'setup' => $GLOBALS['LANG']->getLL('setup', true)
),
- "ts_browser_toplevel_setup" => array(
- "0" => "ALL"
+ 'ts_browser_toplevel_setup' => array(
+ '0' => t3lib_div::strtoupper($GLOBALS['LANG']->getLL('all', true))
),
- "ts_browser_toplevel_const" => array(
- "0" => "ALL"
+ 'ts_browser_toplevel_const' => array(
+ '0' => t3lib_div::strtoupper($GLOBALS['LANG']->getLL('all', true))
),
- "ts_browser_const" => array(
- "0" => "Plain substitution (default)",
- "subst" => "Substituted constants in green",
- "const" => "UN-substituted constants in green"
+ 'ts_browser_const' => array(
+ '0' => $GLOBALS['LANG']->getLL('plainSubstitution', true),
+ 'subst' => $GLOBALS['LANG']->getLL('substitutedGreen', true),
+ 'const' => $GLOBALS['LANG']->getLL('unsubstitutedGreen', true)
),
'ts_browser_regexsearch' => '1',
'ts_browser_fixedLgd' => '1',
* @return [type] ...
*/
function main() {
- global $SOBE,$BE_USER,$LANG,$BACK_PATH,$TCA_DESCR,$TCA,$CLIENT,$TYPO3_CONF_VARS;
+ global $SOBE,$BE_USER,$BACK_PATH,$TCA_DESCR,$TCA,$CLIENT,$TYPO3_CONF_VARS;
global $tmpl,$tplRow,$theConstants;
$POST = t3lib_div::_POST();
$bType= $this->pObj->MOD_SETTINGS["ts_browser_type"];
$existTemplate = $this->initialize_editor($this->pObj->id,$template_uid); // initialize
if ($existTemplate) {
- $theOutput .= '<h4 style="margin-bottom:5px;">Current template: <img ' .
+ $theOutput .= '<h4 style="margin-bottom:5px;">' . $GLOBALS['LANG']->getLL('currentTemplate', true) . ' <img ' .
t3lib_iconWorks::skinImg($BACK_PATH, t3lib_iconWorks::getIcon('sys_template', $tplRow)) . ' align="top" /> <b>' .
$this->pObj->linkWrapTemplateTitle($tplRow["title"], ($bType == "setup" ? "config" : "constants")) . '</b>' .
htmlspecialchars(trim($tplRow["sitetitle"]) ? ' - (' . $tplRow["sitetitle"] . ')' : '') . '</h4>';
if ($POST["add_property"]) {
$property = trim($POST["data"][$name]["name"]);
if (preg_replace('/[^a-zA-Z0-9_\.]*/','',$property)!=$property) {
- $theOutput.=$this->pObj->doc->spacer(10);
- $theOutput .= $this->pObj->doc->section($GLOBALS["TBE_TEMPLATE"]->rfw("BAD PROPERTY!"), 'You must enter a property with characters a-z, A-Z and 0-9, no spaces!<br />Nothing was updated!', 0, 0, 0, 1);
+ $theOutput .= $this->pObj->doc->spacer(10);
+ $theOutput .= $this->pObj->doc->section(
+ $GLOBALS['TBE_TEMPLATE']->rfw($GLOBALS['LANG']->getLL('badProperty', true)),
+ $GLOBALS['LANG']->getLL('noSpaces', true) . '<br />' . $GLOBALS['LANG']->getLL('nothingUpdated', true),
+ 0, 0, 0, 1
+ );
} else {
$pline= $name.".".$property." = ".trim($POST["data"][$name]["propertyValue"]);
- $theOutput.=$this->pObj->doc->spacer(10);
- $theOutput.=$this->pObj->doc->section($GLOBALS["TBE_TEMPLATE"]->rfw("PROPERTY ADDED"),htmlspecialchars($pline),0,0,0,1);
+ $theOutput .= $this->pObj->doc->spacer(10);
+ $theOutput .= $this->pObj->doc->section(
+ $GLOBALS['TBE_TEMPLATE']->rfw($GLOBALS['LANG']->getLL('propertyAdded', true)),
+ htmlspecialchars($pline), 0, 0, 0, 1
+ );
$line.=chr(10).$pline;
}
}
elseif ($POST['update_value']) {
$pline= $name." = ".trim($POST["data"][$name]["value"]);
- $theOutput.=$this->pObj->doc->spacer(10);
- $theOutput.=$this->pObj->doc->section($GLOBALS["TBE_TEMPLATE"]->rfw("VALUE UPDATED"),htmlspecialchars($pline),0,0,0,1);
+ $theOutput .= $this->pObj->doc->spacer(10);
+ $theOutput .= $this->pObj->doc->section(
+ $GLOBALS['TBE_TEMPLATE']->rfw($GLOBALS['LANG']->getLL('valueUpdated', true)),
+ htmlspecialchars($pline), 0, 0, 0, 1
+ );
$line.=chr(10).$pline;
}
elseif ($POST['clear_object']) {
if ($POST["data"][$name]["clearValue"]) {
$pline= $name." >";
- $theOutput.=$this->pObj->doc->spacer(10);
- $theOutput.=$this->pObj->doc->section($GLOBALS["TBE_TEMPLATE"]->rfw("Object cleared"),htmlspecialchars($pline),0,0,0,1);
+ $theOutput .= $this->pObj->doc->spacer(10);
+ $theOutput .= $this->pObj->doc->section(
+ $GLOBALS['TBE_TEMPLATE']->rfw($GLOBALS['LANG']->getLL('objectCleared', true)),
+ htmlspecialchars($pline), 0, 0, 0, 1
+ );
$line.=chr(10).$pline;
}
}
// Value
$out = '';
$out.= $this->pObj->sObj.' =<br />';
- $out .= '<input type="Text" name="data[' . $this->pObj->sObj . '][value]" value="' . htmlspecialchars($theSetupValue) . '"' . $GLOBALS["TBE_TEMPLATE"]->formWidth(40) . ' />';
- $out .= '<input type="Submit" name="update_value" value="Update" />';
- $theOutput.=$this->pObj->doc->section("Edit object/property value:",$out,0,0);
+ $out .= '<input type="Text" name="data[' . $this->pObj->sObj . '][value]" value="' . htmlspecialchars($theSetupValue) . '"' . $GLOBALS['TBE_TEMPLATE']->formWidth(40) . ' />';
+ $out .= '<input type="Submit" name="update_value" value="' . $GLOBALS['LANG']->getLL('updateButton', true) . '" />';
+ $theOutput .= $this->pObj->doc->section($GLOBALS['LANG']->getLL('editProperty', true), $out, 0, 0);
// Property
if (t3lib_extMgm::isLoaded("tsconfig_help")) {
$params["formName"]="editForm";
$params["itemName"]="data[".$this->pObj->sObj."][name]";
$params["itemValue"]="data[".$this->pObj->sObj."][propertyValue]";
- $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="TSref reference"></a>';
+ $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', true) . '"></a>';
} else $TSicon="";
- $out="";
- $out="<nobr>".$this->pObj->sObj.".";
- $out .= '<input type="Text" name="data[' . $this->pObj->sObj . '][name]"' . $GLOBALS["TBE_TEMPLATE"]->formWidth(20) . ' />' . $TSicon . ' = </nobr><br />';
- $out .= '<input type="Text" name="data[' . $this->pObj->sObj . '][propertyValue]"' . $GLOBALS["TBE_TEMPLATE"]->formWidth(40) . ' />';
- $out .= '<input type="Submit" name="add_property" value="Add" />';
+ $out = '';
+ $out = '<nobr>' . $this->pObj->sObj . '.';
+ $out .= '<input type="Text" name="data[' . $this->pObj->sObj . '][name]"' . $GLOBALS['TBE_TEMPLATE']->formWidth(20) . ' />' . $TSicon . ' = </nobr><br />';
+ $out .= '<input type="Text" name="data[' . $this->pObj->sObj . '][propertyValue]"' . $GLOBALS['TBE_TEMPLATE']->formWidth(40) . ' />';
+ $out .= '<input type="Submit" name="add_property" value="' . $GLOBALS['LANG']->getLL('addButton', true) . '" />';
- $theOutput.=$this->pObj->doc->spacer(20);
- $theOutput.=$this->pObj->doc->section("Add object property:",$out,0,0);
+ $theOutput .= $this->pObj->doc->spacer(20);
+ $theOutput .= $this->pObj->doc->section($GLOBALS['LANG']->getLL('addProperty', true), $out, 0, 0);
// clear
- $out="";
- $out=$this->pObj->sObj." <b>CLEAR?</b> ";
+ $out = '';
+ $out = $this->pObj->sObj." <b>" . t3lib_div::strtoupper($GLOBALS['LANG']->getLL('clear', true)) . "</b> ";
$out .= '<input type="Checkbox" name="data[' . $this->pObj->sObj . '][clearValue]" value="1" />';
- $out .= '<input type="Submit" name="clear_object" value="Clear" />';
- $theOutput.=$this->pObj->doc->spacer(20);
- $theOutput.=$this->pObj->doc->section("Clear object:",$out,0,0);
+ $out .= '<input type="Submit" name="clear_object" value="' . $GLOBALS['LANG']->getLL('clearButton', true) . '" />';
+ $theOutput .= $this->pObj->doc->spacer(20);
+ $theOutput .= $this->pObj->doc->section($GLOBALS['LANG']->getLL('clearObject', true), $out, 0, 0);
- $theOutput.=$this->pObj->doc->spacer(10);
+ $theOutput .= $this->pObj->doc->spacer(10);
} else {
- $theOutput.=$this->pObj->doc->section("EDIT:",$GLOBALS["TBE_TEMPLATE"]->rfw("You cannot edit properties and values, if there's no current template."),0,0,0,1);
+ $theOutput .= $this->pObj->doc->section($GLOBALS['LANG']->getLL('edit', true), $GLOBALS['TBE_TEMPLATE']->rfw($GLOBALS['LANG']->getLL('noCurrentTemplate', true)), 0, 0, 0, 1);
}
// Links:
- $out='';
+ $out = '';
if (!$this->pObj->MOD_SETTINGS['ts_browser_TLKeys_'.$bType][$this->pObj->sObj]) {
if (count($theSetup)) {
- $out = '<a href="index.php?id='.$this->pObj->id.'&addKey['.$this->pObj->sObj.']=1&SET[ts_browser_toplevel_'.$bType.']='.rawurlencode($this->pObj->sObj).'"><b>Add key</b></a> "'.$this->pObj->sObj.'" to Object List';
+ $out = '<a href="index.php?id=' . $this->pObj->id . '&addKey[' . $this->pObj->sObj . ']=1&SET[ts_browser_toplevel_' . $bType . ']=' . rawurlencode($this->pObj->sObj) . '">';
+ $out .= sprintf($GLOBALS['LANG']->getLL('addKey'), $this->pObj->sObj);
}
} else {
- $out = '<a href="index.php?id='.$this->pObj->id.'&addKey['.$this->pObj->sObj.']=0&SET[ts_browser_toplevel_'.$bType.']=0"><b>Remove key</b></a> "'.$this->pObj->sObj.'" from Object List';
+ $out = '<a href="index.php?id=' . $this->pObj->id . '&addKey[' . $this->pObj->sObj . ']=0&SET[ts_browser_toplevel_' . $bType . ']=0">';
+ $out .= sprintf($GLOBALS['LANG']->getLL('removeKey'), $this->pObj->sObj);
}
if ($out) {
$theOutput.=$this->pObj->doc->divider(5);
}
// back
- $out = "< Back";
+ $out = $GLOBALS['LANG']->getLL('back', true);
$out = '<a href="index.php?id='.$this->pObj->id.'"><b>'.$out.'</b></a>';
$theOutput.=$this->pObj->doc->divider(5);
$theOutput.=$this->pObj->doc->section("",$out);
$tmpl->tsbrowser_depthKeys = $tmpl->ext_getSearchKeys($theSetup, '', t3lib_div::_POST('search_field'), array());
}
- $menu = '<div class="tsob-menu"><label>Browse:</label>';
+ $menu = '<div class="tsob-menu"><label>' . $GLOBALS['LANG']->getLL('browse', true) . '</label>';
$menu .= t3lib_BEfunc::getFuncMenu($this->pObj->id, 'SET[ts_browser_type]', $bType, $this->pObj->MOD_MENU['ts_browser_type']);
- $menu .= '<label for="ts_browser_toplevel_' . $bType . '">Object List:</label>';
+ $menu .= '<label for="ts_browser_toplevel_' . $bType . '">' . $GLOBALS['LANG']->getLL('objectList', true) . '</label>';
$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]);
//search
- $menu .= '<label for="search_field">Search:</label>';
+ $menu .= '<label for="search_field">' . $GLOBALS['LANG']->getLL('search', true) .'</label>';
$menu .= '<input type="Text" name="search_field" id="search_field" value="' . htmlspecialchars($POST['search_field']) . '"' . $GLOBALS['TBE_TEMPLATE']->formWidth(20) . '/>';
- $menu .= '<input type="Submit" name="search" class="tsob-search-submit" value="Search" />';
+ $menu .= '<input type="Submit" name="search" class="tsob-search-submit" value="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:search') . '" />';
$menu .= t3lib_BEfunc::getFuncCheck($this->pObj->id, 'SET[ts_browser_regexsearch]', $this->pObj->MOD_SETTINGS['ts_browser_regexsearch'], '', '', 'id="checkTs_browser_regexsearch"');
- $menu .= '<label for="checkTs_browser_regexsearch">Regular expressions</label>';
+ $menu .= '<label for="checkTs_browser_regexsearch">' . $GLOBALS['LANG']->getLL('regExp', true) . '</label>';
$menu .= '</div>';
$theOutput .= $this->pObj->doc->section('', '<nobr>' . $menu . '</nobr>');
while(list(,$inf)=each($tmpl->parserErrors[$pEkey])) {
$errMsg[]=($inf[1]).": ".$inf[0];
}
- $theOutput.=$this->pObj->doc->spacer(10);
- $theOutput .= $this->pObj->doc->section($GLOBALS["TBE_TEMPLATE"]->rfw("Errors and warnings"), implode($errMsg, "<br />"), 0, 1, 0, 1);
+ $theOutput .= $this->pObj->doc->spacer(10);
+ $theOutput .= $this->pObj->doc->section($GLOBALS['TBE_TEMPLATE']->rfw($GLOBALS['LANG']->getLL('errorsWarnings', true)), implode($errMsg, "<br />"), 0, 1, 0, 1);
}
if (isset($this->pObj->MOD_SETTINGS["ts_browser_TLKeys_".$bType][$theKey])) {
- $remove='<td width="1%" nowrap><a href="index.php?id='.$this->pObj->id.'&addKey['.$theKey.']=0&SET[ts_browser_toplevel_'.$bType.']=0"><b>Remove key from OL</b></a></td>';
+ $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', true) . '</b></a></td>';
} else {
- $remove='';
+ $remove = '';
}
- $label = $theKey ? $theKey : ($bType=="setup"?"SETUP ROOT":"CONSTANTS ROOT");
- $theOutput.=$this->pObj->doc->spacer(15);
- $theOutput.=$this->pObj->doc->sectionEnd();
- $theOutput.='<table border=0 cellpadding=1 cellspacing=0 id="typo3-objectBrowser">
+ $label = $theKey ? $theKey : ($bType == 'setup' ? t3lib_div::strtoupper($GLOBALS['LANG']->getLL('setupRoot', true)) : t3lib_div::strtoupper($GLOBALS['LANG']->getLL('constantRoot', true)));
+ $theOutput .= $this->pObj->doc->spacer(15);
+ $theOutput .= $this->pObj->doc->sectionEnd();
+ $theOutput .= '<table border=0 cellpadding=1 cellspacing=0 id="typo3-objectBrowser">
<tr>
<td><img src=clear.gif width=4 height=1></td>
<td class="bgColor2">
// second row options
$menu = '<div class="tsob-menu-row2">';
$menu .= t3lib_BEfunc::getFuncCheck($this->pObj->id, 'SET[ts_browser_showComments]', $this->pObj->MOD_SETTINGS['ts_browser_showComments'], '', '', 'id="checkTs_browser_showComments"');
- $menu .= '<label for="checkTs_browser_showComments">Display comments</label>';
+ $menu .= '<label for="checkTs_browser_showComments">' . $GLOBALS['LANG']->getLL('displayComments', true) . '</label>';
$menu .= t3lib_BEfunc::getFuncCheck($this->pObj->id, 'SET[ts_browser_alphaSort]', $this->pObj->MOD_SETTINGS['ts_browser_alphaSort'], '', '', 'id="checkTs_browser_alphaSort"');
- $menu .= '<label for="checkTs_browser_alphaSort">Sort alphabetically</label>';
+ $menu .= '<label for="checkTs_browser_alphaSort">' . $GLOBALS['LANG']->getLL('sortAlphabetically', true) . '</label>';
$menu .= t3lib_BEfunc::getFuncCheck($this->pObj->id, 'SET[ts_browser_fixedLgd]', $this->pObj->MOD_SETTINGS["ts_browser_fixedLgd"], '', '', 'id="checkTs_browser_fixedLgd"');
- $menu .= '<label for="checkTs_browser_fixedLgd">Crop lines</label>';
+ $menu .= '<label for="checkTs_browser_fixedLgd">' . $GLOBALS['LANG']->getLL('cropLines', true) . '</label>';
if ($bType == 'setup' && !$this->pObj->MOD_SETTINGS['ts_browser_fixedLgd']) {
- $menu .= '<br /><br /><label>Display constants:</label>';
+ $menu .= '<br /><br /><label>' . $GLOBALS['LANG']->getLL('displayConstants', true) . '</label>';
$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']);
}
$menu .= '</div>';
- $theOutput .= $this->pObj->doc->section('Display options:', '<nobr>' . $menu . '</nobr>', 0, 1);
+ $theOutput .= $this->pObj->doc->section($GLOBALS['LANG']->getLL('displayOptions', true), '<nobr>' . $menu . '</nobr>', 0, 1);
// Conditions:
if (is_array($tmpl->sections)) {
- $theOutput .= $this->pObj->doc->section('Conditions:', '', 0, 1);
+ $theOutput .= $this->pObj->doc->section($GLOBALS['LANG']->getLL('conditions', true), '', 0, 1);
- $out="";
+ $out = '';
reset($tmpl->sections);
while(list($key,$val)=each($tmpl->sections)) {
- $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" : "") . ' />';
+ $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" : "") . ' />';
$out .= '<label for="check' .$key . '">' . $tmpl->substituteCMarkers(htmlspecialchars($val)) . '</label></td></tr>';
}
$theOutput.='
- <table border=0 cellpadding=0 cellspacing=0 class="bgColor4">'.$out.'
- <td><br /><input type="Submit" name="Submit" value="Set conditions" /></td>
+ <table border="0" cellpadding="0" cellspacing="0" class="bgColor4">'.$out.'
+ <td><br /><input type="Submit" name="Submit" value="' . $GLOBALS['LANG']->getLL('setConditions', true) . '" /></td>
</table>
';
}
// Ending section:
- $theOutput.=$this->pObj->doc->sectionEnd();
+ $theOutput .= $this->pObj->doc->sectionEnd();
}
return $theOutput;
}