diff --git a/trunk/includes/class/class.LSformElement.php b/trunk/includes/class/class.LSformElement.php
index 31f63544..bbdbe00d 100644
--- a/trunk/includes/class/class.LSformElement.php
+++ b/trunk/includes/class/class.LSformElement.php
@@ -179,21 +179,6 @@ class LSformElement {
return $this -> _required;
}
- /**
- * Affiche le label de l'élement
- *
- * @retval void
- */
- function displayLabel() {
- if ($this -> isRequired()) {
- $required=" *";
- }
- else {
- $required="";
- }
- echo "\t\t
".$this -> getLabel()."$required | \n";
- }
-
/**
* Retourne le label de l'élement
*
@@ -262,32 +247,14 @@ class LSformElement {
}
/**
- * Retourne l'HTML pour les boutons d'ajout et de suppression de champs du formulaire LSform
+ * Le champ est-il a valeur multiple
*
- * @retval string Le code HTML des boutons
+ * @retval boolean True si le champ est à valeur multiple, False sinon
*/
- function getMultipleData() {
- if ($this -> params['multiple'] == true ) {
- return "";
- }
- else {
- return '';
- }
- }
-
function isMultiple() {
return ($this -> params['multiple'] == true);
}
- /**
- * Retourne le titre du champ
- *
- * @retval string Titre du champ
- **/
- function getTitle() {
- return $this -> form -> ldapObject -> getDisplayValue().' - '.$this -> getLabel();
- }
-
/**
* Retournne un template Smarty compilé dans le contexte d'un LSformElement
*
diff --git a/trunk/includes/class/class.LSformElement_select_object.php b/trunk/includes/class/class.LSformElement_select_object.php
index c415c3cf..694a49ed 100644
--- a/trunk/includes/class/class.LSformElement_select_object.php
+++ b/trunk/includes/class/class.LSformElement_select_object.php
@@ -32,6 +32,9 @@
class LSformElement_select_object extends LSformElement {
+ var $fieldTemplate = 'LSformElement_select_object_field.tpl';
+ var $template = 'LSformElement_select_object.tpl';
+
/**
* Retourn les infos d'affichage de l'élément
*
@@ -45,32 +48,18 @@ class LSformElement_select_object extends LSformElement {
$this -> values = $this -> attr_html -> getValuesFromSession();
}
$return = $this -> getLabelInfos();
- // value
-
- $params=array();
- if (!$this -> isFreeze()) {
- $params['attr_name'] = $this -> name;
- $params['object_type'] = $this -> selectableObject;
- $params['addBtn'] = _('Modifier');
- $params['deleteBtns'] = _('Supprimer');
- $params['multiple'] = ($this -> params['multiple'])?1:0;
- }
-
- $ul_id="LSformElement_select_object_".$this -> name;
- $params['freeze'] = $this -> isFreeze();
- $GLOBALS['LSsession'] -> addJSconfigParam($ul_id,$params);
-
- $return['html']="\n";
+
if (!$this -> isFreeze()) {
+ $GLOBALS['LSsession'] -> addJSconfigParam(
+ $this -> name,
+ array(
+ 'object_type' => $this -> selectableObject,
+ 'addBtn' => _('Modifier'),
+ 'deleteBtns' => _('Supprimer'),
+ 'multiple' => (($this -> params['multiple'])?1:0)
+ )
+ );
+
$GLOBALS['LSsession'] -> addJSscript('LSformElement_select_object_field.js');
$GLOBALS['LSsession'] -> addJSscript('LSformElement_select_object.js');
$GLOBALS['LSsession'] -> addJSscript('LSform.js');
@@ -80,7 +69,9 @@ class LSformElement_select_object extends LSformElement {
$GLOBALS['LSsession'] -> addCssFile('LSsmoothbox.css');
$GLOBALS['LSsession'] -> addJSscript('LSconfirmBox.js');
$GLOBALS['LSsession'] -> addCssFile('LSconfirmBox.css');
+
}
+ $return['html'] = $this -> fetchTemplate(NULL,array('selectableObject' => $this -> selectableObject));
return $return;
}
diff --git a/trunk/includes/js/LSformElement_select_object_field.js b/trunk/includes/js/LSformElement_select_object_field.js
index 47f4501a..f62a95de 100644
--- a/trunk/includes/js/LSformElement_select_object_field.js
+++ b/trunk/includes/js/LSformElement_select_object_field.js
@@ -2,11 +2,10 @@ var LSformElement_select_object_field = new Class({
initialize: function(ul){
this.ul=ul;
this.dd=ul.getParent();
- this.params = varLSdefault.LSjsConfig[ul.id];
+ this.name = ul.id;
+ this.params = varLSdefault.LSjsConfig[this.name];
if ($type(this.params)) {
- if (!this.params.freeze) {
- this.initializeLSformElement_select_object();
- }
+ this.initializeLSformElement_select_object();
}
},
@@ -97,7 +96,7 @@ var LSformElement_select_object_field = new Class({
var data = {
template: 'LSform',
action: 'refreshField',
- attribute: this.params['attr_name'],
+ attribute: this.name,
objecttype: $('LSform_objecttype').value,
objectdn: $('LSform_objectdn').value,
idform: $('LSform_idform').value
@@ -119,7 +118,7 @@ var LSformElement_select_object_field = new Class({
var a = li.getFirst('a');
var input = li.getFirst('input');
if (a.hasClass('LSformElement_select_object_deleted')) {
- input.name=this.params['attr_name']+'[]';
+ input.name=this.name+'[]';
a.addClass('LSformElement_select_object');
a.removeClass('LSformElement_select_object_deleted');
}
diff --git a/trunk/templates/default/LSformElement_select_object.tpl b/trunk/templates/default/LSformElement_select_object.tpl
new file mode 100644
index 00000000..570411ec
--- /dev/null
+++ b/trunk/templates/default/LSformElement_select_object.tpl
@@ -0,0 +1,7 @@
+
diff --git a/trunk/templates/default/LSformElement_select_object_field.tpl b/trunk/templates/default/LSformElement_select_object_field.tpl
new file mode 100644
index 00000000..2bd555db
--- /dev/null
+++ b/trunk/templates/default/LSformElement_select_object_field.tpl
@@ -0,0 +1,9 @@
+{if $freeze}
+ {if $dn}
+ {$txt}
+ {else}
+ {$noValueTxt}
+ {/if}
+{else}
+ {$txt}
+{/if}