Changeset 445 for tapas/web


Ignore:
Timestamp:
04/02/12 16:23:01 (12 years ago)
Author:
vmipsl
Message:

gestion date calendrier/serialisation

Location:
tapas/web
Files:
4 edited

Legend:

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

    r444 r445  
    8888        td1.html( texte1 ); 
    8989        td3.html( texte2 ); 
    90         td2.append(input1); 
    91         td3.append(input2); 
    92  
    93         tr.append(td1); 
    94         tr.append(td2); 
    95         tr.append(td3); 
    96         tr.append(td4); 
    97         container.append(tr); 
     90        td2.append( input1 ); 
     91        td3.append( input2 ); 
     92 
     93        tr.append( td1 ); 
     94        tr.append( td2 ); 
     95        tr.append( td3 ); 
     96        tr.append( td4 ); 
     97        container.append( tr ); 
    9898    }, 
    9999 
     
    143143    handleCreateXML: function( result ) 
    144144    { 
    145         var bob = jQuery.parseJSON( result ).result; 
    146         alert( bob ); 
     145        try 
     146        { 
     147            var bob = jQuery.parseJSON( result ).result; 
     148            alert( "OK " + bob ); 
     149        } 
     150        catch( err ) 
     151        { 
     152            document.location.reload(); 
     153        } 
    147154    }, 
    148155 
     
    270277        //this.tabInput = new Array(3); 
    271278        this.createTrList( "File format", "iformat", tabPreference, 'format' ); 
    272         this.createTrList( "Rayleigh extinction", "irextinction", tabPreference,'yesno' ); 
     279        this.createTrList( "Rayleigh extinction", "irextinction", tabPreference, 'yesno' ); 
    273280        this.createTrList( "H20 extinction", "ih2oe", tabPreference, 'yesno' ); 
    274281        this.createTrList( "O3 extinction", "io3e", tabPreference, 'yesno' ); 
     
    305312 
    306313        // Ajout du calendrier APRES la création du formulaire 
    307        this.createCalendar( tabObservation, "Date measurement"); 
     314        this.createCalendar( tabObservation, "Date measurement" ); 
    308315 
    309316        //jQuery.proxy permet d'envoyer le contexte this courant 
     
    322329        //toutes les valeurs possibles 
    323330        preference.format.firstValue = this.selectFormats.getValues(); 
    324  
    325331        //la valeur selectionnee 
    326332        preference.format.secondValue = this.selectFormats.getValue(); 
    327333 
    328334        preference.rayleighExtinction = new Object 
    329         preference.rayleighExtinction.firstValue="YES,NO"; 
    330         preference.rayleighExtinction.secondValue=$( "#select_irextinction" ).val(); 
    331  
     335        preference.rayleighExtinction.firstValue = "YES,NO"; 
     336        preference.rayleighExtinction.secondValue = $( "#select_irextinction" ).val(); 
    332337 
    333338        preference.h2oExtinction = new Object(); 
    334         preference.h2oExtinction.firstValue="YES,NO"; 
    335         preference.h2oExtinction.secondValue=$( "#select_ih2oe" ).val(); 
    336  
     339        preference.h2oExtinction.firstValue = "YES,NO"; 
     340        preference.h2oExtinction.secondValue = $( "#select_ih2oe" ).val(); 
    337341 
    338342        preference.o3Extinction = new Object(); 
    339         preference.o3Extinction.firstValue=""; 
    340         preference.o3Extinction.secondValue=""; 
     343        preference.o3Extinction.firstValue = ""; 
     344        preference.o3Extinction.secondValue = ""; 
    341345 
    342346        preference.o2Extinction = new Object(); 
    343         preference.o2Extinction.firstValue=""; 
    344         preference.o2Extinction.secondValue=""; 
     347        preference.o2Extinction.firstValue = ""; 
     348        preference.o2Extinction.secondValue = ""; 
    345349 
    346350        preference.co2Extinction = new Object(); 
    347         preference.co2Extinction.firstValue=""; 
    348         preference.co2Extinction.secondValue=""; 
     351        preference.co2Extinction.firstValue = ""; 
     352        preference.co2Extinction.secondValue = ""; 
    349353 
    350354 
    351355        // OBSERVATION 
    352356        var observatory = new Object(); 
    353  
    354357        observatory.name = ""; 
    355  
    356  
    357         observatory.longitude = ""; 
    358         observatory.latitude = ""; 
    359         observatory.altitude = ""; 
    360  
     358        observatory.longitude = 1; 
     359        observatory.latitude = 2; 
     360        observatory.altitude = 3; 
    361361 
    362362        // Los 
    363363        var los = new Object(); 
    364  
    365  
    366364        los.raJ2000 = ""; 
    367365        los.decJ2000 = ""; 
    368  
    369366        los.zenithAngle = new Object(); 
    370367        los.zenithAngle.min = "0"; 
    371368        los.zenithAngle.max = "90"; 
    372         los.zenithAngle.value = ""; 
    373  
    374  
     369        los.zenithAngle.value = "2"; 
    375370 
    376371        // Instrument 
    377372        var instrument = new Object(); 
    378  
    379373        instrument.spectralChoice = new Object(); 
    380374        instrument.spectralChoice.firstValue = this.selectSpectralUnits.getValues(); 
    381375        instrument.spectralChoice.secondValue = this.selectSpectralUnits.getValue(); 
    382  
    383376        instrument.spectralRange = ""; 
    384377 
     
    395388        instrument.samplingRatio.secondValue = ""; 
    396389 
    397  
    398        var observation = new Object(); 
    399        observation.date = this.calendarConverter.parse( $( "#iobservation_date" ).val() ); 
    400        observation.observatory = observatory; 
    401  
     390        var observation = new Object(); 
     391        observation.date = this.calendarConverter.parse( $( "#iobservation_date" ).val() ); 
     392        observation.observatory = observatory; 
    402393        observation.los = los; 
    403394        observation.instrument = instrument; 
     
    406397        // ATMOSPHERE 
    407398        var atmosphere = new Object(); 
    408  
    409399        atmosphere.reference = new Object(); 
    410400        atmosphere.reference.firstValue = this.selectClimatoReferences.getValues(); 
  • tapas/web/src/com/ether/Controller.java

    r444 r445  
    7070     * @throws WebException 
    7171     */ 
    72     @ControllerMethod(jsonResult = true, userMandatory = true) 
     72    @ControllerMethod(jsonResult = true, userMandatory = true, defaultView = VIEW_INDEX) 
    7373    public JSONObject createUserRequest( @ParamName("jsonTapas") @Mandatory @UseJSON final Tapas javaTapas, @NotNull final User user ) // TODO rajouter parametre USER 
    7474            throws WebException 
    7575    { 
    76         String toto="lmml"; 
     76        String toto = "lmml"; 
    7777 
    7878        if( null == javaTapas ) 
  • tapas/web/src/com/ether/ControllerEther.java

    r440 r445  
    6666        { 
    6767            final String webInfPath = getServletContext().getRealPath( "WEB-INF" ); 
    68             return WebHelper.getProperty( webInfPath, property ); 
     68            return WebHelper.getProperty( webInfPath + "/classes/", WebHelper.PROPERTIES_FILE, property ); 
    6969        } 
    7070        catch( IOException e ) 
     
    7272            throw new WebException( WebException.WebCode.ERROR_TO_READ_FILE_PROPERTIES, e ); 
    7373        } 
     74    } 
     75 
     76    /** 
     77     * This method return the text from the files messages**.properties 
     78     * 
     79     * @param code 
     80     * @return 
     81     */ 
     82    public String getMessage( @NotNull final String code ) 
     83    { 
     84        final String webInfPath = getServletContext().getRealPath( "WEB-INF" ); 
     85        return WebHelper.getMessage( webInfPath, code ); 
    7486    } 
    7587 
     
    8597 
    8698            request.setCharacterEncoding( UTF8Charset.getEncoding() ); 
     99//            String message = getMessage( "bo.fulltitle" ); 
    87100 
    88101            // Get method to call 
     
    132145            } 
    133146 
    134             if (methodDescription.isUserMandatory()) { 
     147            if( methodDescription.isUserMandatory() ) 
     148            { 
    135149                final User user = (User) request.getSession().getAttribute( "SES_USER" ); 
    136  
    137150                if( null == user ) 
    138151                    return new ModelAndView( defaultView, "errors", "login.error.unknown" ); 
    139152                else 
    140153                    params[params.length - 1] = user; 
    141  
    142154            } 
    143155 
  • tapas/web/src/com/ether/WebHelper.java

    r423 r445  
    88import org.jetbrains.annotations.NotNull; 
    99import org.jetbrains.annotations.Nullable; 
     10import org.springframework.context.MessageSource; 
     11import org.springframework.context.support.ClassPathXmlApplicationContext; 
    1012 
    1113import javax.servlet.ServletOutputStream; 
     
    106108        { 
    107109            final String webInfPath = request.getSession().getServletContext().getRealPath( "WEB-INF" ); 
    108             return getProperty( webInfPath, property ); 
     110            return getProperty( webInfPath + "/classes/", PROPERTIES_FILE, property ); 
    109111        } 
    110112        catch( IOException e ) 
     
    115117 
    116118    /** 
    117      * Returns the property writed in the properties file 
     119     * Returns the property writed in a properties file 
    118120     * 
    119      * @param webInfPath 
    120      * @param property 
    121      * @return 
     121     * @param pathFile 
     122     * @param fileName 
     123     * @param property @return 
    122124     * @throws IOException 
    123125     */ 
    124     public static String getProperty( @NotNull final String webInfPath, @NotNull final String property ) 
     126    public static String getProperty( @NotNull final String pathFile, final String fileName, @NotNull final String property ) 
    125127            throws IOException 
    126128    { 
    127129        final Properties prop = new Properties(); 
    128         prop.load( new FileInputStream( webInfPath + "/classes/" + PROPERTIES_FILE ) ); 
     130        prop.load( new FileInputStream( pathFile + fileName ) ); 
    129131        return prop.getProperty( property ); 
    130132    } 
    131133 
    132     private static final Log LOGGER = LogFactory.getLog( WebHelper.class ); 
     134    /** 
     135     * This method return the text from the files messages**.properties 
     136     * 
     137     * @param code 
     138     * @return 
     139     */ 
     140    public static String getMessage( @NotNull final String webInfPath, @NotNull final String code ) 
     141    { 
     142        final MessageSource resources = new ClassPathXmlApplicationContext( webInfPath + "/classes/servlet-context.xml" ); 
     143        final String message = resources.getMessage( code, null, "Default", null ); 
     144        return message; 
     145    } 
    133146 
    134147    public static final int STATUS_CODE_SERVICE_EXCEPTION = 500; 
     148    public static final String PROPERTIES_FILE = "tapas.properties"; 
     149 
     150    private static final Log LOGGER = LogFactory.getLog( WebHelper.class ); 
    135151    private static final String CONTENT_TYPE_TEXT_JSON = "text/javascript;charset=" + UTF8Charset.getEncoding(); 
    136     private static final String PROPERTIES_FILE = "tapas.properties"; 
    137152} 
Note: See TracChangeset for help on using the changeset viewer.