From cc0a009b630f7b6dea5afcba06a01c204ccba6c2 Mon Sep 17 00:00:00 2001 From: Benjamin Renard Date: Wed, 15 Oct 2008 17:40:04 +0000 Subject: [PATCH] =?UTF-8?q?-=20LSform.js=20:=20=20=20->=20Refonte=20compl?= =?UTF-8?q?=C3=A8te=20pour=20coller=20au=20plus=20pr=C3=A8s=20de=20la=20r?= =?UTF-8?q?=C3=A9alit=C3=A9=20=20=20->=20Cr=C3=A9ation=20des=20classes=20L?= =?UTF-8?q?SformElement=20et=20LSformElement=5Ffield=20-=20LSsession=20:?= =?UTF-8?q?=20=20=20->=20M=C3=A9thode=20fetchTemplate()=20:=20retourne=20u?= =?UTF-8?q?n=20template=20compil=C3=A9=20-=20LSformElement=20:=20=20=20->?= =?UTF-8?q?=20M=C3=A9thode=20fetchTemplate()=20:=20Utilisation=20des=20tem?= =?UTF-8?q?plates=20pour=20l'affichage=20des=20=20=20=20=20=20LSformElemen?= =?UTF-8?q?t.=20=20=20->=20M=C3=A9thode=20isMultiple()=20=20=20->=20getEmp?= =?UTF-8?q?tyField()=20:=20m=C3=A9thode=20d'affichage=20par=20d=C3=A9faut?= =?UTF-8?q?=20d'un=20champs=20vide=20-=20LSformElement=5Ftextarea=20:=20?= =?UTF-8?q?=20=20->=20Utilisation=20des=20templates=20pour=20l'affichage?= =?UTF-8?q?=20=20=20->=20Ajout=20d'un=20bouton=20clear()=20-=20LSformEleme?= =?UTF-8?q?nt=5Ftext=20:=20=20=20->=20Utilisation=20des=20templates=20pour?= =?UTF-8?q?=20l'affichage=20=20=20->=20Adpatation=20pour=20pouvoir=20faire?= =?UTF-8?q?=20des=20classes=20filles.=20Celles-ci=20h=C3=A9riteront=20=20?= =?UTF-8?q?=20=20=20=20des=20fonctionnalit=C3=A9s=20des=20champs=20textes?= =?UTF-8?q?=20classiques=20=20=20->=20La=20m=C3=A9thode=20de=20g=C3=A9n?= =?UTF-8?q?=C3=A9ration=20est=20maintenant=20appliqu=C3=A9=20=C3=A0=20tout?= =?UTF-8?q?=20les=20champs=20et=20non=20=20=20=20=20=20plus=20simplement?= =?UTF-8?q?=20au=20premier=20-=20LSformElement=5Fmail=20:=20=20=20->=20Ref?= =?UTF-8?q?onte=20en=20utilisant=20l'h=C3=A9ritage=20de=20LSformElement=5F?= =?UTF-8?q?text?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../LSobjects/config.LSobjects.LSeepeople.php | 3 +- trunk/includes/class/class.LSform.php | 2 + trunk/includes/class/class.LSformElement.php | 44 ++++++++++++ .../class/class.LSformElement_mail.php | 67 ++++-------------- .../class/class.LSformElement_text.php | 43 +++--------- .../class/class.LSformElement_textarea.php | 38 ++-------- trunk/includes/class/class.LSsession.php | 15 ++++ trunk/includes/js/LSform.js | 70 +++++-------------- trunk/includes/js/LSformElement.js | 60 ++++++++++++++++ trunk/includes/js/LSformElement_field.js | 42 +++++++++++ trunk/includes/js/LSformElement_mail.js | 1 + trunk/includes/js/LSformElement_text.js | 31 +++++--- trunk/includes/js/LSformElement_text_field.js | 5 ++ trunk/includes/js/LSformElement_textarea.js | 32 +++++++++ trunk/index_ajax.php | 4 +- trunk/templates/default/LSformElement.tpl | 7 ++ .../templates/default/LSformElement_field.tpl | 5 ++ .../default/LSformElement_mail_field.tpl | 5 ++ .../default/LSformElement_text_field.tpl | 5 ++ .../default/LSformElement_textarea_field.tpl | 5 ++ 20 files changed, 297 insertions(+), 187 deletions(-) create mode 100644 trunk/includes/js/LSformElement.js create mode 100644 trunk/includes/js/LSformElement_field.js create mode 100644 trunk/includes/js/LSformElement_textarea.js create mode 100644 trunk/templates/default/LSformElement.tpl create mode 100644 trunk/templates/default/LSformElement_field.tpl create mode 100644 trunk/templates/default/LSformElement_mail_field.tpl create mode 100644 trunk/templates/default/LSformElement_text_field.tpl create mode 100644 trunk/templates/default/LSformElement_textarea_field.tpl diff --git a/trunk/conf/LSobjects/config.LSobjects.LSeepeople.php b/trunk/conf/LSobjects/config.LSobjects.LSeepeople.php index 00ace6ea..5116872e 100644 --- a/trunk/conf/LSobjects/config.LSobjects.LSeepeople.php +++ b/trunk/conf/LSobjects/config.LSobjects.LSeepeople.php @@ -269,7 +269,7 @@ $GLOBALS['LSobjects']['LSeepeople'] = array ( 'mail' => array ( 'label' => _('Adresse e-mail'), 'ldap_type' => 'ascii', - 'html_type' => 'text', + 'html_type' => 'mail', 'html_options' => array( 'generate_value_format' => '%{givenName}.%{sn}@ls.com', 'withoutAccent' => 1, @@ -320,6 +320,7 @@ $GLOBALS['LSobjects']['LSeepeople'] = array ( 'label' => _('Description'), 'ldap_type' => 'ascii', 'html_type' => 'textarea', + 'multiple' => 1, 'rights' => array( 'self' => 'w', 'user' => 'r', diff --git a/trunk/includes/class/class.LSform.php b/trunk/includes/class/class.LSform.php index c81a48b0..24e08763 100644 --- a/trunk/includes/class/class.LSform.php +++ b/trunk/includes/class/class.LSform.php @@ -76,6 +76,8 @@ class LSform { $GLOBALS['LSsession'] -> addJSscript('LSview.js'); } else { + $GLOBALS['LSsession'] -> addJSscript('LSformElement_field.js'); + $GLOBALS['LSsession'] -> addJSscript('LSformElement.js'); $GLOBALS['LSsession'] -> addJSscript('LSform.js'); } $GLOBALS['LSsession'] -> addCssFile('LSform.css'); diff --git a/trunk/includes/class/class.LSformElement.php b/trunk/includes/class/class.LSformElement.php index 238a79bc..c4a3af89 100644 --- a/trunk/includes/class/class.LSformElement.php +++ b/trunk/includes/class/class.LSformElement.php @@ -38,6 +38,8 @@ class LSformElement { var $_required = false; var $_freeze = false; var $attr_html; + var $fieldTemplate = 'LSformElement_field.tpl'; + var $template = 'LSformElement.tpl'; /** * Constructeur @@ -272,6 +274,10 @@ class LSformElement { } } + function isMultiple() { + return ($this -> params['multiple'] == true); + } + /** * Retourne le titre du champ * @@ -280,6 +286,44 @@ class LSformElement { function getTitle() { return $this -> form -> ldapObject -> getDisplayValue().' - '.$this -> getLabel(); } + + /** + * Retournne un template Smarty compilé dans le contexte d'un LSformElement + * + * @param[in] string $template Le template à retourner + * @param[in] array $variables Variables Smarty à assigner avant l'affichage + * + * @retval string Le HTML compilé du template + */ + function fetchTemplate($template=NULL,$variables=array()) { + if (!$template) { + $template = $this -> template; + } + return $GLOBALS['LSsession'] -> fetchTemplate( + $template, + array_merge_recursive( + $variables, + array( + 'freeze' => $this -> isFreeze(), + 'multiple'=> $this -> isMultiple(), + 'value' => '', + 'values' => $this -> values, + 'attr_name' => $this -> name, + 'noValueTxt' => _('Aucune valeur definie'), + 'fieldTemplate' => $this -> fieldTemplate + ) + ) + ); + } + + /** + * Retourne le code HTML d'un champ vide + * + * @retval string Code HTML d'un champ vide. + */ + function getEmptyField() { + return $this -> fetchTemplate($this -> fieldTemplate); + } } ?> diff --git a/trunk/includes/class/class.LSformElement_mail.php b/trunk/includes/class/class.LSformElement_mail.php index cd556e53..bc978d4c 100644 --- a/trunk/includes/class/class.LSformElement_mail.php +++ b/trunk/includes/class/class.LSformElement_mail.php @@ -30,62 +30,19 @@ * @author Benjamin Renard */ -class LSformElement_mail extends LSformElement { +class LSformElement_mail extends LSformElement_text { - /** - * 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'] = "\n"; - } - else { - $return['html'] = "\n"; - } - $GLOBALS['LSsession'] -> addJSscript('LSmail.js'); - $GLOBALS['LSsession'] -> addJSscript('LSsmoothbox.js'); - $GLOBALS['LSsession'] -> addCssFile('LSsmoothbox.css'); - $GLOBALS['LSsession'] -> addJSscript('LSconfirmBox.js'); - $GLOBALS['LSsession'] -> addCssFile('LSconfirmBox.css'); - $GLOBALS['LSsession'] -> addJSscript('LSformElement_mail.js'); - return $return; - } - - /** - * Retourne le code HTML d'un champ vide - * - * @retval string Code HTML d'un champ vide. - */ - function getEmptyField() { - $multiple = $this -> getMultipleData(); - return "".$multiple; - } + var $JSscripts = array( + 'LSmail.js', + 'LSsmoothbox.js', + 'LSconfirmBox.js', + 'LSformElement_mail.js' + ); + var $CSSfiles = array( + 'LSsmoothbox.css', + 'LSconfirmBox.css' + ); + var $fieldTemplate = 'LSformElement_mail_field.tpl'; } ?> diff --git a/trunk/includes/class/class.LSformElement_text.php b/trunk/includes/class/class.LSformElement_text.php index 54fa35d2..7e6b57fd 100644 --- a/trunk/includes/class/class.LSformElement_text.php +++ b/trunk/includes/class/class.LSformElement_text.php @@ -32,6 +32,10 @@ class LSformElement_text extends LSformElement { + var $JSscripts = array(); + var $CSSfiles = array(); + var $fieldTemplate = 'LSformElement_text_field.tpl'; + /** * Retourne les infos d'affichage de l'élément * @@ -43,48 +47,21 @@ class LSformElement_text extends LSformElement { $return = $this -> getLabelInfos(); // value if (!$this -> isFreeze()) { - $return['html'] = "\n"; $GLOBALS['LSsession'] -> addJSscript('LSformElement_text_field.js'); $GLOBALS['LSsession'] -> addJSscript('LSformElement_text.js'); } - else { - $return['html'] = "\n"; + foreach ($this -> JSscripts as $js) { + $GLOBALS['LSsession'] -> addJSscript($js); } + foreach ($this -> CSSfiles as $css) { + $GLOBALS['LSsession'] -> addCssFile($css); + } + $return['html'] = $this -> fetchTemplate(); return $return; } - - /** - * Retourne le code HTML d'un champ vide - * - * @retval string Code HTML d'un champ vide. - */ - function getEmptyField() { - $multiple = $this -> getMultipleData(); - return "".$multiple; - } } ?> diff --git a/trunk/includes/class/class.LSformElement_textarea.php b/trunk/includes/class/class.LSformElement_textarea.php index aa97bdf7..23162b19 100644 --- a/trunk/includes/class/class.LSformElement_textarea.php +++ b/trunk/includes/class/class.LSformElement_textarea.php @@ -32,6 +32,8 @@ class LSformElement_textarea extends LSformElement { + var $fieldTemplate = 'LSformElement_textarea_field.tpl'; + /** * Retourne les infos d'affichage de l'élément * @@ -41,44 +43,12 @@ class LSformElement_textarea extends LSformElement { */ function getDisplay(){ $return = $this -> getLabelInfos(); - // value - $return['html'] = "\n"; + $return['html'] = $this -> fetchTemplate(); return $return; } - - /** - * Retourne le code HTML d'un champ vide - * - * @retval string Code HTML d'un champ vide. - */ - function getEmptyField() { - $multiple = $this -> getMultipleData(); - return "\n".$multiple; - } - } ?> diff --git a/trunk/includes/class/class.LSsession.php b/trunk/includes/class/class.LSsession.php index 5f999982..55bf27dd 100644 --- a/trunk/includes/class/class.LSsession.php +++ b/trunk/includes/class/class.LSsession.php @@ -946,6 +946,21 @@ class LSsession { $this -> setTemplate('empty.tpl'); $GLOBALS['Smarty'] -> display($this -> template); } + + /** + * Retournne un template Smarty compilé + * + * @param[in] string $template Le template à retourner + * @param[in] array $variables Variables Smarty à assigner avant l'affichage + * + * @retval string Le HTML compilé du template + */ + function fetchTemplate($template,$variables=array()) { + foreach($variables as $name => $val) { + $GLOBALS['Smarty'] -> assign($name,$val); + } + return $GLOBALS['Smarty'] -> fetch($template); + } /** * Charge les droits LS de l'utilisateur diff --git a/trunk/includes/js/LSform.js b/trunk/includes/js/LSform.js index aa5ba7ea..b557c371 100644 --- a/trunk/includes/js/LSform.js +++ b/trunk/includes/js/LSform.js @@ -1,19 +1,22 @@ var LSform = new Class({ initialize: function(){ this._modules=[]; - this.initializeLSform_AddAndRemoveBtns(); - this.LStips = new Tips('.LStips'); + this._elements=[]; + + this.objecttype = $('LSform_objecttype').value, + this.objectdn = $('LSform_objectdn').value, + this.idform = $('LSform_idform').value, + + this.initializeLSform(); }, - initializeLSform_AddAndRemoveBtns: function(el) { + initializeLSform: function(el) { + this.LStips = new Tips('.LStips'); if (typeof(el) == 'undefined') { el = document; } - el.getElements('img[class=LSform-add-field-btn]').each(function(btn) { - btn.addEvent('click',this.onAddFieldBtnClick.bind(this,btn)); - }, this); - el.getElements('img[class=LSform-remove-field-btn]').each(function(btn) { - btn.addEvent('click',this.onRemoveFieldBtnClick.bind(this,btn)); + el.getElements('ul.LSform').each(function(ul) { + this._elements[ul.id] = new LSformElement(this,ul.id,ul); }, this); }, @@ -21,51 +24,14 @@ var LSform = new Class({ this._modules[name]=obj; }, - onAddFieldBtnClick: function(img){ - var getAttrName = /LSform_add_field_btn_(.*)_.*/ - var attrName = getAttrName.exec(img.id)[1]; - LSdebug(attrName); - - var data = { - template: 'LSform', - action: 'onAddFieldBtnClick', - attribute: attrName, - objecttype: $('LSform_objecttype').value, - objectdn: $('LSform_objectdn').value, - idform: $('LSform_idform').value, - img: img.id - }; - LSdebug(data); - data.imgload = varLSdefault.loadingImgDisplay(img); - new Request({url: 'index_ajax.php', data: data, onSuccess: this.onAddFieldBtnClickComplete.bind(this)}).send(); - }, - - onAddFieldBtnClickComplete: function(responseText, responseXML) { - var data = JSON.decode(responseText); - LSdebug(data); - if ( varLSdefault.checkAjaxReturn(data) ) { - var li = new Element('li'); - var img = $(data.img); - li.set('html',data.html); - li.injectAfter(img.getParent()); - this.initializeLSform_AddAndRemoveBtns(li); - if (typeof(this._modules[data.fieldtype]) != "undefined") { - try { - this._modules[data.fieldtype].reinitialize(li); - } - catch(e) { - LSdebug('Pas de reinitialise pour ' + data.fieldtype); - } + initializeModule: function(fieldType,li) { + if ($type(this._modules[fieldType])) { + try { + this._modules[fieldType].reinitialize(li); + } + catch(e) { + LSdebug('Pas de reinitialise pour ' + fieldType); } - } - }, - - onRemoveFieldBtnClick: function(img) { - if (img.getParent().getParent().getChildren().length == 1) { - img.getPrevious().getPrevious().value=''; - } - else { - img.getParent().destroy(); } } }); diff --git a/trunk/includes/js/LSformElement.js b/trunk/includes/js/LSformElement.js new file mode 100644 index 00000000..a12b8a86 --- /dev/null +++ b/trunk/includes/js/LSformElement.js @@ -0,0 +1,60 @@ +var LSformElement = new Class({ + initialize: function(LSform,name,ul){ + this.LSform=LSform; + this.name=name; + this.ul=ul; + this.fields=[]; + this.multiple = this.ul.hasClass('LSformElement_multiple'); + this.initializeLSformElement(); + }, + + initializeLSformElement: function(li) { + if (typeof(li) == 'undefined') { + var elements = this.ul.getElements('li'); + } + else { + var elements = [li]; + } + elements.each(function(li) { + var id='LSformElement_field_'+this.name+'_'+$random(1,1000); + this.fields[id] = new LSformElement_field(this,li,id); + }, this); + }, + + onAddFieldBtnClick: function(field){ + var data = { + template: 'LSform', + action: 'onAddFieldBtnClick', + attribute: this.name, + objecttype: this.LSform.objecttype, + objectdn: this.LSform.objectdn, + idform: this.LSform.idform, + fieldId: field.id + }; + LSdebug(data); + data.imgload = varLSdefault.loadingImgDisplay(field.li,'inside'); + new Request({url: 'index_ajax.php', data: data, onSuccess: this.onAddFieldBtnClickComplete.bind(this)}).send(); + }, + + onAddFieldBtnClickComplete: function(responseText, responseXML) { + var data = JSON.decode(responseText); + LSdebug(data); + if ( varLSdefault.checkAjaxReturn(data) ) { + var li = new Element('li'); + var field = this.fields[data.fieldId]; + li.set('html',data.html); + li.injectAfter(field.li); + this.initializeLSformElement(li); + this.LSform.initializeModule(data.fieldtype,li); + } + }, + + onRemoveFieldBtnClick: function(field) { + if (this.ul.getElements('li').length == 1) { + field.clearValue.bind(field)(); + } + else { + field.remove.bind(field)(); + } + } +}); diff --git a/trunk/includes/js/LSformElement_field.js b/trunk/includes/js/LSformElement_field.js new file mode 100644 index 00000000..30b3858d --- /dev/null +++ b/trunk/includes/js/LSformElement_field.js @@ -0,0 +1,42 @@ +var LSformElement_field = new Class({ + initialize: function(LSformElement,li,id){ + this.id = id; + this.LSformElement = LSformElement; + this.li = li; + + if (this.LSformElement.multiple) { + this.addFieldBtn = new Element('img'); + this.addFieldBtn.src = varLSdefault.imagePath('add.png'); + this.addFieldBtn.addClass('btn'); + this.addFieldBtn.addEvent('click',this.LSformElement.onAddFieldBtnClick.bind(this.LSformElement,this)); + this.addFieldBtn.injectInside(this.li); + + this.removeFieldBtn = new Element('img'); + this.removeFieldBtn.src = varLSdefault.imagePath('remove.png'); + this.removeFieldBtn.addClass('btn'); + this.removeFieldBtn.addEvent('click',this.LSformElement.onRemoveFieldBtnClick.bind(this.LSformElement,this)); + this.removeFieldBtn.injectInside(this.li); + } + }, + + getFormField: function() { + if ($type(this._formField)) { + return this._formField; + } + this._formField = this.li.getFirst('input'); + if(!$type(this._formField)) { + this._formField = this.li.getFirst('textarea'); + } + return this._formField; + }, + + clearValue: function() { + if ($type(this.getFormField())) { + this.getFormField().value=''; + } + }, + + remove: function() { + this.li.destroy(); + } +}); diff --git a/trunk/includes/js/LSformElement_mail.js b/trunk/includes/js/LSformElement_mail.js index 9ab605e6..f1d29c92 100644 --- a/trunk/includes/js/LSformElement_mail.js +++ b/trunk/includes/js/LSformElement_mail.js @@ -32,6 +32,7 @@ var LSformElement_mail = new Class({ }, reinitialize: function(el) { + varLSform.initializeModule('LSformElement_text',el); this.initialiseLSformElement_mail(el); }, diff --git a/trunk/includes/js/LSformElement_text.js b/trunk/includes/js/LSformElement_text.js index 8bd5cfc4..2fd165bc 100644 --- a/trunk/includes/js/LSformElement_text.js +++ b/trunk/includes/js/LSformElement_text.js @@ -1,26 +1,37 @@ var LSformElement_text = new Class({ initialize: function(){ - this.fields = new Hash(); + this.elements = new Hash(); this.initialiseLSformElement_text(); + if ($type(varLSform)) { + varLSform.addModule("LSformElement_text",this); + } }, initialiseLSformElement_text: function(el) { + if (typeof(el) == 'undefined') { el = document; } var getName = /^(.*)\[\]$/ - el.getElements('ul.LSformElement_text').each(function(ul) { - var first = ul.getElement('input.LSformElement_text'); - if ($type(first)) { - var name = getName.exec(first.name)[1]; - this.fields[name] = new LSformElement_text_field(name,first,this); + el.getElements('input.LSformElement_text').each(function(input) { + var name = getName.exec(input.name)[1]; + if (!$type(this.elements[name])) { + this.elements[name] = new Hash(); } + var id = this.elements[name].getLength(); + this.elements[name][id] = new LSformElement_text_field(name,input,this); }, this); - this.fields.each(function(el) { - el.start.bind(el)(); + this.elements.each(function(element) { + element.each(function(field) { + field.start.bind(field)(); + },this); },this); }, + reinitialize: function(el) { + this.initialiseLSformElement_text(el); + }, + getDependsFields: function(format) { var retval=new Array(); var find = 1; @@ -43,11 +54,11 @@ var LSformElement_text = new Class({ }, getInput: function(name) { - return this.fields[name].getInput(); + return this.elements[name][0].getInput(); }, getValue: function(name) { - return this.fields[name].getValue(); + return this.elements[name][0].getValue(); } }); diff --git a/trunk/includes/js/LSformElement_text_field.js b/trunk/includes/js/LSformElement_text_field.js index 27a5b020..a4dfd240 100644 --- a/trunk/includes/js/LSformElement_text_field.js +++ b/trunk/includes/js/LSformElement_text_field.js @@ -1,5 +1,6 @@ var LSformElement_text_field = new Class({ initialize: function(name,input,parent){ + this._start = false; this.name = name; this.parent = parent; this.input = input; @@ -10,6 +11,9 @@ var LSformElement_text_field = new Class({ }, start: function() { + if (this._start) { + return true; + } if ($type(this.params)) { if ($type(this.params['generate_value_format'])) { this.format = this.params['generate_value_format']; @@ -36,6 +40,7 @@ var LSformElement_text_field = new Class({ input.addEvent('change',this.refreshValue.bind(this)); },this); } + this._start=true; } } }, diff --git a/trunk/includes/js/LSformElement_textarea.js b/trunk/includes/js/LSformElement_textarea.js new file mode 100644 index 00000000..26e24635 --- /dev/null +++ b/trunk/includes/js/LSformElement_textarea.js @@ -0,0 +1,32 @@ +var LSformElement_textarea = new Class({ + initialize: function(){ + this.initialiseLSformElement_textarea(); + if ($type(varLSform)) { + varLSform.addModule("LSformElement_textarea",this); + } + }, + + initialiseLSformElement_textarea: function(el) { + if (!$type(el)) { + el = document; + } + el.getElements('textarea.LSform').each(function(textarea) { + var btn = new Element('img'); + btn.addClass('btn'); + btn.src = varLSdefault.imagePath('clear.png'); + btn.addEvent('click',this.onClearBtnClick.bind(this,btn)); + btn.injectAfter(textarea); + }, this); + }, + + onClearBtnClick: function(btn) { + btn.getPrevious().value=''; + }, + + reinitialize: function(el) { + this.initialiseLSformElement_textarea(el); + } +}); +window.addEvent(window.ie ? 'load' : 'domready', function() { + varLSformElement_textarea = new LSformElement_textarea(); +}); diff --git a/trunk/index_ajax.php b/trunk/index_ajax.php index e048e2e9..9eacdad9 100644 --- a/trunk/index_ajax.php +++ b/trunk/index_ajax.php @@ -45,7 +45,7 @@ if (!isset($_ERRORS)) { case 'LSform': switch($_REQUEST['action']) { case 'onAddFieldBtnClick': - if ((isset($_REQUEST['attribute'])) && (isset($_REQUEST['objecttype'])) && (isset($_REQUEST['objectdn'])) && (isset($_REQUEST['idform'])) && (isset($_REQUEST['img'])) ) { + if ((isset($_REQUEST['attribute'])) && (isset($_REQUEST['objecttype'])) && (isset($_REQUEST['objectdn'])) && (isset($_REQUEST['idform'])) && (isset($_REQUEST['fieldId'])) ) { if ($GLOBALS['LSsession'] -> loadLSobject($_REQUEST['objecttype'])) { $object = new $_REQUEST['objecttype'](); $object -> loadData($_REQUEST['objectdn']); @@ -54,7 +54,7 @@ if (!isset($_ERRORS)) { if ( $emptyField ) { $data = array( 'html' => $form -> getEmptyField($_REQUEST['attribute']), - 'img' => $_REQUEST['img'], + 'fieldId' => $_REQUEST['fieldId'], 'fieldtype' => get_class($form -> getElement($_REQUEST['attribute'])) ); } diff --git a/trunk/templates/default/LSformElement.tpl b/trunk/templates/default/LSformElement.tpl new file mode 100644 index 00000000..ddabefbd --- /dev/null +++ b/trunk/templates/default/LSformElement.tpl @@ -0,0 +1,7 @@ + diff --git a/trunk/templates/default/LSformElement_field.tpl b/trunk/templates/default/LSformElement_field.tpl new file mode 100644 index 00000000..e447a0b6 --- /dev/null +++ b/trunk/templates/default/LSformElement_field.tpl @@ -0,0 +1,5 @@ +{if $freeze} +{if $value}{$value}{else}{$noValueTxt}{/if} +{else} + +{/if} diff --git a/trunk/templates/default/LSformElement_mail_field.tpl b/trunk/templates/default/LSformElement_mail_field.tpl new file mode 100644 index 00000000..05af6024 --- /dev/null +++ b/trunk/templates/default/LSformElement_mail_field.tpl @@ -0,0 +1,5 @@ +{if $freeze} +{if $value}{$value}{else}{$noValueTxt}{/if} +{else} + +{/if} diff --git a/trunk/templates/default/LSformElement_text_field.tpl b/trunk/templates/default/LSformElement_text_field.tpl new file mode 100644 index 00000000..6806d832 --- /dev/null +++ b/trunk/templates/default/LSformElement_text_field.tpl @@ -0,0 +1,5 @@ +{if $freeze} +{if $value}{$value}{else}{$noValueTxt}{/if} +{else} + +{/if} diff --git a/trunk/templates/default/LSformElement_textarea_field.tpl b/trunk/templates/default/LSformElement_textarea_field.tpl new file mode 100644 index 00000000..637571cd --- /dev/null +++ b/trunk/templates/default/LSformElement_textarea_field.tpl @@ -0,0 +1,5 @@ +{if $freeze} +{if $value}{$value}{else}{$noValueTxt}{/if} +{else} + +{/if}