- Implementation of the localization... on going...

SVN:trunk[366]
This commit is contained in:
Denis Flaven
2010-04-28 16:37:51 +00:00
parent 372943720a
commit 74c322cd26
4 changed files with 39 additions and 31 deletions

View File

@@ -35,7 +35,7 @@ abstract class cmdbAbstractObject extends CMDBObject
protected static function MakeHyperLink($sObjClass, $sObjKey, $aAvailableFields)
{
if ($sObjKey <= 0) return '<em>undefined</em>'; // Objects built in memory have negative IDs
if ($sObjKey <= 0) return '<em>'.Dict::S('UI:UndefinedObject').'</em>'; // Objects built in memory have negative IDs
$oAppContext = new ApplicationContext();
$sExtClassNameAtt = MetaModel::GetNameAttributeCode($sObjClass);
@@ -195,8 +195,7 @@ abstract class cmdbAbstractObject extends CMDBObject
$oDoc = $this->Get($sAttCode);
if (is_object($oDoc) && !$oDoc->IsEmpty())
{
$sHtml .= "<p>Open in New Window: ".$oDoc->GetDisplayLink($sClass, $this->GetKey(), $sAttCode).", \n";
$sHtml .= "Download: ".$oDoc->GetDownloadLink($sClass, $this->GetKey(), $sAttCode)."</p>\n";
$sHtml .= "<p>".Dict::Format('UI:Document:OpenInNewWindow:Download', $oDoc->GetDisplayLink($sClass, $this->GetKey(), $sAttCode), $oDoc->GetDownloadLink($sClass, $this->GetKey(), $sAttCode))."</p>\n";
$sHtml .= "<div>".$oDoc->GetDisplayInline($sClass, $this->GetKey(), $sAttCode)."</div>\n";
}
}
@@ -258,12 +257,12 @@ abstract class cmdbAbstractObject extends CMDBObject
if($iLinkedObjectId == 0)
{
// if 'links' mode is requested the id of the object to link to must be specified
throw new ApplicationException("Parameter object_id is mandatory when link_attr is specified. Check the definition of the display template.");
throw new ApplicationException(Dict::S('UI:Error:MandatoryTemplateParameter_object_id'));
}
if($sTargetAttr == '')
{
// if 'links' mode is requested the d of the object to link to must be specified
throw new ApplicationException("Parameter target_attr is mandatory when link_attr is specified. Check the definition of the display template.");
throw new ApplicationException(Dict::S('UI:Error:MandatoryTemplateParameter_target_attr'));
}
}
$bDisplayMenu = isset($aExtraParams['menu']) ? $aExtraParams['menu'] == true : true;
@@ -312,14 +311,14 @@ abstract class cmdbAbstractObject extends CMDBObject
{
if (!$bSingleSelectMode)
{
$aAttribs['form::select'] = array('label' => "<input type=\"checkbox\" onChange=\"var value = this.checked; $('.selectList{$iListId}').each( function() { this.checked = value; } );\"></input>", 'description' => 'Select / Deselect All');
}
$aAttribs['form::select'] = array('label' => "<input type=\"checkbox\" onChange=\"var value = this.checked; $('.selectList{$iListId}').each( function() { this.checked = value; } );\"></input>", 'description' => Dict::S('UI:SelectAllToggle+'));
}
else
{
$aAttribs['form::select'] = array('label' => "", 'description' => '');
}
}
$aAttribs['key'] = array('label' => '', 'description' => 'Click to display');
$aAttribs['key'] = array('label' => '', 'description' => Dict::S('UI:ClickToDisplay+'));
foreach($aList as $sAttCode)
{
$aAttribs[$sAttCode] = array('label' => MetaModel::GetLabel($sClassName, $sAttCode), 'description' => MetaModel::GetDescription($sClassName, $sAttCode));
@@ -377,14 +376,14 @@ abstract class cmdbAbstractObject extends CMDBObject
$sFilter = $oSet->GetFilter()->serialize();
$aExtraParams['display_limit'] = false; // To expand the full list
$sExtraParams = addslashes(str_replace('"', "'", json_encode($aExtraParams))); // JSON encode, change the style of the quotes and escape them
$sHtml .= '<tr class="containerHeader"><td>'.utils::GetConfig()->GetMinDisplayLimit().' object(s) displayed out of '.$oSet->Count().'&nbsp;&nbsp;<a href="Javascript:ReloadTruncatedList(\''.$divId.'\', \''.$sFilter.'\', \''.$sExtraParams.'\');">Display All</a></td><td>';
$sHtml .= '<tr class="containerHeader"><td>'.Dict::Format('UI:TruncatedResults', utils::GetConfig()->GetMinDisplayLimit(), $oSet->Count()).'&nbsp;&nbsp;<a href="Javascript:ReloadTruncatedList(\''.$divId.'\', \''.$sFilter.'\', \''.$sExtraParams.'\');">'.Dict::S('UI:DisplayAll').'</a></td><td>';
$oPage->add_ready_script("$('#{$divId} table.listResults').addClass('truncated');");
$oPage->add_ready_script("$('#{$divId} table.listResults tr:last td').addClass('truncated');");
}
else
{
// Full list
$sHtml .= '<tr class="containerHeader"><td>&nbsp;'.$oSet->Count().' object(s)</td><td>';
$sHtml .= '<tr class="containerHeader"><td>&nbsp;'.Dict::Format('UI:CountOfResults').'</td><td>';
}
$sHtml .= $oMenuBlock->GetRenderContent($oPage, $aMenuExtraParams);
$sHtml .= '</td></tr>';
@@ -423,7 +422,7 @@ abstract class cmdbAbstractObject extends CMDBObject
foreach($aAuthorizedClasses as $sAlias => $sClassName) // TO DO: check if the user has enough rights to view the classes of the list...
{
$aList[$sClassName] = MetaModel::GetZListItems($sClassName, 'list');
$aAttribs['key_'.$sAlias] = array('label' => '', 'description' => 'Click to display');
$aAttribs['key_'.$sAlias] = array('label' => '', 'description' => Dict::S('UI:ClickToDisplay+'));
foreach($aList[$sClassName] as $sAttCode)
{
$aAttribs[$sAttCode.'_'.$sAlias] = array('label' => MetaModel::GetLabel($sClassName, $sAttCode), 'description' => MetaModel::GetDescription($sClassName, $sAttCode));
@@ -472,14 +471,14 @@ abstract class cmdbAbstractObject extends CMDBObject
$sFilter = $oSet->GetFilter()->serialize();
$aExtraParams['display_limit'] = false; // To expand the full list
$sExtraParams = addslashes(str_replace('"', "'", json_encode($aExtraParams))); // JSON encode, change the style of the quotes and escape them
$sHtml .= '<tr class="containerHeader"><td>'.utils::GetConfig()->GetMinDisplayLimit().' object(s) displayed out of '.$oSet->Count().'&nbsp;&nbsp;<a href="Javascript:ReloadTruncatedList(\''.$divId.'\', \''.$sFilter.'\', \''.$sExtraParams.'\');">Display All</a></td><td>';
$sHtml .= '<tr class="containerHeader"><td>'.Dict::Format('UI:TruncatedResults', utils::GetConfig()->GetMinDisplayLimit(), $oSet->Count()).'&nbsp;&nbsp;<a href="Javascript:ReloadTruncatedList(\''.$divId.'\', \''.$sFilter.'\', \''.$sExtraParams.'\');">'.Dict::S('UI:DisplayAll').'</a></td><td>';
$oPage->add_ready_script("$('#{$divId} table.listResults').addClass('truncated');");
$oPage->add_ready_script("$('#{$divId} table.listResults tr:last td').addClass('truncated');");
}
else
{
// Full list
$sHtml .= '<tr class="containerHeader"><td>&nbsp;'.$oSet->Count().' object(s)</td><td>';
$sHtml .= '<tr class="containerHeader"><td>&nbsp;'.Dict::Format('UI:CountOfResults').'</td><td>';
}
$sHtml .= $oMenuBlock->GetRenderContent($oPage, $aMenuExtraParams);
$sHtml .= '</td></tr>';
@@ -614,12 +613,12 @@ abstract class cmdbAbstractObject extends CMDBObject
$count = $oSet->Count();
if ($count > 0)
{
$oPage->p("Changes log ($count):");
$oPage->p(Dict::Format('UI:ChangesLogTitle', $count));
self::DisplaySet($oPage, $oSet);
}
else
{
$oPage->p("Changes log is empty");
$oPage->p(Dict::S('UI:EmptyChangesLogTitle'));
}
}
@@ -642,13 +641,13 @@ abstract class cmdbAbstractObject extends CMDBObject
// (especially when used to add a link)
/*
$sHtml .= "<div class=\"mini_tabs\" id=\"mini_tabs{$iSearchFormId}\"><ul>
<li><a href=\"#\" onClick=\"$('div.mini_tab{$iSearchFormId}').toggle();$('#mini_tabs{$iSearchFormId} ul li a').toggleClass('selected');\">OQL Query</a></li>
<li><a class=\"selected\" href=\"#\" onClick=\"$('div.mini_tab{$iSearchFormId}').toggle();$('#mini_tabs{$iSearchFormId} ul li a').toggleClass('selected');\">Simple Search</a></li>
<li><a href=\"#\" onClick=\"$('div.mini_tab{$iSearchFormId}').toggle();$('#mini_tabs{$iSearchFormId} ul li a').toggleClass('selected');\">".Dict::S('UI:OQLQueryTab')."</a></li>
<li><a class=\"selected\" href=\"#\" onClick=\"$('div.mini_tab{$iSearchFormId}').toggle();$('#mini_tabs{$iSearchFormId} ul li a').toggleClass('selected');\">".Dict::S('UI:SimpleSearchTab')."</a></li>
</ul></div>\n";
*/
// Simple search form
$sHtml .= "<div id=\"SimpleSearchForm{$iSearchFormId}\" class=\"mini_tab{$iSearchFormId}\">\n";
$sHtml .= "<h1>Search for ".MetaModel::GetName($sClassName)." Objects</h1>\n";
$sHtml .= "<h1>".Dict::Format('UI:SearchFor_Class_Objects', $sClassName)."</h1>\n";
$oUnlimitedFilter = new DBObjectSearch($sClassName);
$sHtml .= "<form id=\"form{$iSearchFormId}\">\n";
$index = 0;
@@ -726,7 +725,7 @@ abstract class cmdbAbstractObject extends CMDBObject
$sHtml .= "<td colspan=\"".(2*($numCols - ($index % $numCols)))."\"></td>\n";
}
$sHtml .= "</tr>\n";
$sHtml .= "<tr><td colspan=\"".(2*$numCols)."\" align=\"right\"><input type=\"submit\" value=\" Search \"></td></tr>\n";
$sHtml .= "<tr><td colspan=\"".(2*$numCols)."\" align=\"right\"><input type=\"submit\" value=\"".Dict::S('UI:Button:Search')."\"></td></tr>\n";
$sHtml .= "</table>\n";
foreach($aExtraParams as $sName => $sValue)
{
@@ -741,7 +740,7 @@ abstract class cmdbAbstractObject extends CMDBObject
// OQL query builder
$sHtml .= "<div id=\"OQLQuery{$iSearchFormId}\" style=\"display:none\" class=\"mini_tab{$iSearchFormId}\">\n";
$sHtml .= "<h1>OQL Query Builder</h1>\n";
$sHtml .= "<h1>".Dict::S('UI:OQLQueryBuilderTitle')."</h1>\n";
$sHtml .= "<form id=\"formOQL{$iSearchFormId}\"><table style=\"width:80%;\"><tr style=\"vertical-align:top\">\n";
$sHtml .= "<td style=\"text-align:right\"><label>SELECT&nbsp;</label><select name=\"oql_class\">";
$aClasses = MetaModel::EnumChildClasses($sClassName, ENUM_CHILD_CLASSES_ALL);
@@ -755,7 +754,7 @@ abstract class cmdbAbstractObject extends CMDBObject
}
$sHtml .= "</select>&nbsp;</td><td>\n";
$sHtml .= "<textarea name=\"oql_clause\" style=\"width:100%\">$sOQLClause</textarea></td></tr>\n";
$sHtml .= "<tr><td colspan=\"2\" style=\"text-align:right\"><input type=\"submit\" value=\" Query \"></td></tr>\n";
$sHtml .= "<tr><td colspan=\"2\" style=\"text-align:right\"><input type=\"submit\" value=\"".Dict::S('UI:Button:Query')."\"></td></tr>\n";
$sHtml .= "<input type=\"hidden\" name=\"dosearch\" value=\"1\" />\n";
foreach($aExtraParams as $sName => $sValue)
{
@@ -936,8 +935,8 @@ abstract class cmdbAbstractObject extends CMDBObject
$oPage->add("<input type=\"hidden\" name=\"$sName\" value=\"$value\">\n");
}
$oPage->add($oAppContext->GetForForm());
$oPage->add("<button type=\"button\" class=\"action\" onClick=\"goBack()\"><span>Cancel</span></button>&nbsp;&nbsp;&nbsp;&nbsp;\n");
$oPage->add("<button type=\"submit\" class=\"action\"><span>Apply</span></button>\n");
$oPage->add("<button type=\"button\" class=\"action\" onClick=\"goBack()\"><span>".Dict::S('UI:Button:Cancel')."</span></button>&nbsp;&nbsp;&nbsp;&nbsp;\n");
$oPage->add("<button type=\"submit\" class=\"action\"><span>".Dict::S('UI:Button:Apply')."</span></button>\n");
$oPage->add("</form>\n");
}
@@ -997,8 +996,8 @@ abstract class cmdbAbstractObject extends CMDBObject
{
$oPage->add("<input type=\"hidden\" name=\"$sName\" value=\"$value\">\n");
}
$oPage->add("<button type=\"button\" class=\"action\" onClick=\"goBack()\"><span>Cancel</span></button>&nbsp;&nbsp;&nbsp;&nbsp;\n");
$oPage->add("<button type=\"submit\" class=\"action\"><span>Apply</span></button>\n");
$oPage->add("<button type=\"button\" class=\"action\" onClick=\"goBack()\"><span>".Dict::S('UI:Button:Cancel')."</span></button>&nbsp;&nbsp;&nbsp;&nbsp;\n");
$oPage->add("<button type=\"submit\" class=\"action\"><span>".Dict::S('UI:Button:Apply')."</span></button>\n");
$oPage->add("</form>\n");
}

