Translation keys available client side (Dict.S()) : format + JS/PHPDoc

SVN:trunk[5890]
This commit is contained in:
Pierre Goiffon
2018-06-18 15:55:10 +00:00
parent 46a647ae66
commit b02c30a525
2 changed files with 467 additions and 383 deletions

View File

@@ -31,25 +31,32 @@
Interface Page
{
public function output();
public function add($sText);
public function p($sText);
public function pre($sText);
public function add_comment($sText);
public function table($aConfig, $aData, $aParams = array());
}
/**
* Simple helper class to ease the production of HTML pages
* <p>Simple helper class to ease the production of HTML pages
*
* This class provide methods to add content, scripts, includes... to a web page
* <p>This class provide methods to add content, scripts, includes... to a web page
* and renders the full web page by putting the elements in the proper place & order
* when the output() method is called.
* Usage:
*
* <p>Usage:
* ```php
* $oPage = new WebPage("Title of my page");
* $oPage->p("Hello World !");
* $oPage->output();
* ```
*/
class WebPage implements Page
{
@@ -86,7 +93,7 @@ class WebPage implements Page
$this->a_linked_scripts = array();
$this->a_linked_stylesheets = array();
$this->a_headers = array();
$this->a_base = array( 'href' => '', 'target' => '');
$this->a_base = array('href' => '', 'target' => '');
$this->iNextId = 0;
$this->iTransactionId = 0;
$this->sContentType = '';
@@ -157,6 +164,7 @@ class WebPage implements Page
{
$this->add('<!--'.$sText.'-->');
}
/**
* Add a paragraph to the body of the page
*/
@@ -169,7 +177,8 @@ class WebPage implements Page
* Adds a tabular content to the web page
*
* @param string[] $aConfig Configuration of the table: hash array of 'column_id' => 'Column Label'
* @param string[] $aData Hash array. Data to display in the table: each row is made of 'column_id' => Data. A column 'pkey' is expected for each row
* @param string[] $aData Hash array. Data to display in the table: each row is made of 'column_id' => Data. A
* column 'pkey' is expected for each row
* @param array $aParams Hash array. Extra parameters for the table.
*
* @return void
@@ -189,19 +198,20 @@ class WebPage implements Page
$sHtml .= "<table class=\"listResults\">\n";
$sHtml .= "<thead>\n";
$sHtml .= "<tr>\n";
foreach($aConfig as $sName=>$aDef)
foreach ($aConfig as $sName => $aDef)
{
$sHtml .= "<th title=\"".$aDef['description']."\">".$aDef['label']."</th>\n";
}
$sHtml .= "</tr>\n";
$sHtml .= "</thead>\n";
$sHtml .= "<tbody>\n";
foreach($aData as $aRow)
foreach ($aData as $aRow)
{
$sHtml .= $this->GetTableRow($aRow, $aConfig);
}
$sHtml .= "</tbody>\n";
$sHtml .= "</table>\n";
return $sHtml;
}
@@ -216,13 +226,14 @@ class WebPage implements Page
{
$sHtml .= "<tr>";
}
foreach($aConfig as $sName=>$aAttribs)
foreach ($aConfig as $sName => $aAttribs)
{
$sClass = isset($aAttribs['class']) ? 'class="'.$aAttribs['class'].'"' : '';
$sValue = ($aRow[$sName] === '') ? '&nbsp;' : $aRow[$sName];
$sHtml .= "<td $sClass>$sValue</td>";
}
$sHtml .= "</tr>";
return $sHtml;
}
@@ -243,7 +254,12 @@ class WebPage implements Page
}
/**
* Add a dictionary entry for the Javascript side
* Allow a dictionnary entry to be used client side with Dict.S()
*
* @param string $s_entryId a translation label key
*
* @see \WebPage::add_dict_entries()
* @see utils.js
*/
public function add_dict_entry($s_entryId)
{
@@ -252,6 +268,11 @@ class WebPage implements Page
/**
* Add a set of dictionary entries (based on the given prefix) for the Javascript side
*
* @param string $s_entriesPrefix translation label prefix (eg 'UI:Button:' to add all keys beginning with this)
*
* @see \WebPage::add_dict_entry()
* @see utils.js
*/
public function add_dict_entries($s_entriesPrefix)
{
@@ -260,17 +281,18 @@ class WebPage implements Page
protected function get_dict_signature()
{
return str_replace('_', '', Dict::GetUserLanguage()).'-'.md5(implode(',', $this->a_dict_entries).'|'.implode(',', $this->a_dict_entries_prefixes));
return str_replace('_', '', Dict::GetUserLanguage()).'-'.md5(implode(',',
$this->a_dict_entries).'|'.implode(',', $this->a_dict_entries_prefixes));
}
protected function get_dict_file_content()
{
$aEntries = array();
foreach($this->a_dict_entries as $sCode)
foreach ($this->a_dict_entries as $sCode)
{
$aEntries[$sCode] = Dict::S($sCode);
}
foreach($this->a_dict_entries_prefixes as $sPrefix)
foreach ($this->a_dict_entries_prefixes as $sPrefix)
{
$aEntries = array_merge($aEntries, Dict::ExportEntries($sPrefix));
}
@@ -301,7 +323,7 @@ class WebPage implements Page
*/
public function add_linked_stylesheet($s_linked_stylesheet, $s_condition = "")
{
$this->a_linked_stylesheets[] = array( 'link' => $s_linked_stylesheet, 'condition' => $s_condition);
$this->a_linked_stylesheets[] = array('link' => $s_linked_stylesheet, 'condition' => $s_condition);
}
public function add_saas($sSaasRelPath)
@@ -316,6 +338,7 @@ class WebPage implements Page
$sCSSUrl = $sRootUrl.$sCssRelPath;
$this->add_linked_stylesheet($sCSSUrl);
}
/**
* Add some custom header to the page
*/
@@ -344,6 +367,7 @@ class WebPage implements Page
/**
* Whether or not the page is a PDF page
*
* @return boolean
*/
public function is_pdf()
@@ -353,6 +377,7 @@ class WebPage implements Page
/**
* Records the current state of the 'html' part of the page output
*
* @return mixed The current state of the 'html' output
*/
public function start_capture()
@@ -363,13 +388,16 @@ class WebPage implements Page
/**
* Returns the part of the html output that occurred since the call to start_capture
* and removes this part from the current html output
*
* @param $offset mixed The value returned by start_capture
*
* @return string The part of the html output that was added since the call to start_capture
*/
public function end_capture($offset)
{
$sCaptured = substr($this->s_content, $offset);
$this->s_content = substr($this->s_content, 0, $offset);
return $sCaptured;
}
@@ -379,7 +407,7 @@ class WebPage implements Page
public function GetDetails($aFields)
{
$sHtml = "<div class=\"details\" id='search-widget-results-outer'>\n";
foreach($aFields as $aAttrib)
foreach ($aFields as $aAttrib)
{
$sDataAttCode = isset($aAttrib['attcode']) ? "data-attcode=\"{$aAttrib['attcode']}\"" : '';
$sLayout = isset($aAttrib['layout']) ? $aAttrib['layout'] : 'small';
@@ -399,11 +427,11 @@ class WebPage implements Page
// Checking if we should add comments & infos
$sComment = (isset($aAttrib['comments'])) ? $aAttrib['comments'] : '';
$sInfo = (isset($aAttrib['infos'])) ? $aAttrib['infos'] : '';
if($sComment !== '')
if ($sComment !== '')
{
$sHtml .= "<div class=\"field_comments\">$sComment</div>\n";
}
if($sInfo !== '')
if ($sInfo !== '')
{
$sHtml .= "<div class=\"field_infos\">$sInfo</div>\n";
}
@@ -412,11 +440,13 @@ class WebPage implements Page
$sHtml .= "</div>\n";
}
$sHtml .= "</div>\n";
return $sHtml;
}
/**
* Build a set of radio buttons suitable for editing a field/attribute of an object (including its validation)
*
* @param $aAllowedValues hash Array of value => display_value
* @param $value mixed Current value for the field/attribute
* @param $iId mixed Unique Id for the input control in the page
@@ -424,15 +454,17 @@ class WebPage implements Page
* @param $bMandatory bool Whether or not the field is mandatory
* @param $bVertical bool Disposition of the radio buttons vertical or horizontal
* @param $sValidationField string HTML fragment holding the validation field (exclamation icon...)
*
* @return string The HTML fragment corresponding to the radio buttons
*/
public function GetRadioButtons($aAllowedValues, $value, $iId, $sFieldName, $bMandatory, $bVertical, $sValidationField)
{
public function GetRadioButtons(
$aAllowedValues, $value, $iId, $sFieldName, $bMandatory, $bVertical, $sValidationField
) {
$idx = 0;
$sHTMLValue = '';
foreach($aAllowedValues as $key => $display_value)
foreach ($aAllowedValues as $key => $display_value)
{
if ((count($aAllowedValues) == 1) && ($bMandatory == 'true') )
if ((count($aAllowedValues) == 1) && ($bMandatory == 'true'))
{
// When there is only once choice, select it by default
$sSelected = ' checked';
@@ -459,6 +491,7 @@ class WebPage implements Page
// Validation icon at the end of the line
$sHTMLValue .= "&nbsp;{$sValidationField}\n";
}
return $sHTMLValue;
}
@@ -511,6 +544,7 @@ class WebPage implements Page
$sOutput = '';
}
}
return $sOutput;
}
@@ -519,7 +553,7 @@ class WebPage implements Page
*/
public function output()
{
foreach($this->a_headers as $s_header)
foreach ($this->a_headers as $s_header)
{
header($s_header);
}
@@ -535,7 +569,7 @@ class WebPage implements Page
$this->output_dict_entries();
foreach($this->a_linked_scripts as $s_script)
foreach ($this->a_linked_scripts as $s_script)
{
// Make sure that the URL to the script contains the application's version number
// so that the new script do NOT get reloaded from the cache when the application is upgraded
@@ -549,16 +583,16 @@ class WebPage implements Page
}
echo "<script type=\"text/javascript\" src=\"$s_script\"></script>\n";
}
if (count($this->a_scripts)>0)
if (count($this->a_scripts) > 0)
{
echo "<script type=\"text/javascript\">\n";
foreach($this->a_scripts as $s_script)
foreach ($this->a_scripts as $s_script)
{
echo "$s_script\n";
}
echo "</script>\n";
}
foreach($this->a_linked_stylesheets as $a_stylesheet)
foreach ($this->a_linked_stylesheets as $a_stylesheet)
{
if (strpos($a_stylesheet['link'], '?') === false)
{
@@ -579,10 +613,10 @@ class WebPage implements Page
}
}
if (count($this->a_styles)>0)
if (count($this->a_styles) > 0)
{
echo "<style>\n";
foreach($this->a_styles as $s_style)
foreach ($this->a_styles as $s_style)
{
echo "$s_style\n";
}
@@ -618,7 +652,7 @@ class WebPage implements Page
*/
public function add_input_hidden($sLabel, $aData)
{
foreach($aData as $sKey => $sValue)
foreach ($aData as $sKey => $sValue)
{
// Note: protection added to protect against the Notice 'array to string conversion' that appeared with PHP 5.4
// (this function seems unused though!)
@@ -645,11 +679,13 @@ class WebPage implements Page
}
$sTag .= " />\n";
}
return $sTag;
}
/**
* Get an ID (for any kind of HTML tag) that is guaranteed unique in this page
*
* @return int The unique ID (in this page)
*/
public function GetUniqueId()
@@ -659,7 +695,9 @@ class WebPage implements Page
/**
* Set the content-type (mime type) for the page's content
*
* @param $sContentType string
*
* @return void
*/
public function SetContentType($sContentType)
@@ -669,8 +707,10 @@ class WebPage implements Page
/**
* Set the content-disposition (mime type) for the page's content
*
* @param $sDisposition string The disposition: 'inline' or 'attachment'
* @param $sFileName string The original name of the file
*
* @return void
*/
public function SetContentDisposition($sDisposition, $sFileName)
@@ -681,7 +721,9 @@ class WebPage implements Page
/**
* Set the transactionId of the current form
*
* @param $iTransactionId integer
*
* @return void
*/
public function SetTransactionId($iTransactionId)
@@ -691,6 +733,7 @@ class WebPage implements Page
/**
* Returns the transactionId of the current form
*
* @return integer The current transactionID
*/
public function GetTransactionId()
@@ -705,6 +748,7 @@ class WebPage implements Page
/**
* What is the currently selected output format
*
* @return string The selected output format: html, pdf...
*/
public function GetOutputFormat()
@@ -714,13 +758,15 @@ class WebPage implements Page
/**
* Check whether the desired output format is possible or not
*
* @param string $sOutputFormat The desired output format: html, pdf...
*
* @return bool True if the format is Ok, false otherwise
*/
function IsOutputFormatAvailable($sOutputFormat)
{
$bResult = false;
switch($sOutputFormat)
switch ($sOutputFormat)
{
case 'html':
$bResult = true; // Always supported
@@ -730,11 +776,13 @@ class WebPage implements Page
$bResult = @is_readable(APPROOT.'lib/MPDF/mpdf.php');
break;
}
return $bResult;
}
/**
* Check whether the output must be printable (using print.css, for sure!)
*
* @return bool ...
*/
public function IsPrintableVersion()
@@ -744,8 +792,10 @@ class WebPage implements Page
/**
* Retrieves the value of a named output option for the given format
*
* @param string $sFormat The format: html or pdf
* @param string $sOptionName The name of the option
*
* @return mixed false if the option was never set or the options's value
*/
public function GetOutputOption($sFormat, $sOptionName)
@@ -754,10 +804,13 @@ class WebPage implements Page
{
return $this->a_OutputOptions[$sFormat][$sOptionName];
}
return false;
}
/**
* Sets a named output option for the given format
*
* @param string $sFormat The format for which to set the option: html or pdf
* @param string $sOptionName the name of the option
* @param mixed $sValue The value of the option
@@ -783,7 +836,8 @@ class WebPage implements Page
foreach ($aActions as $aAction)
{
$sClass = isset($aAction['css_classes']) ? ' class="'.implode(' ', $aAction['css_classes']).'"' : '';
$sOnClick = isset($aAction['onclick']) ? ' onclick="'.htmlspecialchars($aAction['onclick'], ENT_QUOTES, "UTF-8").'"' : '';
$sOnClick = isset($aAction['onclick']) ? ' onclick="'.htmlspecialchars($aAction['onclick'], ENT_QUOTES,
"UTF-8").'"' : '';
$sTarget = isset($aAction['target']) ? " target=\"{$aAction['target']}\"" : "";
if (empty($aAction['url']))
{
@@ -800,12 +854,13 @@ class WebPage implements Page
}
}
$sHtml .= "</ul></li></ul></div>";
foreach(array_reverse($aFavoriteActions) as $aAction)
foreach (array_reverse($aFavoriteActions) as $aAction)
{
$sTarget = isset($aAction['target']) ? " target=\"{$aAction['target']}\"" : "";
$sHtml .= "<div class=\"actions_button\"><a $sTarget href='{$aAction['url']}'>{$aAction['label']}</a></div>";
}
}
return $sHtml;
}
@@ -824,7 +879,8 @@ class WebPage implements Page
file_put_contents($sJSFileName, $this->get_dict_file_content());
}
// Load the dictionary as the first javascript file, so that other JS file benefit from the translations
array_unshift($this->a_linked_scripts, utils::GetAbsoluteUrlAppRoot().'pages/ajax.document.php?operation=dict&s='.$sSignature);
array_unshift($this->a_linked_scripts,
utils::GetAbsoluteUrlAppRoot().'pages/ajax.document.php?operation=dict&s='.$sSignature);
}
}
}
@@ -845,12 +901,14 @@ interface iTabbedPage
* Add a tab which content will be loaded asynchronously via the supplied URL
*
* Limitations:
* Cross site scripting is not not allowed for security reasons. Use a normal tab with an IFRAME if you want to pull content from another server.
* Static content cannot be added inside such tabs.
* Cross site scripting is not not allowed for security reasons. Use a normal tab with an IFRAME if you want to
* pull content from another server. Static content cannot be added inside such tabs.
*
* @param string $sTabLabel The (localised) label of the tab
* @param string $sUrl The URL to load (on the same server)
* @param boolean $bCache Whether or not to cache the content of the tab once it has been loaded. flase will cause the tab to be reloaded upon each activation.
* @param boolean $bCache Whether or not to cache the content of the tab once it has been loaded. flase will cause
* the tab to be reloaded upon each activation.
*
* @since 2.0.3
*/
public function AddAjaxTab($sTabLabel, $sUrl, $bCache = true);
@@ -861,6 +919,7 @@ interface iTabbedPage
/**
* Finds the tab whose title matches a given pattern
*
* @return mixed The name of the tab as a string or false if not found
*/
public function FindTab($sPattern, $sTabContainer = null);
@@ -885,6 +944,7 @@ class TabManager
public function AddTabContainer($sTabContainer, $sPrefix = '')
{
$this->m_aTabs[$sTabContainer] = array('prefix' => $sPrefix, 'tabs' => array());
return "\$Tabs:$sTabContainer\$";
}
@@ -895,21 +955,27 @@ class TabManager
public function GetCurrentTabLength($sHtml)
{
$iLength = isset($this->m_aTabs[$this->m_sCurrentTabContainer]['tabs'][$this->m_sCurrentTab]['html']) ? strlen($this->m_aTabs[$this->m_sCurrentTabContainer]['tabs'][$this->m_sCurrentTab]['html']): 0;
$iLength = isset($this->m_aTabs[$this->m_sCurrentTabContainer]['tabs'][$this->m_sCurrentTab]['html']) ? strlen($this->m_aTabs[$this->m_sCurrentTabContainer]['tabs'][$this->m_sCurrentTab]['html']) : 0;
return $iLength;
}
/**
* Truncates the given tab to the specifed length and returns the truncated part
*
* @param string $sTabContainer The tab container in which to truncate the tab
* @param string $sTab The name/identifier of the tab to truncate
* @param integer $iLength The length/offset at which to truncate the tab
*
* @return string The truncated part
*/
public function TruncateTab($sTabContainer, $sTab, $iLength)
{
$sResult = substr($this->m_aTabs[$this->m_sCurrentTabContainer]['tabs'][$this->m_sCurrentTab]['html'], $iLength);
$this->m_aTabs[$this->m_sCurrentTabContainer]['tabs'][$this->m_sCurrentTab]['html'] = substr($this->m_aTabs[$this->m_sCurrentTabContainer]['tabs'][$this->m_sCurrentTab]['html'], 0, $iLength);
$sResult = substr($this->m_aTabs[$this->m_sCurrentTabContainer]['tabs'][$this->m_sCurrentTab]['html'],
$iLength);
$this->m_aTabs[$this->m_sCurrentTabContainer]['tabs'][$this->m_sCurrentTab]['html'] = substr($this->m_aTabs[$this->m_sCurrentTabContainer]['tabs'][$this->m_sCurrentTab]['html'],
0, $iLength);
return $sResult;
}
@@ -942,6 +1008,7 @@ class TabManager
// Append to the content of the tab
$this->m_aTabs[$sTabContainer]['tabs'][$sTabLabel]['html'] .= $sHtml;
}
return ''; // Nothing to add to the page for now
}
@@ -949,6 +1016,7 @@ class TabManager
{
$sPreviousTabContainer = $this->m_sCurrentTabContainer;
$this->m_sCurrentTabContainer = $sTabContainer;
return $sPreviousTabContainer;
}
@@ -956,6 +1024,7 @@ class TabManager
{
$sPreviousTab = $this->m_sCurrentTab;
$this->m_sCurrentTab = $sTabLabel;
return $sPreviousTab;
}
@@ -963,12 +1032,14 @@ class TabManager
* Add a tab which content will be loaded asynchronously via the supplied URL
*
* Limitations:
* Cross site scripting is not not allowed for security reasons. Use a normal tab with an IFRAME if you want to pull content from another server.
* Static content cannot be added inside such tabs.
* Cross site scripting is not not allowed for security reasons. Use a normal tab with an IFRAME if you want to
* pull content from another server. Static content cannot be added inside such tabs.
*
* @param string $sTabLabel The (localised) label of the tab
* @param string $sUrl The URL to load (on the same server)
* @param boolean $bCache Whether or not to cache the content of the tab once it has been loaded. flase will cause the tab to be reloaded upon each activation.
* @param boolean $bCache Whether or not to cache the content of the tab once it has been loaded. flase will cause
* the tab to be reloaded upon each activation.
*
* @since 2.0.3
*/
public function AddAjaxTab($sTabLabel, $sUrl, $bCache = true)
@@ -979,6 +1050,7 @@ class TabManager
'url' => $sUrl,
'cache' => $bCache,
);
return ''; // Nothing to add to the page for now
}
@@ -1014,6 +1086,7 @@ class TabManager
/**
* Finds the tab whose title matches a given pattern
*
* @return mixed The actual name of the tab (as a string) or false if not found
*/
public function FindTab($sPattern, $sTabContainer = null)
@@ -1023,7 +1096,7 @@ class TabManager
{
$sTabContainer = $this->m_sCurrentTabContainer;
}
foreach($this->m_aTabs[$sTabContainer]['tabs'] as $sTabLabel => $void)
foreach ($this->m_aTabs[$sTabContainer]['tabs'] as $sTabLabel => $void)
{
if (preg_match($sPattern, $sTabLabel))
{
@@ -1031,6 +1104,7 @@ class TabManager
break;
}
}
return $result;
}
@@ -1044,11 +1118,11 @@ class TabManager
{
$container_index = 0;
$tab_index = 0;
foreach($this->m_aTabs as $sCurrentTabContainerName => $aTabs)
foreach ($this->m_aTabs as $sCurrentTabContainerName => $aTabs)
{
if ($sTabContainer == $sCurrentTabContainerName)
{
foreach($aTabs['tabs'] as $sCurrentTabLabel => $void)
foreach ($aTabs['tabs'] as $sCurrentTabLabel => $void)
{
if ($sCurrentTabLabel == $sTabLabel)
{
@@ -1061,13 +1135,14 @@ class TabManager
$container_index++;
}
$sSelector = '#tabbedContent_'.$container_index.' > ul';
return "window.setTimeout(\"$('$sSelector').tabs('select', $tab_index);\", 100);"; // Let the time to the tabs widget to initialize
}
public function RenderIntoContent($sContent, WebPage $oPage)
{
// Render the tabs in the page (if any)
foreach($this->m_aTabs as $sTabContainerName => $aTabs)
foreach ($this->m_aTabs as $sTabContainerName => $aTabs)
{
$sTabs = '';
$sPrefix = $aTabs['prefix'];
@@ -1077,23 +1152,23 @@ class TabManager
if ($oPage->IsPrintableVersion())
{
$oPage->add_ready_script(
<<< EOF
<<< EOF
oHiddeableChapters = {};
EOF
);
$sTabs = "<!-- tabs -->\n<div id=\"tabbedContent_{$sPrefix}{$container_index}\" class=\"light\">\n";
$i = 0;
foreach($aTabs['tabs'] as $sTabName => $aTabData)
foreach ($aTabs['tabs'] as $sTabName => $aTabData)
{
$sTabNameEsc = addslashes($sTabName);
$sTabId = "tab_{$sPrefix}{$container_index}$i";
switch($aTabData['type'])
switch ($aTabData['type'])
{
case 'ajax':
$sTabHtml = '';
$sUrl = $aTabData['url'];
$oPage->add_ready_script(
<<< EOF
<<< EOF
$.post('$sUrl', {printable: '1'}, function(data){
$('#$sTabId > .printable-tab-content').append(data);
});
@@ -1105,9 +1180,11 @@ EOF
default:
$sTabHtml = $aTabData['html'];
}
$sTabs .= "<div class=\"printable-tab\" id=\"$sTabId\"><h2 class=\"printable-tab-title\">".htmlentities($sTabName, ENT_QUOTES, 'UTF-8')."</h2><div class=\"printable-tab-content\">".$sTabHtml."</div></div>\n";
$sTabs .= "<div class=\"printable-tab\" id=\"$sTabId\"><h2 class=\"printable-tab-title\">".htmlentities($sTabName,
ENT_QUOTES,
'UTF-8')."</h2><div class=\"printable-tab-content\">".$sTabHtml."</div></div>\n";
$oPage->add_ready_script(
<<< EOF
<<< EOF
oHiddeableChapters['$sTabId'] = '$sTabNameEsc';
EOF
);
@@ -1121,26 +1198,28 @@ EOF
$sTabs .= "<ul>\n";
// Display the unordered list that will be rendered as the tabs
$i = 0;
foreach($aTabs['tabs'] as $sTabName => $aTabData)
foreach ($aTabs['tabs'] as $sTabName => $aTabData)
{
switch($aTabData['type'])
switch ($aTabData['type'])
{
case 'ajax':
$sTabs .= "<li data-cache=\"".($aTabData['cache'] ? 'true' : 'false')."\"><a href=\"{$aTabData['url']}\" class=\"tab\"><span>".htmlentities($sTabName, ENT_QUOTES, 'UTF-8')."</span></a></li>\n";
$sTabs .= "<li data-cache=\"".($aTabData['cache'] ? 'true' : 'false')."\"><a href=\"{$aTabData['url']}\" class=\"tab\"><span>".htmlentities($sTabName,
ENT_QUOTES, 'UTF-8')."</span></a></li>\n";
break;
case 'html':
default:
$sTabs .= "<li><a href=\"#tab_{$sPrefix}{$container_index}$i\" class=\"tab\"><span>".htmlentities($sTabName, ENT_QUOTES, 'UTF-8')."</span></a></li>\n";
$sTabs .= "<li><a href=\"#tab_{$sPrefix}{$container_index}$i\" class=\"tab\"><span>".htmlentities($sTabName,
ENT_QUOTES, 'UTF-8')."</span></a></li>\n";
}
$i++;
}
$sTabs .= "</ul>\n";
// Now add the content of the tabs themselves
$i = 0;
foreach($aTabs['tabs'] as $sTabName => $aTabData)
foreach ($aTabs['tabs'] as $sTabName => $aTabData)
{
switch($aTabData['type'])
switch ($aTabData['type'])
{
case 'ajax':
// Nothing to add
@@ -1158,6 +1237,7 @@ EOF
$sContent = str_replace("\$Tabs:$sTabContainerName\$", $sTabs, $sContent);
$container_index++;
}
return $sContent;
}
}

View File

@@ -688,6 +688,10 @@ function Format() {
return str;
}
/**
* Enable to access translation keys client side.
* The called keys needs to be exported using \WebPage::add_dict_entry
*/
var Dict = {};
if (typeof aDictEntries == 'undefined') {
Dict._entries = {}; // Entries have not been loaded (we are in the setup ?)