Subversion Repositories eFlore/Applications.cel

Compare Revisions

Ignore whitespace Rev 3173 → Rev 3172

/trunk/widget/modules/manager/squelettes/js/manager.js
220,20 → 220,6
// Logique de recueil d'informations en fonction du type de champ choisi
function onChangeFieldTypeCollectDetails( fieldIndex ) {
 
var today = new Date();
var tomorrow = new Date();
var todayMonth = ( today.getMonth() + 1 ).toString();
var tomorrowMonth = ( tomorrow.getMonth() + 1 ).toString();
if((today.getMonth() + 1) < 10) {
todayMonth = '0' + todayMonth;
}
if((tomorrow.getMonth() + 1) < 10) {
tomorrowMonth = '0' + tomorrowMonth;
}
 
today = today.getFullYear() + '-' + todayMonth + '-' + today.getDate();
tomorrow = tomorrow.getFullYear() + '-' + tomorrowMonth + '-' + ( tomorrow.getDate() + 1 );
 
var fieldDetails =
// Placeholder (champ type text par défaut)
'<label for="aide-saisie" title="Aidez les utilisateurs en deux ou 3 mots ou chiffres à comprendre ce que doit contenir le champ">Texte d\'aide à la saisie</label>'+
289,11 → 275,11
fieldDetails =
// Date min
'<label for="min" title="valeur min">Valeur minimale</label>'+
'<input type="date" name="min" class="min" value="' + today + '">'+
'<input type="date" name="min" class="min">'+
 
// Date max
'<label for="max" title="valeur max">Valeur maximale</label>'+
'<input type="date" name="max" class="max" value="' + tomorrow + '">';
'<input type="date" name="max" class="max">';
 
break;
 
482,7 → 468,7
// Collecte les des données dépendantes de l'élément choisi
// sous forme d'un tableau de resultats
onSelectCollectDataValuesToSubmit( datasToSubmit[ resultArrayIndex ] , index );
if( $.isEmptyObject(datasToSubmit[ resultArrayIndex ].fieldValues) ){
if( ! datasToSubmit[ resultArrayIndex ].fieldValues.length ){
delete datasToSubmit[ resultArrayIndex ].fieldValues;
}
 
500,6 → 486,7
$('#submit-button').before(
'<input type="hidden" name="champs-supp" id="champs-supp" value=\'' + resultsArrayJson + '\'>'
);
console.log( $('#champs-supp').val() );
});
 
}
508,6 → 495,12
// pour les données dépendant de l'élément choisi
function onSelectCollectDataValuesToSubmit( datasToSubmitObject , index ) {
 
var today = new Date();
var tomorrow = new Date();
 
today = today.getDate() + 1 + '/' + ( today.getMonth() + 1 ) + '/' + today.getFullYear();
tomorrow = ( tomorrow.getDate() + 1 ) + '/' + ( tomorrow.getMonth() + 1 ) + '/' + tomorrow.getFullYear();
 
switch( datasToSubmitObject.element ) {
 
// case 'file' :
518,7 → 511,7
case 'list-checkbox':
case 'radio':
 
datasToSubmitObject.fieldValues.listValue = [];
datasToSubmitObject.fieldValues.listValue = [];
 
// Ajout des valeurs de liste
onChangeStoreListValueLabel( datasToSubmitObject , index );
563,10 → 556,18
case 'date':
 
// Min
datasToSubmitObject.fieldValues.min = $( '.new-field[data-id="' + index + '"] .min' ).val();
if( $( '.new-field[data-id="' + index + '"] .min' ).val() ) {
datasToSubmitObject.fieldValues.min = $( '.new-field[data-id="' + index + '"] .min' ).val();
} else {
datasToSubmitObject.fieldValues.min = today;
}
 
// Max
datasToSubmitObject.fieldValues.max = $( '.new-field[data-id="' + index + '"] .max' ).val();
if( $( '.new-field[data-id="' + index + '"] .max' ).val() ) {
datasToSubmitObject.fieldValues.max = $( '.new-field[data-id="' + index + '"] .max' ).val();
} else {
datasToSubmitObject.fieldValues.min = tomorrow;
}
 
break;
 
574,6 → 575,7
case 'text':
case 'textarea':
default:
 
// Placeholder
if( $( '.new-field[data-id="' + index + '"] .aide-saisie' ).val() ) {
datasToSubmitObject.fieldValues.placeholder = $( '.new-field[data-id="' + index + '"] .aide-saisie' ).val();
581,7 → 583,6
 
break;
}
return datasToSubmitObject;
}
 
// Ajout d'une valeur d'un élément liste (select, checkbox etc.)