From 6f1e2844c21f1e514395bf9f59e40c4b65db01a0 Mon Sep 17 00:00:00 2001 From: Benjamin Renard Date: Wed, 28 Jan 2009 08:13:36 +0000 Subject: [PATCH] =?UTF-8?q?-=20LSattr=5Fldap=5Fboolean=20:=20D=C3=A9placem?= =?UTF-8?q?ent=20de=20la=20configuration=20dans=20ldap=5Foptions=20=09(Bug?= =?UTF-8?q?=20#1770)=20-=20LSattr=5Fhtml=5Fselect=5Fobject=20:=20D=C3=A9pl?= =?UTF-8?q?acement=20de=20la=20configuration=20dans=20html=5Foptions=20=09?= =?UTF-8?q?(Bug=20#1768)=20-=20LSattr=5Fhtml=5Fselect=5Flist=20:=20D=C3=A9?= =?UTF-8?q?placement=20de=20la=20configuration=20dans=20html=5Foptions=20?= =?UTF-8?q?=09(Bug=20#1769)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../config.LSobjects.LSeecompany.php | 4 +- .../LSobjects/config.LSobjects.LSeegroup.php | 26 ++++---- .../LSobjects/config.LSobjects.LSeepeople.php | 66 +++++++++++-------- .../class/class.LSattr_html_select_list.php | 8 +-- .../class/class.LSattr_html_select_object.php | 14 ++-- .../class/class.LSattr_ldap_boolean.php | 8 +-- .../class.LSformElement_select_object.php | 8 +-- 7 files changed, 74 insertions(+), 60 deletions(-) diff --git a/trunk/conf/LSobjects/config.LSobjects.LSeecompany.php b/trunk/conf/LSobjects/config.LSobjects.LSeecompany.php index 8a8d3627..fd729028 100644 --- a/trunk/conf/LSobjects/config.LSobjects.LSeecompany.php +++ b/trunk/conf/LSobjects/config.LSobjects.LSeecompany.php @@ -78,9 +78,11 @@ $GLOBALS['LSobjects']['LSeecompany'] = array ( 'label' => _('Parrain(s)'), 'ldap_type' => 'ascii', 'html_type' => 'select_object', - 'selectable_object' => array( + 'html_options' => array( + 'selectable_object' => array( 'object_type' => 'LSeepeople', 'value_attribute' => '%{dn}' + ) ), 'validation' => array ( array ( diff --git a/trunk/conf/LSobjects/config.LSobjects.LSeegroup.php b/trunk/conf/LSobjects/config.LSobjects.LSeegroup.php index 9fab5d90..c3b2c8c4 100644 --- a/trunk/conf/LSobjects/config.LSobjects.LSeegroup.php +++ b/trunk/conf/LSobjects/config.LSobjects.LSeegroup.php @@ -100,6 +100,16 @@ $GLOBALS['LSobjects']['LSeegroup'] = array ( 'label' => _('Membres'), 'ldap_type' => 'ascii', 'html_type' => 'select_object', + 'html_options' => array( + 'selectable_object' => array( + 'object_type' => 'LSeepeople', // Nom de l'objet à lister + 'display_attribute' => '%{cn} (%{uidNumber})', // Spécifie le attributs à lister pour le choix, + // si non définie => utilisation du 'select_display_attrs' + // de la définition de l'objet + + 'value_attribute' => 'dn', // Spécifie le attributs dont la valeur sera retournée par + ) + ), 'required' => 0, 'multiple' => 1, 'validation' => array ( @@ -116,14 +126,6 @@ $GLOBALS['LSobjects']['LSeegroup'] = array ( 'form' => array ( 'modify' => 1, 'create' => 1 - ), - 'selectable_object' => array( - 'object_type' => 'LSeepeople', // Nom de l'objet à lister - 'display_attribute' => '%{cn} (%{uidNumber})', // Spécifie le attributs à lister pour le choix, - // si non définie => utilisation du 'select_display_attrs' - // de la définition de l'objet - - 'value_attribute' => 'dn', // Spécifie le attributs dont la valeur sera retournée par ) ), /* ----------- end -----------*/ @@ -152,9 +154,11 @@ $GLOBALS['LSobjects']['LSeegroup'] = array ( 'label' => _('Parrain(s)'), 'ldap_type' => 'ascii', 'html_type' => 'select_object', - 'selectable_object' => array( - 'object_type' => 'LSeepeople', - 'value_attribute' => '%{dn}' + 'html_options' => array ( + 'selectable_object' => array( + 'object_type' => 'LSeepeople', + 'value_attribute' => '%{dn}' + ), ), 'validation' => array ( array ( diff --git a/trunk/conf/LSobjects/config.LSobjects.LSeepeople.php b/trunk/conf/LSobjects/config.LSobjects.LSeepeople.php index 953edc0a..4a2568a1 100644 --- a/trunk/conf/LSobjects/config.LSobjects.LSeepeople.php +++ b/trunk/conf/LSobjects/config.LSobjects.LSeepeople.php @@ -268,6 +268,26 @@ $GLOBALS['LSobjects']['LSeepeople'] = array ( 'label' => _('Groupe principal'), 'ldap_type' => 'numeric', 'html_type' => 'select_list', + 'html_options' => array ( + 'possible_values' => array( + 'OTHER_OBJECT' => array( + 'object_type' => 'LSeegroup', // Nom de l'objet à lister + 'display_attribute' => '%{cn} (%{gidNumber})', // Spécifie le attributs à lister pour le choix, + // si non définie => utilisation du 'select_display_attrs' + // de la définition de l'objet + + 'value_attribute' => 'gidNumber', // Spécifie le attributs dont la valeur sera retournée par + /*'filter' => // le formulaire spécifie les filtres de recherche pour + array ( // l'établissement de la liste d'objets : + array( // Premier filtre + 'filter' => 'cn=*a*', + //'basedn' => 'o=company', + 'scope' => 'sub', + ) + )*/ + ) + ) + ), 'multiple' => false, 'required' => 1, 'validation' => array ( @@ -287,24 +307,6 @@ $GLOBALS['LSobjects']['LSeepeople'] = array ( 'form' => array ( 'modify' => 1, 'create' => 1 - ), - 'possible_values' => array( - 'OTHER_OBJECT' => array( - 'object_type' => 'LSeegroup', // Nom de l'objet à lister - 'display_attribute' => '%{cn} (%{gidNumber})', // Spécifie le attributs à lister pour le choix, - // si non définie => utilisation du 'select_display_attrs' - // de la définition de l'objet - - 'value_attribute' => 'gidNumber', // Spécifie le attributs dont la valeur sera retournée par - /*'filter' => // le formulaire spécifie les filtres de recherche pour - array ( // l'établissement de la liste d'objets : - array( // Premier filtre - 'filter' => 'cn=*a*', - //'basedn' => 'o=company', - 'scope' => 'sub', - ) - )*/ - ) ) ), /* ----------- end -----------*/ @@ -314,6 +316,10 @@ $GLOBALS['LSobjects']['LSeepeople'] = array ( 'label' => _('Interpreteur de commande'), 'help_info' => _("Permet ou non a l'utilisateur de se connecter à un système POSIX."), 'ldap_type' => 'boolean', + 'ldap_options' => array ( + 'true_value' => '/bin/bash', + 'false_value' => '/bin/false' + ), 'html_type' => 'boolean', 'required' => 1, 'default_value' => 'no', @@ -324,9 +330,7 @@ $GLOBALS['LSobjects']['LSeepeople'] = array ( 'form' => array ( 'modify' => 1, 'create' => 1 - ), - 'true_value' => '/bin/bash', - 'false_value' => '/bin/false' + ) ), /* ----------- end -----------*/ @@ -397,6 +401,13 @@ $GLOBALS['LSobjects']['LSeepeople'] = array ( 'label' => _('Titre'), 'ldap_type' => 'ascii', 'html_type' => 'select_list', + 'html_options' => array ( + 'possible_values' => array( + 'M.' => 'M.', + 'Mme' => 'Mme', + 'Mlle' => 'Mlle' + ) + ), 'required' => 1, 'default_value' => 'M.', 'rights' => array( @@ -409,11 +420,6 @@ $GLOBALS['LSobjects']['LSeepeople'] = array ( 'form' => array ( 'modify' => 1, 'create' => 1 - ), - 'possible_values' => array( - 'M.' => 'M.', - 'Mme' => 'Mme', - 'Mlle' => 'Mlle' ) ), /* ----------- end -----------*/ @@ -576,9 +582,11 @@ $GLOBALS['LSobjects']['LSeepeople'] = array ( 'label' => _('Parrain(s)'), 'ldap_type' => 'ascii', 'html_type' => 'select_object', - 'selectable_object' => array( - 'object_type' => 'LSeepeople', - 'value_attribute' => '%{dn}' + 'html_options' => array ( + 'selectable_object' => array( + 'object_type' => 'LSeepeople', + 'value_attribute' => '%{dn}' + ), ), 'validation' => array ( array ( diff --git a/trunk/includes/class/class.LSattr_html_select_list.php b/trunk/includes/class/class.LSattr_html_select_list.php index b2e9ee8c..9c8982e2 100644 --- a/trunk/includes/class/class.LSattr_html_select_list.php +++ b/trunk/includes/class/class.LSattr_html_select_list.php @@ -72,8 +72,8 @@ class LSattr_html_select_list extends LSattr_html{ */ function getPossibleValues() { $retInfos = array(); - if (isset($this -> config['possible_values'])) { - foreach($this -> config['possible_values'] as $val_name => $val) { + if (isset($this -> config['html_options']['possible_values'])) { + foreach($this -> config['html_options']['possible_values'] as $val_name => $val) { if($val_name=='OTHER_OBJECT') { if ((!isset($val['object_type'])) || (!isset($val['value_attribute']))) { LSerror :: addErrorCode('LSattr_html_select_list_01',$this -> name); @@ -84,7 +84,7 @@ class LSattr_html_select_list extends LSattr_html{ } $obj = new $val['object_type'](); if($val['scope']) { - $param=array('scope' => $this -> config['possible_values']['scope']); + $param=array('scope' => $this -> config['html_options']['possible_values']['scope']); } else { $param=array(); @@ -96,7 +96,7 @@ class LSattr_html_select_list extends LSattr_html{ $param['attributes'][] = $val['value_attribute']; } - $list = $obj -> search($val['filter'],$this -> config['possible_values']['basedn'],$param); + $list = $obj -> search($val['filter'],$this -> config['html_options']['possible_values']['basedn'],$param); if(($val['value_attribute']=='dn')||($val['value_attribute']=='%{dn}')) { for($i=0;$i setValue($values); } } - $element -> setSelectableObject($this -> config['selectable_object']['object_type']); + $element -> setSelectableObject($this -> config['html_options']['selectable_object']['object_type']); return $element; } @@ -78,8 +78,8 @@ class LSattr_html_select_object extends LSattr_html{ */ function getValuesFromFormValues($values=NULL) { $retValues = array(); - if (isset($this -> config['selectable_object'])) { - $conf=$this -> config['selectable_object']; + if (isset($this -> config['html_options']['selectable_object'])) { + $conf=$this -> config['html_options']['selectable_object']; if (!isset($conf['object_type'])) { LSerror :: addErrorCode('LSattr_html_select_object_01',$this -> name); return; @@ -126,8 +126,8 @@ class LSattr_html_select_object extends LSattr_html{ function getFormValues($values=NULL,$fromDNs=false) { $retInfos = array(); $DNs=array(); - if (isset($this -> config['selectable_object'])) { - $conf=$this -> config['selectable_object']; + if (isset($this -> config['html_options']['selectable_object'])) { + $conf=$this -> config['html_options']['selectable_object']; if (!isset($conf['object_type'])) { LSerror :: addErrorCode('LSattr_html_select_object_01',$this -> name); return; @@ -184,8 +184,8 @@ class LSattr_html_select_object extends LSattr_html{ * le DN et en valeur ce qui sera affiché. */ function getValuesFromSession() { - if(is_array($_SESSION['LSselect'][$this -> config['selectable_object']['object_type']])) { - return $this -> getFormValues($_SESSION['LSselect'][$this -> config['selectable_object']['object_type']],true); + if(is_array($_SESSION['LSselect'][$this -> config['html_options']['selectable_object']['object_type']])) { + return $this -> getFormValues($_SESSION['LSselect'][$this -> config['html_options']['selectable_object']['object_type']],true); } return false; } diff --git a/trunk/includes/class/class.LSattr_ldap_boolean.php b/trunk/includes/class/class.LSattr_ldap_boolean.php index 84dcc102..2975a535 100644 --- a/trunk/includes/class/class.LSattr_ldap_boolean.php +++ b/trunk/includes/class/class.LSattr_ldap_boolean.php @@ -50,10 +50,10 @@ class LSattr_ldap_boolean extends LSattr_ldap { */ function getUpdateData($data) { if ($data[0]=='yes') { - return array($this -> config['true_value']); + return array($this -> config['ldap_options']['true_value']); } if ($data[0]=='no') { - return array($this -> config['false_value']); + return array($this -> config['ldap_options']['false_value']); } return array(); } @@ -69,7 +69,7 @@ class LSattr_ldap_boolean extends LSattr_ldap { if (!is_array($data)) { $data=array($data); } - if ($data[0] == $this -> config['true_value']) { + if ($data[0] == $this -> config['ldap_options']['true_value']) { return true; } return; @@ -86,7 +86,7 @@ class LSattr_ldap_boolean extends LSattr_ldap { if (!is_array($data)) { $data=array($data); } - if ($data[0] == $this -> config['false_value']) { + if ($data[0] == $this -> config['ldap_options']['false_value']) { return true; } return; diff --git a/trunk/includes/class/class.LSformElement_select_object.php b/trunk/includes/class/class.LSformElement_select_object.php index 63aca7c4..4ec4c070 100644 --- a/trunk/includes/class/class.LSformElement_select_object.php +++ b/trunk/includes/class/class.LSformElement_select_object.php @@ -141,10 +141,10 @@ class LSformElement_select_object extends LSformElement { * @retval array(dn -> displayName) Les objets trouvés */ function searchAdd ($pattern) { - if (is_array($this -> params['selectable_object'])) { - if (LSsession :: loadLSobject($this -> params['selectable_object']['object_type'])) { - $obj = new $this -> params['selectable_object']['object_type'](); - $ret = $obj -> getSelectArray($pattern,NULL,$this -> params['selectable_object']['display_attribute']); + if (is_array($this -> params['html_options']['selectable_object'])) { + if (LSsession :: loadLSobject($this -> params['html_options']['selectable_object']['object_type'])) { + $obj = new $this -> params['html_options']['selectable_object']['object_type'](); + $ret = $obj -> getSelectArray($pattern,NULL,$this -> params['html_options']['selectable_object']['display_attribute']); if (is_array($ret)) { return $ret; }