mirror of
https://gitlab.easter-eggs.com/ee/ldapsaisie.git
synced 2024-11-18 00:09:06 +01:00
LSformElement::getEmptyField() / LSformElement.tpl: Provide value index as $value_idx template variable
This commit is contained in:
parent
df1c46eab6
commit
6a3fd60d3e
9 changed files with 93 additions and 52 deletions
|
@ -667,16 +667,17 @@ class LSform extends LSlog_staticLoggerClass {
|
|||
}
|
||||
|
||||
/**
|
||||
* Retourne le code HTML d'un champ vide.
|
||||
* Return the HTML code of an empty form field
|
||||
*
|
||||
* @param[in] string Le nom du champ du formulaire
|
||||
* @param[in] $element string The form element name
|
||||
* @param[in] $value_idx integer|null The value index (optional, default: null == 0)
|
||||
*
|
||||
* @retval string Le code HTML du champ vide.
|
||||
* @retval string|null The HTML code of the specified field if exist, null otherwise
|
||||
*/
|
||||
public function getEmptyField($element) {
|
||||
public function getEmptyField($element, $value_idx=null) {
|
||||
$element = $this -> getElement($element);
|
||||
if ($element) {
|
||||
return $element -> getEmptyField();
|
||||
return $element -> getEmptyField($value_idx);
|
||||
}
|
||||
else {
|
||||
return;
|
||||
|
@ -777,10 +778,12 @@ class LSform extends LSlog_staticLoggerClass {
|
|||
$object = new $_REQUEST['objecttype']();
|
||||
$object -> loadData($_REQUEST['objectdn']);
|
||||
$form = $object -> getForm($_REQUEST['idform']);
|
||||
$emptyField=$form -> getEmptyField($_REQUEST['attribute']);
|
||||
$value_idx = (isset($_REQUEST['value_idx'])?$_REQUEST['value_idx']:0);
|
||||
$emptyField = $form -> getEmptyField($_REQUEST['attribute'], $value_idx);
|
||||
if ( $emptyField ) {
|
||||
$data = array(
|
||||
'html' => $form -> getEmptyField($_REQUEST['attribute']),
|
||||
'html' => $emptyField,
|
||||
'value_idx' => $value_idx,
|
||||
'fieldId' => $_REQUEST['fieldId'],
|
||||
'fieldtype' => get_class($form -> getElement($_REQUEST['attribute']))
|
||||
);
|
||||
|
|
|
@ -322,12 +322,20 @@ class LSformElement extends LSlog_staticLoggerClass {
|
|||
}
|
||||
|
||||
/**
|
||||
* Retourne le code HTML d'un champ vide
|
||||
* Return HTML code of an empty form field
|
||||
*
|
||||
* @retval string Code HTML d'un champ vide.
|
||||
* @param[in] $value_idx integer|null The value index (optional, default: null == 0)
|
||||
*
|
||||
* @retval string The HTML code of an empty field
|
||||
*/
|
||||
public function getEmptyField() {
|
||||
return $this -> fetchTemplate($this -> fieldTemplate);
|
||||
public function getEmptyField($value_idx=null) {
|
||||
return $this -> fetchTemplate(
|
||||
$this -> fieldTemplate,
|
||||
array(
|
||||
'value' => null,
|
||||
'value_idx' => intval($value_idx),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -59,15 +59,22 @@ class LSformElement_labeledValue extends LSformElement {
|
|||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retourne le code HTML d'un champ vide
|
||||
*
|
||||
* @retval string Code HTML d'un champ vide.
|
||||
*/
|
||||
public function getEmptyField() {
|
||||
return $this -> fetchTemplate($this -> fieldTemplate,array(
|
||||
'labels' => $this -> getParam('html_options.labels'),
|
||||
));
|
||||
/**
|
||||
* Return HTML code of an empty form field
|
||||
*
|
||||
* @param[in] $value_idx integer|null The value index (optional, default: null == 0)
|
||||
*
|
||||
* @retval string The HTML code of an empty field
|
||||
*/
|
||||
public function getEmptyField($value_idx=null) {
|
||||
return $this -> fetchTemplate(
|
||||
$this -> fieldTemplate,
|
||||
array(
|
||||
'value' => null,
|
||||
'value_idx' => intval($value_idx),
|
||||
'labels' => $this -> getParam('html_options.labels'),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -94,16 +94,20 @@ class LSformElement_mailQuota extends LSformElement {
|
|||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retourne le code HTML d'un champ vide
|
||||
*
|
||||
* @retval string Code HTML d'un champ vide.
|
||||
*/
|
||||
public function getEmptyField() {
|
||||
/**
|
||||
* Return HTML code of an empty form field
|
||||
*
|
||||
* @param[in] $value_idx integer|null The value index (optional, default: null == 0)
|
||||
*
|
||||
* @retval string The HTML code of an empty field
|
||||
*/
|
||||
public function getEmptyField($value_idx=null) {
|
||||
return $this -> fetchTemplate(
|
||||
$this -> fieldTemplate,
|
||||
array(
|
||||
'sizeFacts' => $this -> sizeFacts
|
||||
'value' => null,
|
||||
'value_idx' => intval($value_idx),
|
||||
'sizeFacts' => $this -> sizeFacts,
|
||||
)
|
||||
);
|
||||
}
|
||||
|
|
|
@ -94,16 +94,20 @@ class LSformElement_quota extends LSformElement {
|
|||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retourne le code HTML d'un champ vide
|
||||
*
|
||||
* @retval string Code HTML d'un champ vide.
|
||||
*/
|
||||
public function getEmptyField() {
|
||||
/**
|
||||
* Return HTML code of an empty form field
|
||||
*
|
||||
* @param[in] $value_idx integer|null The value index (optional, default: null == 0)
|
||||
*
|
||||
* @retval string The HTML code of an empty field
|
||||
*/
|
||||
public function getEmptyField($value_idx=null) {
|
||||
return $this -> fetchTemplate(
|
||||
$this -> fieldTemplate,
|
||||
array(
|
||||
'sizeFacts' => $this -> sizeFacts
|
||||
'value' => null,
|
||||
'value_idx' => intval($value_idx),
|
||||
'sizeFacts' => $this -> sizeFacts,
|
||||
)
|
||||
);
|
||||
}
|
||||
|
|
|
@ -118,13 +118,22 @@ class LSformElement_supannCompositeAttribute extends LSformElement {
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Retourne le code HTML d'un champ vide
|
||||
*
|
||||
* @retval string Code HTML d'un champ vide.
|
||||
*/
|
||||
public function getEmptyField() {
|
||||
return $this -> fetchTemplate($this -> fieldTemplate,array('components' => $this -> components));
|
||||
/**
|
||||
* Return HTML code of an empty form field
|
||||
*
|
||||
* @param[in] $value_idx integer|null The value index (optional, default: null == 0)
|
||||
*
|
||||
* @retval string The HTML code of an empty field
|
||||
*/
|
||||
public function getEmptyField($value_idx=null) {
|
||||
return $this -> fetchTemplate(
|
||||
$this -> fieldTemplate,
|
||||
array(
|
||||
'value' => null,
|
||||
'value_idx' => intval($value_idx),
|
||||
'components' => $this -> components,
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -123,16 +123,20 @@ class LSformElement_valueWithUnit extends LSformElement {
|
|||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retourne le code HTML d'un champ vide
|
||||
*
|
||||
* @retval string Code HTML d'un champ vide.
|
||||
*/
|
||||
public function getEmptyField() {
|
||||
/**
|
||||
* Return HTML code of an empty form field
|
||||
*
|
||||
* @param[in] $value_idx integer|null The value index (optional, default: null == 0)
|
||||
*
|
||||
* @retval string The HTML code of an empty field
|
||||
*/
|
||||
public function getEmptyField($value_idx=null) {
|
||||
return $this -> fetchTemplate(
|
||||
$this -> fieldTemplate,
|
||||
array(
|
||||
'units' => $this -> getUnits()
|
||||
'value' => null,
|
||||
'value_idx' => intval($value_idx),
|
||||
'units' => $this -> getUnits(),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
|
|
@ -27,7 +27,8 @@ var LSformElement = new Class({
|
|||
objecttype: this.LSform.objecttype,
|
||||
objectdn: this.LSform.objectdn,
|
||||
idform: this.LSform.idform,
|
||||
fieldId: field.id
|
||||
fieldId: field.id,
|
||||
value_idx: this.ul.getChildren('li').length,
|
||||
};
|
||||
LSdebug(data);
|
||||
data.imgload = varLSdefault.loadingImgDisplay(field.li,'inside');
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
<ul class='LSform{if $multiple && !$freeze} LSformElement_multiple'{/if}' id='{$attr_name|escape:"quotes"}'>
|
||||
{foreach from=$values item=value}
|
||||
<ul class='LSform{if $multiple && !$freeze} LSformElement_multiple{/if}' id='{$attr_name|escape:"quotes"}'>
|
||||
{foreach from=$values key=value_idx item=value}
|
||||
<li>{include file="ls:$fieldTemplate"}</li>
|
||||
{foreachelse}
|
||||
{assign var=value value=""}
|
||||
{assign var=value_idx value=0}
|
||||
<li>{include file="ls:$fieldTemplate"}</li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
|
|
Loading…
Reference in a new issue