Changeset 497 for tapas/web/project


Ignore:
Timestamp:
04/27/12 17:39:33 (12 years ago)
Author:
vmipsl
Message:

tests

File:
1 edited

Legend:

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

    r496 r497  
    88        /** *********** CONTAINERS *********** **/ 
    99        this.containerForm = $( "#formulaire" ); 
    10         //this.containerErrors = $( "#errors" ); 
    1110        this.containerErrors = $( "#errForm" ); 
    1211        this.containerCenter = $( "#containerCenter" ); 
    1312        this.containerTabs = $( "#tab" ); 
    1413 
     14        /** *********** VARIABLES *********** **/ 
    1515        this.jSonFileFormats = jsonFileFormats || null; 
    1616        this.jSonYesNos = jsonYesNos || null; 
     
    2323        this.numRequest = 1; 
    2424 
    25  
    26         this.containerErrors.show(); 
    27  
    2825        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 )} ); 
    2926        this.addRequestButton = new Button( {value:tapasTexts["label.addButton"], parent:this.containerCenter, id:"button_add", className: "positive", onClick:jQuery.proxy( this.onClickAdd, this )} ); 
     
    3330        this.createForm(); 
    3431        this.tabActive = this.createTab(); 
     32 
     33        this.containerErrors.hide(); 
    3534    }, 
    3635 
     
    118117        if( !currentTime ) 
    119118            currentTime = "00:00:00"; 
     119        // TODO : voir si besoin de convertir format des heures 
    120120//        $( "#" + inputDateId ).val( this.timeConverter.format( currentTime ) ); 
    121121        $( "#" + inputDateId ).val( currentTime ); 
     
    269269    onClickSubmit: function() 
    270270    { 
    271         // if( this.validFields() ) 
    272         // { 
    273         if( confirm( tapasTexts["confirm"] ) ) 
    274         { 
    275             this.containerErrors.hide(); 
    276             this.requestCreateXML(); 
    277         } 
    278         // } 
     271        if( this.validFields() ) 
     272        { 
     273            if( confirm( tapasTexts["confirm"] ) ) 
     274            { 
     275                this.containerErrors.hide(); 
     276//                this.requestCreateXML(); 
     277            } 
     278        } 
    279279    }, 
    280280 
     
    282282    onClickAdd: function() 
    283283    { 
    284         //if( this.validFields() ) 
    285         if( true ) 
    286         { 
    287             this.containerErrors.hide(); 
    288             this.nbRequest++; 
    289  
    290             //tabs 
    291             $( ".tab_class" ).removeClass( "activated" ); 
    292             this.tabActive = this.createTab(); 
    293             this.numRequest = this.tabActive.numTab; 
    294  
    295             //formulaires 
    296             $( ".divAll" ).hide(); 
    297             this.createForm(); 
    298  
    299             this.updateButtons(); 
    300         } 
     284        this.containerErrors.hide(); 
     285        this.nbRequest++; 
     286 
     287        //tabs 
     288        $( ".tab_class" ).removeClass( "activated" ); 
     289        this.tabActive = this.createTab(); 
     290        this.numRequest = this.tabActive.numTab; 
     291 
     292        //formulaires 
     293        $( ".divAll" ).hide(); 
     294        this.createForm(); 
     295 
     296        this.updateButtons(); 
    301297    }, 
    302298 
     
    304300    onClickDel: function() 
    305301    { 
    306         //if( this.validFields() ) 
    307         if( true ) 
     302        if( confirm( "pouet" ) ) 
    308303        { 
    309304            var numCurrent = this.numRequest; 
     
    696691    validFields: function() 
    697692    { 
    698         return ( 
    699                 isSup( this.selectObservatories.getValue(), 0, tapasTexts["label.observatory"], tapasTexts["text.toselect"], this.containerErrors ) && 
    700                         isDiff( this.selectSpectralUnits.getValue(), -1, tapasTexts["label.spectralUnit"], tapasTexts["text.toselect"] ) && 
    701                         isValidRange( $( "#iminspectral_ranger" ).val(), $( "#imaxspectral_ranger" ).val(), this.selectSpectralUnits.getValue(), tapasTexts["label.spectralRange"], tapasTexts["text.badvalue"] ) && 
    702                         isDeg( $( "#ide" ).val(), tapasTexts["label.ide"], tapasTexts["text.badvalue"] ) && 
    703                         isValidNum( $( "#iza" ).val(), tapasTexts["label.iza"], tapasTexts["text.badvalue"] ) && isBetween( $( "#iza" ).val(), 0, 90, tapasTexts["label.iza"], tapasTexts["text.badvalue"] ) && 
    704                         isValidNum( $( "#irp" ).val(), tapasTexts["label.resolution"], tapasTexts["text.badvalue"] ) && isSup( $( "#irp" ).val(), 1, tapasTexts["label.resolution"], tapasTexts["text.badvalue"] ) && 
    705                         isValidNum( $( "#isr" ).val(), tapasTexts["label.ratio"], tapasTexts["text.badvalue"] ) && isSup( $( "#isr" ).val(), 1, tapasTexts["label.ratio"], tapasTexts["text.badvalue"] ) 
    706                 ) 
     693        var testOk = isSup( this.selectObservatories.getValue(), 0 ); 
     694        if( !testOk ) 
     695        { 
     696            this.containerErrors.html( tapasTexts["label.observatory"] + " : " + tapasTexts["text.toselect"] ); 
     697            this.containerErrors.show(); 
     698            return false; 
     699        } 
     700 
     701        testOk = isDiff( this.selectSpectralUnits.getValue(), -1 ); 
     702        if( !testOk ) 
     703        { 
     704            this.containerErrors.html( tapasTexts["label.spectralUnit"] + " : " + tapasTexts["text.toselect"] ); 
     705            this.containerErrors.show(); 
     706            return false; 
     707        } 
     708 
     709        testOk = isValidRange( $( "#iminspectral_ranger" ).val(), $( "#imaxspectral_ranger" ).val(), this.selectSpectralUnits.getValue() ); 
     710        if( !testOk ) 
     711        { 
     712            this.containerErrors.html( tapasTexts["label.spectralRange"] + " : " + tapasTexts["text.badvalue"] ); 
     713            this.containerErrors.show(); 
     714            return false; 
     715        } 
     716 
     717        testOk = isDeg( $( "#ide" ).val() ); 
     718        if( !testOk ) 
     719        { 
     720            this.containerErrors.html( tapasTexts["label.ide"] + " : " + tapasTexts["text.badvalue"] ); 
     721            this.containerErrors.show(); 
     722            return false; 
     723        } 
     724 
     725        testOk = isValidNum( $( "#iza" ).val() ); 
     726        if( !testOk ) 
     727        { 
     728            this.containerErrors.html( tapasTexts["label.iza"] + " : " + tapasTexts["text.badvalue"] ); 
     729            this.containerErrors.show(); 
     730            return false; 
     731        } 
     732 
     733        testOk = isBetween( $( "#iza" ).val(), 0, 90 ); 
     734        if( !testOk ) 
     735        { 
     736            this.containerErrors.html( tapasTexts["label.iza"] + " : " + tapasTexts["text.badvalue"] ); 
     737            this.containerErrors.show(); 
     738            return false; 
     739        } 
     740 
     741        testOk = isValidNum( $( "#irp" ).val() ); 
     742        if( !testOk ) 
     743        { 
     744            this.containerErrors.html( tapasTexts["label.resolution"] + " : " + tapasTexts["text.badvalue"] ); 
     745            this.containerErrors.show(); 
     746            return false; 
     747        } 
     748 
     749        testOk = isSup( $( "#irp" ).val(), 1 ); 
     750        if( !testOk ) 
     751        { 
     752            this.containerErrors.html( tapasTexts["label.resolution"] + " : " + tapasTexts["text.badvalue"] ); 
     753            this.containerErrors.show(); 
     754            return false; 
     755        } 
     756 
     757        testOk = isValidNum( $( "#isr" ).val() ); 
     758        if( !testOk ) 
     759        { 
     760            this.containerErrors.html( tapasTexts["label.ratio"] + " : " + tapasTexts["text.badvalue"] ); 
     761            this.containerErrors.show(); 
     762            return false; 
     763        } 
     764 
     765        testOk = isSup( $( "#isr" ).val(), 1 ); 
     766        if( !testOk ) 
     767        { 
     768            this.containerErrors.html( tapasTexts["label.ratio"] + " : " + tapasTexts["text.badvalue"] ); 
     769            this.containerErrors.show(); 
     770            return false; 
     771        } 
    707772    }, 
    708773 
Note: See TracChangeset for help on using the changeset viewer.