Changeset 825 for tapas/web/project/formTapas_script.jsp
- Timestamp:
- 07/31/15 16:26:38 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tapas/web/project/formTapas_script.jsp
r817 r825 41 41 this.tabActive = false; 42 42 this.numRequest = 1; 43 this.optionForm = 1; 43 44 44 45 … … 59 60 } 60 61 62 61 63 // Buttons 62 var submitButton = new Button( {value:tapasTexts["label.submitButton"], parent:this.containerCenter, id:"button_submit", className: "tapas1", classNameText:"tapas1_text", onClick:jQuery.proxy( this.onClickSubmit, this )} ); 64 //var submitButton = new Button( {value:tapasTexts["label.submitButton"], parent:this.containerCenter, id:"button_submit", className: "tapas1", classNameText:"tapas1_text", onClick:jQuery.proxy( this.onClickSubmit, this )} ); 65 this.execButton = new Button( {value:tapasTexts["label.submitButton"], parent:this.containerCenter, id:"button_submit", className: "tapas1", classNameText:"tapas1_text", onClick:jQuery.proxy( this.onClickSubmit, this )} ); 63 66 this.addRequestButton = new Button( {title:tapasTexts["label.title.add"],value:tapasTexts["label.addButton"], parent:this.containerCenter, id:"button_add", className: "positive", onClick:jQuery.proxy( this.onClickAdd, this )} ); 64 67 this.delRequestButton = new Button( {title:tapasTexts["label.title.del"],value:tapasTexts["label.delButton"], parent:this.containerCenter, id:"button_del", className: "negative", onClick:jQuery.proxy( this.onClickDel, this )} ); 65 68 this.delRequestButton.disable(); 69 this.execButton.enable(); 70 //this.addRequestButton.disable(); 71 this.optionButton = new Button( {title:"",value:"XML", parent:this.containerCenter, id:"button_opt", className: "option", onClick:jQuery.proxy( this.onClickOption, this )} ); 72 73 this.divX = $( document.createElement( "div" ) ); 74 this.divX.attr( {id:"divX", class:"xmlInfos"} ); 75 this.containerForm.append( this.divX ); 76 77 var img = $( document.createElement( "img" ) ); 78 var a = $( document.createElement( "a" ) ); 79 80 img.attr( "src", "resources/images/info.png" ); 81 img.attr( "width", "19" ); 82 a.attr( "style", "cursor:pointer" ); 83 84 img.bind( "click", ["xmlInfos",450,100,this], this.onClickInfos ); 85 a.append( img ); 86 this.divX.append( a ); 87 88 89 66 90 67 91 this.createForm(); 68 92 69 93 this.tabActive = this.createTab(); 94 70 95 this.divE = $( document.createElement( "div" ) ); 71 96 this.divE.attr( {id:"divErrors", class:"errorsForm"} ); … … 85 110 this.loadingRequest = new Loading( param ); 86 111 87 var nbr =1;88 89 $( '#select_iobservatory_' +this.nbRequest ).bind( 'focus', ["1"], jQuery.proxy(this.locationChoice,this));112 var nbr = 1; 113 114 $( '#select_iobservatory_' + this.nbRequest ).bind( 'focus', ["1"], jQuery.proxy( this.locationChoice, this ) ); 90 115 91 116 //this.loadingRequest.display(); … … 134 159 td4.attr( {colspan:5} ); 135 160 td4.append( inputDate2 ); 136 inputDate2.bind( "change", jQuery.proxy( this.checkDate,this));137 inputDate.bind( "focusin", jQuery.proxy( this.tempDate,this));138 inputDate.bind( "focusout", jQuery.proxy( this.emptyCpyDate,this));161 inputDate2.bind( "change", jQuery.proxy( this.checkDate, this ) ); 162 inputDate.bind( "focusin", jQuery.proxy( this.tempDate, this ) ); 163 inputDate.bind( "focusout", jQuery.proxy( this.emptyCpyDate, this ) ); 139 164 tr.append( td4 ); 140 165 containerCalendar.append( tr ); … … 208 233 209 234 235 createTrUploadFile: function( inputId, container, info ) 236 { 237 var tr = $( document.createElement( "tr" ) ); 238 var td1 = $( document.createElement( "td" ) ); 239 var input = $( document.createElement( "textarea") ); 240 241 input.attr( {id: inputId, class:"containerArea"} ); 242 243 td1.append( input ); 244 245 tr.append( td1 ); 246 container.append( tr ); 247 248 249 if( info ) 250 { 251 tapasTexts["label.delButton"] 252 //td1.append( texte ); 253 254 } 255 256 }, 257 258 210 259 createTr: function( texte, inputId, container, textesup, event, champ, ctnb, info ) 211 260 { … … 234 283 tr.append( td3 ); 235 284 container.append( tr ); 236 237 285 238 286 … … 258 306 tr.append( div ); 259 307 260 if (inputId.match( re2 )) { 261 input.css("backgroundColor", "#bfafd6"); 262 input.attr('disabled','disabled'); 308 if( inputId.match( re2 ) ) 309 { 310 input.css( "backgroundColor", "#bfafd6" ); 311 input.attr( 'disabled', 'disabled' ); 263 312 } 264 313 … … 376 425 input4.attr( {disabled: true} ); 377 426 378 input1.css( "backgroundColor", "#bfafd6");379 input2.css( "backgroundColor", "#bfafd6");380 input3.css( "backgroundColor", "#bfafd6");381 input4.css( "backgroundColor", "#bfafd6");382 383 input1.bind( "change", ["2"], jQuery.proxy( this.locationChoice,this));384 input2.bind( "change", ["2"], jQuery.proxy( this.locationChoice,this));385 input3.bind( "change", ["2"], jQuery.proxy( this.locationChoice,this));386 input4.bind( "change", ["2"], jQuery.proxy( this.locationChoice,this));427 input1.css( "backgroundColor", "#bfafd6" ); 428 input2.css( "backgroundColor", "#bfafd6" ); 429 input3.css( "backgroundColor", "#bfafd6" ); 430 input4.css( "backgroundColor", "#bfafd6" ); 431 432 input1.bind( "change", ["2"], jQuery.proxy( this.locationChoice, this ) ); 433 input2.bind( "change", ["2"], jQuery.proxy( this.locationChoice, this ) ); 434 input3.bind( "change", ["2"], jQuery.proxy( this.locationChoice, this ) ); 435 input4.bind( "change", ["2"], jQuery.proxy( this.locationChoice, this ) ); 387 436 388 437 td3.html( texte2 ); … … 392 441 393 442 394 395 443 /* 396 var img = $( document.createElement( "img" ) );397 var a = $( document.createElement( "a" ) );398 img.attr( "src", "resources/images/info.png" );399 img.attr( "width", "19" );400 a.attr( "style", "cursor:pointer" );401 img.bind( "click", ["spectral_range",450,100,this], this.onClickInfos );402 a.append( img );403 td1.append( a );*/444 var img = $( document.createElement( "img" ) ); 445 var a = $( document.createElement( "a" ) ); 446 img.attr( "src", "resources/images/info.png" ); 447 img.attr( "width", "19" ); 448 a.attr( "style", "cursor:pointer" ); 449 img.bind( "click", ["spectral_range",450,100,this], this.onClickInfos ); 450 a.append( img ); 451 td1.append( a );*/ 404 452 td1.append( texte1 ); 405 453 … … 412 460 td7.attr( {class:"containerLabel2"} ); 413 461 td9.attr( {class:"containerLabel2"} ); 414 415 462 416 463 … … 468 515 this.displaySelect( td2, inputId, index, this.jSonYesNos, this.select_ico2eList, false, "yesNos" ); 469 516 else if( (/^(ich4e_[1-9]+)$/.test( inputId ) ) ) 470 517 this.displaySelect( td2, inputId, index, this.jSonYesNos, this.select_ich4eList, false, "yesNos" ); 471 518 else if( (/^(in2oe_[1-9]+)$/.test( inputId ) ) ) 472 519 this.displaySelect( td2, inputId, index, this.jSonYesNos, this.select_in2oeList, false, "yesNos" ); 473 520 else if( (/^(iOneTransmission_[1-9]+)$/.test( inputId ) ) ) 521 { 474 522 this.displaySelect( td2, inputId, index, this.jSonYesNos, this.select_iOneTransmissionList, false, "yesNos" ); 523 info = true; 524 champ = inputId; 525 } 475 526 else if( (/^(irextinction_[1-9]+)$/.test( inputId ) ) ) 476 527 { … … 516 567 517 568 518 519 569 td1.attr( {class:"containerLabel"} ); 520 570 tr.append( td1 ); 521 522 523 571 524 572 … … 556 604 requestCreateXML: function() 557 605 { 558 var tapasForm = this.createTapasObject(); 606 if (this.optionForm == 1) 607 var tapasForm = this.createTapasObject(); 608 else 609 var tapasForm = this.createFileRequestObject(); 610 559 611 //passage de javascript a json grace au jquery 560 612 var jsonTapasForm = $.toJSON( tapasForm ); 561 562 613 563 614 if( jsonTapasForm ) … … 568 619 } ); 569 620 570 }, 621 622 }, 623 624 625 /* 626 requestCreateUploadFileRequest: function() 627 { 628 var tapasUploadFile = this.createFileRequestObject(); 629 var jsonTapasUploadFile = $.toJSON( tapasUploadFile ); 630 631 if( jsonTapasUploadFile ) 632 $.ajax( { 633 contentType: 'multipart/form-data', 634 dataType: 'html', 635 url: "data?methodName=uploadFile&jsonTapas=" + jsonTapasUploadFile, 636 type: 'POST'//, 637 } ); 638 }, 639 */ 571 640 572 641 … … 575 644 { 576 645 this.loadingRequest.hide(); 577 //this.loadingRequest.display(); 646 this.execButton.enable(); 647 this.optionButton.enable(); 578 648 579 649 var res = jQuery.parseJSON( result ).result; … … 748 818 width = 600; 749 819 height = 360; 820 } 821 } 822 823 824 var re = new RegExp( "xmlInfos" ); 825 if( parametre.match( re ) ) 826 { 827 var titre = "Requête XML"; 828 var pageInfo = "resources/doc/infosXml_fr.txt"; 829 width = 600; 830 height = 450; 831 if( "fr" != context.language ) 832 { 833 titre = "XML request"; 834 pageInfo = "resources/doc/infosXml_en.txt"; 835 width = 600; 836 height = 450; 837 } 838 } 839 840 var re = new RegExp( "iOneTransmission_" ); 841 if( parametre.match( re ) ) 842 { 843 var titre = "Sélection des composants atmosphériques"; 844 var pageInfo = "resources/doc/infosTransmission_fr.txt"; 845 width = 600; 846 height = 200; 847 if( "fr" != context.language ) 848 { 849 titre = "Selection of atmospheric constituents"; 850 pageInfo = "resources/doc/infosTransmission_en.txt"; 851 width = 600; 852 height = 200; 750 853 } 751 854 } … … 827 930 onClickSubmit: function() 828 931 { 932 var test = 12; 829 933 if( this.validFields() ) 830 934 { … … 833 937 { 834 938 this.loadingRequest.display(); 939 this.execButton.disable(); 940 this.optionButton.disable(); 835 941 this.requestCreateXML(); 836 942 } … … 854 960 855 961 this.updateButtons(); 962 }, 963 964 965 onClickOption: function() 966 { 967 968 if (this.optionForm == 1) 969 { 970 $( ".divObservation" ).hide(); 971 $( ".divPreference" ).hide(); 972 $( ".divUploadFile").show(); 973 $( "#button_opt" ).html('FORM') ; 974 this.optionForm=0; 975 this.addRequestButton.disable(); 976 this.delRequestButton.disable() 977 this.displayRequests(1); 978 $( "#tab_request" + this.numRequest ).html( "Request 1" ); 979 this.divE.hide(); 980 } 981 else 982 { 983 $( ".divObservation" ).show(); 984 $( ".divPreference" ).show(); 985 $( ".divUploadFile").hide(); 986 $( "#button_opt" ).html('XML') ; 987 this.optionForm=1; 988 this.addRequestButton.enable(); 989 if (this.nbRequest > 1) this.delRequestButton.enable(); 990 this.displayRequests(0); 991 $( "#icxml_"+this.numRequest ).val(""); 992 this.divE.hide(); 993 $( "#tab_request" + this.numRequest ).html( "Request " + this.numRequest ); 994 } 995 856 996 }, 857 997 … … 943 1083 AnyTime.noPicker( "iobservation_date_" + i ); 944 1084 945 if (!isEmpty($( "#iobservation_cpydate_" + i ).val())) { 1085 if( !isEmpty( $( "#iobservation_cpydate_" + i ).val() ) ) 1086 { 946 1087 var oldDate2 = this.calendarConverter.parse( $( "#iobservation_cpydate_" + i ).val() ); 947 1088 AnyTime.noPicker( "iobservation_cpydate_" + i ); … … 953 1094 $( "#iobservation_cpydate_" + i ).attr( {id:"iobservation_cpydate_" + z} ); 954 1095 this.createCalendar( $( "#tabObservation_" + z ), tapasTexts["label.datemesure"], tapasTexts["label.cpydatemesure"], "iobservation_date_" + z, "iobservation_cpydate_" + z, oldDate, false ); 955 956 1096 957 1097 … … 982 1122 983 1123 1124 displayRequests: function(flag) 1125 { 1126 1127 var numr = this.nbRequest; 1128 1129 if (numr > 1) 1130 { 1131 for( var numCurrent = 1; numCurrent <= this.nbRequest; numCurrent++ ) 1132 if (numCurrent != this.numRequest) 1133 { 1134 if (flag == 1) $( "#tab_request"+numCurrent.toString() ).hide(); 1135 else $( "#tab_request"+numCurrent.toString() ).show(); 1136 } 1137 } 1138 1139 }, 1140 1141 984 1142 onClickTab: function( event ) 985 1143 { … … 1027 1185 break; 1028 1186 case "instrumentalFunctions" : 1029 select.add( jsonElement.value, tapasTexts[jsonElement.text], jQuery.proxy(this.ifunctionChoice,this) ); // passe le gros this1187 select.add( jsonElement.value, tapasTexts[jsonElement.text], jQuery.proxy( this.ifunctionChoice, this ) ); // passe le gros this 1030 1188 break; 1031 1189 case "climatoReferences" : … … 1120 1278 createForm: function() 1121 1279 { 1122 1123 1280 var divAll = $( document.createElement( "div" ) ); 1124 1281 divAll.attr( {id:"all_" + this.nbRequest, class:"divAll"} ); 1125 1126 1282 1127 1283 //Creation div … … 1135 1291 tabObservation.attr( {id:"tabObservation_" + this.nbRequest, cellspacing:3} ); 1136 1292 1293 //Creation div 1294 var divUploadFile = $( document.createElement( "div" ) ); 1295 var tabUploadFile = $( document.createElement( "table" ) ); 1296 tabUploadFile.attr( {cellspacing:3} ); 1297 1137 1298 1138 1299 var divAtmosphere = $( document.createElement( "div" ) ); 1139 1300 var tabAtmosphere = $( document.createElement( "table" ) ); 1140 1141 1301 1142 1302 var fieldSetObservation = $( document.createElement( "fieldset" ) ); … … 1158 1318 legendPreference.addClass( "containerField" ); 1159 1319 1320 var fieldSetUploadFile = $( document.createElement( "fieldset" ) ); 1321 fieldSetUploadFile.addClass( "cfs4" ); 1322 divUploadFile.append( fieldSetUploadFile ); 1323 1324 var legendUploadFile = $( document.createElement( "legend" ) ); 1325 //legendUploadFile.html( tapasTexts["label.preferences"] ); 1326 //fieldSetPreference.append( legendPreference ); 1327 //legendPreference.addClass( "containerField" ); 1328 1160 1329 fieldSetObservation.append( tabObservation ); 1161 1330 divObservation.addClass( "divObservation" ); … … 1171 1340 divAll.append( divPreference ); 1172 1341 1342 fieldSetUploadFile.append( tabUploadFile ); 1343 divUploadFile.addClass( "divUploadFile" ); 1344 divAll.append( divUploadFile ); 1345 1173 1346 this.containerForm.append( divAll ); 1174 1347 this.containerForm.append( this.divE ); 1175 1348 //this.tabInput = new Array(3); 1176 1349 1177 this.createTrList( tapasTexts["label.format"], "iformat_" + this.nbRequest, this.nbRequest, tabPreference, 'format',false,"" ); 1178 this.createTrList( tapasTexts["label.berv"], "ibervC_" + this.nbRequest, this.nbRequest, tabPreference, 'yesno',false,"" ); 1179 this.createTrList( tapasTexts["label.era"], "irextinction_" + this.nbRequest, this.nbRequest, tabPreference, 'yesno',false,"" ); 1180 this.createTrList( tapasTexts["label.eh2o"], "ih2oe_" + this.nbRequest, this.nbRequest, tabPreference, 'yesno',false,"" ); 1181 this.createTrList( tapasTexts["label.eo3"], "io3e_" + this.nbRequest, this.nbRequest, tabPreference, 'yesno',false,"" ); 1182 this.createTrList( tapasTexts["label.eo2"], "io2e_" + this.nbRequest, this.nbRequest, tabPreference, 'yesno',false,"" ); 1183 this.createTrList( tapasTexts["label.eco2"], "ico2e_" + this.nbRequest, this.nbRequest, tabPreference, 'yesno',false,"" ); 1184 this.createTrList( tapasTexts["label.ech4"], "ich4e_" + this.nbRequest, this.nbRequest, tabPreference, 'yesno',false,"" ); 1185 this.createTrList( tapasTexts["label.en2o"], "in2oe_" + this.nbRequest, this.nbRequest, tabPreference, 'yesno',false,"" ); 1186 this.createTrList( tapasTexts["label.onetransmission"], "iOneTransmission_" + this.nbRequest, this.nbRequest, tabPreference, 'yesno',false,"" ); 1187 1350 this.createTrUploadFile( "icxml_"+this.nbRequest, tabUploadFile, false ); 1351 1352 this.createTrList( tapasTexts["label.format"], "iformat_" + this.nbRequest, this.nbRequest, tabPreference, 'format', false, "" ); 1353 this.createTrList( tapasTexts["label.berv"], "ibervC_" + this.nbRequest, this.nbRequest, tabPreference, 'yesno', false, "" ); 1354 this.createTrList( tapasTexts["label.era"], "irextinction_" + this.nbRequest, this.nbRequest, tabPreference, 'yesno', false, "" ); 1355 this.createTrList( tapasTexts["label.eh2o"], "ih2oe_" + this.nbRequest, this.nbRequest, tabPreference, 'yesno', false, "" ); 1356 this.createTrList( tapasTexts["label.eo3"], "io3e_" + this.nbRequest, this.nbRequest, tabPreference, 'yesno', false, "" ); 1357 this.createTrList( tapasTexts["label.eo2"], "io2e_" + this.nbRequest, this.nbRequest, tabPreference, 'yesno', false, "" ); 1358 this.createTrList( tapasTexts["label.eco2"], "ico2e_" + this.nbRequest, this.nbRequest, tabPreference, 'yesno', false, "" ); 1359 this.createTrList( tapasTexts["label.ech4"], "ich4e_" + this.nbRequest, this.nbRequest, tabPreference, 'yesno', false, "" ); 1360 this.createTrList( tapasTexts["label.en2o"], "in2oe_" + this.nbRequest, this.nbRequest, tabPreference, 'yesno', false, "" ); 1361 this.createTrList( tapasTexts["label.onetransmission"], "iOneTransmission_" + this.nbRequest, this.nbRequest, tabPreference, 'yesno', false, "" ); 1188 1362 1189 1363 1190 1364 this.createTrList( tapasTexts["label.observatory"], "iobservatory_" + this.nbRequest, this.nbRequest, tabObservation, 'observatories', true, "" ); 1191 1365 this.createTrTxt( tapasTexts["label.or"], tabObservation ); 1192 this.createTr3Input( tapasTexts["label.locality"], tapasTexts["label.altitude"], tapasTexts["label.latitude"], tapasTexts["label.longitude"],"ilocality_" + this.nbRequest, "ialtitude_" + this.nbRequest, "ilatitude_" + this.nbRequest, "ilongitude_" + this.nbRequest , tabObservation, "[decimal]"," <b>m</b>" );1366 this.createTr3Input( tapasTexts["label.locality"], tapasTexts["label.altitude"], tapasTexts["label.latitude"], tapasTexts["label.longitude"], "ilocality_" + this.nbRequest, "ialtitude_" + this.nbRequest, "ilatitude_" + this.nbRequest, "ilongitude_" + this.nbRequest, tabObservation, "[decimal]", " <b>m</b>" ); 1193 1367 1194 1368 this.createCalendar( tabObservation, tapasTexts["label.datemesure"], tapasTexts["label.cpydatemesure"], "iobservation_date_" + this.nbRequest, "iobservation_cpydate_" + this.nbRequest, false, true ); … … 1200 1374 1201 1375 //fonction instrumentale 1202 this.createTrList( tapasTexts["label.ifunction"], "ifunction_" + this.nbRequest, this.nbRequest, tabObservation, "ilsf", false, "select" );1376 this.createTrList( tapasTexts["label.ifunction"], "ifunction_" + this.nbRequest, this.nbRequest, tabObservation, "ilsf", false, "select" ); 1203 1377 //reference climato 1204 1378 //this.createTrList( tapasTexts["label.climato"], "icr", tabAtmosphere, "climatoReference" ); 1205 this.createTrList( tapasTexts["label.climato"], "icr_" + this.nbRequest, this.nbRequest, tabObservation, "climatoReference", false, "" );1379 this.createTrList( tapasTexts["label.climato"], "icr_" + this.nbRequest, this.nbRequest, tabObservation, "climatoReference", false, "" ); 1206 1380 1207 1381 this.createTr( tapasTexts["label.resolution"], "irp_" + this.nbRequest, tabObservation, "", "", "", "", true ); … … 1214 1388 this.createTr( tapasTexts["label.iza"], "iza_" + this.nbRequest, tabObservation, "[0,90] °", "keypress", "za", "2", true ); 1215 1389 1390 1216 1391 this.createAutoCompleteMenuForRegions(); 1217 1392 1218 1393 this.initRequestFields(); 1219 1394 1220 1221 1222 1395 $( ".divUploadFile").hide(); 1396 1397 //divAll.attr("style", "visibility: hidden"); 1223 1398 //jQuery.proxy permet d'envoyer le contexte this courant 1224 1399 … … 1226 1401 1227 1402 1228 1229 createTapasObject: function() 1403 createFileRequestObject: function() 1230 1404 { 1231 1405 … … 1233 1407 var i = 1; 1234 1408 1235 1409 /*for( var i = 1; i <= this.nbRequest; i++ ) 1410 { */ 1411 1412 // REQUEST 1413 var fileRequest = new Object(); 1414 fileRequest.id = 1; 1415 fileRequest.cXml = $( "#icxml_"+this.nbRequest).val(); 1416 1417 requests[0] = fileRequest; 1418 //} 1419 1420 // TAPAS 1421 var tapas = new Object(); 1422 tapas.requests = requests; 1423 return tapas; 1424 }, 1425 1426 1427 1428 createTapasObject: function() 1429 { 1430 1431 var requests = new Array(); 1432 var i = 1; 1236 1433 1237 1434 for( var i = 1; i <= this.nbRequest; i++ ) … … 1337 1534 var observation = new Object(); 1338 1535 1339 if (!isEmpty($( "#iobservation_cpydate_" + i ).val()) && isDate($("#iobservation_cpydate_" + i ).val()) )1536 if( !isEmpty( $( "#iobservation_cpydate_" + i ).val() ) && isDate( $( "#iobservation_cpydate_" + i ).val() ) ) 1340 1537 { 1341 1538 observation.date = this.calendarConverter.parse( $( "#iobservation_cpydate_" + i ).val() ).getTime(); … … 1345 1542 observation.date = this.calendarConverter.parse( $( "#iobservation_date_" + i ).val() ).getTime(); 1346 1543 } 1544 1545 1546 /*observation.uploadRequest = new Object(); 1547 observation.uploadRequest.firstValue = "0"; 1548 observation.uploadRequest.secondValue = $( "#icxml_" + i ).val();*/ 1347 1549 1348 1550 … … 1353 1555 observation.los = los; 1354 1556 observation.instrument = instrument; 1557 1355 1558 1356 1559 // ATMOSPHERE … … 1369 1572 request.atmosphere = atmosphere; 1370 1573 1574 //request.cXml = ($( "#icxml_" + i ).val()).toString(); 1575 1371 1576 requests[i - 1] = request; 1372 1577 } … … 1378 1583 }, 1379 1584 1585 1380 1586 validFields: function() 1381 1587 { 1382 1588 1383 for( var i = 1; i <= this.nbRequest; i++ ) 1384 { 1385 1386 var chaine = tapasTexts["text.erreur.saisie"] + " " + i + "<br>"; 1387 var testOk1 = false; 1388 var testOk2 = false; 1389 var testOk3 = false; 1390 1391 testOk1 = isDate( $( "#iobservation_cpydate_" + this.nbRequest ).val() ) || isEmpty( $( "#iobservation_cpydate_" + this.nbRequest ).val() ); 1392 if( !testOk1 ) 1589 if ( this.optionForm == 0) { 1590 var cxml = ($( "#icxml_"+this.numRequest).val()).toString(); 1591 if (isEmpty(cxml)) 1393 1592 { 1394 1593 this.divE.hide(); 1395 this.divE.html( chaine + " : " + tapasTexts["text.errcpydate"] );1594 this.divE.html( tapasTexts["text.errcxml"] ); 1396 1595 this.divE.show(); 1397 1596 return false; 1398 1597 } 1399 1400 1401 //var testOk = isSup( this.selectObservatoriesList[i].getValue(), 0 ); 1402 var testOk = isEmpty( $( "#select_iobservatory_" + i ).val() ) || this.listObs.indexOf( $( "#select_iobservatory_" + i ).val() ) < 0; 1403 testOk2 = !isEmpty( $( "#ilocality_" + i ).val() ) && isValidNum( $( "#ialtitude_" + i ).val() ) && isValidNum( $( "#ilatitude_" + i ).val() ) && isValidNum( $( "#ilongitude_" + i ).val() ) 1404 1405 if( testOk && !testOk2) 1598 else 1406 1599 { 1407 1600 this.divE.hide(); 1408 this.divE.html( chaine + " " + tapasTexts["text.selectlocation"] ); 1409 this.divE.show(); 1410 return false; 1411 } 1412 1413 testOk = isDiff( this.selectSpectralUnitsList[i].getValue(), -1 ); 1414 if( !testOk ) 1415 { 1416 this.divE.html( chaine + tapasTexts["label.spectralUnit"] + " : " + tapasTexts["text.toselect"] ); 1417 this.divE.show(); 1418 return false; 1419 } 1420 1421 testOk = isValidRange( $( "#iminspectral_ranger_" + i ).val(), $( "#imaxspectral_ranger_" + i ).val(), this.selectSpectralUnitsList[i].getValue() ); 1422 if( !testOk ) 1423 { 1424 this.divE.html( chaine + tapasTexts["label.spectralRange"] + " : " + tapasTexts["text.badvalue"] ); 1425 this.divE.show(); 1426 return false; 1427 } 1428 1429 /*testOk = isDeg( $( "#ide_" + i ).val() ); 1430 if( !testOk ) 1431 { 1432 this.divE.html( chaine + tapasTexts["label.ide"] + " : " + tapasTexts["text.badvalue"] ); 1433 this.divE.show(); 1434 return false; 1435 } */ 1436 1437 1438 testOk = isBetween( $( "#iza_" + i ).val(), 0, 90 ); 1439 testOk1 = isValidNum( $( "#iza_" + i ).val() ); 1440 testOk2 = isDeg( $( "#ide_" + i ).val() ); 1441 testOk3 = isHourDeg( $( "#ira_" + i ).val() ); 1442 if( !((testOk && testOk1) || (testOk2 && testOk3)) ) 1443 { 1444 if( !(testOk && testOk1) ) 1445 this.divE.html( chaine + "LOS : " + tapasTexts["text.badvalue"] ); 1446 else 1447 this.divE.html( chaine + tapasTexts["label.iza"] + " : " + tapasTexts["text.badvalue"] ); 1448 this.divE.show(); 1449 return false; 1450 } 1451 1452 /*testOk = isBetween( $( "#iza_" + i ).val(), 0, 90 ); 1453 if( !testOk ) 1454 { 1455 this.divE.html( chaine + tapasTexts["label.iza"] + " : " + tapasTexts["text.badvalue"] ); 1456 this.divE.show(); 1457 return false; 1458 } */ 1459 1460 1461 testOk = isValidNum( $( "#irp_" + i ).val() ); 1462 testOk2 = isSupS( this.selectInstrumentalFunctionsList[i].getValue() , -1 ); 1463 1464 1465 if (testOk2) 1466 { 1467 if( !testOk ) 1468 { 1469 this.divE.html( chaine + tapasTexts["label.resolution"] + " : " + tapasTexts["text.badvalue"] ); 1470 this.divE.show(); 1471 return false; 1472 } 1473 1474 testOk = isSup( $( "#irp_" + i ).val(), 1 ); 1475 if( !testOk ) 1476 { 1477 this.divE.html( chaine + tapasTexts["label.resolution"] + " : " + tapasTexts["text.badvalue"] ); 1478 this.divE.show(); 1479 return false; 1480 } 1481 } 1482 1483 1484 testOk = isValidNum( $( "#isr_" + i ).val() ); 1485 if( !testOk ) 1486 { 1487 this.divE.html( chaine + tapasTexts["label.ratio"] + " : " + tapasTexts["text.badvalue"] ); 1488 this.divE.show(); 1489 return false; 1490 } 1491 1492 testOk = isSup( $( "#isr_" + i ).val(), 1 ); 1493 if( !testOk ) 1494 { 1495 this.divE.html( chaine + tapasTexts["label.ratio"] + " : " + tapasTexts["text.badvalue"] ); 1496 this.divE.show(); 1497 return false; 1601 return true; 1602 } 1603 1604 } 1605 else 1606 { 1607 for( var i = 1; i <= this.nbRequest; i++ ) 1608 { 1609 var chaine = tapasTexts["text.erreur.saisie"] + " " + i + "<br>"; 1610 var testOk1 = false; 1611 var testOk2 = false; 1612 var testOk3 = false; 1613 1614 testOk1 = isDate( $( "#iobservation_cpydate_" + i ).val() ) || isEmpty( $( "#iobservation_cpydate_" + i ).val() ); 1615 if( !testOk1 ) 1616 { 1617 this.divE.hide(); 1618 this.divE.html( chaine + " : " + tapasTexts["text.errcpydate"] ); 1619 this.divE.show(); 1620 return false; 1621 } 1622 1623 1624 //var testOk = isSup( this.selectObservatoriesList[i].getValue(), 0 ); 1625 var testOk = isEmpty( $( "#select_iobservatory_" + i ).val() ) || this.listObs.indexOf( $( "#select_iobservatory_" + i ).val() ) < 0; 1626 testOk2 = !isEmpty( $( "#ilocality_" + i ).val() ) && isValidNum( $( "#ialtitude_" + i ).val() ) && isValidNum( $( "#ilatitude_" + i ).val() ) && isValidNum( $( "#ilongitude_" + i ).val() ) 1627 1628 if( testOk && !testOk2 ) 1629 { 1630 this.divE.hide(); 1631 this.divE.html( chaine + " " + tapasTexts["text.selectlocation"] ); 1632 this.divE.show(); 1633 return false; 1634 } 1635 1636 testOk = isDiff( this.selectSpectralUnitsList[i].getValue(), -1 ); 1637 if( !testOk ) 1638 { 1639 this.divE.html( chaine + tapasTexts["label.spectralUnit"] + " : " + tapasTexts["text.toselect"] ); 1640 this.divE.show(); 1641 return false; 1642 } 1643 1644 testOk = isValidRange( $( "#iminspectral_ranger_" + i ).val(), $( "#imaxspectral_ranger_" + i ).val(), this.selectSpectralUnitsList[i].getValue() ); 1645 if( !testOk ) 1646 { 1647 this.divE.html( chaine + tapasTexts["label.spectralRange"] + " : " + tapasTexts["text.badvalue"] ); 1648 this.divE.show(); 1649 return false; 1650 } 1651 1652 /*testOk = isDeg( $( "#ide_" + i ).val() ); 1653 if( !testOk ) 1654 { 1655 this.divE.html( chaine + tapasTexts["label.ide"] + " : " + tapasTexts["text.badvalue"] ); 1656 this.divE.show(); 1657 return false; 1658 } */ 1659 1660 1661 testOk = isBetween( $( "#iza_" + i ).val(), 0, 90 ); 1662 testOk1 = isValidNum( $( "#iza_" + i ).val() ); 1663 testOk2 = isDeg( $( "#ide_" + i ).val() ); 1664 testOk3 = isHourDeg( $( "#ira_" + i ).val() ); 1665 if( !((testOk && testOk1) || (testOk2 && testOk3)) ) 1666 { 1667 if( !(testOk && testOk1) ) 1668 this.divE.html( chaine + "LOS : " + tapasTexts["text.badvalue"] ); 1669 else 1670 this.divE.html( chaine + tapasTexts["label.iza"] + " : " + tapasTexts["text.badvalue"] ); 1671 this.divE.show(); 1672 return false; 1673 } 1674 1675 /*testOk = isBetween( $( "#iza_" + i ).val(), 0, 90 ); 1676 if( !testOk ) 1677 { 1678 this.divE.html( chaine + tapasTexts["label.iza"] + " : " + tapasTexts["text.badvalue"] ); 1679 this.divE.show(); 1680 return false; 1681 } */ 1682 1683 1684 testOk = isValidNum( $( "#irp_" + i ).val() ); 1685 testOk2 = isSupS( this.selectInstrumentalFunctionsList[i].getValue(), -1 ); 1686 1687 1688 if( testOk2 ) 1689 { 1690 if( !testOk ) 1691 { 1692 this.divE.html( chaine + tapasTexts["label.resolution"] + " : " + tapasTexts["text.badvalue"] ); 1693 this.divE.show(); 1694 return false; 1695 } 1696 1697 testOk = isSup( $( "#irp_" + i ).val(), 1 ); 1698 if( !testOk ) 1699 { 1700 this.divE.html( chaine + tapasTexts["label.resolution"] + " : " + tapasTexts["text.badvalue"] ); 1701 this.divE.show(); 1702 return false; 1703 } 1704 } 1705 1706 1707 testOk = isValidNum( $( "#isr_" + i ).val() ); 1708 if( !testOk ) 1709 { 1710 this.divE.html( chaine + tapasTexts["label.ratio"] + " : " + tapasTexts["text.badvalue"] ); 1711 this.divE.show(); 1712 return false; 1713 } 1714 1715 testOk = isSup( $( "#isr_" + i ).val(), 1 ); 1716 if( !testOk ) 1717 { 1718 this.divE.html( chaine + tapasTexts["label.ratio"] + " : " + tapasTexts["text.badvalue"] ); 1719 this.divE.show(); 1720 return false; 1721 } 1722 1498 1723 } 1499 1724 } … … 1546 1771 var valeur = this.selectInstrumentalFunctionsList[this.nbRequest].getValue(); 1547 1772 1548 if ( valeur == -1 ) { 1549 $( "#irp_" + this.nbRequest ).val(""); 1550 $( "#irp_" + this.nbRequest ).css("backgroundColor", "#bfafd6"); 1551 $( "#irp_" + this.nbRequest ).attr('disabled','disabled'); 1552 } 1553 else { 1554 $( "#irp_" + this.nbRequest ).css("backgroundColor", "#FFFFFF"); 1555 $( "#irp_" + this.nbRequest ).removeAttr('disabled'); 1773 if( valeur == -1 ) 1774 { 1775 $( "#irp_" + this.nbRequest ).val( "" ); 1776 $( "#irp_" + this.nbRequest ).css( "backgroundColor", "#bfafd6" ); 1777 $( "#irp_" + this.nbRequest ).attr( 'disabled', 'disabled' ); 1778 } 1779 else 1780 { 1781 $( "#irp_" + this.nbRequest ).css( "backgroundColor", "#FFFFFF" ); 1782 $( "#irp_" + this.nbRequest ).removeAttr( 'disabled' ); 1556 1783 } 1557 1784 … … 1562 1789 1563 1790 1564 locationChoice: function( ind)1791 locationChoice: function( ind ) 1565 1792 { 1566 1793 var option = ind.data[0].toString(); 1567 1794 1568 if ("1" == option)1569 { 1570 $( '#ilocality_' + this.nbRequest ).val("");1571 $( '#ialtitude_' + this.nbRequest ).val("");1572 $( '#ilatitude_' + this.nbRequest ).val("");1573 $( '#ilongitude_' + this.nbRequest ).val("");1795 if( "1" == option ) 1796 { 1797 $( '#ilocality_' + this.nbRequest ).val( "" ); 1798 $( '#ialtitude_' + this.nbRequest ).val( "" ); 1799 $( '#ilatitude_' + this.nbRequest ).val( "" ); 1800 $( '#ilongitude_' + this.nbRequest ).val( "" ); 1574 1801 } 1575 1802 else 1576 1803 { 1577 $( '#select_iobservatory_' + this.nbRequest ).val("");1804 $( '#select_iobservatory_' + this.nbRequest ).val( "" ); 1578 1805 } 1579 1806 }, … … 1583 1810 checkDate: function() 1584 1811 { 1585 var testOk1 = isDate( $( "#iobservation_cpydate_" + this.nbRequest ).val() ) || isEmpty( $( "#iobservation_cpydate_" + this.nbRequest ).val() );1812 var testOk1 = isDate( $( "#iobservation_cpydate_" + this.nbRequest ).val() ) || isEmpty( $( "#iobservation_cpydate_" + this.nbRequest ).val() ); 1586 1813 if( !testOk1 ) 1587 1814 { … … 1596 1823 emptyCpyDate: function() 1597 1824 { 1598 if ( this.dateTemp != $( "#iobservation_cpydate_" + this.nbRequest ).val("") ) { 1599 $( "#iobservation_cpydate_" + this.nbRequest ).val(""); 1825 if( this.dateTemp != $( "#iobservation_cpydate_" + this.nbRequest ).val( "" ) ) 1826 { 1827 $( "#iobservation_cpydate_" + this.nbRequest ).val( "" ); 1600 1828 } 1601 1829 return true;
Note: See TracChangeset
for help on using the changeset viewer.