Ignore:
Timestamp:
07/31/15 16:26:38 (9 years ago)
Author:
rboipsl
Message:

changement logo
champs locality/lieu desactives
+modif sur tapas.css et bas page frontend
+ ajout textes info xml et one transmission

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tapas/web/project/formTapas_script.jsp

    r817 r825  
    4141        this.tabActive = false; 
    4242        this.numRequest = 1; 
     43        this.optionForm = 1; 
    4344 
    4445 
     
    5960        } 
    6061 
     62 
    6163        // 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 )} ); 
    6366        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 )} ); 
    6467        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 )} ); 
    6568        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 
    6690 
    6791        this.createForm(); 
    6892 
    6993        this.tabActive = this.createTab(); 
     94 
    7095        this.divE = $( document.createElement( "div" ) ); 
    7196        this.divE.attr( {id:"divErrors", class:"errorsForm"} ); 
     
    85110        this.loadingRequest = new Loading( param ); 
    86111 
    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 ) ); 
    90115 
    91116        //this.loadingRequest.display(); 
     
    134159            td4.attr( {colspan:5} ); 
    135160            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 ) ); 
    139164            tr.append( td4 ); 
    140165            containerCalendar.append( tr ); 
     
    208233 
    209234 
     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 
    210259    createTr: function( texte, inputId, container, textesup, event, champ, ctnb, info ) 
    211260    { 
     
    234283        tr.append( td3 ); 
    235284        container.append( tr ); 
    236  
    237285 
    238286 
     
    258306            tr.append( div ); 
    259307 
    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' ); 
    263312            } 
    264313 
     
    376425        input4.attr( {disabled: true} ); 
    377426 
    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 ) ); 
    387436 
    388437        td3.html( texte2 ); 
     
    392441 
    393442 
    394  
    395443        /* 
    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 );*/ 
    404452        td1.append( texte1 ); 
    405453 
     
    412460        td7.attr( {class:"containerLabel2"} ); 
    413461        td9.attr( {class:"containerLabel2"} ); 
    414  
    415462 
    416463 
     
    468515                this.displaySelect( td2, inputId, index, this.jSonYesNos, this.select_ico2eList, false, "yesNos" ); 
    469516            else if( (/^(ich4e_[1-9]+)$/.test( inputId )  ) ) 
    470                     this.displaySelect( td2, inputId, index, this.jSonYesNos, this.select_ich4eList, false, "yesNos" ); 
     517                this.displaySelect( td2, inputId, index, this.jSonYesNos, this.select_ich4eList, false, "yesNos" ); 
    471518            else if( (/^(in2oe_[1-9]+)$/.test( inputId )  ) ) 
    472519                this.displaySelect( td2, inputId, index, this.jSonYesNos, this.select_in2oeList, false, "yesNos" ); 
    473520            else if( (/^(iOneTransmission_[1-9]+)$/.test( inputId )  ) ) 
     521            { 
    474522                this.displaySelect( td2, inputId, index, this.jSonYesNos, this.select_iOneTransmissionList, false, "yesNos" ); 
     523                info = true; 
     524                champ = inputId; 
     525            } 
    475526            else if( (/^(irextinction_[1-9]+)$/.test( inputId )  ) ) 
    476527            { 
     
    516567 
    517568 
    518  
    519569        td1.attr( {class:"containerLabel"} ); 
    520570        tr.append( td1 ); 
    521  
    522  
    523571 
    524572 
     
    556604    requestCreateXML: function() 
    557605    { 
    558         var tapasForm = this.createTapasObject(); 
     606        if (this.optionForm == 1) 
     607                var tapasForm = this.createTapasObject(); 
     608        else 
     609                var tapasForm = this.createFileRequestObject(); 
     610 
    559611        //passage de javascript a json grace au jquery 
    560612        var jsonTapasForm = $.toJSON( tapasForm ); 
    561  
    562613 
    563614        if( jsonTapasForm ) 
     
    568619            } ); 
    569620 
    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*/ 
    571640 
    572641 
     
    575644    { 
    576645        this.loadingRequest.hide(); 
    577         //this.loadingRequest.display(); 
     646        this.execButton.enable(); 
     647        this.optionButton.enable(); 
    578648 
    579649        var res = jQuery.parseJSON( result ).result; 
     
    748818                width = 600; 
    749819                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; 
    750853            } 
    751854        } 
     
    827930    onClickSubmit: function() 
    828931    { 
     932        var test = 12; 
    829933        if( this.validFields() ) 
    830934        { 
     
    833937            { 
    834938                this.loadingRequest.display(); 
     939                this.execButton.disable(); 
     940                this.optionButton.disable(); 
    835941                this.requestCreateXML(); 
    836942            } 
     
    854960 
    855961        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 
    856996    }, 
    857997 
     
    9431083                    AnyTime.noPicker( "iobservation_date_" + i ); 
    9441084 
    945                     if (!isEmpty($( "#iobservation_cpydate_" + i ).val())) { 
     1085                    if( !isEmpty( $( "#iobservation_cpydate_" + i ).val() ) ) 
     1086                    { 
    9461087                        var oldDate2 = this.calendarConverter.parse( $( "#iobservation_cpydate_" + i ).val() ); 
    9471088                        AnyTime.noPicker( "iobservation_cpydate_" + i ); 
     
    9531094                    $( "#iobservation_cpydate_" + i ).attr( {id:"iobservation_cpydate_" + z} ); 
    9541095                    this.createCalendar( $( "#tabObservation_" + z ), tapasTexts["label.datemesure"], tapasTexts["label.cpydatemesure"], "iobservation_date_" + z, "iobservation_cpydate_" + z, oldDate, false ); 
    955  
    9561096 
    9571097 
     
    9821122 
    9831123 
     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 
    9841142    onClickTab: function( event ) 
    9851143    { 
     
    10271185                    break; 
    10281186                case "instrumentalFunctions" : 
    1029                     select.add( jsonElement.value, tapasTexts[jsonElement.text],jQuery.proxy(this.ifunctionChoice,this) );     // passe le gros this 
     1187                    select.add( jsonElement.value, tapasTexts[jsonElement.text], jQuery.proxy( this.ifunctionChoice, this ) );     // passe le gros this 
    10301188                    break; 
    10311189                case "climatoReferences" : 
     
    11201278    createForm: function() 
    11211279    { 
    1122  
    11231280        var divAll = $( document.createElement( "div" ) ); 
    11241281        divAll.attr( {id:"all_" + this.nbRequest, class:"divAll"} ); 
    1125  
    11261282 
    11271283        //Creation div 
     
    11351291        tabObservation.attr( {id:"tabObservation_" + this.nbRequest, cellspacing:3} ); 
    11361292 
     1293        //Creation div 
     1294        var divUploadFile = $( document.createElement( "div" ) ); 
     1295        var tabUploadFile = $( document.createElement( "table" ) ); 
     1296        tabUploadFile.attr( {cellspacing:3} ); 
     1297 
    11371298 
    11381299        var divAtmosphere = $( document.createElement( "div" ) ); 
    11391300        var tabAtmosphere = $( document.createElement( "table" ) ); 
    1140  
    11411301 
    11421302        var fieldSetObservation = $( document.createElement( "fieldset" ) ); 
     
    11581318        legendPreference.addClass( "containerField" ); 
    11591319 
     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 
    11601329        fieldSetObservation.append( tabObservation ); 
    11611330        divObservation.addClass( "divObservation" ); 
     
    11711340        divAll.append( divPreference ); 
    11721341 
     1342        fieldSetUploadFile.append( tabUploadFile ); 
     1343        divUploadFile.addClass( "divUploadFile" ); 
     1344        divAll.append( divUploadFile ); 
     1345 
    11731346        this.containerForm.append( divAll ); 
    11741347        this.containerForm.append( this.divE ); 
    11751348        //this.tabInput = new Array(3); 
    11761349 
    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, "" ); 
    11881362 
    11891363 
    11901364        this.createTrList( tapasTexts["label.observatory"], "iobservatory_" + this.nbRequest, this.nbRequest, tabObservation, 'observatories', true, "" ); 
    11911365        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>" ); 
    11931367 
    11941368        this.createCalendar( tabObservation, tapasTexts["label.datemesure"], tapasTexts["label.cpydatemesure"], "iobservation_date_" + this.nbRequest, "iobservation_cpydate_" + this.nbRequest, false, true ); 
     
    12001374 
    12011375        //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" ); 
    12031377        //reference climato 
    12041378        //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, "" ); 
    12061380 
    12071381        this.createTr( tapasTexts["label.resolution"], "irp_" + this.nbRequest, tabObservation, "", "", "", "", true ); 
     
    12141388        this.createTr( tapasTexts["label.iza"], "iza_" + this.nbRequest, tabObservation, "[0,90] &deg;", "keypress", "za", "2", true ); 
    12151389 
     1390 
    12161391        this.createAutoCompleteMenuForRegions(); 
    12171392 
    12181393        this.initRequestFields(); 
    12191394 
    1220  
    1221  
    1222  
     1395        $( ".divUploadFile").hide(); 
     1396 
     1397        //divAll.attr("style", "visibility: hidden"); 
    12231398        //jQuery.proxy permet d'envoyer le contexte this courant 
    12241399 
     
    12261401 
    12271402 
    1228  
    1229     createTapasObject: function() 
     1403    createFileRequestObject: function() 
    12301404    { 
    12311405 
     
    12331407        var i = 1; 
    12341408 
    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; 
    12361433 
    12371434        for( var i = 1; i <= this.nbRequest; i++ ) 
     
    13371534            var observation = new Object(); 
    13381535 
    1339             if (!isEmpty($( "#iobservation_cpydate_" + i ).val()) && isDate($("#iobservation_cpydate_" + i ).val()) ) 
     1536            if( !isEmpty( $( "#iobservation_cpydate_" + i ).val() ) && isDate( $( "#iobservation_cpydate_" + i ).val() ) ) 
    13401537            { 
    13411538                observation.date = this.calendarConverter.parse( $( "#iobservation_cpydate_" + i ).val() ).getTime(); 
     
    13451542                observation.date = this.calendarConverter.parse( $( "#iobservation_date_" + i ).val() ).getTime(); 
    13461543            } 
     1544 
     1545 
     1546            /*observation.uploadRequest = new Object(); 
     1547             observation.uploadRequest.firstValue = "0"; 
     1548             observation.uploadRequest.secondValue = $( "#icxml_" + i ).val();*/ 
    13471549 
    13481550 
     
    13531555            observation.los = los; 
    13541556            observation.instrument = instrument; 
     1557 
    13551558 
    13561559            // ATMOSPHERE 
     
    13691572            request.atmosphere = atmosphere; 
    13701573 
     1574            //request.cXml = ($( "#icxml_" + i ).val()).toString(); 
     1575 
    13711576            requests[i - 1] = request; 
    13721577        } 
     
    13781583    }, 
    13791584 
     1585 
    13801586    validFields: function() 
    13811587    { 
    13821588 
    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)) 
    13931592            { 
    13941593                this.divE.hide(); 
    1395                 this.divE.html( chaine + " : " + tapasTexts["text.errcpydate"] ); 
     1594                this.divE.html( tapasTexts["text.errcxml"] ); 
    13961595                this.divE.show(); 
    13971596                return false; 
    13981597            } 
    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 
    14061599            { 
    14071600                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 
    14981723            } 
    14991724        } 
     
    15461771        var valeur = this.selectInstrumentalFunctionsList[this.nbRequest].getValue(); 
    15471772 
    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' ); 
    15561783        } 
    15571784 
     
    15621789 
    15631790 
    1564     locationChoice: function(ind) 
     1791    locationChoice: function( ind ) 
    15651792    { 
    15661793        var option = ind.data[0].toString(); 
    15671794 
    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( "" ); 
    15741801        } 
    15751802        else 
    15761803        { 
    1577             $( '#select_iobservatory_' + this.nbRequest).val(""); 
     1804            $( '#select_iobservatory_' + this.nbRequest ).val( "" ); 
    15781805        } 
    15791806    }, 
     
    15831810    checkDate: function() 
    15841811    { 
    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() ); 
    15861813        if( !testOk1 ) 
    15871814        { 
     
    15961823    emptyCpyDate: function() 
    15971824    { 
    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( "" ); 
    16001828        } 
    16011829        return true; 
Note: See TracChangeset for help on using the changeset viewer.