Ignore:
Timestamp:
04/01/14 16:56:38 (10 years ago)
Author:
rboipsl
Message:

Dernière version rboipsl

File:
1 edited

Legend:

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

    r767 r779  
    1  
     1<script src="js/library/jquery-ui-1.8.16.custom/js/jquery-ui-1.8.16.custom.min.js"></script> 
    22<script type="text/javascript"> 
    33 
     
    2222        this.select_io3eList = new Object(); 
    2323        this.select_ico2eList = new Object(); 
     24        this.select_ich4eList = new Object(); 
     25        this.select_in2oeList = new Object(); 
    2426        this.select_irextinctionList = new Object(); 
    2527        this.select_ibervCList = new Object(); 
     
    188190        if (event.length > 0) input.bind( event, [this, champ], this.angleChoice ); 
    189191 
    190         td1.html( texte ); 
     192 
    191193        td1.attr( {class:"containerLabel"} ); 
    192194 
     
    204206 
    205207        if (info && (inputId.match(re1) || inputId.match(re2))) { 
    206             var mt="-4px"; 
    207             var ml=""; 
    208  
    209             if (this.browser == "Firefox") { 
    210                 if (this.language == "en") ml="-252px"; 
    211                 else ml="-244px"; 
    212             } 
    213             else if (this.browser == "Chrome") { 
    214                 if (this.language == "en") ml="-227px"; 
    215                 else ml="-223px"; 
    216             } 
    217208 
    218209            var img = $( document.createElement( "img" ) ); 
     
    226217            a.append(img); 
    227218            div.append(a); 
    228             div.attr( "style","margin-left:"+ml+";margin-top:"+mt); 
    229  
     219 
     220 
     221            td1.append( a ); 
     222            td1.append( texte ); 
    230223            tr.append( div ); 
    231224 
    232             /*td2.attr( {colspan:3} ); 
    233             tr.append( td2 ); 
    234             tr.append( div );*/ 
    235225        } 
    236226        else if (info) { 
     
    242232            img.bind("click",[inputId,450,100,this],this.onClickInfos); 
    243233            a.append(img); 
    244             td3.append(a); 
     234            td1.append(a); 
     235            td1.append( texte ); 
    245236 
    246237        } 
     
    280271        input2.attr( {id: inputId2,class:"containerText",size:11} ); 
    281272 
    282         td1.html( texte1 ); 
     273 
    283274        td3.html( texte2 ); 
    284275        td5.html( textesup ); 
     
    290281        img.bind("click",["spectral_range",450,100,this],this.onClickInfos); 
    291282        a.append(img); 
    292         td5.append(a); 
     283        td1.append(a); 
     284         td1.append( texte1 ); 
    293285 
    294286        //img.onclick(this.onClickInfos("spectral_range",1200,440)); 
     
    318310        var td1 = $( document.createElement( "td" ) ); 
    319311        var td2 = $( document.createElement( "td" ) ); 
     312        var td3 = $( document.createElement( "td" ) ); 
    320313        var input = $( document.createElement( "input" ) ); 
    321         var champ="", ml="", mt="-4px"; 
     314        var champ=""; 
    322315 
    323316        var div = $( document.createElement( "div" ) ); 
    324317 
     318 
    325319        input.attr( {id: inputId} ); 
    326320 
    327         td1.html( texte ); 
    328         td1.attr( {class:"containerLabel"} ); 
    329         tr.append( td1 ); 
    330  
    331  
    332                  // alert(inputId); 
     321        // alert(inputId); 
    333322        if( 'format' == type ) { 
    334323            this.displaySelect( td2, inputId, index, this.jSonFileFormats, this.selectFileFormatsList, false, null ); 
    335324            info = true; 
    336325            champ = "iformat_"; 
    337             ml="-2px"; 
    338             mt="-4px"; 
    339         } 
    340  
     326 
     327        } 
    341328        else 
    342329        if( 'yesno' == type ) 
     
    350337            else if( (/^(ico2e_[1-9]+)$/.test( inputId )  ) ) 
    351338                this.displaySelect( td2, inputId, index, this.jSonYesNos, this.select_ico2eList, false, "yesNos" ); 
     339            else if( (/^(ich4e_[1-9]+)$/.test( inputId )  ) ) 
     340                this.displaySelect( td2, inputId, index, this.jSonYesNos, this.select_ich4eList, false, "yesNos" ); 
     341            else if( (/^(in2oe_[1-9]+)$/.test( inputId )  ) ) 
     342                this.displaySelect( td2, inputId, index, this.jSonYesNos, this.select_in2oeList, false, "yesNos" ); 
    352343            else if( (/^(irextinction_[1-9]+)$/.test( inputId )  ) ) { 
    353344 
     
    355346                info = true; 
    356347                champ=inputId; 
    357                 if (this.language == "en") ml="-11px"; 
    358                 else ml="-13px"; 
    359  
    360348            } 
    361349            else if( (/^(ibervC_[1-9]+)$/.test( inputId )  ) ) { 
     
    363351                info = true; 
    364352                champ=inputId; 
    365                 if (this.language == "en") ml="-11px"; 
    366                 else ml="-13px"; 
    367353            } 
    368354        } 
    369355        else if( 'observatories' == type ) { 
    370             this.displaySelect( td2, inputId, index, this.jSonObservatories, this.selectObservatoriesList, true, "observatories" ); 
    371  
    372             if (this.browser == "Firefox") { 
    373                 if (this.language == "en") ml="-162px"; 
    374                 else ml="-116px"; 
    375             } 
    376             else if (this.browser == "Chrome") { 
    377                 if (this.language == "en") ml="-123px"; 
    378                 else ml="-84px"; 
    379             } 
     356 
     357            this.displaySelect1( td2, inputId, index, this.jSonObservatories, this.selectObservatoriesList, true, "observatories" ); 
     358            //this.displaySelect( td2, inputId, index, this.jSonObservatories, this.selectObservatoriesList, true, "observatories" ); 
    380359 
    381360            champ="iobservatory_"; 
     
    386365 
    387366            champ = "ispectral_choice_"; 
    388  
    389            if (this.browser == "Firefox") { 
    390                 if (this.language == "en") ml="-162px"; 
    391                 else ml="-116px"; 
    392             } 
    393             else if (this.browser == "Chrome") { 
    394                 if (this.language == "en") ml="-123px"; 
    395                 else ml="-84px"; 
    396             } 
    397  
    398367        } 
    399368        else if( 'ilsf' == type ) { 
     
    401370            info = true; 
    402371            champ = "ifunction_"; 
    403             if (this.language == "en") ml="-192px"; 
    404             else ml="-172px"; 
    405  
    406             if (this.browser == "Firefox") { 
    407                 if (this.language == "en") ml="-192px"; 
    408                 else ml="-172px"; 
    409             } 
    410             else if (this.browser == "Chrome") { 
    411                 if (this.language == "en") ml="-149px"; 
    412                 else ml="-134px"; 
    413             } 
    414  
    415372        } 
    416373        else if( 'climatoReference' == type ) { 
     
    418375            info = true; 
    419376            champ = "icr_"; 
    420  
    421             if (this.browser == "Firefox") { 
    422                 if (this.language == "en") ml="-170px"; 
    423                 else ml="-162px"; 
    424             } 
    425             else if (this.browser == "Chrome") { 
    426                 if (this.language == "en") ml="-127px"; 
    427                 else ml="-124px"; 
    428             } 
    429  
    430         } 
    431  
     377        } 
     378 
     379        td1.attr( {class:"containerLabel"} ); 
     380        tr.append( td1 ); 
    432381 
    433382 
     
    442391            a.append(img); 
    443392            div.append(a); 
    444             div.attr( "style","margin-left:"+ml+";margin-top:"+mt); 
    445  
    446             td2.attr( {colspan:3} ); 
     393 
     394 
     395            td2.attr( {colspan:5} ); 
     396            td1.append( a ); 
     397            td1.append( texte ); 
     398 
    447399            tr.append( td2 ); 
    448             tr.append( div ); 
     400 
    449401        } 
    450402        else { 
     403            td1.append( texte ); 
    451404            td2.attr( {colspan:3} ); 
    452405            tr.append( td2 ); 
     
    760713                    //$( "#tab_request" + i ).html( "toto"); 
    761714                    $( "#tab_request" + i ).attr( {name:z} ); 
    762                     $( "#tab_request" + i ).attr( {id:"tab_request" + z} );       this.angleChoice 
     715                    $( "#tab_request" + i ).attr( {id:"tab_request" + z} );       //this.angleChoice 
    763716                    $( "#tabObservation_" + i ).attr( {id:"tabObservation_" + z} ); 
    764717//                    $( "#select_iobservatory_" + i ).attr( {id:"select_iobservatory_" + z} ); 
     
    801754                    this.select_ico2eList[i] = null; 
    802755 
     756                    this.select_ich4eList[z] = this.select_ich4eList[i]; 
     757                    this.select_ich4eList[i] = null; 
     758 
     759                    this.select_in2oeList[z] = this.select_in2oeList[i]; 
     760                    this.select_in2oeList[i] = null; 
     761 
    803762                    this.select_ibervCList[z] = this.select_ibervCList[i]; 
    804763                    this.select_ibervCList[i] = null; 
     
    895854    }, 
    896855 
     856    createAutoCompleteMenuForRegions: function() 
     857    { 
     858 
     859        $( "#select_iobservatory_"+this.nbRequest ).autocomplete( { 
     860            source: this.listObs, 
     861            appendTo: "#regionContent"+this.nbRequest, 
     862            minLength: 0, 
     863            autoFocus: true, 
     864            autoSelect: true, 
     865            select: jQuery.proxy( function( event, ui ) 
     866            { 
     867                this.regionLabel = ui.item.value; 
     868            }, this ) 
     869        } ).focus( function( event ) 
     870        { 
     871            $( this ).autocomplete( "search", "" ); 
     872        } ); 
     873 
     874        //$( "#regionTags" ).focus(); 
     875    }, 
     876 
     877 
     878// OTHERS ******************************************************** 
     879    // General method to display select 
     880    displaySelect1: function( container, id, index, jsonList, selectList, nullValueIsNeeded, contentManage ) 
     881    { 
     882        //alert("ok"); 
     883        var iselect = $( document.createElement( "select" ) ); 
     884        var option = document.createElement("option"); 
     885 
     886        var paramSelect = new Object(); 
     887        paramSelect.id = "select_" + id; 
     888        paramSelect.parent = container; 
     889 
     890        var observatoryArray=new Array(); 
     891        this.listObs=new Array(); 
     892 
     893 
     894        //var bob =$('<div id="region" class="containerField"><div class="containerTitle"><div class="containerTitleText">Region</div><div class="containerTitleClose"><img src="img/close.png"></div></div><div class="containerRegion"><input id="regionTags" size="23"/></div><div id="regionContent"></div></div> '); 
     895        var bob =$('<div class="containerField"><input id="select_'+id+'" size="42"/></div><div id="regionContent'+this.nbRequest+'" class="regionContent"></div> '); 
     896 
     897        //alert('<div class=containerField><input id=select_'+id+' size=23/></div><div id=regionContent></div> '); 
     898 
     899        //var select = new Select( paramSelect ); 
     900        //iselect.options.add("1","1"); 
     901        //if( nullValueIsNeeded )                          Select1 
     902 
     903        var option = new Option(); 
     904        option.text = "-- " + tapasTexts["text.select"] + " --"; 
     905        option.value = "-1"; 
     906        iselect.append( option ); 
     907 
     908        jQuery.each( jsonList, jQuery.proxy( function ( i, jsonElement ) 
     909        { 
     910                //ajouter fonction 
     911 
     912                /*var option = new Option(); 
     913                option.text = jsonElement.name; 
     914                option.value = jsonElement.id;*/ 
     915                //observatoryArray.push(jsonElement.name); 
     916                this.listObs.push(jsonElement.name); 
     917                //console.log(option.value+"-"+option.text); 
     918                //iselect.append(option); 
     919 
     920 
     921        }, this ) ); 
     922        //iselect.selectFirst( false ); 
     923        /*selectList[index] = select;*/ 
     924        //container.append(iselect); 
     925        container.append(bob); 
     926        selectList[index]="select_"+id; 
     927 
     928    }, 
     929 
     930 
    897931    showErrors: function( result ) 
    898932    { 
     
    9671001        this.createTrList( tapasTexts["label.eo2"], "io2e_" + this.nbRequest, this.nbRequest, tabPreference, 'yesno' ); 
    9681002        this.createTrList( tapasTexts["label.eco2"], "ico2e_" + this.nbRequest, this.nbRequest, tabPreference, 'yesno' ); 
     1003        this.createTrList( tapasTexts["label.ech4"], "ich4e_" + this.nbRequest, this.nbRequest, tabPreference, 'yesno' ); 
     1004        this.createTrList( tapasTexts["label.en2o"], "in2oe_" + this.nbRequest, this.nbRequest, tabPreference, 'yesno' ); 
    9691005        this.createTrList( tapasTexts["label.berv"], "ibervC_" + this.nbRequest, this.nbRequest, tabPreference, 'yesno' ); 
    9701006 
     
    9931029        this.createTr( tapasTexts["label.iza"], "iza_" + this.nbRequest, tabObservation, "[0,90] &deg;","keypress","za","2",true ); 
    9941030 
     1031        this.createAutoCompleteMenuForRegions(); 
    9951032 
    9961033        this.initRequestFields(); 
     
    10361073            preference.co2Extinction.secondValue = this.select_ico2eList[i].getValue(); 
    10371074 
     1075            preference.ch4Extinction = new Object(); 
     1076            preference.ch4Extinction.firstValue = this.select_ich4eList[i].getValuesInString(); 
     1077            preference.ch4Extinction.secondValue = this.select_ich4eList[i].getValue(); 
     1078 
     1079            preference.n2oExtinction = new Object(); 
     1080            preference.n2oExtinction.firstValue = this.select_in2oeList[i].getValuesInString(); 
     1081            preference.n2oExtinction.secondValue = this.select_in2oeList[i].getValue(); 
     1082 
    10381083            preference.bervCorrection = new Object(); 
    10391084            preference.bervCorrection.firstValue = this.select_ibervCList[i].getValuesInString(); 
     
    10431088            // OBSERVATION 
    10441089            var observatory = new Object(); 
    1045             observatory.id = this.selectObservatoriesList[i].getValue(); 
     1090            //observatory.id = "European Southern Obs R La Serena Cerro La Silla";//this.selectObservatoriesList[i].getValue(); 
     1091            //observatory.id = this.selectObservatoriesList[i].getValue(); 
     1092            //observatory.id = 2; 
     1093            observatory.name = $("#select_iobservatory_"+i).val(); 
    10461094 
    10471095            // Los 
     
    11241172            var testOk2=false; 
    11251173            var testOk3=false; 
    1126             var testOk = isSup( this.selectObservatoriesList[i].getValue(), 0 ); 
    1127             if( !testOk ) 
     1174            //var testOk = isSup( this.selectObservatoriesList[i].getValue(), 0 ); 
     1175            var testOk = isEmpty($( "#select_iobservatory_" + i ).val()) || this.listObs.indexOf($( "#select_iobservatory_" + i ).val())<0; 
     1176            //alert(testOk); 
     1177            if( testOk ) 
    11281178            { 
    11291179                this.divE.html( chaine + tapasTexts["label.observatory"] + " : " + tapasTexts["text.toselect"] ); 
     
    13051355            this.select_io2eList[indice].select(this.select_io2eList[indice-1].getValue(),false); 
    13061356            this.select_ico2eList[indice].select(this.select_ico2eList[indice-1].getValue(),false); 
     1357            this.select_ich4eList[indice].select(this.select_ich4eList[indice-1].getValue(),false); 
     1358            this.select_in2oeList[indice].select(this.select_in2oeList[indice-1].getValue(),false); 
    13071359            this.select_ibervCList[indice].select(this.select_ibervCList[indice-1].getValue(),false); 
    13081360 
Note: See TracChangeset for help on using the changeset viewer.