- Timestamp:
- 03/15/12 18:54:48 (12 years ago)
- Location:
- tapas/web
- Files:
-
- 474 added
- 13 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
tapas/web/backoffice/user-script.jsp
r409 r416 46 46 { 47 47 var parametersUrl = "name=" + $( "#lastName" ).val() + "&firstName=" + $( "#firstName" ).val() + "&email=" + $( "#email" ).val() + 48 "&pwd=" + $( "#password" ).val() + "&role=" + this.selectRoles.getValue() + "&hasAccess=" + $( "#boAccess" ).attr( 'checked' ); 48 "&pwd=" + $( "#password" ).val() + "&role=" + this.selectRoles.getValue() + "&laboratory=" + $( "#laboratory" ).val() + "&country=" + $( "#country" ).val() + 49 "&hasAccess=" + $( "#boAccess" ).attr( 'checked' ); 49 50 var request = $.ajax( { 50 51 url: "backoffice?methodName=addUser&" + parametersUrl, … … 69 70 { 70 71 var parametersUrl = "id=" + this.user.id + "&name=" + $( "#lastName" ).val() + "&firstName=" + $( "#firstName" ).val() + "&email=" + $( "#email" ).val() + 71 "&pwd=" + $( "#password" ).val() + "&role=" + this.selectRoles.getValue() + 72 "&pwd=" + $( "#password" ).val() + "&role=" + this.selectRoles.getValue() + "&laboratory=" + $( "#laboratory" ).val() + "&country=" + $( "#country" ).val() + 72 73 "&hasAccess=" + $( "#boAccess" ).attr( 'checked' ) + "&keepSamePassword=" + $( "#keepSamePassword" ).attr( 'checked' ); 73 74 $.ajax( { … … 125 126 tdRole.html( user.role ); 126 127 tr.append( tdRole ); 128 var tdLaboratory = $( document.createElement( "td" ) ); 129 tdLaboratory.html( user.laboratory ); 130 tr.append( tdLaboratory ); 131 var tdCountry = $( document.createElement( "td" ) ); 132 tdCountry.html( user.country ); 133 tr.append( tdCountry ); 127 134 128 135 var tdDate = $( document.createElement( "td" ) ); … … 245 252 this.selectRoles.select( user.role, false ); 246 253 $( "#boAccess" ).attr( 'checked', user.accessToBO ); 254 $( "#laboratory" ).val( user.laboratory ); 255 $( "#country" ).val( user.country ); 247 256 248 257 this.updateModifyUserButtonAndTitle( user.id ); -
tapas/web/backoffice/user.jsp
r414 r416 79 79 <th><spring:message code="bo.user.email"/></th> 80 80 <th><spring:message code="bo.user.role"/></th> 81 <th><spring:message code="bo.user.laboratory"/></th> 82 <th><spring:message code="bo.user.country"/></th> 81 83 <th><spring:message code="bo.user.creationDate"/></th> 82 84 <th title="<spring:message code="bo.user.boAccess.help"/>"><spring:message code="bo.user.boAccess"/></th> … … 131 133 <td><input id="email" size="40"></td> 132 134 133 <td>< /td>134 <td>< /td>135 <td><spring:message code="bo.user.laboratory"/></td> 136 <td><input id="laboratory" size="20"></td> 135 137 </tr> 136 138 … … 139 141 <td><input id="password" size="40"></td> 140 142 141 <td>< /td>142 <td>< /td>143 <td><spring:message code="bo.user.country"/></td> 144 <td><input id="country" size="20"></td> 143 145 </tr> 144 146 <tr> -
tapas/web/init.jsp
r400 r416 2 2 <%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %> 3 3 <%@ taglib prefix="tiles" uri="/WEB-INF/tlds/struts-tiles.tld" %> 4 <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> 4 5 5 6 <tiles:insert page="/resources/templates/templateEther.jsp" flush="true"> … … 16 17 17 18 <tiles:put name="body" type="string"> 19 <c:if test="${not empty errors}"> 20 <div id="errors"><spring:message code="${errors}"/></div> 21 </c:if> 22 18 23 PAGE ACCUEIL TAPAS 24 19 25 </tiles:put> 20 26 -
tapas/web/resources/js/classesForJQuery/LoginButton.js
r413 r416 33 33 this.inscriptionText = param.inscriptionText ? param.inscriptionText : loginTexts["login.inscription"]; 34 34 this.errorText = param.errorText ? param.errorText : loginTexts[this.errors]; 35 36 this.containerMainErrors = $( "#errors" ); 35 37 }, 36 38 … … 111 113 112 114 var divErrors = $( document.createElement( "div" ) ); 113 divErrors.attr( {id:"errors ", class:"containerErrors"} );115 divErrors.attr( {id:"errorsLogin", class:"containerErrors"} ); 114 116 containerLoginForm.append( divErrors ); 115 this.containerErrors = $( "#errors " );117 this.containerErrors = $( "#errorsLogin" ); 116 118 }, 117 119 … … 175 177 this.parent.empty(); 176 178 this.display(); 179 this.containerMainErrors.hide(); 177 180 }, 178 181 179 182 displayLoginErrors: function ( text ) 180 183 { 181 $( "#errors" ).show();182 $( "#errors" ).html( text );184 this.containerErrors.show(); 185 this.containerErrors.html( text ); 183 186 }, 184 187 -
tapas/web/resources/jsp/dataProtocol_en.jsp
r366 r416 1 The access to Megapoli data (download and upload) is managed by the following data protocol.<BR/> 2 You have to accept this protocol to ask for an account. An email will be sent to inform you about the activation of your account. 3 <BR/><BR/> 4 5 6 <div class="title1">MEGAPOLI Data Policy and Data Protocol</div> 1 <div class="title1">TAPAS Data Policy and Data Protocol</div> 7 2 <BR/> 8 I accept : 9 <ul> 10 <li>to use data for my own account for a scientific use only, without any direct or indirect commercial use,</li> 11 <li>not to redistribute of these data to third parties,</li> 12 <li>to include acknowledgements in my publications with those sentences :</li> 13 </ul> 14 15 <div style="font-style:italic">«Data used have been produced in the frame of the European Union's Seventh Framework Programme FP/2007-2011 within the project MEGAPOLI,grant 16 agreement n°212520, with additional support of the French ANR and LEFE/CHAT MEGAPOLI-PARIS projects. 17 The authors acknowledge Ether the French data centre for atmospheric chemistry, created and co-directed by CNES (the French Space Agency) and INSU-CNRS (National Institute of 18 Sciences of the Universe) to support the MEGAPOLI database.» 19 </div> 20 <ul> 21 <li>in case of publication to contact the MEGAPOLI Principal Investigator according to the dataset used (see in the meta data) and to offer co-authorship ; each data owner has 22 the right to refuse to allow his/her work to be used in another publication prior to his/her own publication of the work. The data owner must then publish the work within 23 reasonable time (12 months after the request). 24 </li> 25 </ul> 3 qsdkmqldksfsdjfkl 26 4 <BR/> 27 <a href=" SendFileToClient.do?path=dataProtocol_en.pdf">5 <a href="project?methodName=downloadFileDataProtocol"> 28 6 <button class="dataProtocolDownloadButton">Download</button> 29 7 </a> … … 53 31 </tr> 54 32 <tr> 33 <td><label for="laboratory">Laboratory</label></td> 34 <td><input id="laboratory" name="laboratory" type="text" size="40"></td> 35 </tr> 36 <tr> 37 <td><label for="country">Country</label></td> 38 <td><input id="country" name="country" type="text" size="40"></td> 39 </tr> 40 <tr> 55 41 <td> 56 42 <input id="checkboxUser" type="checkbox" class="dataProtocolCheckbox"> -
tapas/web/resources/jsp/dataProtocol_fr.jsp
r366 r416 1 L'accÚs aux données Megapoli (téléchargement, dépÃŽt) est régi par le protocole ci-dessous.<BR/> 2 Vous devez donc l'accepter pour demander un compte utilisateur, un email vous sera ensuite envoyé afin de vous informer de la décision de l'administrateur. 3 <BR/><BR/> 4 5 6 <div class="title1">Protocole d'utilisation des données</div> 1 <div class="title1">TAPAS Protocole de données</div> 7 2 <BR/> 8 9 Je m'engage à : 10 <ul> 11 <li>utiliser les données pour mon propre compte dans un cadre scientifique uniquement, sans but commercial qu'il soit direct ou indirect,</li> 12 <li>ne pas redistribuer ces données ou produits à des tierces personnes,</li> 13 <li>inclure dans mes publications les remerciements suivants :</li> 14 </ul> 15 <div style="font-style:italic"> 16 «Les données utilisées ont été produites au sein du projet MEGAPOLI (du septiÚme programme-cadre de l'Union Européenne FP/2007-2011, accord n°212520), soutenu par l'ANR et les 17 projets LEFE/CHAT. 18 Les auteurs remercient le Centre de Produits et de Services de Chimie de l'AtmosphÚre Ether, crée et co-dirigé par le CNES (l'Agence Française de l'Espace) et l'INSU-CNRS 19 (Institut National des Sciences de l'Univers) pour leur support dans la création de la base de données MEGAPOLI.» 20 </div> 21 22 <ul> 23 <li>en cas de publication, contacter le scientifique responsable des données utilisées (information fournie dans les méta-données) et proposer une co-signature ; Chaque 24 propriétaire de données a le droit de refuser toute utilisation de ses produits pour des publications précédent ses propres parutions, il devra néanmoins publier ses 25 résultats dans un délai raisonnable (12 mois aprÚs la demande). 26 </li> 27 </ul> 3 qsdkmqldksfsdjfkl 28 4 <BR/> 29 <a href=" SendFileToClient.do?path=dataProtocol_fr.pdf">30 <button class="dataProtocolDownloadButton">Télécharge ment</button>5 <a href="project?methodName=downloadFileDataProtocol"> 6 <button class="dataProtocolDownloadButton">Télécharger</button> 31 7 </a> 32 8 … … 55 31 </tr> 56 32 <tr> 33 <td><label for="laboratory">Laboratoire</label></td> 34 <td><input id="laboratory" name="laboratory" type="text" size="40"></td> 35 </tr> 36 <tr> 37 <td><label for="country">Pays</label></td> 38 <td><input id="country" name="country" type="text" size="40"></td> 39 </tr> 40 <tr> 57 41 <td> 58 42 <input id="checkboxUser" type="checkbox" class="dataProtocolCheckbox"> -
tapas/web/resources/templates/templateEther.jsp
r414 r416 1 1 <%@ page import="com.ether.user.UserRole" %> 2 <%@ page import="com.ether.WebException" %> 2 3 <%@ page contentType="text/html;charset=UTF-8" language="java" %> 3 4 <%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %> … … 20 21 <ether:htmlCss cssFile="complexButton"/> 21 22 <ether:htmlCss cssFile="TwitterLogin/front"/> 23 <ether:htmlCss cssFile="jquery-ui-1.8.16.custom/jquery-ui-1.8.16.custom"/> 22 24 <ether:htmlCss cssFile="mainEther"/> 23 25 <ether:htmlCss cssFile="tapas"/> … … 31 33 <ether:htmlJs jsFile="classesForJQuery/LoginButton"/> 32 34 <ether:htmlJs jsFile="TwitterLogin/javascripts/jquery.tipsy"/> 35 <ether:htmlJs jsFile="library/jquery-ui-1.8.16.custom/js/jquery-ui-1.8.16.custom.min"/> 33 36 <ether:htmlJs jsFile="apycom.com-5-red/menu"/> 34 37 … … 129 132 <script type="text/javascript"> 130 133 var templateTexts = $A( "" ); 131 templateTexts["label.home"] = '<spring:message code="label.home"/>'; 132 templateTexts["label.language.to.switch"] = '<spring:message code="label.language.to.switch"/>'; 133 templateTexts["label.language.value.to.switch"] = '<spring:message code="label.language.value.to.switch"/>'; 134 templateTexts["label.mail"] = '<spring:message code="label.mail"/>'; 135 templateTexts["label.map"] = '<spring:message code="label.map"/>'; 136 templateTexts["label.backoffice"] = '<spring:message code="label.backoffice"/>'; 134 templateTexts["<%=WebException.WebCode.USER_ALREADY_EXISTS%>"] = "<spring:message code="USER_ALREADY_EXISTS"/>"; 137 135 138 136 // Needed texts if you use the library LoginButton.js -
tapas/web/resources/templates/templateEther_script.jsp
r414 r416 1 1 <%@ page import="com.ether.WebHelper" %> 2 <%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %> 2 3 3 4 <script type="text/javascript"> … … 13 14 /** *********** VARIABLES *********** **/ 14 15 // TODO : vérifier cette adresse de webmaster !!!! 16 this.language = '<spring:message code="language"/>'; 15 17 this.webmaster = "rboipsl@ipsl.jussieu.fr"; 16 18 this.jSONUser = <%=WebHelper.getJSONUser( request )%> ? <%=WebHelper.getJSONUser( request )%> : false; … … 24 26 createTools: function() 25 27 { 26 var backofficeButton = new Button( {value: templateTexts["label.backoffice"], parent:this.containerTools, id:"button_bo", className: "red_button", classNameText:"red_button_text", onClick:jQuery.proxy( this.onClickBO, this )} );28 var backofficeButton = new Button( {value:'<spring:message code="label.backoffice"/>', parent:this.containerTools, id:"button_bo", className: "red_button", classNameText:"red_button_text", onClick:jQuery.proxy( this.onClickBO, this )} ); 27 29 28 var mailButton = new Button( {value: templateTexts["label.mail"], parent:this.containerTools, id:"button_mail", className: "red_button", classNameText:"red_button_text", onClick:jQuery.proxy( this.onClickMail, this )} );29 var languageButton = new Button( {value: templateTexts["label.language.to.switch"], parent:this.containerTools, id:"button_language", className: "red_button", classNameText:"red_button_text", onClick:jQuery.proxy( this.onClickLanguage, this )} );30 var homeButton = new Button( {value: templateTexts["label.home"], parent:this.containerTools, id:"button_home", className: "red_button", classNameText:"red_button_text", onClick:this.onClickHome} );30 var mailButton = new Button( {value:'<spring:message code="label.mail"/>', parent:this.containerTools, id:"button_mail", className: "red_button", classNameText:"red_button_text", onClick:jQuery.proxy( this.onClickMail, this )} ); 31 var languageButton = new Button( {value:'<spring:message code="label.language.to.switch"/>', parent:this.containerTools, id:"button_language", className: "red_button", classNameText:"red_button_text", onClick:jQuery.proxy( this.onClickLanguage, this )} ); 32 var homeButton = new Button( {value:'<spring:message code="label.home"/>', parent:this.containerTools, id:"button_home", className: "red_button", classNameText:"red_button_text", onClick:this.onClickHome} ); 31 33 }, 32 34 33 35 createLogin: function() 34 36 { 35 var loginModule = new LoginButton( {parent:this.containerLogin, urlLogin:"project?methodName=login", urlLogout:"project?methodName=logout", webmaster: this.webmaster, isNeededInscription:true, anotherOnClickLogin:this.updateLoginOrLogout, anotherOnClickLogout:this.updateLoginOrLogout} );37 var loginModule = new LoginButton( {parent:this.containerLogin, urlLogin:"project?methodName=login", urlLogout:"project?methodName=logout", webmaster: this.webmaster, isNeededInscription:true, callbackInscription:jQuery.proxy( this.onClickInscription, this ) } ); 36 38 loginModule.setJSONUser( this.jSONUser ); 37 39 loginModule.display(); 38 //setLoginModule( this.loginModule );40 setLoginModule( this.loginModule ); 39 41 }, 40 42 … … 43 45 { 44 46 $.ajax( { 45 url: "project?methodName=setLocale&language= " + templateTexts["label.language.value.to.switch"],47 url: "project?methodName=setLocale&language=<spring:message code="label.language.value.to.switch"/>", 46 48 success:function() 47 49 { … … 72 74 { 73 75 document.location.href = "mailto:" + this.webmaster + "?subject=[TAPAS]"; 76 }, 77 78 onClickInscription: function() 79 { 80 var dataProtocol = "resources/jsp/dataProtocol_fr.jsp"; 81 if( "fr" != this.language ) 82 dataProtocol = "resources/jsp/dataProtocol_en.jsp"; 83 84 var $dialog = $( '<div></div>' ) 85 .load( dataProtocol ) 86 .dialog( { 87 autoOpen: false, 88 title: '<spring:message code="login.inscription" />', 89 height:800, 90 width:750 91 } ); 92 $dialog.dialog( 'open' ); 74 93 } 75 94 76 } ); 95 } ) 96 ; 97 98 /** ******************************* **/ 99 /** *********** ACCOUNT *********** **/ 100 /** ******************************* **/ 101 function onClickAcceptDataProtocol() 102 { 103 if( '' == $( "#lastName" ).val() || '' == $( "#email" ).val() || '' == $( "#password" ).val() ) 104 { 105 showErrorAccount( null, "<spring:message code='login.dataProtocolFields'/>" ); 106 return; 107 } 108 109 if( $( "#checkboxUser" ).attr( 'checked' ) ) 110 createAccount(); 111 else 112 showErrorAccount( null, "<spring:message code='login.dataProtocolAccept'/>" ); 113 } 114 115 function createAccount() 116 { 117 var parametersUrl = "name=" + $( "#lastName" ).val() + "&firstName=" + $( "#firstName" ).val() + "&email=" + $( "#email" ).val() + "&pwd=" + $( "#password" ).val() + "&laboratory=" + $( "#laboratory" ).val() + "&country=" + $( "#country" ).val(); 118 var request = $.ajax( { 119 url: "project?methodName=createAccount&" + parametersUrl, 120 success:handleCreateAccount, 121 error: showErrorAccount 122 } ); 123 } 124 125 function handleCreateAccount() 126 { 127 $( "#infosAccount" ).hide(); 128 $( "#infosAccount" ).removeClass( "containerErrors" ); 129 $( "#infosAccount" ).addClass( "containerInfos" ); 130 $( "#infosAccount" ).html( '<spring:message code="login.dataProtocol.account"/>' ); 131 $( "#infosAccount" ).show(); 132 } 133 134 function showErrorAccount( result, text ) 135 { 136 $( "#infosAccount" ).hide(); 137 $( "#infosAccount" ).removeClass( "containerInfos" ); 138 $( "#infosAccount" ).addClass( "containerErrors" ); 139 if( null != result ) 140 $( "#infosAccount" ).html( templateTexts[result.responseText] ); 141 else 142 $( "#infosAccount" ).html( text ); 143 144 $( "#infosAccount" ).show(); 145 } 77 146 78 147 </script> -
tapas/web/src/com/ether/Controller.java
r414 r416 24 24 /** *********************** VIEWS ***************************** **/ 25 25 /** *********************************************************** **/ 26 @ControllerMethod(view = VIEW_FORM_TAPAS )26 @ControllerMethod(view = VIEW_FORM_TAPAS, loginMandatory = true, defaultView = VIEW_INDEX) 27 27 public Map<String, Object> viewForm() 28 28 throws WebException … … 51 51 private static final Log LOGGER = LogFactory.getLog( Controller.class ); 52 52 53 private static final String VIEW_INDEX = "init"; 53 54 private static final String VIEW_FORM_TAPAS = "project/formTapas"; 54 55 } -
tapas/web/src/com/ether/ControllerBackoffice.java
r409 r416 56 56 @NotNull @ParamName(ParameterConstants.PARAMETER_PWD) final String pwd, 57 57 @Nullable @ParamName(ParameterConstants.PARAMETER_ROLE) final String role, 58 @Nullable @ParamName(ParameterConstants.PARAMETER_LABORATORY) final String laboratory, 59 @Nullable @ParamName(ParameterConstants.PARAMETER_COUNTRY) final String country, 58 60 @NotNull @ParamName(ParameterConstants.PARAMETER_HAS_ACCESS) final Boolean hasAccessToBO ) 59 61 throws WebException, ServiceException … … 66 68 final Date creationDate = new Date(); 67 69 final String encryptedPassword = EtherHelper.encryptPassword( pwd ); 68 final User user = new User( lastName, firstName, email, encryptedPassword, role, hasAccessToBO, creationDate );70 final User user = new User( lastName, firstName, email, encryptedPassword, role, hasAccessToBO, laboratory, country, creationDate ); 69 71 70 72 _backofficeService.createUser( user ); … … 102 104 @Nullable @ParamName(ParameterConstants.PARAMETER_PWD) final String pwd, 103 105 @Nullable @ParamName(ParameterConstants.PARAMETER_ROLE) final String role, 106 @Nullable @ParamName(ParameterConstants.PARAMETER_LABORATORY) final String laboratory, 107 @Nullable @ParamName(ParameterConstants.PARAMETER_COUNTRY) final String country, 104 108 @NotNull @ParamName(ParameterConstants.PARAMETER_HAS_ACCESS) final Boolean hasAccessToBO, 105 109 @NotNull @ParamName(ParameterConstants.PARAMETER_KEEP_SAME_PASSWORD) final Boolean keepSamePassword ) … … 122 126 user.setRole( UserRole.valueOf( role ) ); 123 127 user.setAccessToBO( hasAccessToBO ); 128 user.setLaboratory( laboratory ); 129 user.setCountry( country ); 124 130 125 131 _backofficeService.updateUser( user ); -
tapas/web/src/com/ether/ControllerEponge.java
r414 r416 28 28 /** *********************** VIEWS ***************************** **/ 29 29 /** *********************************************************** **/ 30 /** 31 * Home method 32 * 33 * @return 34 * @throws WebException 35 */ 30 36 @ControllerMethod(view = VIEW_INIT) 31 37 public Map<String, Object> home() 32 38 throws WebException 33 39 { 34 return new HashMap<String, Object>();35 }36 37 @ControllerMethod(view = VIEW_ERRORS)38 public Map<String, Object> viewErrors()39 throws ServiceException40 {41 return new HashMap<String, Object>();42 }43 44 @ControllerMethod(view = VIEW_DATA_PROTOCOL_EN, requestMandatory = true)45 public Map<String, Object> viewHomeDataProtocol( @NotNull final HttpServletRequest request )46 throws ServiceException47 {48 final MethodDescription methodDescription = getMethods().get( "viewHomeDataProtocol" );49 50 // if( Context.getLangue( request ).equals( Constantes.french_language ) )51 // methodDescription.setView( VIEW_DATA_PROTOCOL_FR );52 // else53 // methodDescription.setView( VIEW_DATA_PROTOCOL_EN );54 40 return new HashMap<String, Object>(); 55 41 } … … 120 106 @Nullable @ParamName(ParameterConstants.PARAMETER_FIRST_NAME) final String firstName, 121 107 @NotNull @ParamName(ParameterConstants.PARAMETER_EMAIL) final String email, 122 @NotNull @ParamName(ParameterConstants.PARAMETER_PWD) final String password ) 108 @NotNull @ParamName(ParameterConstants.PARAMETER_PWD) final String password, 109 @Nullable @ParamName(ParameterConstants.PARAMETER_LABORATORY) final String laboratory, 110 @Nullable @ParamName(ParameterConstants.PARAMETER_COUNTRY) final String country ) 123 111 throws ServiceException, WebException 124 112 { … … 131 119 132 120 final String encryptedPassword = EtherHelper.encryptPassword( password ); 133 final User user = new User( lastName, firstName, email, encryptedPassword, UserRole.USER, false, creationDate );121 final User user = new User( lastName, firstName, email, encryptedPassword, UserRole.USER, false, laboratory, country, creationDate ); 134 122 135 123 getTapasService().createUser( user ); … … 186 174 } 187 175 176 @ControllerMethod(downloadFile = DOWNLOAD_DATA_PROTOCOL_EN) 177 public void downloadFileDataProtocol() 178 { 179 } 180 188 181 private static final Log LOGGER = LogFactory.getLog( ControllerEponge.class ); 189 182 190 183 private static final String VIEW_INIT = "init"; 191 private static final String VIEW_ERRORS = "project/errors";192 184 private static final String VIEW_DATA_PROTOCOL_EN = "project/home_dataProtocol_en"; 193 private static final String VIEW_DATA_PROTOCOL_FR = "project/home_dataProtocol_fr";185 private static final String DOWNLOAD_DATA_PROTOCOL_EN = "bib.txt"; 194 186 } -
tapas/web/src/com/ether/ControllerEther.java
r414 r416 23 23 import javax.servlet.http.HttpServletRequest; 24 24 import javax.servlet.http.HttpServletResponse; 25 import java.io.BufferedInputStream; 26 import java.io.File; 27 import java.io.FileInputStream; 25 28 import java.io.IOException; 29 import java.io.InputStream; 30 import java.io.OutputStream; 26 31 import java.io.UnsupportedEncodingException; 27 32 import java.lang.annotation.Annotation; … … 93 98 // Parse parameters 94 99 final Object[] params = buildParams( methodDescription, request ); 100 final String defaultView = ( null != methodDescription.getDefaultView() && !"".equals( methodDescription.getDefaultView() ) ) ? methodDescription.getDefaultView() : methodDescription.getView(); 95 101 96 102 if( methodDescription.isRequestMandatory() ) 97 103 params[params.length - 1] = request; 98 104 105 if( methodDescription.isLoginMandatory() ) 106 { 107 final User user = (User) request.getSession().getAttribute( "SES_USER" ); 108 if( null == user ) 109 return new ModelAndView( defaultView, "errors", "login.error.unknown" ); 110 } 111 99 112 if( methodDescription.isBackofficeMethod() ) 100 113 { 101 final String defaultView = null != methodDescription.getDefaultView() ? methodDescription.getDefaultView() : methodDescription.getView();102 114 final User user = (User) request.getSession().getAttribute( "SES_USER" ); 103 115 if( null == user ) … … 137 149 final String jsonResult = convertToJson( result ); 138 150 WebHelper.writeJsonToResponse( response, jsonResult ); 151 return null; 152 } 153 // TODO : mettre le downloadPath en properties 154 else if( null != methodDescription.getDownloadFile() && !"".equals( methodDescription.getDownloadFile() ) ) 155 { 156 final String fileName = methodDescription.getDownloadFile(); 157 final String downloadPath = "/home_local/"; 158 159 response.setContentType( "multipart/zip" ); 160 response.setHeader( "Content-Disposition", "attachment; filename=\"" + fileName.trim() + "\";" ); 161 162 final File file = new File( downloadPath + fileName ); 163 if( !file.exists() ) 164 throw new WebException( WebException.WebCode.ERROR_TO_DOWNLOAD_FILE, file.getPath() ); 165 166 response.setContentLength( (int) file.length() ); 167 try 168 { 169 final OutputStream outputStream = response.getOutputStream(); 170 final FileInputStream fileInputStream = new FileInputStream( file ); 171 172 final BufferedInputStream bufferedInputStream = new BufferedInputStream( fileInputStream ); 173 final InputStream inputStream = new BufferedInputStream( bufferedInputStream ); 174 175 int count; 176 final byte[] buf = new byte[4096]; 177 while( ( count = inputStream.read( buf ) ) > -1 ) 178 outputStream.write( buf, 0, count ); 179 inputStream.close(); 180 outputStream.close(); 181 } 182 catch( Exception ex ) 183 { 184 throw new WebException( WebException.WebCode.ERROR_TO_DOWNLOAD_FILE, ex ); 185 } 139 186 return null; 140 187 } -
tapas/web/src/com/ether/WebException.java
r410 r416 37 37 { 38 38 IO_EXCEPTION_ERROR_TO_GET_OUTPUTSTREAM, 39 ERROR_TO_DOWNLOAD_FILE, 39 40 ERROR_UNSUPPORTED_UTF8_ENCODING, 40 41 ERROR_NO_REQUEST_HANDLING_METHOD, -
tapas/web/src/messages_en.properties
r414 r416 1 1 inWork=Work in progress.. 2 language= English2 language=en 3 3 label.language.to.switch=French 4 4 label.language.value.to.switch=fr … … 26 26 27 27 ################################################################ 28 ####################### ERRORS ################################# 29 ################################################################ 30 USER_ALREADY_EXISTS=This email is already used, you have to give another one 31 32 33 ################################################################ 28 34 ####################### LOGIN ################################## 29 35 ################################################################ … … 41 47 login.dataProtocolAccept=You have to accept the data protocol to ask for an account 42 48 login.dataProtocolFields=Fields 'LastName', 'Email' and 'Password' must be filled 43 login.dataProtocol.account=Your account is waiting for administrator validation. You will receive an email when it will be activated. 44 login.dataProtocol.alreadyExist=This email is already used, you have to give another one 49 login.dataProtocol.account=Your account is now activated. You can login with your email and password. 45 50 46 51 login.error.notAccepted=You are not allowed to access to protected areas. … … 87 92 bo.user.password.same.help=(only to modify a password) 88 93 bo.user.role=Role 94 bo.user.laboratory=Laboratory 95 bo.user.country=Country 89 96 bo.user.creationDate=Creation date 90 97 bo.user.state=State -
tapas/web/src/messages_fr.properties
r414 r416 1 1 inWork=Page en cours de construction.. 2 language= Français2 language=fr 3 3 label.language.to.switch=Anglais 4 4 label.language.value.to.switch=en … … 26 26 27 27 ################################################################ 28 ####################### ERRORS ################################# 29 ################################################################ 30 USER_ALREADY_EXISTS=Cette email est déjà utilisé par un compte, veuillez en fournir un autre. 31 32 33 ################################################################ 28 34 ####################### LOGIN ################################## 29 35 ################################################################ 30 36 login.authentification=Authentification 31 login.intro=Veuillez vous identifier afin d'acc \u00E9der aux zones prot\u00E9g\u00E9es de ce site.37 login.intro=Veuillez vous identifier afin d'accéder aux zones protégées de ce site. 32 38 login=Login 33 39 login.password=Mot de passe … … 37 43 login.pwdForget=Oubli du mot de passe ? 38 44 login.inscription=Nouvelle inscription 39 login.text=Veuillez vous identifier afin d'acc \u00E9der aux zones prot\u00E9g\u00E9es de ce site.45 login.text=Veuillez vous identifier afin d'accéder aux zones protégées de ce site. 40 46 41 login.dataProtocolAccept=Vous devez accepter le protocole d'utilisation des donn \u00E9es pour demander un compte47 login.dataProtocolAccept=Vous devez accepter le protocole d'utilisation des données pour demander un compte 42 48 login.dataProtocolFields=Les champs 'Nom', 'Email' et 'Mot de passe' sont incomplets 43 login.dataProtocol.account=Votre compte est en attente de validation par l'administrateur. Vous recevrez un email lors de son activation. 44 login.dataProtocol.alreadyExist=Cette email est d\u00E9j\u00E0 utilis\u00E9 par un compte, veuillez en fournir un autre. 49 login.dataProtocol.account=Votre compte est désormais créé. Vous pouvez vous connecter avec votre email et mot de passe. 45 50 46 login.error.notAccepted=Vous n' \u00EAtes pas autoris\u00E9 \u00E0 acc\u00E9der aux zones prot\u00E9g\u00E9s.47 login.error.bo.notAccepted=Vous n' \u00EAtes pas autoris\u00E9 \u00E0 acc\u00E9der au backoffice.48 login.error.notFound=Ce login est inconnu.<br> Si vous voulez vous enregistrer pour obtenir l'acc \u00E8s aux zones prot\u00E9g\u00E9es du site, veuillez cliquez sur 'Nouvelle inscription'. <br>51 login.error.notAccepted=Vous n'êtes pas autorisé à accéder aux zones protégés. 52 login.error.bo.notAccepted=Vous n'êtes pas autorisé à accéder au backoffice. 53 login.error.notFound=Ce login est inconnu.<br> Si vous voulez vous enregistrer pour obtenir l'accÚs aux zones protégées du site, veuillez cliquez sur 'Nouvelle inscription'. <br> 49 54 login.error.wrongPassword=Ce mot de passe est incorrect. 50 login.error.failed=Echec de l\'op \u00E9ration d'authentification.<br> Veuillez contacter le <a href\='mailto\:{0}?subject\=[TAPAS]'>webmaster</a> pour lui signaler le probl\u00E8me.<br>51 login.error.unknown=Vous n' \u00EAtes pas identifi\u00E9ou vous avez perdu votre session, veuillez vous connecter.55 login.error.failed=Echec de l\'opération d'authentification.<br> Veuillez contacter le <a href\='mailto\:{0}?subject\=[TAPAS]'>webmaster</a> pour lui signaler le problÚme.<br> 56 login.error.unknown=Vous n'êtes pas identifié ou vous avez perdu votre session, veuillez vous connecter. 52 57 53 58 … … 86 91 bo.user.password.same.help=(only to modify a password) 87 92 bo.user.role=Role 93 bo.user.laboratory=Laboratory 94 bo.user.country=Country 88 95 bo.user.creationDate=Creation date 89 96 bo.user.state=State
Note: See TracChangeset
for help on using the changeset viewer.