diff --git a/application/views/default/helpers/Field.php b/application/views/default/helpers/Field.php
index 6082794a..26fab78d 100644
--- a/application/views/default/helpers/Field.php
+++ b/application/views/default/helpers/Field.php
@@ -24,155 +24,114 @@ class Zend_View_Helper_Field extends Zend_View_Helper_Abstract
//How many type of fields is defined
$nbFields = count($params['fields']);
- $this->display = true;
+ $display = true;
//If more than one field exist we need to make a special display
if ( $nbFields > 1) {
- $html.= '
';
- $html.= $this->structureLabel($label);
- $html.= '
';
+ $out.= '
';
+ $out.= $this->structureLabel($label);
+ $out.= '
';
- $html.= '
';
+ $out.= '
';
+ $out.= '
';
//Masquer les champs
- $this->display = false;
+ $display = false;
}
//Draw fields
foreach ( $params['fields'] as $type => $options )
{
- $label = $labelG;
- if ( array_key_exists('label', $options) ) {
- $label = $options['label'];
- }
-
switch($type)
{
case 'select':
- $html.= $this->structureHTML(
- $label,
- $this->selectHTML($name, $options),
- $title
- );
+ $html = $this->selectHTML($name, $options);
break;
case 'selectMultiple':
- $html.= $this->structureHTML(
- $label,
- $this->selectMultipleHTML($name, $options),
- $title
- );
+ $html = $this->selectMultipleHTML($name, $options);
break;
case 'intervalSelect':
- $html.= $this->structureHTML(
- $label,
- $this->intervalSelectHTML($name, $options),
- $title
- );
+ $html = $this->intervalSelectHTML($name, $options);
break;
case 'checkbox':
- $html.= $this->structureHTML(
- $label,
- $this->checkboxHTML($name, $options),
- $title
- );
+ $html = $this->checkboxHTML($name, $options);
break;
case 'intervalDate':
- $html.= $this->structureHTML(
- $label,
- $this->intervalDateHTML($name, $options),
- $title
- );
+ $html = $this->intervalDateHTML($name, $options);
break;
case 'interval':
- $html.= $this->structureHTML(
- $label,
- $this->intervalHTML($name, $field),
- $title
- );
+ $html = $this->intervalHTML($name, $field);
break;
case 'date':
- $html.= $this->structureHTML(
- $field['label'],
- $this->dateHTML($name, $field));
+ $html = $this->dateHTML($name, $field);
break;
case 'text':
- $html.= $this->structureHTML(
- $label,
- $this->textHTML($name, $options),
- $title
- );
+ $html = $this->textHTML($name, $options);
break;
case 'textarea':
- $html.= $this->structureHTML(
- $field['label'],
- $this->textareaHTML($name, $field)
- );
+ $html = $this->textareaHTML($name, $field);
break;
case 'radio':
- $html.= $this->structureHTML(
- $field['label'],
- $this->radioHTML($name, $field));
+ $html = $this->radioHTML($name, $field);
break;
case 'file':
- $html.= $this->structureHTML(
- $field['label'],
- $this->fileuploadHtml($name, $field));
+ $html = $this->fileuploadHtml($name, $field);
break;
case 'tree':
//Do nothing
break;
case 'list':
- $html.= $this->structureHTML(
- $label,
- $this->textareaHTML($name, $options),
- $title
- );
+ $html = $this->textareaHTML($name, $options);
break;
default:
- $html.= $this->structureHTML($name, '');
- break;
-
+ $html = $this->structureHTML($name, '');
+ break;
}
+
+ $label = $labelG;
+ if ( array_key_exists('label', $options) ) {
+ $label = $options['label'];
+ }
+
+ $style = '';
+ $class = ' class="fieldgrp"';
+ if ( $display===false ) {
+ $style = ' style="display:none;"';
+ }
+ if ( !empty($title) ) {
+ $title = ' title="'.$title.'"';
+ }
+
+ $out.= '';
+ $out.= $this->structureLabel($label);
+ $out.= '
'.$html.'
';
+ $out.= '
';
+
}
- return $html;
- }
-
- private function structureHTML($label, $html, $title='')
- {
- $out = '';
-
- $style = '';
- $class = ' class="fieldgrp"';
- if ( $this->display===false ) {
- $style = ' style="display:none;"';
- }
- if ( !empty($title) ) {
- $title = ' title="'.$title.'"';
- }
-
- $out.= '';
- $out.= $this->structureLabel($label);
- $out.= '
'.$html.'
';
- $out.= '
';
+
return $out;
}
-
+
/**
* Définition du label
* @param unknown_type $label
diff --git a/library/Scores/Fields.php b/library/Scores/Fields.php
index 1362c3b1..32bc3e08 100644
--- a/library/Scores/Fields.php
+++ b/library/Scores/Fields.php
@@ -178,6 +178,7 @@ class Scores_Fields
'fields' => array(
'tree' => array('value' => null, 'action' => 'naf', 'title' => "Arborescence de code NAF établissement"),
'text' => array('value' => null, 'label' => "Recherche de code NAF", 'title'=>"Sélection de code NAF établissement"),
+ 'list' => array('value' => null, 'label' => "Liste de code NAF", 'title'=>"Liste de code NAF établissement"),
),
'famille' => 'economique',
'activated' => true,
@@ -187,6 +188,7 @@ class Scores_Fields
'fields' => array(
'tree' => array('value' => null, 'action' => 'naf', 'title' => "Arborescence de code NAF entreprise"),
'text' => array('value' => null, 'label' => "Recherche de code NAF", 'title'=>"Sélection de code NAF entreprise"),
+ 'list' => array('value' => null, 'label' => "Liste de code NAF", 'title'=>"Liste de code NAF entreprise"),
),
'famille' => 'economique',
'activated' => true,
@@ -795,8 +797,6 @@ Les zones urbaines sensibles constituent un sous-ensemble de l'ensemble plus lar
* min,max
*
*/
-
-
//Do some operation on value
$types = array_keys($this->fields[$key]['fields']);
diff --git a/public/themes/default/scripts/fields.js b/public/themes/default/scripts/fields.js
index ea267f4b..822bd9e2 100644
--- a/public/themes/default/scripts/fields.js
+++ b/public/themes/default/scripts/fields.js
@@ -212,21 +212,37 @@ $(document).ready(function()
$('#tabs').delegate('a.text', 'click', function(e) {
e.preventDefault();
var id = $(this).attr('id');
- if ($('div#field_'+id).css('display') == 'none') {
- $('div#field_'+id).show('blind');
+ if ($('div#field_text_'+id).css('display') == 'none') {
+ $('div#field_text_'+id).show('blind');
} else {
- $('div#field_'+id).hide('blind');
+ $('div#field_text_'+id).hide('blind');
}
});
$('#tabs').delegate('a.list', 'click', function(e) {
+ e.preventDefault();
+ var id = $(this).attr('id');
+ if ($('div#field_list_'+id).css('display') == 'none') {
+ $('div#field_list_'+id).show('blind');
+ } else {
+ $('div#field_list_'+id).hide('blind');
+ }
+ });
+
+ $('#tabs').delegate('a.list', 'click', function(e){
e.stopPropagation();
var obj = $(this).parent().find('textarea.criteres');
- var name = obj.attr('name');
- var value = obj.val();
- if (value!='') {
- set(name, value);
- }
+ //regexp
+
+ set(obj.attr('name'), obj.val());
+ });
+
+ $('#tabs').delegate('a.listEx', 'click', function(e){
+ e.stopPropagation();
+ var obj = $(this).parent().find('textarea.criteres');
+ //regexp
+
+ set(obj.attr('name'), obj.val(), 1);
});
});