mirror of
https://gitlab.easter-eggs.com/ee/ldapsaisie.git
synced 2024-12-18 14:33:49 +01:00
LSaddon :: supann : redesign and improve this addon
This commit is contained in:
parent
391018e492
commit
53ef8436d4
28 changed files with 4366 additions and 2874 deletions
File diff suppressed because it is too large
Load diff
|
@ -0,0 +1,41 @@
|
|||
ul.LSformElement_supannCompositeAttribute li {
|
||||
border: 1px dotted #CCC;
|
||||
padding: 2px;
|
||||
}
|
||||
|
||||
ul.LSformElement_supannCompositeAttribute li.noValue {
|
||||
border: none;
|
||||
}
|
||||
|
||||
ul.LSformElement_supannCompositeAttribute p {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
ul.LSformElement_supannCompositeAttribute p label {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
input.LSformElement_supannCompositeAttribute_search {
|
||||
border: 1px solid #CCC;
|
||||
width: 200px;
|
||||
background: url('../../images/default/find.png') no-repeat scroll 0% 0% #FFF !important;
|
||||
padding-left: 18px;
|
||||
}
|
||||
|
||||
div.supannCompositeAttribute_possibleValues ul {
|
||||
list-style-type: none;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
border: 1px solid #CCC;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
div.supannCompositeAttribute_possibleValues li {
|
||||
border-bottom: 1px solid #CCC;
|
||||
margin-bottom: 2px;
|
||||
}
|
||||
|
||||
div.supannCompositeAttribute_possibleValues li:hover {
|
||||
background-color: #CCC;
|
||||
cursor: pointer;
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
LSformElement_supannRoleEntite_label_SUPANN.png
|
BIN
public_html/images/default/supann_label_BCN.png
Normal file
BIN
public_html/images/default/supann_label_BCN.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 678 B |
1
public_html/images/default/supann_label_NCORPS.png
Symbolic link
1
public_html/images/default/supann_label_NCORPS.png
Symbolic link
|
@ -0,0 +1 @@
|
|||
supann_label_BCN.png
|
1
public_html/images/default/supann_label_SISE.png
Symbolic link
1
public_html/images/default/supann_label_SISE.png
Symbolic link
|
@ -0,0 +1 @@
|
|||
supann_label_BCN.png
|
Before Width: | Height: | Size: 851 B After Width: | Height: | Size: 851 B |
Before Width: | Height: | Size: 901 B After Width: | Height: | Size: 901 B |
|
@ -68,16 +68,11 @@ LSerror :: defineError('SUPANN_02',
|
|||
}
|
||||
|
||||
$MUST_DEFINE_ARRAY= array(
|
||||
'supannRoleGenerique',
|
||||
'supannTypeEntite',
|
||||
'supannTranslateRoleEntiteValueDirectory',
|
||||
'supannTranslateFunctionDirectory',
|
||||
'tableCodeUAI',
|
||||
'supannTranslateEtablissementDirectory',
|
||||
'supannNomenclatures',
|
||||
);
|
||||
foreach($MUST_DEFINE_ARRAY as $array) {
|
||||
if ( !isset($GLOBALS[$array]) || !is_array($GLOBALS[$array])) {
|
||||
LSerror :: addErrorCode('SUPANN_SUPPORT_01',$array);
|
||||
LSerror :: addErrorCode('SUPANN_SUPPORT_03',$array);
|
||||
$retval=false;
|
||||
}
|
||||
}
|
||||
|
@ -91,6 +86,10 @@ LSerror :: defineError('SUPANN_02',
|
|||
return $retval;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* Fonctions de génération de valeurs d'attributs
|
||||
**********************************************************************/
|
||||
|
||||
/**
|
||||
* Generation du displayName
|
||||
*
|
||||
|
@ -237,6 +236,31 @@ LSerror :: defineError('SUPANN_02',
|
|||
return $retval;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* Fonction de parsing des valeurs spécifiques SUPANN
|
||||
**********************************************************************/
|
||||
|
||||
/**
|
||||
* Parse une valeur a etiquette SUPANN
|
||||
*
|
||||
* Exemple de valeur :
|
||||
*
|
||||
* {SUPANN}S410
|
||||
*
|
||||
* @param[in] $val La valeur
|
||||
*
|
||||
* @retval array Un tableau cle->valeur contenant label et value ou False
|
||||
**/
|
||||
function supannParseLabeledValue($value) {
|
||||
if (preg_match('/^\{([^\}]*)\}(.*)$/',$value,$m)) {
|
||||
return array(
|
||||
'label'=>$m[1],
|
||||
'value'=>$m[2]
|
||||
);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse une valeur composite SUPANN
|
||||
*
|
||||
|
@ -261,175 +285,139 @@ LSerror :: defineError('SUPANN_02',
|
|||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retourne une eventuelle fonction de traduction d'une valeur
|
||||
* en fonction de son label et de sa cle.
|
||||
*
|
||||
* Utilise la table $GLOBALS['supannTranslateFunctionDirectory']
|
||||
*
|
||||
* @param[in] $label Le label de la valeur
|
||||
* @param[in] $key La cle de la valeur
|
||||
*
|
||||
* @retval string|false Le nom de la fonction de traduction ou false
|
||||
**/
|
||||
function supannTranslateRoleEntiteFunction($label,$key) {
|
||||
if (isset($GLOBALS['supannTranslateFunctionDirectory'][$label][$key])) {
|
||||
return $GLOBALS['supannTranslateFunctionDirectory'][$label][$key];
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* Fonctions relatives aux entités
|
||||
**********************************************************************/
|
||||
|
||||
/**
|
||||
* Retourne le nom court d'une entite en fonction de son identifiant
|
||||
*
|
||||
* Fonction utilise comme fonction de traduction dans la fonction
|
||||
* supannTranslateRoleEntiteValue()
|
||||
*
|
||||
* @param[in] $label Le label de la valeur
|
||||
* @param[in] $key La cle de la valeur
|
||||
* @param[in] $value La valeur : l'identifiant de l'entite (supannCodeEntite)
|
||||
* @param[in] $id L'identifiant de l'entite (supannCodeEntite)
|
||||
*
|
||||
* @retval string Le nom de l'entite
|
||||
**/
|
||||
function supanGetEntiteNameById($label,$key,$value) {
|
||||
function supanGetEntiteNameById($id) {
|
||||
if (LSsession::loadLSobject(LS_SUPANN_LSOBJECT_ENTITE_TYPE)) {
|
||||
$type=LS_SUPANN_LSOBJECT_ENTITE_TYPE;
|
||||
$e = new $type();
|
||||
$list=$e -> listObjectsName("(supannCodeEntite=$value)",NULL,array(),LS_SUPANN_LSOBJECT_ENTITE_FORMAT_SHORTNAME);
|
||||
$list=$e -> listObjectsName("(supannCodeEntite=$id)",NULL,array(),LS_SUPANN_LSOBJECT_ENTITE_FORMAT_SHORTNAME);
|
||||
if (count($list)==1) {
|
||||
return array(
|
||||
'translated' => array_pop($list),
|
||||
'label' => $label
|
||||
);
|
||||
return array_pop($list);
|
||||
}
|
||||
}
|
||||
return array(
|
||||
'translated' => getFData(__("%{value} (unrecognized value)"),$value),
|
||||
'label' => $label
|
||||
);
|
||||
return getFData(__("Entity %{id} (unrecognized)"),$id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse une valeur a etiquette SUPANN
|
||||
* Valide l'ID d'une entite
|
||||
*
|
||||
* Exemple de valeur :
|
||||
* @param[in] $id L'identifiant de l'entite (supannCodeEntite)
|
||||
*
|
||||
* {SUPANN}S410
|
||||
*
|
||||
* @param[in] $val La valeur
|
||||
*
|
||||
* @retval array Un tableau cle->valeur contenant label et value ou False
|
||||
* @retval boolean True si une entité avec cet ID existe, False sinon
|
||||
**/
|
||||
function supannParseLabeledValue($value) {
|
||||
if (preg_match('/^\{([^\}]*)\}(.*)$/',$value,$m)) {
|
||||
return array(
|
||||
'label'=>$m[1],
|
||||
'value'=>$m[2]
|
||||
);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Simple découpage label/valeur sans traduction réel
|
||||
*
|
||||
* @param[in] $key La cle
|
||||
* @param[in] $value La valeur
|
||||
*
|
||||
* @retval array Un tableau cle->valeur contenant label et translated
|
||||
**/
|
||||
function supannTranslateLabeledValue($value) {
|
||||
$label='no';
|
||||
$pl=supannParseLabeledValue($value);
|
||||
if ($pl) {
|
||||
$label=$pl['label'];
|
||||
$value=$pl['value'];
|
||||
}
|
||||
|
||||
return array(
|
||||
'label' => $label,
|
||||
'translated' => $value
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Traduit une valeur en fonction de sa cle extrait d'un attribut
|
||||
* supannRoleEntite.
|
||||
*
|
||||
* @param[in] $key La cle
|
||||
* @param[in] $value La valeur
|
||||
*
|
||||
* @retval array Un tableau cle->valeur contenant label et translated ou False
|
||||
**/
|
||||
function supannTranslateRoleEntiteValue($key,$value) {
|
||||
$label='no';
|
||||
$pl=supannParseLabeledValue($value);
|
||||
if ($pl) {
|
||||
$label=$pl['label'];
|
||||
$value=$pl['value'];
|
||||
}
|
||||
|
||||
// Translate by method
|
||||
if (supannTranslateRoleEntiteFunction($label,$key)) {
|
||||
$func = supannTranslateRoleEntiteFunction($label,$key);
|
||||
if (function_exists($func)) {
|
||||
try {
|
||||
return $func($label,$key,$value);
|
||||
}
|
||||
catch (Exception $e) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
else {
|
||||
return;
|
||||
function supannValidateEntityId($id) {
|
||||
if (LSsession::loadLSobject(LS_SUPANN_LSOBJECT_ENTITE_TYPE)) {
|
||||
$type=LS_SUPANN_LSOBJECT_ENTITE_TYPE;
|
||||
$e = new $type();
|
||||
$list=$e -> listObjectsName("(supannCodeEntite=$id)");
|
||||
if (count($list)==1) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
// Translate by directory
|
||||
elseif (isset($GLOBALS['supannTranslateRoleEntiteValueDirectory'][$label][$key][$value])) {
|
||||
return array(
|
||||
'translated' => $GLOBALS['supannTranslateRoleEntiteValueDirectory'][$label][$key][$value],
|
||||
'label' => $label
|
||||
);
|
||||
}
|
||||
else {
|
||||
return array(
|
||||
'label' => $label,
|
||||
'translated' => $value
|
||||
);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Traduit une valeur en fonction de sa cle extrait d'un attribut
|
||||
* supannEtablissement
|
||||
* Cherche des entités répond au pattern de recherche passé en paramètres
|
||||
* et retourne un tableau mettant en relation leur identifiant et leur nom
|
||||
* d'affichage.
|
||||
*
|
||||
* @param[in] $key La cle
|
||||
* @param[in] $value La valeur
|
||||
* @param[in] $pattern string Le pattern de recherche
|
||||
*
|
||||
* @retval array Un tableau cle->valeur contenant label et translated
|
||||
* @retval array Tableau du résultat de la recherche mettant en relation
|
||||
* l'identifiant des entités trouvés avec leur nom d'affichage.
|
||||
**/
|
||||
function supannTranslateEtablissement($value) {
|
||||
$label='no';
|
||||
$pl=supannParseLabeledValue($value);
|
||||
if ($pl) {
|
||||
$label=$pl['label'];
|
||||
$value=$pl['value'];
|
||||
}
|
||||
function supannSearchEntityByPattern($pattern) {
|
||||
$retval=array();
|
||||
if (LSsession::loadLSclass('LSsearch')) {
|
||||
$search=new LSsearch(
|
||||
LS_SUPANN_LSOBJECT_ENTITE_TYPE,
|
||||
'SUPANN:supannSearchEntityByPattern',
|
||||
array(
|
||||
'pattern' => $pattern,
|
||||
'attributes' => array('supannCodeEntite'),
|
||||
'sizelimit' => 10,
|
||||
)
|
||||
);
|
||||
$search -> run();
|
||||
|
||||
if (isset($GLOBALS['supannTranslateEtablissementDirectory'][$label][$value])) {
|
||||
return array(
|
||||
'translated' => $GLOBALS['supannTranslateEtablissementDirectory'][$label][$value],
|
||||
'label' => $label
|
||||
);
|
||||
}
|
||||
else {
|
||||
return array(
|
||||
'label' => $label,
|
||||
'translated' => $value
|
||||
);
|
||||
}
|
||||
foreach($search -> getSearchEntries() as $e) {
|
||||
$code=$e->get('supannCodeEntite');
|
||||
if (is_array($code)) $code=$code[0];
|
||||
$retval[$code]=$e->displayName;
|
||||
}
|
||||
}
|
||||
return $retval;
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
/***********************************************************************
|
||||
* Fonctions relatives aux nomenclatures
|
||||
**********************************************************************/
|
||||
|
||||
/**
|
||||
* Vérifie si une valeur et son étiquette sont valide pour une table donnée
|
||||
*
|
||||
* @param[in] $table La table de nomenclature
|
||||
* @param[in] $label L'étiquette de la valeur
|
||||
* @param[in] $value La valeur
|
||||
*
|
||||
* @retval booleab True si valide, False sinon
|
||||
**/
|
||||
function supannValidateNomenclatureValue($table,$label,$value) {
|
||||
$label=strtoupper($label);
|
||||
if (isset($GLOBALS['supannNomenclatures'][$label]) &&
|
||||
isset($GLOBALS['supannNomenclatures'][$label][$table]) &&
|
||||
isset($GLOBALS['supannNomenclatures'][$label][$table][$value])) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retourne le label d'une valeur en fonction de la table de nomenclature
|
||||
* et de l'étiquette de la valeur.
|
||||
*
|
||||
* @param[in] $table La table de nomenclature
|
||||
* @param[in] $label L'étiquette de la valeur
|
||||
* @param[in] $value La valeur
|
||||
*
|
||||
* @retval array Le label de la valeur. En cas de valeur nor-reconnue, retourne
|
||||
* la valeur en spécifiant qu'elle n'est pas reconnue.
|
||||
**/
|
||||
function supannGetNomenclatureLabel($table,$label,$value) {
|
||||
if (supannValidateNomenclatureValue($table,$label,$value)) {
|
||||
$label=strtoupper($label);
|
||||
return $GLOBALS['supannNomenclatures'][$label][$table][$value];
|
||||
}
|
||||
return getFData(__("%{value} (unrecognized value)"),$value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retourne les valeurs possibles d'une table de nomenclature
|
||||
*
|
||||
* @param[in] $table La table de nomenclature
|
||||
*
|
||||
* @retval array Tableau contenant les valeurs possibles de la table
|
||||
* de nomenclature
|
||||
**/
|
||||
function supannGetNomenclatureTable($table) {
|
||||
$retval=array();
|
||||
foreach($GLOBALS['supannNomenclatures'] as $label => $tables) {
|
||||
if (isset($GLOBALS['supannNomenclatures'][$label][$table])) {
|
||||
$retval[$label]=$GLOBALS['supannNomenclatures'][$label][$table];
|
||||
}
|
||||
}
|
||||
return $retval;
|
||||
}
|
||||
|
||||
|
|
|
@ -30,5 +30,3 @@ class LSattr_html_supannRoleEntite extends LSattr_html {
|
|||
var $LSformElement_type = 'supannRoleEntite';
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
@ -0,0 +1,312 @@
|
|||
<?php
|
||||
/*******************************************************************************
|
||||
* Copyright (C) 2007 Easter-eggs
|
||||
* http://ldapsaisie.labs.libre-entreprise.org
|
||||
*
|
||||
* Author: See AUTHORS file in top-level directory.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License version 2
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
******************************************************************************/
|
||||
|
||||
LSsession :: loadLSclass('LSformElement');
|
||||
LSsession :: loadLSaddon('supann');
|
||||
|
||||
/**
|
||||
* Element supannCompositeAttribute d'un formulaire pour LdapSaisie
|
||||
*
|
||||
* Cette classe permet de gérer les attributs composite supann en la déclinant.
|
||||
* Elle étant la classe basic LSformElement.
|
||||
*
|
||||
* @author Benjamin Renard <brenard@easter-eggs.com>
|
||||
*/
|
||||
|
||||
class LSformElement_supannCompositeAttribute extends LSformElement {
|
||||
|
||||
var $template = 'LSformElement_supannCompositeAttribute.tpl';
|
||||
var $fieldTemplate = 'LSformElement_supannCompositeAttribute_field.tpl';
|
||||
|
||||
/*
|
||||
* Composants des valeurs composites :
|
||||
*
|
||||
* Format :
|
||||
* array (
|
||||
* '[clé composant1]' => array (
|
||||
* 'label' => '[label composant]',
|
||||
* 'type' => '[type de composant]',
|
||||
* 'table' => '[table de nomenclature correspondante]',
|
||||
* 'required' => '[booléen obligatoire]'
|
||||
* ),
|
||||
* '[clé composant 2]' => array (
|
||||
* [...]
|
||||
* ),
|
||||
* [...]
|
||||
* )
|
||||
* Types :
|
||||
* - 'table' => Composant alimenté à partir d'une table issu de la
|
||||
* nomenclature SUPANN. Le paramètre 'table' permet alors
|
||||
* de spécifier quel table SUPANN intéroger.
|
||||
* - 'codeEntite' => Composant stockant le code d'une entite SUPANN de
|
||||
* l'annuaire.
|
||||
* - 'text' => saisie manuelle
|
||||
*
|
||||
*/
|
||||
var $components = array ();
|
||||
|
||||
var $_postParsedData=null;
|
||||
|
||||
/**
|
||||
* 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();
|
||||
|
||||
$parseValues=array();
|
||||
$invalidValues=array();
|
||||
foreach($this -> values as $val) {
|
||||
$keyValue=supannParseCompositeValue($val);
|
||||
if ($keyValue) {
|
||||
$parseValue=array('value' => $val);
|
||||
foreach($keyValue as $key => $value) {
|
||||
$parseValue[$key]=$this -> translateComponentValue($key,$value);
|
||||
}
|
||||
$parseValues[]=$parseValue;
|
||||
}
|
||||
else {
|
||||
$invalidValues[]=$val;
|
||||
}
|
||||
}
|
||||
|
||||
$return['html'] = $this -> fetchTemplate(NULL,
|
||||
array(
|
||||
'parseValues' => $parseValues,
|
||||
'components' => $this -> components
|
||||
)
|
||||
);
|
||||
LSsession :: addCssFile('LSformElement_supannCompositeAttribute.css');
|
||||
if (!$this -> isFreeze()) {
|
||||
LSsession :: addJSconfigParam(
|
||||
$this -> name,
|
||||
array(
|
||||
'searchBtn' => _('Modify'),
|
||||
'noValueLabel' => _('No set value'),
|
||||
'noResultLabel' => _('No result'),
|
||||
'components' => $this->components
|
||||
)
|
||||
);
|
||||
LSsession :: addJSscript('LSformElement_supannCompositeAttribute_field_value_component.js');
|
||||
LSsession :: addJSscript('LSformElement_supannCompositeAttribute_field_value.js');
|
||||
LSsession :: addJSscript('LSformElement_supannCompositeAttribute_field.js');
|
||||
LSsession :: addJSscript('LSformElement_supannCompositeAttribute.js');
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Retourne le code HTML d'un champ vide
|
||||
*
|
||||
* @retval string Code HTML d'un champ vide.
|
||||
*/
|
||||
function getEmptyField() {
|
||||
return $this -> fetchTemplate($this -> fieldTemplate,array('components' => $this -> components));
|
||||
}
|
||||
|
||||
/**
|
||||
* Traduit la valeur d'un composant
|
||||
*
|
||||
* Retourne un array contenant :
|
||||
* - label : l'étiquette de la valeur ou 'no' sinon
|
||||
* - value : la valeur brute
|
||||
* - translated : la valeur traduite ou la valeur elle même
|
||||
*
|
||||
* @param[in] $c string Le nom du composant
|
||||
* @param[in] $val string La valeur
|
||||
*
|
||||
* @retval array
|
||||
**/
|
||||
function translateComponentValue($c,$val) {
|
||||
$retval = array (
|
||||
'translated' => $val,
|
||||
'label' => 'no',
|
||||
'value' => $val,
|
||||
);
|
||||
if (isset($this -> components[$c])) {
|
||||
if ($this -> components[$c]['type']=='table') {
|
||||
$pv=supannParseLabeledValue($val);
|
||||
if ($pv) {
|
||||
$retval['label'] = $pv['label'];
|
||||
$retval['translated'] = supannGetNomenclatureLabel($this -> components[$c]['table'],$pv['label'],$pv['value']);
|
||||
}
|
||||
}
|
||||
elseif ($this -> components[$c]['type']=='codeEntite') {
|
||||
$retval['translated']=supanGetEntiteNameById($val);
|
||||
}
|
||||
//elseif type == 'text' => aucune transformation
|
||||
}
|
||||
return $retval;
|
||||
}
|
||||
|
||||
/**
|
||||
* Recupère la valeur de l'élement passée en POST
|
||||
*
|
||||
* Cette méthode vérifie la présence en POST de la valeur de l'élément et la récupère
|
||||
* pour la mettre dans le tableau passer en paramètre avec en clef le nom de l'élément
|
||||
*
|
||||
* @param[] array Pointeur sur le tableau qui recupèrera la valeur.
|
||||
*
|
||||
* @retval boolean true si la valeur est présente en POST, false sinon
|
||||
*/
|
||||
function getPostData(&$return) {
|
||||
if($this -> isFreeze()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$count=0;
|
||||
$end=false;
|
||||
$parseValues=array();
|
||||
$return[$this -> name]=array();
|
||||
while ($end==false) {
|
||||
$value="";
|
||||
$parseValue=array();
|
||||
$errors=array();
|
||||
$unemptyComponents=array();
|
||||
foreach ($this -> components as $c => $cconf) {
|
||||
if (isset($_POST[$this -> name.'__'.$c][$count])) {
|
||||
$parseValue[$c]=$_POST[$this -> name.'__'.$c][$count];
|
||||
if ($cconf['required'] && empty($parseValue[$c])) {
|
||||
$errors[]=getFData(__('Component %{c} must be defined'),__($cconf['label']));
|
||||
continue;
|
||||
}
|
||||
if (empty($parseValue[$c])) {
|
||||
continue;
|
||||
}
|
||||
$unemptyComponents[]=$c;
|
||||
if ($cconf['type']=='table') {
|
||||
$pv=supannParseLabeledValue($parseValue[$c]);
|
||||
if ($pv) {
|
||||
if (!supannValidateNomenclatureValue($cconf['table'],$pv['label'],$pv['value'])) {
|
||||
$errors[]=getFData(__('Invalid value for component %{c}.'),__($cconf['label']));
|
||||
}
|
||||
}
|
||||
else {
|
||||
$errors[]=getFData(__('Unparsable value for component %{c}.'),__($cconf['label']));
|
||||
}
|
||||
}
|
||||
elseif ($cconf['type']=='codeEntite') {
|
||||
if (!supannValidateEntityId($parseValue[$c])) {
|
||||
$errors[]=getFData(__('Invalid value for component %{c}.'),__($cconf['label']));
|
||||
}
|
||||
}
|
||||
if (is_array($cconf['check_data'])) {
|
||||
foreach($cconf['check_data'] as $ruleType => $rconf) {
|
||||
$className='LSformRule_'.$ruleType;
|
||||
if (LSsession::loadLSclass($className)) {
|
||||
$r=new $className();
|
||||
if (!$r -> validate($parseValue[$c],$rconf,$this)) {
|
||||
if (isset($rconf['msg'])) {
|
||||
$errors[]=getFData(__($rconf['msg']),__($cconf['label']));
|
||||
}
|
||||
else {
|
||||
$errors[]=getFData(__('Invalid value for component %{c}.'),__($cconf['label']));
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
$errors[]=getFData(__("Can't validate value of component %{c}."),__($cconf['label']));
|
||||
}
|
||||
}
|
||||
}
|
||||
$value.="[".$c."=".$parseValue[$c].']';
|
||||
}
|
||||
else {
|
||||
// end of value break
|
||||
$end=true;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
if (!$end) {
|
||||
if (!empty($unemptyComponents)) {
|
||||
foreach($errors as $e) {
|
||||
$this -> form -> setElementError($this -> attr_html,$e);
|
||||
}
|
||||
$return[$this -> name][]=$value;
|
||||
$parseValues[]=$parseValue;
|
||||
}
|
||||
$count++;
|
||||
}
|
||||
}
|
||||
$this -> _postParsedData=$parseValues;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* This ajax method is used by the searchComponentPossibleValues function of the form element.
|
||||
*
|
||||
* @param[in] $data The address to the array of data witch will be return by the ajax request
|
||||
*
|
||||
* @retval void
|
||||
**/
|
||||
public static function ajax_searchComponentPossibleValues(&$data) {
|
||||
if ((isset($_REQUEST['attribute'])) && (isset($_REQUEST['objecttype'])) && (isset($_REQUEST['component'])) && (isset($_REQUEST['pattern'])) && (isset($_REQUEST['idform'])) ) {
|
||||
if (LSsession ::loadLSobject($_REQUEST['objecttype'])) {
|
||||
$object = new $_REQUEST['objecttype']();
|
||||
$form = $object -> getForm($_REQUEST['idform']);
|
||||
$field=$form -> getElement($_REQUEST['attribute']);
|
||||
if (isset($field->components[$_REQUEST['component']])) {
|
||||
$data['possibleValues'] = $field -> searchComponentPossibleValues($_REQUEST['component'],$_REQUEST['pattern']);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function searchComponentPossibleValues($c,$pattern) {
|
||||
$pattern=strtolower($pattern);
|
||||
$retval=array();
|
||||
if (isset($this -> components[$c])) {
|
||||
if ($this -> components[$c]['type'] == 'table') {
|
||||
$table=supannGetNomenclatureTable($this -> components[$c]['table']);
|
||||
foreach($table as $label => $values) {
|
||||
foreach($values as $v => $txt) {
|
||||
if (strpos(strtolower($txt),$pattern)!==false) {
|
||||
$retval[]=array(
|
||||
'label' => $label,
|
||||
'value' => "{".$label."}".$v,
|
||||
'translated' => $txt
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
elseif ($this -> components[$c]['type'] == 'codeEntite') {
|
||||
foreach (supannSearchEntityByPattern($pattern) as $code => $displayName) {
|
||||
$retval[]=array(
|
||||
'label' => 'no',
|
||||
'value' => $code,
|
||||
'translated' => $displayName
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
return $retval;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
|
@ -34,17 +34,7 @@ LSsession :: loadLSaddon('supann');
|
|||
|
||||
class LSformElement_supannEtablissement extends LSformElement_supannLabeledValue {
|
||||
|
||||
/**
|
||||
* Traduit une valeur
|
||||
*
|
||||
* @param[in] $value La valeur
|
||||
*
|
||||
* @retval array Un tableau cle->valeur contenant translated et label ou False
|
||||
**/
|
||||
function translate($value) {
|
||||
return supannTranslateEtablissement($value);
|
||||
}
|
||||
|
||||
var $supannNomenclatureTable = 'codeEtablissement';
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -37,6 +37,8 @@ class LSformElement_supannLabeledValue extends LSformElement {
|
|||
var $template = 'LSformElement_supannLabeledValue.tpl';
|
||||
var $fieldTemplate = 'LSformElement_supannLabeledValue_field.tpl';
|
||||
|
||||
var $supannNomenclatureTable = null;
|
||||
|
||||
/**
|
||||
* Retourne les infos d'affichage de l'élément
|
||||
*
|
||||
|
@ -49,31 +51,33 @@ class LSformElement_supannLabeledValue extends LSformElement {
|
|||
|
||||
$parseValues=array();
|
||||
foreach($this -> values as $val) {
|
||||
$parseValue=array(
|
||||
'value' => $val
|
||||
);
|
||||
$tr=$this -> translate($val);
|
||||
if ($tr) {
|
||||
if($tr['translated'])
|
||||
$parseValue['translated']=$tr['translated'];
|
||||
if($tr['label'])
|
||||
$parseValue['label']=$tr['label'];
|
||||
}
|
||||
$parseValues[]=$parseValue;
|
||||
$parseValues[]=$this -> parseValue($val);
|
||||
}
|
||||
$return['html'] = $this -> fetchTemplate(NULL,array('parseValues' => $parseValues));
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Traduit une valeur
|
||||
* Parse une valeur
|
||||
*
|
||||
* @param[in] $value La valeur
|
||||
*
|
||||
* @retval array Un tableau cle->valeur contenant translated et label ou False
|
||||
* @retval array Un tableau cle->valeur contenant value, translated et label
|
||||
**/
|
||||
function translate($value) {
|
||||
return supannTranslateLabeledValue($value);
|
||||
function parseValue($value) {
|
||||
$retval=array(
|
||||
'value' => $value,
|
||||
);
|
||||
$pv=supannParseLabeledValue($value);
|
||||
if ($pv) {
|
||||
$retval['label'] = $pv['label'];
|
||||
$retval['translated'] = supannGetNomenclatureLabel($this -> supannNomenclatureTable,$pv['label'],$pv['value']);
|
||||
}
|
||||
else {
|
||||
$retval['label'] = 'no';
|
||||
$retval['translated'] = getFData(__('%s (Unparsable value)'),$value);
|
||||
}
|
||||
return $retval;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
******************************************************************************/
|
||||
|
||||
LSsession :: loadLSclass('LSformElement');
|
||||
LSsession :: loadLSclass('LSformElement_supannCompositeAttribute');
|
||||
LSsession :: loadLSaddon('supann');
|
||||
|
||||
/**
|
||||
|
@ -32,46 +32,29 @@ LSsession :: loadLSaddon('supann');
|
|||
* @author Benjamin Renard <brenard@easter-eggs.com>
|
||||
*/
|
||||
|
||||
class LSformElement_supannRoleEntite extends LSformElement {
|
||||
class LSformElement_supannRoleEntite extends LSformElement_supannCompositeAttribute {
|
||||
|
||||
var $template = 'LSformElement_supannRoleEntite.tpl';
|
||||
var $fieldTemplate = 'LSformElement_supannRoleEntite_field.tpl';
|
||||
|
||||
/**
|
||||
* 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();
|
||||
|
||||
$parseValues=array();
|
||||
foreach($this -> values as $val) {
|
||||
$keyValue=supannParseCompositeValue($val);
|
||||
if ($keyValue) {
|
||||
$parseValue=array('value' => $val);
|
||||
foreach($keyValue as $key => $value) {
|
||||
$parseValue[$key]=array(
|
||||
'value' => $value
|
||||
);
|
||||
$tr=supannTranslateRoleEntiteValue($key,$value);
|
||||
if ($tr) {
|
||||
if($tr['translated'])
|
||||
$parseValue[$key]['translated']=$tr['translated'];
|
||||
if($tr['label'])
|
||||
$parseValue[$key]['label']=$tr['label'];
|
||||
}
|
||||
}
|
||||
$parseValues[]=$parseValue;
|
||||
}
|
||||
}
|
||||
|
||||
$return['html'] = $this -> fetchTemplate(NULL,array('parseValues' => $parseValues));
|
||||
return $return;
|
||||
function LSformElement_supannRoleEntite (&$form, $name, $label, $params,&$attr_html){
|
||||
$this -> components = array (
|
||||
'role' => array (
|
||||
'label' => _('Role'),
|
||||
'type' => 'table',
|
||||
'table' => 'roleGenerique',
|
||||
'required' => true,
|
||||
),
|
||||
'type' => array (
|
||||
'label' => _('Entity type'),
|
||||
'type' => 'table',
|
||||
'table' => 'typeEntite',
|
||||
'required' => true,
|
||||
),
|
||||
'code' => array (
|
||||
'label' => _('Entity'),
|
||||
'type' => 'codeEntite',
|
||||
'required' => false
|
||||
)
|
||||
);
|
||||
return parent::LSformElement ($form, $name, $label, $params,$attr_html);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
@ -34,17 +34,7 @@ LSsession :: loadLSaddon('supann');
|
|||
|
||||
class LSformElement_supannRoleGenerique extends LSformElement_supannLabeledValue {
|
||||
|
||||
/**
|
||||
* Traduit une valeur
|
||||
*
|
||||
* @param[in] $value La valeur
|
||||
*
|
||||
* @retval array Un tableau cle->valeur contenant translated et label ou False
|
||||
**/
|
||||
function translate($value) {
|
||||
return supannTranslateRoleEntiteValue('role',$value);
|
||||
}
|
||||
|
||||
var $supannNomenclatureTable = 'roleGenerique';
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -34,17 +34,7 @@ LSsession :: loadLSaddon('supann');
|
|||
|
||||
class LSformElement_supannTypeEntite extends LSformElement_supannLabeledValue {
|
||||
|
||||
/**
|
||||
* Traduit une valeur
|
||||
*
|
||||
* @param[in] $value La valeur
|
||||
*
|
||||
* @retval array Un tableau cle->valeur contenant translated et label ou False
|
||||
**/
|
||||
function translate($value) {
|
||||
return supannTranslateRoleEntiteValue('type',$value);
|
||||
}
|
||||
|
||||
var $supannNomenclatureTable = 'typeEntite';
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
var LSformElement_supannCompositeAttribute = new Class({
|
||||
initialize: function(){
|
||||
this.fields = [];
|
||||
this.initialiseLSformElement_supannCompositeAttribute();
|
||||
},
|
||||
|
||||
initialiseLSformElement_supannCompositeAttribute: function(el) {
|
||||
if (!$type(el)) {
|
||||
el = document;
|
||||
}
|
||||
el.getElements('ul.LSformElement_supannCompositeAttribute').each(function(ul) {
|
||||
this.fields[ul.id] = new LSformElement_supannCompositeAttribute_field(ul);
|
||||
}, this);
|
||||
}
|
||||
});
|
||||
window.addEvent(window.ie ? 'load' : 'domready', function() {
|
||||
varLSformElement_supannCompositeAttribute = new LSformElement_supannCompositeAttribute();
|
||||
});
|
|
@ -0,0 +1,34 @@
|
|||
var LSformElement_supannCompositeAttribute_field = new Class({
|
||||
initialize: function(ul){
|
||||
this.ul=ul;
|
||||
this.dd=ul.getParent();
|
||||
this.name = ul.id;
|
||||
this.values = [];
|
||||
this.field_type = ul.get('data-fieldType');
|
||||
this.initializeLSformElement_supannCompositeAttribute_field();
|
||||
varLSform.addField(this.name,this);
|
||||
},
|
||||
|
||||
initializeLSformElement_supannCompositeAttribute_field: function(el) {
|
||||
if (!$type(el)) {
|
||||
el = this.ul;
|
||||
}
|
||||
el.getElements('li').each(function(li) {
|
||||
this.values.push(new LSformElement_supannCompositeAttribute_field_value(li,this.name,this.field_type));
|
||||
}, this);
|
||||
},
|
||||
|
||||
clearValue: function() {
|
||||
console.log('clear');
|
||||
console.log(this.values);
|
||||
if (this.values.length>1) {
|
||||
for(var i=1; i<=this.values.length; i++) {
|
||||
$(this.values[i].li).dispose();
|
||||
}
|
||||
this.values[0].clear();
|
||||
}
|
||||
else if (this.values.length==1) {
|
||||
this.values[0].clear();
|
||||
}
|
||||
}
|
||||
});
|
|
@ -0,0 +1,29 @@
|
|||
var LSformElement_supannCompositeAttribute_field_value = new Class({
|
||||
initialize: function(li,name,field_type){
|
||||
this.li=li;
|
||||
this.name = name;
|
||||
this.components = {};
|
||||
this.field_type = field_type;
|
||||
this.initializeLSformElement_supannCompositeAttribute_field_value();
|
||||
varLSform.addModule(field_type,this);
|
||||
},
|
||||
|
||||
initializeLSformElement_supannCompositeAttribute_field_value: function(el) {
|
||||
if (!$type(el)) {
|
||||
el = this.li;
|
||||
}
|
||||
el.getElements('p').each(function(p) {
|
||||
this.components[p.get('data-component')]=new LSformElement_supannCompositeAttribute_field_value_component(p,p.get('data-component'),this.name);
|
||||
}, this);
|
||||
},
|
||||
|
||||
reinitialize: function(el) {
|
||||
this.initializeLSformElement_supannCompositeAttribute_field_value(el);
|
||||
},
|
||||
|
||||
clear: function() {
|
||||
for (c in this.components) {
|
||||
this.components[c].clear();
|
||||
}
|
||||
}
|
||||
});
|
|
@ -0,0 +1,174 @@
|
|||
var LSformElement_supannCompositeAttribute_field_value_component = new Class({
|
||||
initialize: function(p,name,field_name){
|
||||
this.p = p;
|
||||
this.field_name = field_name;
|
||||
this.name = name;
|
||||
this.params = varLSdefault.LSjsConfig[this.field_name];
|
||||
|
||||
this.input = p.getElement('input');
|
||||
this.img = p.getElement('img');
|
||||
this.span = p.getElement('span');
|
||||
|
||||
if (this.params.components[this.name].type=="table" || this.params.components[this.name].type=="codeEntite") {
|
||||
this.inputSearch=new Element(
|
||||
'input',
|
||||
{
|
||||
'class': 'LSformElement_supannCompositeAttribute_search',
|
||||
'styles': {
|
||||
'display': 'none'
|
||||
}
|
||||
}
|
||||
);
|
||||
this.inputSearch.addEvent('keydown',this.onKeyUpInputSearch.bindWithEvent(this));
|
||||
this.inputSearch.injectInside(this.p);
|
||||
|
||||
this.searchBtn=new Element(
|
||||
'img',
|
||||
{
|
||||
'src': varLSdefault.imagePath('modify'),
|
||||
'alt': this.params.searchBtn,
|
||||
'title': this.params.searchBtn,
|
||||
}
|
||||
);
|
||||
this.searchBtn.addEvent('click',this.toogleInputSearch.bind(this));
|
||||
this.searchBtn.injectBefore(this.inputSearch);
|
||||
|
||||
this._lastSearch=null;
|
||||
this._possibleValues=null;
|
||||
}
|
||||
},
|
||||
|
||||
toogleInputSearch: function() {
|
||||
if (this.inputSearch.getStyle('display')=='none') {
|
||||
this.inputSearch.setStyle('display','block');
|
||||
this.inputSearch.focus();
|
||||
}
|
||||
else {
|
||||
this.hidePossibleValues();
|
||||
this.inputSearch.setStyle('display','none');
|
||||
this.inputSearch.set('value','');
|
||||
}
|
||||
},
|
||||
|
||||
onKeyUpInputSearch: function(event) {
|
||||
event = new Event(event);
|
||||
|
||||
if ((event.key=='enter')||(event.key=='tab')) {
|
||||
event.stop();
|
||||
if (this.inputSearch.value!="") {
|
||||
this.launchSearch();
|
||||
}
|
||||
}
|
||||
|
||||
if (event.key=='esc') {
|
||||
this.toogleInputSearch();
|
||||
}
|
||||
},
|
||||
|
||||
launchSearch: function() {
|
||||
this.hidePossibleValues();
|
||||
this._lastSearch=this.inputSearch.value;
|
||||
var data = {
|
||||
template: 'LSformElement_supannCompositeAttribute',
|
||||
action: 'searchComponentPossibleValues',
|
||||
attribute: this.field_name,
|
||||
objecttype: varLSform.objecttype,
|
||||
idform: varLSform.idform,
|
||||
component: this.name,
|
||||
pattern: this.inputSearch.value
|
||||
};
|
||||
data.imgload=varLSdefault.loadingImgDisplay(this.inputSearch);
|
||||
new Request({url: 'index_ajax.php', data: data, onSuccess: this.onSearchComplete.bind(this)}).send();
|
||||
},
|
||||
|
||||
onSearchComplete: function(responseText, responseXML) {
|
||||
var data = JSON.decode(responseText);
|
||||
if ( varLSdefault.checkAjaxReturn(data) ) {
|
||||
this.displayPossibleValues(data.possibleValues);
|
||||
}
|
||||
},
|
||||
|
||||
displayPossibleValues: function(possibleValues) {
|
||||
if (this._possibleValues==null) {
|
||||
this._possibleValues=new Element(
|
||||
'div',
|
||||
{
|
||||
'class': 'supannCompositeAttribute_possibleValues',
|
||||
}
|
||||
);
|
||||
this._possibleValues.injectInside(this.p);
|
||||
}
|
||||
|
||||
|
||||
var ul=new Element('ul');
|
||||
possibleValues.each(function(v) {
|
||||
var li=new Element(
|
||||
'li',
|
||||
{
|
||||
'data-value': v.value,
|
||||
'data-label': v.label,
|
||||
'data-translated': v.translated,
|
||||
}
|
||||
);
|
||||
if (v.label!='no') {
|
||||
li.set('html',"<img src='"+varLSdefault.imagePath('supann_label_'+v.label)+"' alt='["+v.label+"]'/> "+v.translated);
|
||||
}
|
||||
else {
|
||||
li.set('html',v.translated);
|
||||
}
|
||||
li.injectInside(this);
|
||||
}, ul);
|
||||
if (ul.getElements('li').length==0) {
|
||||
new Element(
|
||||
'li',
|
||||
{
|
||||
'html': this.params.noResultLabel
|
||||
}
|
||||
).injectInside(ul);
|
||||
}
|
||||
else {
|
||||
ul.getElements('li').each(function(li) {
|
||||
li.addEvent('click',this.onClickPossibleValue.bindWithEvent(this));
|
||||
}, this);
|
||||
}
|
||||
ul.injectInside(this._possibleValues);
|
||||
this._possibleValues.setStyle('display', 'block');
|
||||
},
|
||||
|
||||
hidePossibleValues: function() {
|
||||
if (this._possibleValues!=null) {
|
||||
this._possibleValues.setStyle('display', 'none');
|
||||
this._possibleValues.empty();
|
||||
}
|
||||
},
|
||||
|
||||
onClickPossibleValue: function(event) {
|
||||
this.hidePossibleValues();
|
||||
event = new Event(event);
|
||||
var li=$(event.target);
|
||||
if (event.target.tagName=='IMG') {
|
||||
li=li.getParent();
|
||||
}
|
||||
this.input.set('value',li.get('data-value'));
|
||||
if (li.get('data-label')!='no') {
|
||||
if (this.img==null) {
|
||||
this.img=new Element('img');
|
||||
this.img.injectBefore(this.span);
|
||||
}
|
||||
this.img.set('src',varLSdefault.imagePath('supann_label_'+li.get('data-label')));
|
||||
}
|
||||
this.span.set('html',li.get('data-translated'));
|
||||
this.toogleInputSearch();
|
||||
},
|
||||
|
||||
clear: function() {
|
||||
if (this.img) {
|
||||
this.img.dispose();
|
||||
this.img=null;
|
||||
}
|
||||
this.input.set('value','');
|
||||
if (this.span) {
|
||||
this.span.set('html',this.params.noValueLabel);
|
||||
}
|
||||
}
|
||||
});
|
Binary file not shown.
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -0,0 +1,7 @@
|
|||
<ul class='LSform {if $multiple && !$freeze} LSformElement_multiple{/if} LSformElement_supannCompositeAttribute' id='{$attr_name}' data-fieldType="{$fieldType}">
|
||||
{foreach from=$parseValues item=parseValue}
|
||||
<li>{include file="ls:$fieldTemplate"}</li>
|
||||
{foreachelse}
|
||||
<li {if $freeze}class='noValue'{/if}>{include file="ls:$fieldTemplate"}</li>
|
||||
{/foreach}
|
||||
</ul>
|
|
@ -0,0 +1,37 @@
|
|||
{if $freeze}
|
||||
{if isset($parseValue)}
|
||||
{foreach $components as $c => $cconf}
|
||||
{if !isset($parseValue[$c])}{continue}{/if}
|
||||
<p>
|
||||
<label>{tr msg=$cconf.label} : </label>
|
||||
{if !empty($parseValue[$c].label) and $parseValue[$c].label!='no'}
|
||||
{assign var=clabel value=$parseValue[$c].label}
|
||||
<img src='{img name="supann_label_$clabel"}' alt='[{$clabel}]' title='{$clabel}'/>
|
||||
{/if}
|
||||
<span title="{$parseValue[$c].value}">{$parseValue[$c].translated}</span>
|
||||
</p>
|
||||
{/foreach}
|
||||
{else}
|
||||
{$noValueTxt}
|
||||
{/if}
|
||||
{else}
|
||||
{foreach $components as $c => $cconf}
|
||||
<p data-component="{$c}">
|
||||
<label>{tr msg=$cconf.label}{if $cconf.required}*{/if} :</label>
|
||||
{if $cconf.type=='table' or $cconf.type=='codeEntite'}
|
||||
<input type='hidden' name='{$attr_name}__{$c}[]' value="{if $parseValue and $parseValue[$c]}{$parseValue[$c].value}{/if}"/>
|
||||
{if $parseValue and !empty($parseValue[$c].label) and $parseValue[$c].label!='no'}
|
||||
{assign var=clabel value=$parseValue[$c].label}
|
||||
<img src='{img name="supann_label_$clabel"}' alt='[{$clabel}]' title='{$clabel}'/>
|
||||
{/if}
|
||||
{if $parseValue}
|
||||
<span title="{$parseValue[$c].value}">{$parseValue[$c].translated}</span>
|
||||
{else}
|
||||
<span>{$noValueTxt}</span>
|
||||
{/if}
|
||||
{else}
|
||||
<input type='text' name='{$attr_name}__{$c}[]' value="{if $parseValue and $parseValue[$c]}{$parseValue[$c].value}{/if}"/>
|
||||
{/if}
|
||||
</p>
|
||||
{/foreach}
|
||||
{/if}
|
|
@ -1,7 +1,7 @@
|
|||
{if $freeze}
|
||||
{if $value or $parseValue}
|
||||
{if $parseValue}
|
||||
<span class='LSformElement_supannLabeledValue'>{if $label}<img src='{img name="LSformElement_supannLabeledValue_label_$label"}' alt='[{$label}]' title='{$label}' /> {/if}<span title='{$parseValue.value}'>{$value}</span></span>
|
||||
<span class='LSformElement_supannLabeledValue'>{if $label}<img src='{img name="supann_label_$label"}' alt='[{$label}]' title='{$label}' /> {/if}<span title='{$parseValue.value}'>{$value}</span></span>
|
||||
{else}
|
||||
<span class='LSformElement_supannLabeledValue_unparsed'>{$value}</span>
|
||||
{/if}
|
||||
|
|
|
@ -1,25 +0,0 @@
|
|||
<ul class='LSform{if $multiple && !$freeze} LSformElement_multiple'{/if}' id='{$attr_name}'>
|
||||
{if $parseValues}
|
||||
{foreach from=$parseValues item=parseValue}
|
||||
{if $parseValue.role.translated}{assign var=role value=$parseValue.role.translated}{else}{assign var=role value=$parseValue.role.value}{/if}
|
||||
{if $parseValue.role.label!="no"}{assign var=label_role value=$parseValue.role.label}{else}{assign var=label_role value=""}{/if}
|
||||
{if $parseValue.type.translated}{assign var=type value=$parseValue.type.translated}{else}{assign var=type value=$parseValue.type.value}{/if}
|
||||
{if $parseValue.type.label!="no"}{assign var=label_type value=$parseValue.type.label}{else}{assign var=label_type value=""}{/if}
|
||||
{if $parseValue.code.translated}{assign var=code value=$parseValue.code.translated}{else}{assign var=code value=$parseValue.code.value}{/if}
|
||||
{if $parseValue.code.label!="no"}{assign var=label_code value=$parseValue.code.label}{else}{assign var=label_code value=""}{/if}
|
||||
<li>{include file="ls:$fieldTemplate"}</li>
|
||||
{foreachelse}
|
||||
{assign var=value value=""}
|
||||
{assign var=parseValue value=""}
|
||||
<li>{include file="ls:$fieldTemplate"}</li>
|
||||
{/foreach}
|
||||
{else}
|
||||
{foreach from=$values item=value}
|
||||
<li>{include file="ls:$fieldTemplate"}</li>
|
||||
{foreachelse}
|
||||
{assign var=value value=""}
|
||||
{assign var=parseValue value=""}
|
||||
<li>{include file="ls:$fieldTemplate"}</li>
|
||||
{/foreach}
|
||||
{/if}
|
||||
</ul>
|
|
@ -1,17 +0,0 @@
|
|||
{if $freeze}
|
||||
{if $value or $parseValue}
|
||||
{if $parseValue}
|
||||
<span class='LSformElement_supannRoleEntite'>{if $label_role}<img src='{img name="LSformElement_supannRoleEntite_label_$label_role"}' alt='[{$label_role}]' title='{$label_role}' /> {/if}<span title='{$parseValue.role.value}'>{$role}</span> : {if $label_code}<img src='{img name="LSformElement_supannRoleEntite_label_$label_code"}' alt='[{$label_code}]' title='{$label_code}' /> {/if}<span title='{$parseValue.code.value}'>{$code}</span> ({if $label_type}<img src='{img name="LSformElement_supannRoleEntite_label_$label_type"}' alt='[{$label_type}]' title='{$label_type}' /> {/if}<span title='{$parseValue.type.value}'>{$type}</span>)</span>
|
||||
{else}
|
||||
<span class='LSformElement_supannRoleEntite_unparsed'>{$value}</span>
|
||||
{/if}
|
||||
{else}
|
||||
{$noValueTxt}
|
||||
{/if}
|
||||
{else}
|
||||
{if $parseValue}
|
||||
<input type='text' name='{$attr_name}[]' class='LSformElement_text' value="{$parseValue.value}" autocomplete="off"/>
|
||||
{else}
|
||||
<input type='text' name='{$attr_name}[]' class='LSformElement_text' value="{$value}" autocomplete="off"/>
|
||||
{/if}
|
||||
{/if}
|
Loading…
Reference in a new issue