View File

@@ -128,7 +128,7 @@ class DisplayBlock
if(empty($aParams['target_attr']))
{
// if 'links' mode is requested the id of the object to link to must be specified
throw new ApplicationException(Dict::S('UI:Error:MandatoryTemplateParameter_link_attr'));
throw new ApplicationException(Dict::S('UI:Error:MandatoryTemplateParameter_target_attr'));
}
}
@@ -549,7 +549,7 @@ class DisplayBlock
$sHtml .= cmdbAbstractObject::GetSearchForm($oPage, $this->m_oSet, $aExtraParams);
$sHtml .= "</div>\n";
$sHtml .= "<div class=\"HRDrawer\"></div>\n";
$sHtml .= "<div id=\"LnkSearch_$iSearchSectionId\" class=\"DrawerHandle\">Search</div>\n";
$sHtml .= "<div id=\"LnkSearch_$iSearchSectionId\" class=\"DrawerHandle\">".Dict::S('UI:SearchToggle')."</div>\n";
break;
case 'pie_chart':
@@ -955,10 +955,10 @@ class MenuBlock extends DisplayBlock
//$aActions[] = array ('label' => 'Bookmark...', 'url' => "../pages/ajax.render.php?operation=create&class=$sClass&filter=$sFilter", 'class' => 'jqmTrigger');
if ($bIsModifyAllowed) { $aActions[] = array ('label' => Dict::S('UI:Menu:New'), 'url' => "../pages/$sUIPage?operation=new&class=$sClass&$sContext{$sDefault}"); }
//if ($bIsBulkModifyAllowed) { $aActions[] = array ('label' => 'Modify All...', 'url' => "../pages/$sUIPage?operation=modify_all&filter=$sFilter&$sContext"); }
//if ($bIsBulkDeleteAllowed) { $aActions[] = array ('label' => 'Delete All...', 'url' => "../pages/$sUIPage?operation=delete_all&filter=$sFilter&$sContext"); }
if ($bIsBulkDeleteAllowed) { $aActions[] = array ('label' => Dict::S('UI:Menu:BulkDelete'), 'url' => "../pages/$sUIPage?operation=select_for_deletion&filter=$sFilter&$sContext"); }
}
}
$sHtml .= "<div class=\"jd_menu_itop\"><ul class=\"jd_menu jd_menu_itop\">\n<li>Actions\n<ul>\n";
$sHtml .= "<div class=\"jd_menu_itop\"><ul class=\"jd_menu jd_menu_itop\">\n<li>".Dict::S('UI:Menu:Actions')."\n<ul>\n";
foreach ($aActions as $aAction)
{
$sClass = isset($aAction['class']) ? " class=\"{$aAction['class']}\"" : "";

View File

@@ -303,7 +303,7 @@ EOF
$sLogonMessage = Dict::Format('UI:LoggedAsMessage', $sUserName);
}
$sLogOffBtn = Dict::S('UI:Button:Logoff');
$sSearchBtn = Dict::S('UI:Button:Search');
$sSearchBtn = Dict::S('UI:Button:GlobalSearch');
echo "<div id=\"Login\" style=\"position:absolute; top:18px; right:16px; width:600px;\">{$sLogonMessage}&nbsp;&nbsp;";
echo "<form action=\"../pages/UI.php\" method=\"post\" style=\"display:inline\">\n";
echo "<input type=\"submit\" value=\"$sLogOffBtn\" />\n";

