diff --git a/trunk/conf/LSobjects/config.LSobjects.LSeegroup.php b/trunk/conf/LSobjects/config.LSobjects.LSeegroup.php index c3b2c8c4..e31d279d 100644 --- a/trunk/conf/LSobjects/config.LSobjects.LSeegroup.php +++ b/trunk/conf/LSobjects/config.LSobjects.LSeegroup.php @@ -103,8 +103,8 @@ $GLOBALS['LSobjects']['LSeegroup'] = array ( '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' + 'display_name_format' => '%{cn} (%{uidNumber})', // Spécifie le attributs à lister pour le choix, + // si non définie => utilisation du 'display_name_format' // de la définition de l'objet 'value_attribute' => 'dn', // Spécifie le attributs dont la valeur sera retournée par @@ -157,7 +157,7 @@ $GLOBALS['LSobjects']['LSeegroup'] = array ( 'html_options' => array ( 'selectable_object' => array( 'object_type' => 'LSeepeople', - 'value_attribute' => '%{dn}' + 'value_attribute' => 'dn' ), ), 'validation' => array ( diff --git a/trunk/conf/LSobjects/config.LSobjects.LSeepeople.php b/trunk/conf/LSobjects/config.LSobjects.LSeepeople.php index 4a2568a1..8d2a5e52 100644 --- a/trunk/conf/LSobjects/config.LSobjects.LSeepeople.php +++ b/trunk/conf/LSobjects/config.LSobjects.LSeepeople.php @@ -272,8 +272,8 @@ $GLOBALS['LSobjects']['LSeepeople'] = 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' + 'display_name_format' => '%{cn} (%{gidNumber})', // Spécifie le attributs à lister pour le choix, + // si non définie => utilisation du 'display_name_format' // de la définition de l'objet 'value_attribute' => 'gidNumber', // Spécifie le attributs dont la valeur sera retournée par diff --git a/trunk/includes/class/class.LSattr_html_select_list.php b/trunk/includes/class/class.LSattr_html_select_list.php index 9c8982e2..c87d0cb2 100644 --- a/trunk/includes/class/class.LSattr_html_select_list.php +++ b/trunk/includes/class/class.LSattr_html_select_list.php @@ -23,6 +23,21 @@ /** * Type d'attribut HTML select_list * + * 'html_options' => array ( + * 'possible_values' => array ( + * '[LSformat de la valeur clé]' => '[LSformat du nom d'affichage]', + * ... + * 'OTHER_OBJECT' => array ( + * 'object_type' => '[Type d'LSobject]', + * 'display_name_format' => '[LSformat du nom d'affichage des LSobjects]', + * 'value_attribute' => '[Nom de l'attribut clé]', + * 'filter' => '[Filtre de recherche des LSobject]', + * 'scope' => '[Scope de la recherche]', + * 'basedn' => '[Basedn de la recherche]' + * ) + * ) + * ), + * * @author Benjamin Renard */ class LSattr_html_select_list extends LSattr_html{ @@ -72,7 +87,7 @@ class LSattr_html_select_list extends LSattr_html{ */ function getPossibleValues() { $retInfos = array(); - if (isset($this -> config['html_options']['possible_values'])) { + if (is_array($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']))) { @@ -84,22 +99,22 @@ class LSattr_html_select_list extends LSattr_html{ } $obj = new $val['object_type'](); if($val['scope']) { - $param=array('scope' => $this -> config['html_options']['possible_values']['scope']); + $param=array('scope' => $val['scope']); } else { $param=array(); } - $param['attributes'] = getFieldInFormat($val['display_attribute']); + $param['attributes'] = getFieldInFormat($val['display_name_format']); if ($val['value_attribute']!='dn') { $param['attributes'][] = $val['value_attribute']; } - $list = $obj -> search($val['filter'],$this -> config['html_options']['possible_values']['basedn'],$param); + $list = $obj -> search($val['filter'],$val['basedn'],$param); if(($val['value_attribute']=='dn')||($val['value_attribute']=='%{dn}')) { for($i=0;$i loadData($dn)) { - $retInfos[$dn] = $obj -> getDisplayName($conf['display_attribute']); + $retInfos[$dn] = $obj -> getDisplayName($conf['display_name_format']); } } } @@ -157,7 +157,7 @@ class LSattr_html_select_object extends LSattr_html{ if ($filter!='') { $filter='(|'.$filter.')'; $obj = new $conf['object_type'](); - $listobj = $obj -> listObjectsName($filter,NULL,array(),$conf['display_attribute']); + $listobj = $obj -> listObjectsName($filter,NULL,array(),$conf['display_name_format']); foreach($listobj as $dn => $name) { $DNs[]=$dn; $retInfos[$dn] = $name; diff --git a/trunk/includes/class/class.LSformElement_select_object.php b/trunk/includes/class/class.LSformElement_select_object.php index 4ec4c070..8279e6c9 100644 --- a/trunk/includes/class/class.LSformElement_select_object.php +++ b/trunk/includes/class/class.LSformElement_select_object.php @@ -24,9 +24,20 @@ /** * Element select d'un formulaire pour LdapSaisie * - * Cette classe définis les éléments select des formulaires. - * Elle étant la classe basic LSformElement. + * Cette classe définis les éléments select des formulaires. + * Elle étant la classe basic LSformElement. * + * Options HTML : + * // ************************************* + * 'html_options' => array ( + * selectable_object => array ( + * 'object_type' => '[Type d'LSobject selectionnable]', + * 'display_name_format' => '[LSformat du nom d'affichage des LSobjects]', + * 'value_attribute' => '[LSformat de la valeur clé référant à un LSobject donnée]' + * ) + * ), + * // ************************************* + * * @author Benjamin Renard */ @@ -144,7 +155,7 @@ class LSformElement_select_object extends LSformElement { 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']); + $ret = $obj -> getSelectArray($pattern,NULL,$this -> params['html_options']['selectable_object']['display_name_format']); if (is_array($ret)) { return $ret; }