diff --git a/trunk/conf/LSobjects/config.LSobjects.LSeepeople.php b/trunk/conf/LSobjects/config.LSobjects.LSeepeople.php index db6f6178..d3e05760 100644 --- a/trunk/conf/LSobjects/config.LSobjects.LSeepeople.php +++ b/trunk/conf/LSobjects/config.LSobjects.LSeepeople.php @@ -163,7 +163,7 @@ $GLOBALS['LSobjects']['LSeepeople'] = array ( 'html_type' => 'text', 'html_options' => array( 'generate_value_format' => '%{givenName} %{sn}', - 'autoGenerateOnModify' => false // default : false + 'autoGenerateOnModify' => true // default : false ), 'required' => 1, 'validation' => 'valid', @@ -222,8 +222,8 @@ $GLOBALS['LSobjects']['LSeepeople'] = array ( ), 'loginShell' => array ( 'label' => _('Interpreteur de commande'), - 'ldap_type' => 'ascii', - 'html_type' => 'select_list', + 'ldap_type' => 'boolean', + 'html_type' => 'boolean', 'required' => 1, 'default_value' => '/bin/false', 'rights' => array( @@ -235,10 +235,8 @@ $GLOBALS['LSobjects']['LSeepeople'] = array ( 'modify' => 1, 'create' => 1 ), - 'possible_values' => array( - '/bin/false' => _('Aucun'), - '/bin/bash' => 'Bash', - ) + 'true_value' => '/bin/bash', + 'false_value' => '/bin/false' ), 'sambaSID' => array ( 'label' => _('Identifiant Samba'), diff --git a/trunk/includes/class/class.LSattr_html_boolean.php b/trunk/includes/class/class.LSattr_html_boolean.php new file mode 100644 index 00000000..953b8a9e --- /dev/null +++ b/trunk/includes/class/class.LSattr_html_boolean.php @@ -0,0 +1,53 @@ + + */ +class LSattr_html_boolean extends LSattr_html { + + /** + * Ajoute l'attribut au formualaire passer en paramètre + * + * @param[in] &$form LSform Le formulaire + * @param[in] $idForm L'identifiant du formulaire + * @param[in] $data Valeur du champs du formulaire + * + * @retval LSformElement L'element du formulaire ajouté + */ + function addToForm (&$form,$idForm,$data=NULL) { + $element=$form -> addElement('boolean', $this -> name, $this -> config['label'],$this -> config, $this); + if(!$element) { + $GLOBALS['LSerror'] -> addErrorCode(206,$this -> name); + return; + } + if ($data) { + $element -> setValue($data); + } + return $element; + } + +} + +?> diff --git a/trunk/includes/class/class.LSattr_ldap_boolean.php b/trunk/includes/class/class.LSattr_ldap_boolean.php new file mode 100644 index 00000000..8eca3b35 --- /dev/null +++ b/trunk/includes/class/class.LSattr_ldap_boolean.php @@ -0,0 +1,76 @@ + isTrue($data))?1:0; + } + + /** + * Retourne la valeur de l'attribut après traitement lié à son type ldap + * + * @param[in] $data mixed La valeur de l'attribut + * + * @retval mixed La valeur traitée de l'attribut + */ + function getUpdateData($data) { + if ($data[0]==1) { + return array($this -> config['true_value']); + } + else { + return array($this -> config['false_value']); + } + } + + /** + * Determine si la valeur passé en paramètre correspond a True ou non + * + * @param[in] $data La valeur de l'attribut + * + * @retval boolean True ou False + */ + function isTrue($data) { + if (!is_array($data)) { + $data=array($data); + } + if ($data[0] == $this -> config['true_value']) { + return true; + } + return; + } +} + +?> diff --git a/trunk/includes/class/class.LSform.php b/trunk/includes/class/class.LSform.php index c3670201..fcf78c4d 100644 --- a/trunk/includes/class/class.LSform.php +++ b/trunk/includes/class/class.LSform.php @@ -247,7 +247,7 @@ class LSform { */ function checkRequired($data) { foreach($data as $val) { - if (!empty($val)) + if (!empty($val)||(is_string($val)&&($val=="0"))) return true; } return; diff --git a/trunk/includes/class/class.LSformElement_boolean.php b/trunk/includes/class/class.LSformElement_boolean.php new file mode 100644 index 00000000..ec2771b0 --- /dev/null +++ b/trunk/includes/class/class.LSformElement_boolean.php @@ -0,0 +1,101 @@ + + */ + +class LSformElement_boolean extends LSformElement { + + /** + * Retourne les infos d'affichage de l'élément + * + * Cette méthode retourne les informations d'affichage de l'élement + * + * @retval array + */ + function getDisplay(){ + $return = $this -> getLabelInfos(); + // value + if (!$this -> isFreeze()) { + $return['html'] = "