View File

@@ -310,7 +310,12 @@ Dict::Add('EN US', 'English', 'English', array(
'UI:LoggedAsMessage' => 'Logged in as %1$s',
'UI:LoggedAsMessage+Admin' => 'Logged in as %1$s (Administrator)',
'UI:Button:Logoff' => 'Log off',
'UI:Button:Search' => 'Search',
'UI:Button:GlobalSearch' => 'Search',
'UI:Button:Search' => ' Search ',
'UI:Button:Query' => ' Query ',
'UI:Button:Cancel' => 'Cancel',
'UI:Button:Apply' => 'Apply',
'UI:SearchToggle' => 'Search',
'UI:ClickToCreateNew' => 'Click here to create a new %1$s',
'UI:NoObjectToDisplay' => 'No object to display.',
'UI:Error:MandatoryTemplateParameter_object_id' => 'Parameter object_id is mandatory when link_attr is specified. Check the definition of the display template.',
@@ -330,6 +335,7 @@ Dict::Add('EN US', 'English', 'English', array(
'UI:History:Changes' => 'Changes',
'UI:History:Changes+' => 'Changes made to the object',
'UI:Loading' => 'Loading...',
'UI:Menu:Actions' => 'Actions',
'UI:Menu:New' => 'New...',
'UI:Menu:Add' => 'Add...',
'UI:Menu:Manage' => 'Manage...',
@@ -349,6 +355,9 @@ Dict::Add('EN US', 'English', 'English', array(
'UI:ChangesLogTitle' => 'Changes log (%1$d):',
'UI:EmptyChangesLogTitle' => 'Changes log is empty',
'UI:SearchFor_Class_Objects' => 'Search for %1$s Objects',
'UI:OQLQueryBuilderTitle' => 'OQL Query Builder',
'UI:OQLQueryTab' => 'OQL Query',
'UI:SimpleSearchTab' => 'Simple Search',
));