diff --git a/trunk/conf/LSobjects/config.LSobjects.LSeepeople.php b/trunk/conf/LSobjects/config.LSobjects.LSeepeople.php index 264b2988..3893f3ee 100644 --- a/trunk/conf/LSobjects/config.LSobjects.LSeepeople.php +++ b/trunk/conf/LSobjects/config.LSobjects.LSeepeople.php @@ -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', diff --git a/trunk/css/default/LSform.css b/trunk/css/default/LSform.css index 9ac3dea1..df7d8f9c 100644 --- a/trunk/css/default/LSform.css +++ b/trunk/css/default/LSform.css @@ -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; } diff --git a/trunk/includes/class/class.LSldapObject.php b/trunk/includes/class/class.LSldapObject.php index 9c4769b6..bbb71ed9 100644 --- a/trunk/includes/class/class.LSldapObject.php +++ b/trunk/includes/class/class.LSldapObject.php @@ -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 diff --git a/trunk/includes/class/class.LSobjects.LSeegroup.php b/trunk/includes/class/class.LSobjects.LSeegroup.php index df5c494c..a6113de9 100644 --- a/trunk/includes/class/class.LSobjects.LSeegroup.php +++ b/trunk/includes/class/class.LSobjects.LSeegroup.php @@ -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 * diff --git a/trunk/includes/js/LSdefault.js b/trunk/includes/js/LSdefault.js index f522943e..d5aa5cca 100644 --- a/trunk/includes/js/LSdefault.js +++ b/trunk/includes/js/LSdefault.js @@ -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') { diff --git a/trunk/includes/js/LSsmoothbox.js b/trunk/includes/js/LSsmoothbox.js index 27167959..0c37c5ef 100644 --- a/trunk/includes/js/LSsmoothbox.js +++ b/trunk/includes/js/LSsmoothbox.js @@ -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;