Changeset 501
- Timestamp:
- 05/02/12 16:18:55 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tapas/web/project/formTapas_script.jsp
r500 r501 14 14 /** *********** VARIABLES *********** **/ 15 15 this.jSonFileFormats = jsonFileFormats || null; 16 this.selectFileFormatsList = new Object(); 16 17 this.jSonYesNos = jsonYesNos || null; 18 17 19 this.jSonObservatories = jsonObservatories || false; 20 this.selectObservatoriesList = new Object(); 18 21 this.jSonSpectralUnits = jsonSpectralUnits || null; 22 this.selectSpectralUnitsList = new Object(); 19 23 this.jSonInstrumentalFunctions = jsonInstrumentalFunctions || null; 24 this.selectInstrumentalFunctionsList = new Object(); 20 25 this.jSonClimatoReferences = jsonClimatoReferences || null; 26 this.selectClimatoReferencesList = new Object(); 21 27 this.nbRequest = 1; 22 28 this.tabActive = false; 23 29 this.numRequest = 1; 24 30 31 // Buttons 25 32 var submitButton = new Button( {value:tapasTexts["label.submitButton"], parent:this.containerCenter, id:"button_submit", className: "red_button", classNameText:"red_button_text", onClick:jQuery.proxy( this.onClickSubmit, this )} ); 26 33 this.addRequestButton = new Button( {value:tapasTexts["label.addButton"], parent:this.containerCenter, id:"button_add", className: "positive", onClick:jQuery.proxy( this.onClickAdd, this )} ); … … 200 207 201 208 202 createTrList: function( texte, inputId, container, type )209 createTrList: function( texte, inputId, index, container, type ) 203 210 { 204 211 var tr = $( document.createElement( "tr" ) ); … … 213 220 214 221 tr.append( td1 ); 215 if( type == 'format' ) this.displayFileFormats( td2, inputId ); 216 else if( type == 'yesno' ) 222 // if( type == 'format' ) this.displayFileFormats( td2, inputId ); 223 if( 'format' == type ) this.displaySelect( td2, inputId, index, this.jSonFileFormats, this.selectFileFormatsList, false, null ); 224 else 225 if( 'yesno' == type ) 217 226 { 218 227 if( (/^(ih2oe_[1-9]+)$/.test( inputId ) ) ) this.select_ih2oe = this.createSelectYesNo( td2, inputId ); … … 222 231 else if( (/^(irextinction_[1-9]+)$/.test( inputId ) ) ) this.select_irextinction = this.createSelectYesNo( td2, inputId ); 223 232 } 224 else if( type == 'observatories' ) this.displayObservatories( td2, inputId ); 225 else if( type == 'spectralUnit' ) 226 { 227 this.displaySpectralUnits( td2, inputId ); 228 //td2.attr({colspan:3}); 229 } 230 else if( type == 'ilsf' ) this.displayInstrumentalFunctions( td2, inputId ); 231 else if( type == 'climatoReference' ) 232 { 233 this.displayClimatoReferences( td2, inputId ); 234 } 233 else if( 'observatories' == type ) 234 this.displaySelect( td2, inputId, index, this.jSonObservatories, this.selectObservatoriesList, true, "observatories" ); 235 else if( 'spectralUnit' == type ) 236 this.displaySelect( td2, inputId, index, this.jSonSpectralUnits, this.selectSpectralUnitsList, true, "spectralUnits" ); 237 else if( 'ilsf' == type ) 238 this.displaySelect( td2, inputId, index, this.jSonInstrumentalFunctions, this.selectInstrumentalFunctionsList, false, "instrumentalFunctions" ); 239 else if( 'climatoReference' == type ) 240 this.displaySelect( td2, inputId, index, this.jSonClimatoReferences, this.selectClimatoReferencesList, false, "climatoReferences" ); 235 241 236 242 td2.attr( {colspan:3} ); … … 396 402 397 403 // OTHERS ******************************************************** 398 displayFileFormats: function( container, id ) 404 // General method to display select 405 displaySelect: function( container, id, index, jsonList, selectList, nullValueIsNeeded, contentManage ) 399 406 { 400 407 var paramSelect = new Object(); 401 408 paramSelect.id = "select_" + id; 402 409 paramSelect.parent = container; 403 this.selectFormats = new Select( paramSelect ); 404 jQuery.each( this.jSonFileFormats, jQuery.proxy( function ( i, jsonFileFormat ) 405 { 406 this.selectFormats.add( jsonFileFormat.value, jsonFileFormat.text ); 410 var select = new Select( paramSelect ); 411 if( nullValueIsNeeded ) 412 select.add( "-1", "-- " + tapasTexts["text.select"] + " --" ); 413 jQuery.each( jsonList, jQuery.proxy( function ( i, jsonElement ) 414 { 415 switch( contentManage ) 416 { 417 case "observatories": 418 select.add( jsonElement.id, jsonElement.name ); 419 break; 420 case "spectralUnits": 421 select.add( jsonElement.value, tapasTexts[jsonElement.value] ); 422 break; 423 case "instrumentalFunctions" : 424 case "climatoReferences": 425 select.add( jsonElement.value, tapasTexts[jsonElement.text] ); 426 break; 427 default: 428 select.add( jsonElement.value, jsonElement.text ); 429 break; 430 } 407 431 }, this ) ); 408 this.selectFormats.selectFirst( false ); 409 }, 410 411 412 displayObservatories: function( container, id ) 413 { 414 var paramSelect = new Object(); 415 paramSelect.id = "select_" + id; 416 paramSelect.name = id; 417 paramSelect.parent = container; 418 this.selectObservatories = new Select( paramSelect ); 419 //ajouter select vide avec add 420 this.selectObservatories.add( "-1", "-- " + tapasTexts["text.select"] + " --" ); 421 jQuery.each( this.jSonObservatories, jQuery.proxy( function ( i, jsonObservatory ) 422 { 423 this.selectObservatories.add( jsonObservatory.id, jsonObservatory.name ); 424 }, this ) ); 425 this.selectObservatories.selectFirst( true ); 426 }, 427 428 429 displaySpectralUnits: function( container, id ) 430 { 431 var paramSelect = new Object(); 432 paramSelect.id = "select_" + id; 433 paramSelect.parent = container; 434 this.selectSpectralUnits = new Select( paramSelect ); 435 //ajouter select vide avec add 436 this.selectSpectralUnits.add( "-1", "-- " + tapasTexts["text.select"] + " --" ); 437 jQuery.each( this.jSonSpectralUnits, jQuery.proxy( function ( i, jsonSpectralUnit ) 438 { 439 this.selectSpectralUnits.add( jsonSpectralUnit.value, tapasTexts[jsonSpectralUnit.value] ); 440 //this.selectSpectralUnits.add( jsonSpectralUnit.value, jsonSpectralUnit.value ); 441 }, this ) ); 442 this.selectSpectralUnits.selectFirst( true ); 443 }, 444 445 displayInstrumentalFunctions: function( container, id ) 446 { 447 var paramSelect = new Object(); 448 paramSelect.id = "select_" + id; 449 paramSelect.parent = container; 450 this.selectInstrumentalFunctions = new Select( paramSelect ); 451 //ajouter select vide avec add 452 jQuery.each( this.jSonInstrumentalFunctions, jQuery.proxy( function ( i, jsonInstrumentalFunction ) 453 { 454 this.selectInstrumentalFunctions.add( jsonInstrumentalFunction.value, tapasTexts[jsonInstrumentalFunction.text] ); 455 }, this ) ); 456 this.selectInstrumentalFunctions.selectFirst( true ); 457 }, 458 459 460 displayClimatoReferences: function( container, id ) 461 { 462 var paramSelect = new Object(); 463 paramSelect.id = "select_" + id; 464 paramSelect.parent = container; 465 this.selectClimatoReferences = new Select( paramSelect ); 466 //ajouter select vide avec add 467 jQuery.each( this.jSonClimatoReferences, jQuery.proxy( function ( i, jsonClimatoReference ) 468 { 469 this.selectClimatoReferences.add( jsonClimatoReference.value, tapasTexts[jsonClimatoReference.text] ); 470 }, this ) ); 471 this.selectClimatoReferences.selectFirst( true ); 472 }, 473 432 select.selectFirst( false ); 433 selectList[index] = select; 434 }, 435 436 // TODO : remove 437 // displayFileFormats: function( container, id ) 438 // { 439 // var paramSelect = new Object(); 440 // paramSelect.id = "select_" + id; 441 // paramSelect.parent = container; 442 // this.selectFormats = new Select( paramSelect ); 443 // jQuery.each( this.jSonFileFormats, jQuery.proxy( function ( i, jsonFileFormat ) 444 // { 445 // this.selectFormats.add( jsonFileFormat.value, jsonFileFormat.text ); 446 // }, this ) ); 447 // this.selectFormats.selectFirst( false ); 448 // }, 449 450 // TODO : remove 451 // displayObservatories: function( container, id ) 452 // { 453 // var paramSelect = new Object(); 454 // paramSelect.id = "select_" + id; 455 // paramSelect.parent = container; 456 // this.selectObservatories = new Select( paramSelect ); 457 // //ajouter select vide avec add 458 // this.selectObservatories.add( "-1", "-- " + tapasTexts["text.select"] + " --" ); 459 // jQuery.each( this.jSonObservatories, jQuery.proxy( function ( i, jsonObservatory ) 460 // { 461 // this.selectObservatories.add( jsonObservatory.id, jsonObservatory.name ); 462 // }, this ) ); 463 // this.selectObservatories.selectFirst( true ); 464 // }, 465 466 // TODO : remove 467 // displaySpectralUnits:function( container, id ) 468 // { 469 // var paramSelect = new Object(); 470 // paramSelect.id = "select_" + id; 471 // paramSelect.parent = container; 472 // this.selectSpectralUnits = new Select( paramSelect ); 473 // //ajouter select vide avec add 474 // this.selectSpectralUnits.add( "-1", "-- " + tapasTexts["text.select"] + " --" ); 475 // jQuery.each( this.jSonSpectralUnits, jQuery.proxy( function ( i, jsonSpectralUnit ) 476 // { 477 // this.selectSpectralUnits.add( jsonSpectralUnit.value, tapasTexts[jsonSpectralUnit.value] ); 478 // //this.selectSpectralUnits.add( jsonSpectralUnit.value, jsonSpectralUnit.value ); 479 // }, this ) ); 480 // this.selectSpectralUnits.selectFirst( true ); 481 // }, 482 483 // TODO : remove 484 // displayInstrumentalFunctions: function( container, id ) 485 // { 486 // var paramSelect = new Object(); 487 // paramSelect.id = "select_" + id; 488 // paramSelect.parent = container; 489 // this.selectInstrumentalFunctions = new Select( paramSelect ); 490 // //ajouter select vide avec add 491 // jQuery.each( this.jSonInstrumentalFunctions, jQuery.proxy( function ( i, jsonInstrumentalFunction ) 492 // { 493 // this.selectInstrumentalFunctions.add( jsonInstrumentalFunction.value, tapasTexts[jsonInstrumentalFunction.text] ); 494 // }, this ) ); 495 // this.selectInstrumentalFunctions.selectFirst( true ); 496 // }, 497 498 499 // TODO : remove 500 // displayClimatoReferences: function( container, id ) 501 // { 502 // var paramSelect = new Object(); 503 // paramSelect.id = "select_" + id; 504 // paramSelect.parent = container; 505 // this.selectClimatoReferences = new Select( paramSelect ); 506 // //ajouter select vide avec add 507 // jQuery.each( this.jSonClimatoReferences, jQuery.proxy( function ( i, jsonClimatoReference ) 508 // { 509 // this.selectClimatoReferences.add( jsonClimatoReference.value, tapasTexts[jsonClimatoReference.text] ); 510 // }, this ) ); 511 // this.selectClimatoReferences.selectFirst( true ); 512 // }, 474 513 475 514 showErrors: function( result ) … … 478 517 // this.containerErrors.html( tapasTexts[result.responseText] ); 479 518 }, 480 481 519 482 520 … … 542 580 //this.tabInput = new Array(3); 543 581 544 this.createTrList( tapasTexts["label.format"], "iformat_" + this.nbRequest, t abPreference, 'format' );545 this.createTrList( tapasTexts["label.era"], "irextinction_" + this.nbRequest, t abPreference, 'yesno' );546 this.createTrList( tapasTexts["label.eh2o"], "ih2oe_" + this.nbRequest, t abPreference, 'yesno' );547 this.createTrList( tapasTexts["label.eo3"], "io3e_" + this.nbRequest, t abPreference, 'yesno' );548 this.createTrList( tapasTexts["label.eo2"], "io2e_" + this.nbRequest, t abPreference, 'yesno' );549 this.createTrList( tapasTexts["label.eco2"], "ico2e_" + this.nbRequest, t abPreference, 'yesno' );550 551 this.createTrList( tapasTexts["label.observatory"], "iobservatory_" + this.nbRequest, t abObservation, 'observatories' );582 this.createTrList( tapasTexts["label.format"], "iformat_" + this.nbRequest, this.nbRequest, tabPreference, 'format' ); 583 this.createTrList( tapasTexts["label.era"], "irextinction_" + this.nbRequest, this.nbRequest, tabPreference, 'yesno' ); 584 this.createTrList( tapasTexts["label.eh2o"], "ih2oe_" + this.nbRequest, this.nbRequest, tabPreference, 'yesno' ); 585 this.createTrList( tapasTexts["label.eo3"], "io3e_" + this.nbRequest, this.nbRequest, tabPreference, 'yesno' ); 586 this.createTrList( tapasTexts["label.eo2"], "io2e_" + this.nbRequest, this.nbRequest, tabPreference, 'yesno' ); 587 this.createTrList( tapasTexts["label.eco2"], "ico2e_" + this.nbRequest, this.nbRequest, tabPreference, 'yesno' ); 588 589 this.createTrList( tapasTexts["label.observatory"], "iobservatory_" + this.nbRequest, this.nbRequest, tabObservation, 'observatories' ); 552 590 this.createCalendar( tabObservation, tapasTexts["label.datemesure"], "iobservation_date_" + this.nbRequest, false, true ); 553 591 554 592 //unite 555 this.createTrList( tapasTexts["label.spectralUnit"], "ispectral_choice_" + this.nbRequest, t abObservation, 'spectralUnit' );593 this.createTrList( tapasTexts["label.spectralUnit"], "ispectral_choice_" + this.nbRequest, this.nbRequest, tabObservation, 'spectralUnit' ); 556 594 this.createTr2Input( tapasTexts["label.spectralRange"], tapasTexts["label.to"], "iminspectral_ranger_" + this.nbRequest, "imaxspectral_ranger_" + this.nbRequest, tabObservation, "[350,2500] nm" ); 557 595 558 596 //fonction instrumentale 559 this.createTrList( tapasTexts["label.ifunction"], "ifunction_" + this.nbRequest, t abObservation, "ilsf" );597 this.createTrList( tapasTexts["label.ifunction"], "ifunction_" + this.nbRequest, this.nbRequest, tabObservation, "ilsf" ); 560 598 //reference climato 561 599 //this.createTrList( tapasTexts["label.climato"], "icr", tabAtmosphere, "climatoReference" ); 562 this.createTrList( tapasTexts["label.climato"], "icr_" + this.nbRequest, t abObservation, "climatoReference" );600 this.createTrList( tapasTexts["label.climato"], "icr_" + this.nbRequest, this.nbRequest, tabObservation, "climatoReference" ); 563 601 564 602 … … 577 615 578 616 579 580 617 createTapasObject: function() 581 618 { … … 590 627 preference.format = new Object(); 591 628 //toutes les valeurs possibles 592 preference.format.firstValue = this.selectFormats.getValuesInString(); 593 629 preference.format.firstValue = this.selectFileFormatsList[i].getValuesInString(); 594 630 //la valeur selectionnee 595 // preference.format.secondValue = this.selectFormats.getValue(); 596 preference.format.secondValue = $( "#select_iformat_" + i )[0].textContent; 631 preference.format.secondValue = this.selectFileFormatsList[i].getValue(); 597 632 598 633 preference.rayleighExtinction = new Object(); … … 624 659 // OBSERVATION 625 660 var observatory = new Object(); 626 // observatory.id = this.selectObservatories.getValue(); 627 observatory.id = $( "#select_iobservatory_" + i )[0].textContent; 661 observatory.id = this.selectObservatoriesList[i].getValue(); 628 662 629 663 // Los
Note: See TracChangeset
for help on using the changeset viewer.