From 0e84f7d2848c6c082209ae601d4b22ac9842128a Mon Sep 17 00:00:00 2001 From: Benjamin Renard Date: Thu, 9 Oct 2008 09:50:38 +0000 Subject: [PATCH] =?UTF-8?q?-=20LSldapObject=20:=20=20=20->=20Ajout=20d'une?= =?UTF-8?q?=20m=C3=A9thode=20getObjectKeyValueInRelation()=20et=20d'un=20p?= =?UTF-8?q?aram=C3=A8tre=20=20=20=20=20=20'getkeyvalue'=20pour=20LSrelatio?= =?UTF-8?q?n=20car=20jusqu'a=20pr=C3=A9sent=20le=20cas=20de=20renomage=20d?= =?UTF-8?q?es=20=20=20=20=20=20objet=20en=20relation=20bas=C3=A9=20sur=20a?= =?UTF-8?q?utre=20chose=20que=20le=20dn=20n'=C3=A9tait=20pas=20g=C3=A9r?= =?UTF-8?q?=C3=A9=20-=20Rectification=20d'une=20erreur=20dans=20la=20css?= =?UTF-8?q?=20(LSform)=20du=20th=C3=A8me=20par=20d=C3=A9faut=20-=20LSsmoot?= =?UTF-8?q?hobox=20:=20Rectification=20d'une=20erreur=20dans=20l'affichage?= =?UTF-8?q?=20de=20l'image=20de=20=20=20chargement=20-=20LSdefault=20:=20R?= =?UTF-8?q?ectification=20d'une=20erreur=20dans=20l'affichage=20des=20imag?= =?UTF-8?q?es=20de=20=20=20chargement?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../LSobjects/config.LSobjects.LSeepeople.php | 1 + trunk/css/default/LSform.css | 2 +- trunk/includes/class/class.LSldapObject.php | 52 +++++++++++++++---- .../class/class.LSobjects.LSeegroup.php | 11 ++++ trunk/includes/js/LSdefault.js | 4 +- trunk/includes/js/LSsmoothbox.js | 2 +- 6 files changed, 59 insertions(+), 13 deletions(-) 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;