diff --git a/trunk/includes/addons/LSaddons.supann.php b/trunk/includes/addons/LSaddons.supann.php new file mode 100644 index 00000000..e4b284b2 --- /dev/null +++ b/trunk/includes/addons/LSaddons.supann.php @@ -0,0 +1,139 @@ + _("SUPANN Support : La constante %{const} n'est pas définie."), + 'level' => 'c' + ); + + $GLOBALS['LSerror_code']['SUPANN_01']= array ( + 'msg' => _("SUPANN Support : L'attribut %{dependency} est introuvable. Impossible de générer l'attribut %{attr}."), + 'level' => 'c' + ); + + /** + * Fin des données de configuration + */ + + + /** + * Verification du support SUPANN par ldapSaisie + * + * @author Benjamin Renard + * + * @retval boolean true si SUPANN est pleinement supporté, false sinon + */ + function LSaddon_supann_support() { + $retval = true; + + $MUST_DEFINE_CONST= array( + 'LS_SUPANN_LASTNAME_ATTR', + 'LS_SUPANN_FIRSTNAME_ATTR' + ); + + foreach($MUST_DEFINE_CONST as $const) { + if ( constant($const) == '' ) { + $GLOBALS['LSerror'] -> addErrorCode('SUPANN_SUPPORT_01',$const); + $retval=false; + } + } + + return $retval; + } + + /** + * Generation du displayName + * + * @author Benjamin Renard + * + * @param[in] $ldapObject L'objet ldap + * + * @retval string Le displayName ou false si il y a un problème durant la génération + */ + function generate_displayName($ldapObject) { + if ( get_class($ldapObject -> attrs[ LS_SUPANN_LASTNAME_ATTR ]) != 'LSattribute' ) { + $GLOBALS['LSerror'] -> addErrorCode('SUPANN_01',array('dependency' => LS_SUPANN_LASTNAME_ATTR, 'attr' => 'cn')); + return; + } + if ( get_class($ldapObject -> attrs[ LS_SUPANN_FIRSTNAME_ATTR ]) != 'LSattribute' ) { + $GLOBALS['LSerror'] -> addErrorCode('SUPANN_01',array('dependency' => LS_SUPANN_FIRSTNAME_ATTR, 'attr' => 'cn')); + return; + } + + $nom = $ldapObject -> attrs[ LS_SUPANN_LASTNAME_ATTR ] -> getValue(); + $prenom = $ldapObject -> attrs[ LS_SUPANN_FIRSTNAME_ATTR ] -> getValue(); + + return ($prenom.' '.$nom); + } + + /** + * Generation du CN + * + * @author Benjamin Renard + * + * @param[in] $ldapObject L'objet ldap + * + * @retval string Le CN ou false si il y a un problème durant la génération + */ + function generate_cn($ldapObject) { + if ( get_class($ldapObject -> attrs[ LS_SUPANN_LASTNAME_ATTR ]) != 'LSattribute' ) { + $GLOBALS['LSerror'] -> addErrorCode('SUPANN_01',array('dependency' => LS_SUPANN_LASTNAME_ATTR, 'attr' => 'cn')); + return; + } + if ( get_class($ldapObject -> attrs[ LS_SUPANN_FIRSTNAME_ATTR ]) != 'LSattribute' ) { + $GLOBALS['LSerror'] -> addErrorCode('SUPANN_01',array('dependency' => LS_SUPANN_FIRSTNAME_ATTR, 'attr' => 'cn')); + return; + } + + $nom = $ldapObject -> attrs[ LS_SUPANN_LASTNAME_ATTR ] -> getValue(); + $prenom = $ldapObject -> attrs[ LS_SUPANN_FIRSTNAME_ATTR ] -> getValue(); + + return (replaceAccents($nom).' '.replaceAccents($prenom)); + } + + + /** + * Supprime les accents d'une chaine + * + * @param[in] $string La chaine originale + * + * @retval string La chaine sans les accents + */ + function replaceAccents($string){ + return strtr($string, 'àáâãäçèéêëìíîïñòóôõöùúûüýÿÀÁÂÃÄÇÈÉÊËÌÍÎÏÑÒÓÔÕÖÙÚÛÜÝ', + 'aaaaaceeeeiiiinooooouuuuyyAAAAACEEEEIIIINOOOOOUUUUY'); + } + + +?> diff --git a/trunk/includes/class/class.LSattr_html_select_object.php b/trunk/includes/class/class.LSattr_html_select_object.php index 7ff9ef99..30bed0a9 100644 --- a/trunk/includes/class/class.LSattr_html_select_object.php +++ b/trunk/includes/class/class.LSattr_html_select_object.php @@ -83,7 +83,12 @@ class LSattr_html_select_object extends LSattr_html{ $conf=$this -> config['selectable_object']; if (!isset($conf['object_type'])) { $GLOBALS['LSerror'] -> addErrorCode(102,$this -> name); - break; + return; + } + + if (!$GLOBALS['LSsession'] -> loadLSobject($conf['object_type'])) { + $GLOBALS['LSerror'] -> addErrorCode(1004,$conf['object_type']); + return; } if (is_array($values)) { diff --git a/trunk/includes/class/class.LSformElement_select.php b/trunk/includes/class/class.LSformElement_select.php index a71d34a5..f058d93f 100644 --- a/trunk/includes/class/class.LSformElement_select.php +++ b/trunk/includes/class/class.LSformElement_select.php @@ -68,6 +68,9 @@ class LSformElement_select extends LSformElement { foreach ($this -> values as $value) { $return['html'].="
  • ".$this -> params['text_possible_values'][$value]."
  • "; } + if (empty($this -> values)) { + $return['html'] .= "
  • "._('Aucune valeur definie')."
  • \n"; + } $return['html'].="\n"; } return $return; diff --git a/trunk/includes/class/class.LSformElement_text.php b/trunk/includes/class/class.LSformElement_text.php index 76475a52..54fa35d2 100644 --- a/trunk/includes/class/class.LSformElement_text.php +++ b/trunk/includes/class/class.LSformElement_text.php @@ -44,7 +44,7 @@ class LSformElement_text extends LSformElement { // value if (!$this -> isFreeze()) { $return['html'] = "
      \n"; - if ($this -> params['html_options']['generate_value_format']!="") { + if (isset($this -> params['html_options'])) { $GLOBALS['LSsession'] -> addJSconfigParam($this -> name,$this -> params['html_options']); } if (empty($this -> values)) { diff --git a/trunk/includes/js/LSformElement_text_field.js b/trunk/includes/js/LSformElement_text_field.js index 069c0a73..6a36751c 100644 --- a/trunk/includes/js/LSformElement_text_field.js +++ b/trunk/includes/js/LSformElement_text_field.js @@ -27,6 +27,11 @@ var LSformElement_text_field = new Class({ },this); this.oldBg=this.input.getStyle('background-color'); this.fx = new Fx.Tween(this.input,{property: 'background-color',duration:600}); + this.generateBtn = new Element('img'); + this.generateBtn.addClass('btn'); + this.generateBtn.src='templates/images/generate.png'; + this.generateBtn.addEvent('click',this.refreshValue.bind(this)); + this.generateBtn.injectAfter(this.input); } } } @@ -42,7 +47,13 @@ var LSformElement_text_field = new Class({ refreshValue: function() { if (this._auto) { - this.input.value=getFData(this.format,this.parent,'getValue'); + var val=getFData(this.format,this.parent,'getValue'); + if ($type(this.params['withoutAccents'])) { + if(this.params['withoutAccents']) { + val = replaceAccents(val); + } + } + this.input.value = val; this.fx.start(this.onChangeColor); (function() {this.fx.start(this.oldBg);}).delay(1000,this); } diff --git a/trunk/includes/js/LSsmoothbox.js b/trunk/includes/js/LSsmoothbox.js index 9a8ad326..27167959 100644 --- a/trunk/includes/js/LSsmoothbox.js +++ b/trunk/includes/js/LSsmoothbox.js @@ -78,6 +78,10 @@ var LSsmoothbox = new Class({ this._open=0; this._scrolling=0; + + this.openOptions = {}; + + this.frame.set('html',''); }, position: function(){ @@ -335,12 +339,13 @@ var LSsmoothbox = new Class({ }, openURL: function(href,openOptions) { + this.load.bind(this)(); var options = { method: 'post', update: this.frame, url: href, evalScripts: true, - onComplete: varLSdefault.ajaxDisplayDebugAndError() + onComplete: (function(){varLSdefault.ajaxDisplayDebugAndError();this.resize()}).bind(this) }; this.displayValidBtn(); new Request.HTML(options).send(); diff --git a/trunk/includes/js/functions.js b/trunk/includes/js/functions.js index 194d2985..95cda7fb 100644 --- a/trunk/includes/js/functions.js +++ b/trunk/includes/js/functions.js @@ -73,3 +73,25 @@ function getFData(format,data,meth) { } return format; } + +/** +* Supprime les accents d'une chaine +* +* @param[in] $string La chaine originale +* +* @retval string La chaine sans les accents +*/ +function replaceAccents(str) { + var new_str = String(str); + var accent = + new Array("à","á","â","ã","ä","ç","è","é","ê","ë","ì","í","î","ï","ñ","ò","ó","ô","õ","ö","ù","ú","û","ü","ý","ÿ","À","Á","Â","Ã","Ä","Ç","È","É","Ê","Ë","Ì","Í","Î","Ï","Ñ","Ò","Ó","Ô","Õ","Ö","Ù","Ú","Û","Ü","Ý"); + var sans_accent = + new Array("a","a","a","a","a","c","e","e","e","e","i","i","i","i","n","o","o","o","o","o","u","u","u","u","y","y","A","A","A","A","A","C","E","E","E","E","I","I","I","I","N","O","O","O","O","O","U","U","U","U","Y"); + if (str && str!= "") { + for (i=0; i