- LSldapObject :

-> Ajout d'une méthode getObjectKeyValueInRelation() et d'un paramètre
     'getkeyvalue' pour LSrelation car jusqu'a présent le cas de renomage des
     objet en relation basé sur autre chose que le dn n'était pas géré
- Rectification d'une erreur dans la css (LSform) du thème par défaut
- LSsmoothobox : Rectification d'une erreur dans l'affichage de l'image de
  chargement
- LSdefault : Rectification d'une erreur dans l'affichage des images de
  chargement
This commit is contained in:
Benjamin Renard 2008-10-09 09:50:38 +00:00
parent 92701517d7
commit 0e84f7d284
6 changed files with 59 additions and 13 deletions

View file

@ -50,6 +50,7 @@ $GLOBALS['LSobjects']['LSeepeople'] = array (
'emptyText' => _("N'appartient à aucun groupe."),
'LSobject' => 'LSeegroup',
'list_function' => 'listUserGroups',
'getkeyvalue_function' => 'getMemberKeyValue',
'update_function' => 'updateUserGroups',
'remove_function' => 'deleteOneMember',
'rename_function' => 'renameOneMember',

View file

@ -43,7 +43,7 @@ ul.LSform li {
* Champs du formulaire
*/
.LSform input[type=text], .LSform input[type=file], .LSform input[type=submit], .LSform input[type=password], .LSform select, .LSform textarea {
border: 1px solid #84ff6a;
border: 1px solid #ccc;
width: 300px;
background-color: #b5e4f6;
}

View file

@ -529,6 +529,7 @@ class LSldapObject {
if (!$GLOBALS['LSldap'] -> move($oldDn,$newDn)) {
return;
}
$this -> dn = $newDn;
if (!$this -> afterRename($oldDn,$newDn)) {
$GLOBALS['LSerror'] -> addErrorCode(37);
return;
@ -1039,10 +1040,16 @@ class LSldapObject {
if ( isset($relation_conf['list_function']) ) {
if ($GLOBALS['LSsession'] -> loadLSobject($relation_conf['LSobject'])) {
$obj = new $relation_conf['LSobject']();
if (method_exists($obj,$relation_conf['list_function'])) {
if ((method_exists($obj,$relation_conf['list_function']))&&(method_exists($obj,$relation_conf['getkeyvalue_function']))) {
$list = $obj -> $relation_conf['list_function']($this);
if (is_array($list)) {
$this -> _relationsCache[$relation_name] = $list;
// Key Value
$key = $obj -> $relation_conf['getkeyvalue_function']($this);
$this -> _relationsCache[$relation_name] = array(
'list' => $list,
'keyvalue' => $key
);
}
else {
return;
@ -1092,12 +1099,12 @@ class LSldapObject {
$GLOBALS['LSsession'] -> changeAuthUser($this);
}
foreach($this -> _relationsCache as $relation_name => $objList) {
if (isset($this->config['relations'][$relation_name]['rename_function'])) {
foreach($objList as $obj) {
foreach($this -> _relationsCache as $relation_name => $objInfos) {
if ((isset($this->config['relations'][$relation_name]['rename_function']))&&(is_array($objInfos['list']))) {
foreach($objInfos['list'] as $obj) {
$meth = $this->config['relations'][$relation_name]['rename_function'];
if (method_exists($obj,$meth)) {
if (!($obj -> $meth($this,$oldDn))) {
if (!($obj -> $meth($this,$objInfos['keyvalue']))) {
$error=1;
}
}
@ -1134,9 +1141,9 @@ class LSldapObject {
*/
function afterDelete() {
$error = 0;
foreach($this -> _relationsCache as $relation_name => $objList) {
if (isset($this->config['relations'][$relation_name]['remove_function'])) {
foreach($objList as $obj) {
foreach($this -> _relationsCache as $relation_name => $objInfos) {
if ((isset($this->config['relations'][$relation_name]['remove_function']))&&(is_array($objInfos['list']))) {
foreach($objInfos['list'] as $obj) {
$meth = $this->config['relations'][$relation_name]['remove_function'];
if (method_exists($obj,$meth)) {
if (!($obj -> $meth($this))) {
@ -1236,6 +1243,33 @@ class LSldapObject {
return !$error;
}
/**
* Retourne la valeur clef d'un objet en relation
*
* @param[in] $object Un object de type $objectType
* @param[in] $attr L'attribut dans lequel l'objet doit apparaitre
* @param[in] $objectType Le type d'objet en relation
* @param[in] $value La valeur que doit avoir l'attribut :
* - soit le dn (par defaut)
* - soit la valeur [0] d'un attribut
*
* @retval Mixed La valeur clef d'un objet en relation
**/
function getObjectKeyValueInRelation($object,$attr,$objectType,$attrValue='dn') {
if ((!$attr)||(!$objectType)) {
$GLOBALS['LSerror'] -> addErrorCode(1021,'getObjectKeyValueInRelation');
return;
}
if ($attrValue=='dn') {
$val = $object -> getDn();
}
else {
$val = $object -> getValue($attrValue);
$val = $val[0];
}
return $val;
}
/**
* Retourne la liste des relations pour l'objet en fonction de sa présence
* dans un des attributs

View file

@ -48,6 +48,17 @@ class LSeegroup extends LSldapObject {
}
/* ========== Members ========== */
/**
* Retourne la valeur clef d'un membre
*
* @param[in] $object Un object utilisateur
*
* @retval Mixed La valeur clef d'un membre
**/
function getMemberKeyValue($object) {
return $this -> getObjectKeyValueInRelation($object,$this -> memberAttr,$this -> userObjectType);
}
/**
* Retourne la liste des groupes pour utilisateur
*

View file

@ -119,10 +119,10 @@ var LSdefault = new Class({
this.loading_img_id++;
this.loading_img[this.loading_img_id] = new Element('img');
if (size=='big') {
var src = 'templates/images/loading.gif';
var src = this.imagePath('loading.gif');
}
else {
var src = 'templates/images/ajax-loader.gif';
var src = this.imagePath('ajax-loader.gif');
}
this.loading_img[this.loading_img_id].src=src;
if (position=='inside') {

View file

@ -288,7 +288,7 @@ var LSsmoothbox = new Class({
load: function() {
this.frame.empty();
this.loadingImage = new Element('img');
this.loadingImage.setProperty('src','templates/images/loading.gif');
this.loadingImage.setProperty('src',varLSdefault.imagePath('loading.gif'));
this.loadingImage.setProperty('id','loadingImage-LSsmoothbox');
this.openOptions.width = 120;
this.openOptions.height = 120;