Changeset 440
- Timestamp:
- 03/26/12 17:00:15 (12 years ago)
- Location:
- tapas
- Files:
-
- 9 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
tapas/common/implementation/com/ether/MethodDescription.java
r416 r440 19 19 _isLoginMandatory = annotation.loginMandatory(); 20 20 _isRequestMandatory = annotation.requestMandatory(); 21 _isUserMandatory = annotation.userMandatory(); 21 22 _isBackofficeMethod = annotation.backofficeMethod(); 22 23 _params = new ArrayList<ParamDescription>(); … … 99 100 } 100 101 102 101 103 public void setRequestMandatory( final Boolean requestMandatory ) 102 104 { 103 105 _isRequestMandatory = requestMandatory; 106 } 107 108 public Boolean isUserMandatory() 109 { 110 return _isUserMandatory; 111 } 112 113 public void setUserMandatory( final Boolean userMandatory ) 114 { 115 _isUserMandatory = userMandatory; 104 116 } 105 117 … … 136 148 private Boolean _isLoginMandatory; 137 149 private Boolean _isRequestMandatory; 150 private Boolean _isUserMandatory; 138 151 private Boolean _isBackofficeMethod; 139 152 @Nullable -
tapas/common/implementation/com/ether/annotation/ControllerMethod.java
r416 r440 21 21 boolean requestMandatory() default false; 22 22 23 boolean userMandatory() default false; 24 23 25 boolean backofficeMethod() default false; 24 26 -
tapas/common/implementation/com/ether/annotation/UserMandatory.java
r434 r440 8 8 @Retention(RetentionPolicy.RUNTIME) 9 9 @Target(ElementType.PARAMETER) 10 public @interface RequestMandatory10 public @interface UserMandatory 11 11 { 12 12 } -
tapas/domain/interface/com/ether/SpectralUnit.java
r434 r440 1 1 package com.ether; 2 3 import java.lang.reflect.Field; 2 4 3 5 /** … … 5 7 * Date: 19 march 2012 6 8 */ 7 public enum YesNo9 public enum SpectralUnit 8 10 { 9 YES, 10 NO 11 NM, 12 CM 13 14 /*"Vacuum Wavelength (nm)", 15 'Standard Wavelength (nm)', 16 'Wavenumber (cm-1)'*/ 17 11 18 } -
tapas/service/implementation/com/ether/TapasServiceImpl.java
r420 r440 36 36 final Element tapas = new Element( "tapas" ); 37 37 final Element request = new Element( "request" ); 38 final Element preferences = new Element( "preferences" ); 39 final Element format = new Element( "format" ); 40 final Element rayleighExtinction = new Element( "rayleigh_extinction" ); 38 41 39 42 40 //On crée un nouveau Document JDOM basé sur la racine que l'on vient de créer … … 51 49 for( final Request iRequest : requests ) 52 50 { 51 // Id de la request 53 52 final Attribute idR = new Attribute( "Id", iRequest.getId().toString() ); 54 53 request.setAttribute( idR ); 55 54 56 tapas.addContent( request );57 request.addContent( preferences);55 // PREFERENCES 56 final Element preferences = new Element( "preferences" ); 58 57 58 // Element format 59 final Element format = new Element( "format" ); 59 60 final Attribute validF = new Attribute( "valid", iRequest.getPreference().getFormat().getFirstValue() ); 60 61 format.setAttribute( validF ); 61 62 format.setText( iRequest.getPreference().getFormat().getSecondValue() ); 63 preferences.addContent( format ); 62 64 65 // Element rayleighExtinction 66 final Element rayleighExtinction = new Element( "rayleigh_extinction" ); 63 67 final Attribute validR = new Attribute( "valid", iRequest.getPreference().getRayleighExtinction().getFirstValue() ); 64 68 rayleighExtinction.setAttribute( validR ); 65 69 rayleighExtinction.setText( iRequest.getPreference().getRayleighExtinction().getSecondValue() ); 70 preferences.addContent( rayleighExtinction ); 66 71 72 // 73 74 request.addContent( preferences ); 75 76 // OBSERVATORIES 77 78 79 80 81 tapas.addContent( request ); 67 82 } 68 83 -
tapas/web/WEB-INF/servlet-context.xml
r414 r440 5 5 http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd 6 6 http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd"> 7 7 8 8 9 <!-- i18n --> -
tapas/web/project/formTapas.jsp
r439 r440 29 29 <tiles:put name="body" type="string"> 30 30 31 <div id="formulaire"></div> 31 <div id="formulaire"> 32 33 </div> 32 34 33 35 <div id="errors"></div> … … 38 40 tapasTexts["<%=WebException.WebCode.ERROR_JSON_TAPAS_IS_NULL%>"] = "<spring:message code="error.ERROR_JSON_TAPAS_IS_NULL"/>"; 39 41 40 var interfaceTapas = new InterfaceTapas( ${jSonFileFormats}, ${jSonYesNos} ); 42 //var interfaceTapas = new InterfaceTapas(${jSonFileFormats},${jSonYesNos},${jSonObservatories},${jSonSelectUnits}); 43 var interfaceTapas = new InterfaceTapas(${jSonFileFormats},${jSonYesNos},${jSonObservatories}); 41 44 </script> 42 45 -
tapas/web/project/formTapas_script.jsp
r439 r440 2 2 var InterfaceTapas = Class.create( { 3 3 4 initialize: function( jsonFileFormats, jsonYesNos )4 initialize: function( jsonFileFormats, jsonYesNos, jsonObservatories ) 5 5 { 6 6 /** *********** CONTAINERS *********** **/ … … 10 10 this.jsonFileFormats = jsonFileFormats || null; 11 11 this.jsonYesNos = jsonYesNos || null; 12 this.jSonObservatories = jsonObservatories || null; 13 //this.jSonSelectUnits = jsonSelectUnits || null; 12 14 13 15 this.containerErrors.hide(); 14 16 15 17 this.createForm(); 16 this.createCalendar( this.containerForm ); 18 17 19 }, 18 20 … … 23 25 { 24 26 // Create input for date text 25 var inputDateId = " observationDate";27 var inputDateId = "iobservation_date"; 26 28 var inputDate = $( document.createElement( "input" ) ); 27 29 inputDate.attr( {id:inputDateId, size:"17"} ); … … 65 67 var input = $( document.createElement( "input" ) ); 66 68 67 68 69 input.attr( {id: inputId} ); 69 70 td1.html( texte ); 70 71 tr.append( td1 ); 71 72 if( type == 'format' ) this.displayFileFormats( td2 ); 72 else if( type == 'yesno' ) this.displayYesNo( td2 ); 73 else if( type == 'yesno' ) this.displayYesNo( td2, inputId ); 74 else if( type == 'observatories' ) this.displayObservatories( td2 ); 75 else if( type == 'spectralUnit' ) this.displaySpectralUnits( td2 ); 73 76 74 77 tr.append( td2 ); … … 80 83 { 81 84 82 //Creation div 85 //Creation div / tab 83 86 var divPreference = $( document.createElement( "div" ) ); 84 87 var tabPreference = $( document.createElement( "table" ) ); 85 88 86 this.createTrList( "File format", "p1", tabPreference, 'format' ); 87 this.createTr( "Rayleigh extinction", "p2", tabPreference ); 88 this.createTrList( "H20 extinction", "p3", tabPreference, 'yesno' ); 89 this.createTrList( "O3 extinction", "p4", tabPreference, 'yesno' ); 90 this.createTrList( "O2 extinction", "p5", tabPreference, 'yesno' ); 91 this.createTrList( "CO2 extinction", "p6", tabPreference, 'yesno' ); 89 var divObservation = $( document.createElement( "div" ) ); 90 var tabObservation = $( document.createElement( "table" ) ); 91 92 this.createTrList( "File format", "iformat", tabPreference, 'format' ); 93 this.createTr( "Rayleigh extinction", "irextinction", tabPreference ); 94 this.createTrList( "H20 extinction", "ih2oe", tabPreference, 'yesno' ); 95 this.createTrList( "O3 extinction", "io3e", tabPreference, 'yesno' ); 96 this.createTrList( "O2 extinction", "io2e", tabPreference, 'yesno' ); 97 this.createTrList( "CO2 extinction", "ico2e", tabPreference, 'yesno' ); 98 99 this.createTrList( "Observatory", "iobservatory", tabObservation, 'observatories' ); 100 101 102 103 this.createCalendar( tabObservation ); 104 105 106 107 this.createTr( "Right LOS ascension", "ira", tabObservation ); 108 this.createTr( "LOS declension", "ide", tabObservation ); 109 this.createTr( "Zenith angle", "iza", tabObservation ); 110 // this.createTrList("Spectral unit", "ispectral_choice", tabObservation, 'spectralUnit'); 111 this.createTr( "Spectral range", "ispectral_ranger", tabObservation ); 112 92 113 93 114 divPreference.append( tabPreference ); 94 115 this.containerForm.append( divPreference ); 95 116 117 divObservation.append( tabObservation ); 118 this.containerForm.append( divObservation ); 119 96 120 //jQuery.proxy permet d'envoyer le contexte this courant 97 121 var submitButton = new Button( {value:tapasTexts["label.submitButton"], parent:this.containerForm, id:"button_submit", className: "red_button", classNameText:"red_button_text", onClick:jQuery.proxy( this.onClickSubmit, this )} ); … … 104 128 requestCreateXML: function() 105 129 { 106 var tapasForm = this.createTapas Form();130 var tapasForm = this.createTapasObject(); 107 131 //passage de javascript a json grace au jquery 108 132 var jsonTapasForm = $.toJSON( tapasForm ); … … 130 154 this.requestCreateXML(); 131 155 }, 156 132 157 133 158 // OTHERS ******************************************************** … … 160 185 161 186 187 displayObservatories: function( container ) 188 { 189 var paramSelect = new Object(); 190 paramSelect.id = "select_observatory"; 191 paramSelect.parent = container; 192 this.selectObservatories = new Select( paramSelect ); 193 //ajouter select vide avec add 194 this.selectObservatories.add( "-1", "-- Select an observatory --" ); 195 jQuery.each( this.jSonObservatories, jQuery.proxy( function ( i, jsonObservatory ) 196 { 197 this.selectObservatories.add( jsonObservatory.id, jsonObservatory.name ); 198 }, this ) ); 199 this.selectObservatories.selectFirst( true ); 200 }, 201 202 203 displaySpectralUnits: function( container ) 204 { 205 var paramSelect = new Object(); 206 paramSelect.id = "select_spectral_unit"; 207 paramSelect.parent = container; 208 this.selectSpectralUnits = new Select( paramSelect ); 209 //ajouter select vide avec add 210 this.selectSpectralUnits.add( "-1", "-- Select unit --" ); 211 jQuery.each( this.jSonSpectralUnit, jQuery.proxy( function ( i, jsonSpectralUnit ) 212 { 213 this.selectSpectralUnits.add( jsonSpectralUnit.id, jsonSpectralUnit.name ); 214 }, this ) ); 215 this.selectSpectralUnits.selectFirst( true ); 216 }, 217 162 218 showErrors: function( result ) 163 219 { … … 166 222 }, 167 223 168 createTapas Form: function()224 createTapasObject: function() 169 225 { 170 226 // PREFERENCE … … 172 228 173 229 preference.format = new Object(); 174 preference.format.firstValue = $( "#1" ).val(); 175 preference.format.secondValue = $( "#2" ).val(); 230 //toutes les valeurs possibles 231 //preference.format.firstValue = $( "#select_formats" ).val(); 232 preference.format.firstValue = this.selectFormats.getValues(); 233 //la valeur selectionnee 234 preference.format.secondValue = this.selectFormats.getValue(); 235 176 236 177 237 var pair = new Object(); 178 238 pair.firstValue = "YES,NO"; 179 pair.secondValue = "YES"; 180 181 preference.rayleighExtinction = pair; 239 pair.secondValue = this.selectFormats.getValue(); 240 241 preference.rayleighExtinction = new Object(); 242 ; 182 243 preference.h2oExtinction = pair; 183 244 preference.o3Extinction = pair; … … 188 249 // Observatory 189 250 var observatory = new Object(); 190 observatory.name = "SanFernandoObs.RSanFernando"; 191 192 observatory.longitude = new Object(); 193 observatory.longitude.min = "-180"; 194 observatory.longitude.max = "180"; 195 observatory.longitude.value = -118.491666666667; 196 197 observatory.latitude = new Object(); 198 observatory.latitude.min = "-90"; 199 observatory.latitude.max = "90"; 200 observatory.latitude.value = 34.3083333333333; 201 202 observatory.altitude = new Object(); 203 observatory.altitude.min = "0"; 204 observatory.altitude.max = "10000"; 205 observatory.altitude.value = 371; 251 //observatory.name = this.selectFormats.name; 252 253 observatory.longitude = this.longitude.value; 254 observatory.latitude = this.latitude.value; 255 observatory.altitude = this.altitude.value; 256 206 257 207 258 // Los … … 234 285 235 286 var observation = new Object(); 236 observation.date = this.calendarConverter.parse( $( "# observationDate" ).val() ).getTime();287 observation.date = this.calendarConverter.parse( $( "#iobservation_date" ).val() ).getTime(); 237 288 observation.observatory = observatory; 238 289 observation.los = los; … … 251 302 atmosphere.ecmwfFile = new Array(); 252 303 atmosphere.ecmwfFile[0] = "/home/ferron/tmp/tapas/ecmwf12.txt"; 304 253 305 254 306 // REQUEST -
tapas/web/resources/css/tapas.css
r439 r440 137 137 -moz-border-radius-topright: 0; 138 138 -webkit-border-radius: 0; /*#E8EFF3*//* #618EAC*/ 139 background: -moz-linear-gradient(white, # F6DC12);139 background: -moz-linear-gradient(white, #52251C); 140 140 background: -webkit-linear-gradient(white, #F6DC12); 141 background: -ms-linear-gradient(white, #F6DC12) repeat scroll 0 0 transparent; /*For IE10*/141 background: -ms-linear-gradient(white,#C03000 ) repeat scroll 0 0 transparent; /*For IE10*/ 142 142 filter: progid:DXImageTransform.Microsoft.gradient(GradientType = 0, startColorstr = 'white', endColorstr = '#F6DC12'); /*For IE7-8-9*/ 143 143 min-height: 400px; -
tapas/web/src/com/ether/Controller.java
r420 r440 7 7 import com.ether.tapas.Observatory; 8 8 import com.ether.tapas.Tapas; 9 import com.ether.user.User; 9 10 import com.ether.user.UserRole; 10 11 import net.sf.json.JSONObject; 11 12 import org.apache.commons.logging.Log; 12 13 import org.apache.commons.logging.LogFactory; 14 import org.jetbrains.annotations.NotNull; 13 15 14 16 import java.util.ArrayList; … … 33 35 throws WebException 34 36 { 35 36 37 try 37 38 { … … 58 59 /** *********************** CALLS ***************************** **/ 59 60 /** *********************************************************** **/ 60 @ControllerMethod(jsonResult = true )61 public JSONObject createUserRequest( @ParamName("jsonTapas") @Mandatory @UseJSON final Tapas javaTapas )61 @ControllerMethod(jsonResult = true, userMandatory = true) 62 public JSONObject createUserRequest( @ParamName("jsonTapas") @Mandatory @UseJSON final Tapas javaTapas, @NotNull final User user ) // TODO rajouter parametre USER 62 63 throws WebException 63 64 { … … 65 66 throw new WebException( WebException.WebCode.ERROR_JSON_TAPAS_IS_NULL, "Serialization error : jsonTapas is null", WebException.getExceptionThrowable() ); 66 67 68 //TODO recuperer le USER via ControllerEther 69 67 70 //appel a createxml 68 getTapasService().createXMLRequest( javaTapas ); 71 getTapasService().createXMLRequest( javaTapas ); // en 2ieme parametre 72 73 //appel a runtime 74 //mettre une methode dans tapas service pour appel au shell system 75 69 76 70 77 final JSONObject result = new JSONObject(); -
tapas/web/src/com/ether/ControllerEther.java
r423 r440 120 120 final String defaultView = ( null != methodDescription.getDefaultView() && !"".equals( methodDescription.getDefaultView() ) ) ? methodDescription.getDefaultView() : methodDescription.getView(); 121 121 122 122 123 if( methodDescription.isRequestMandatory() ) 123 params[params.length - 1] = request; 124 params[params.length - 1] = request; //params = parametre de la methode du Controller 125 124 126 125 127 if( methodDescription.isLoginMandatory() ) … … 128 130 if( null == user ) 129 131 return new ModelAndView( defaultView, "errors", "login.error.unknown" ); 132 } 133 134 if (methodDescription.isUserMandatory()) { 135 final User user = (User) request.getSession().getAttribute( "SES_USER" ); 136 137 if( null == user ) 138 return new ModelAndView( defaultView, "errors", "login.error.unknown" ); 139 else 140 params[params.length - 1] = user; 141 130 142 } 131 143
Note: See TracChangeset
for help on using the changeset viewer.