- Fixed a typo

- New type of attributes that determines automatically the available languages (i.e. loaded dictionaries) for the application

SVN:trunk[446]
This commit is contained in:
Denis Flaven
2010-06-09 08:30:24 +00:00
parent 6dae6d378b
commit 0fea8f1ea0
2 changed files with 34 additions and 2 deletions

View File

@@ -78,7 +78,8 @@ class URP_Users extends UserRightsBaseClass
MetaModel::Init_AddAttribute(new AttributeString("login", array("allowed_values"=>null, "sql"=>"login", "default_value"=>null, "is_null_allowed"=>false, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributePassword("password", array("allowed_values"=>null, "sql"=>"pwd", "default_value"=>null, "is_null_allowed"=>false, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeEnum("language", array("allowed_values"=>new ValueSetEnum('EN US,FR FR'), "sql"=>"language", "default_value"=>"EN US", "is_null_allowed"=>false, "depends_on"=>array())));
//MetaModel::Init_AddAttribute(new AttributeString("language", array("allowed_values"=>array('EN US,FR FR'), "sql"=>"language", "default_value"=>"EN US", "is_null_allowed"=>false, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeApplicationLanguage("language", array("sql"=>"language", "default_value"=>"EN US", "is_null_allowed"=>false, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeLinkedSetIndirect("profiles", array("linked_class"=>"URP_UserProfile", "ext_key_to_me"=>"userid", "ext_key_to_remote"=>"profileid", "allowed_values"=>null, "count_min"=>1, "count_max"=>0, "depends_on"=>array())));
@@ -438,7 +439,7 @@ class URP_UserProfile extends UserRightsBaseClass
public function GetName()
{
return Dict::Format('UI:USerManagement:LinkBetween_User_And_Profile');
return Dict::Format('UI:UserManagement:LinkBetween_User_And_Profile');
}
}

View File

@@ -680,6 +680,37 @@ class AttributeClass extends AttributeString
}
}
/**
* An attibute that matches one of the language codes availables in the dictionnary
*
* @package iTopORM
*/
class AttributeApplicationLanguage extends AttributeString
{
static protected function ListExpectedParams()
{
return parent::ListExpectedParams();
}
public function __construct($sCode, $aParams)
{
$this->m_sCode = $sCode;
$aAvailableLanguages = Dict::GetLanguages();
$aLanguageCodes = array();
foreach($aAvailableLanguages as $sLangCode => $aInfo)
{
$aLanguageCodes[$sLangCode] = $aInfo['description'].' ('.$aInfo['localized_description'].')';
}
$aParams["allowed_values"] = new ValueSetEnum($aLanguageCodes);
parent::__construct($sCode, $aParams);
}
public function RequiresIndex()
{
return true;
}
}
/**
* The attribute dedicated to the finalclass automatic attribute
*