Subversion Repositories eFlore/Applications.cel

Compare Revisions

Ignore whitespace Rev 3172 → Rev 3173

/trunk/widget/modules/manager/squelettes/js/manager.js
220,6 → 220,20
// 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>'+
275,11 → 289,11
fieldDetails =
// Date min
'<label for="min" title="valeur min">Valeur minimale</label>'+
'<input type="date" name="min" class="min">'+
'<input type="date" name="min" class="min" value="' + today + '">'+
 
// Date max
'<label for="max" title="valeur max">Valeur maximale</label>'+
'<input type="date" name="max" class="max">';
'<input type="date" name="max" class="max" value="' + tomorrow + '">';
 
break;
 
468,7 → 482,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( ! datasToSubmit[ resultArrayIndex ].fieldValues.length ){
if( $.isEmptyObject(datasToSubmit[ resultArrayIndex ].fieldValues) ){
delete datasToSubmit[ resultArrayIndex ].fieldValues;
}
 
486,7 → 500,6
$('#submit-button').before(
'<input type="hidden" name="champs-supp" id="champs-supp" value=\'' + resultsArrayJson + '\'>'
);
console.log( $('#champs-supp').val() );
});
 
}
495,12 → 508,6
// 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' :
511,7 → 518,7
case 'list-checkbox':
case 'radio':
 
datasToSubmitObject.fieldValues.listValue = [];
datasToSubmitObject.fieldValues.listValue = [];
 
// Ajout des valeurs de liste
onChangeStoreListValueLabel( datasToSubmitObject , index );
556,18 → 563,10
case 'date':
 
// Min
if( $( '.new-field[data-id="' + index + '"] .min' ).val() ) {
datasToSubmitObject.fieldValues.min = $( '.new-field[data-id="' + index + '"] .min' ).val();
} else {
datasToSubmitObject.fieldValues.min = today;
}
datasToSubmitObject.fieldValues.min = $( '.new-field[data-id="' + index + '"] .min' ).val();
 
// Max
if( $( '.new-field[data-id="' + index + '"] .max' ).val() ) {
datasToSubmitObject.fieldValues.max = $( '.new-field[data-id="' + index + '"] .max' ).val();
} else {
datasToSubmitObject.fieldValues.min = tomorrow;
}
datasToSubmitObject.fieldValues.max = $( '.new-field[data-id="' + index + '"] .max' ).val();
 
break;
 
575,7 → 574,6
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();
583,6 → 581,7
 
break;
}
return datasToSubmitObject;
}
 
// Ajout d'une valeur d'un élément liste (select, checkbox etc.)