Changeset 416


Ignore:
Timestamp:
03/15/12 18:54:48 (12 years ago)
Author:
vmipsl
Message:

User : ajout laboratoire & pays
BO : idem
Création compte : idem
DataProtocole?
Clean accent properties
Language

Location:
tapas
Files:
474 added
18 edited
3 copied

Legend:

Unmodified
Added
Removed
  • tapas/common/implementation/com/ether/MethodDescription.java

    r406 r416  
    2121        _isBackofficeMethod = annotation.backofficeMethod(); 
    2222        _params = new ArrayList<ParamDescription>(); 
     23        _downloadFile = annotation.downloadFile(); 
    2324    } 
    2425 
     
    113114    } 
    114115 
     116    @Nullable 
     117    public String getDownloadFile() 
     118    { 
     119        return _downloadFile; 
     120    } 
     121 
     122    public void setDownloadFile( @Nullable final String downloadFile ) 
     123    { 
     124        _downloadFile = downloadFile; 
     125    } 
     126 
    115127    @NotNull 
    116128    private Method _method; 
     
    125137    private Boolean _isRequestMandatory; 
    126138    private Boolean _isBackofficeMethod; 
     139    @Nullable 
     140    private String _downloadFile; 
    127141} 
  • tapas/common/implementation/com/ether/ParameterConstants.java

    r409 r416  
    44{ 
    55    public static final String PARAMETER_ID = "id"; 
    6     public static final String PARAMETER_DATE = "date"; 
    7     public static final String PARAMETER_CODE = "code"; 
    86    public static final String PARAMETER_NAME = "name"; 
    9     public static final String PARAMETER_DATE_BEGIN = "dateBegin"; 
    10     public static final String PARAMETER_DATE_END = "dateEnd"; 
    117    public static final String PARAMETER_LOGIN = "login"; 
    128    public static final String PARAMETER_PWD = "pwd"; 
     
    1410    public static final String PARAMETER_EMAIL = "email"; 
    1511    public static final String PARAMETER_ROLE = "role"; 
    16     public static final String PARAMETER_STATE = "state"; 
     12    public static final String PARAMETER_LABORATORY = "laboratory"; 
     13    public static final String PARAMETER_COUNTRY = "country"; 
    1714    public static final String PARAMETER_HAS_ACCESS = "hasAccess"; 
    1815    public static final String PARAMETER_KEEP_SAME_PASSWORD = "keepSamePassword"; 
  • tapas/common/implementation/com/ether/annotation/ControllerMethod.java

    r406 r416  
    2424 
    2525    @Nullable String defaultView() default ""; 
     26 
     27    @Nullable String downloadFile() default ""; 
    2628} 
  • tapas/common/implementation/com/ether/annotation/DownloadFile.java

    r411 r416  
    88@Retention(RetentionPolicy.RUNTIME) 
    99@Target(ElementType.PARAMETER) 
    10 public @interface RequestMandatory 
     10public @interface DownloadFile 
    1111{ 
    1212} 
  • tapas/domain/interface/com/ether/user/User.java

    r409 r416  
    1616    } 
    1717 
    18     public User( @NotNull final String lastName, @Nullable final String firstName, @NotNull final String email, @NotNull final String password, @Nullable final UserRole role, final boolean hasAccessToBO, @NotNull final Date creationDate ) 
     18    public User( @NotNull final String lastName, @Nullable final String firstName, @NotNull final String email, @NotNull final String password, @Nullable final UserRole role, final boolean hasAccessToBO, @Nullable final String laboratory, @Nullable final String country, @NotNull final Date creationDate ) 
    1919    { 
    2020        _lastName = lastName; 
     
    2424        _role = role; 
    2525        _accessToBO = hasAccessToBO; 
     26        _laboratory = laboratory; 
     27        _country = country; 
    2628        _creationDate = creationDate; 
    2729    } 
    2830 
    29     public User( @NotNull final String lastName, @Nullable final String firstName, @NotNull final String email, @NotNull final String pwd, @Nullable final String role, final Boolean hasAccessToBO, @NotNull final Date date ) 
     31    public User( @NotNull final String lastName, @Nullable final String firstName, @NotNull final String email, @NotNull final String pwd, @Nullable final String role, final Boolean hasAccessToBO, @Nullable final String laboratory, @Nullable final String country, @NotNull final Date date ) 
    3032    { 
    31         this( lastName, firstName, email, pwd, UserRole.valueOf( role ), hasAccessToBO, date ); 
     33        this( lastName, firstName, email, pwd, UserRole.valueOf( role ), hasAccessToBO, laboratory, country, date ); 
    3234    } 
    3335 
     
    118120    } 
    119121 
     122    @Nullable 
     123    public String getLaboratory() 
     124    { 
     125        return _laboratory; 
     126    } 
     127 
     128    public void setLaboratory( @Nullable final String laboratory ) 
     129    { 
     130        _laboratory = laboratory; 
     131    } 
     132 
     133    @Nullable 
     134    public String getCountry() 
     135    { 
     136        return _country; 
     137    } 
     138 
     139    public void setCountry( @Nullable final String country ) 
     140    { 
     141        _country = country; 
     142    } 
     143 
    120144    private Integer _id; 
    121145    @NotNull 
     
    132156    @NotNull 
    133157    private Date _creationDate; 
     158    @Nullable 
     159    private String _laboratory; 
     160    @Nullable 
     161    private String _country; 
    134162} 
  • tapas/persistence/implementation/com/ether/dao/user/User.hbm.xml

    r409 r416  
    4040            <column name="access_to_bo" not-null="true"/> 
    4141        </property> 
     42 
     43        <property name="laboratory"> 
     44            <column name="laboratory"/> 
     45        </property> 
     46 
     47        <property name="country"> 
     48            <column name="country"/> 
     49        </property> 
     50 
    4251    </class> 
    4352</hibernate-mapping> 
  • tapas/web/backoffice/user-script.jsp

    r409 r416  
    4646        { 
    4747            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' ); 
    4950            var request = $.ajax( { 
    5051                url: "backoffice?methodName=addUser&" + parametersUrl, 
     
    6970        { 
    7071            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() + 
    7273                    "&hasAccess=" + $( "#boAccess" ).attr( 'checked' ) + "&keepSamePassword=" + $( "#keepSamePassword" ).attr( 'checked' ); 
    7374            $.ajax( { 
     
    125126        tdRole.html( user.role ); 
    126127        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 ); 
    127134 
    128135        var tdDate = $( document.createElement( "td" ) ); 
     
    245252        this.selectRoles.select( user.role, false ); 
    246253        $( "#boAccess" ).attr( 'checked', user.accessToBO ); 
     254        $( "#laboratory" ).val( user.laboratory ); 
     255        $( "#country" ).val( user.country ); 
    247256 
    248257        this.updateModifyUserButtonAndTitle( user.id ); 
  • tapas/web/backoffice/user.jsp

    r414 r416  
    7979                    <th><spring:message code="bo.user.email"/></th> 
    8080                    <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> 
    8183                    <th><spring:message code="bo.user.creationDate"/></th> 
    8284                    <th title="<spring:message code="bo.user.boAccess.help"/>"><spring:message code="bo.user.boAccess"/></th> 
     
    131133                <td><input id="email" size="40"></td> 
    132134 
    133                 <td></td> 
    134                 <td></td> 
     135                <td><spring:message code="bo.user.laboratory"/></td> 
     136                <td><input id="laboratory" size="20"></td> 
    135137            </tr> 
    136138 
     
    139141                <td><input id="password" size="40"></td> 
    140142 
    141                 <td></td> 
    142                 <td></td> 
     143                <td><spring:message code="bo.user.country"/></td> 
     144                <td><input id="country" size="20"></td> 
    143145            </tr> 
    144146            <tr> 
  • tapas/web/init.jsp

    r400 r416  
    22<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %> 
    33<%@ taglib prefix="tiles" uri="/WEB-INF/tlds/struts-tiles.tld" %> 
     4<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> 
    45 
    56<tiles:insert page="/resources/templates/templateEther.jsp" flush="true"> 
     
    1617 
    1718    <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 
    1823        PAGE ACCUEIL TAPAS 
     24 
    1925    </tiles:put> 
    2026 
  • tapas/web/resources/js/classesForJQuery/LoginButton.js

    r413 r416  
    3333        this.inscriptionText = param.inscriptionText ? param.inscriptionText : loginTexts["login.inscription"]; 
    3434        this.errorText = param.errorText ? param.errorText : loginTexts[this.errors]; 
     35 
     36        this.containerMainErrors = $( "#errors" ); 
    3537    }, 
    3638 
     
    111113 
    112114        var divErrors = $( document.createElement( "div" ) ); 
    113         divErrors.attr( {id:"errors", class:"containerErrors"} ); 
     115        divErrors.attr( {id:"errorsLogin", class:"containerErrors"} ); 
    114116        containerLoginForm.append( divErrors ); 
    115         this.containerErrors = $( "#errors" ); 
     117        this.containerErrors = $( "#errorsLogin" ); 
    116118    }, 
    117119 
     
    175177        this.parent.empty(); 
    176178        this.display(); 
     179        this.containerMainErrors.hide(); 
    177180    }, 
    178181 
    179182    displayLoginErrors: function ( text ) 
    180183    { 
    181         $( "#errors" ).show(); 
    182         $( "#errors" ).html( text ); 
     184        this.containerErrors.show(); 
     185        this.containerErrors.html( text ); 
    183186    }, 
    184187 
  • 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> 
    72<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> 
     3qsdkmqldksfsdjfkl 
    264<BR/> 
    27 <a href="SendFileToClient.do?path=dataProtocol_en.pdf"> 
     5<a href="project?methodName=downloadFileDataProtocol"> 
    286    <button class="dataProtocolDownloadButton">Download</button> 
    297</a> 
     
    5331    </tr> 
    5432    <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> 
    5541        <td> 
    5642            <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> 
    72<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> 
     3qsdkmqldksfsdjfkl 
    284<BR/> 
    29 <a href="SendFileToClient.do?path=dataProtocol_fr.pdf"> 
    30     <button class="dataProtocolDownloadButton">Téléchargement</button> 
     5<a href="project?methodName=downloadFileDataProtocol"> 
     6    <button class="dataProtocolDownloadButton">Télécharger</button> 
    317</a> 
    328 
     
    5531    </tr> 
    5632    <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> 
    5741        <td> 
    5842            <input id="checkboxUser" type="checkbox" class="dataProtocolCheckbox"> 
  • tapas/web/resources/templates/templateEther.jsp

    r414 r416  
    11<%@ page import="com.ether.user.UserRole" %> 
     2<%@ page import="com.ether.WebException" %> 
    23<%@ page contentType="text/html;charset=UTF-8" language="java" %> 
    34<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %> 
     
    2021    <ether:htmlCss cssFile="complexButton"/> 
    2122    <ether:htmlCss cssFile="TwitterLogin/front"/> 
     23    <ether:htmlCss cssFile="jquery-ui-1.8.16.custom/jquery-ui-1.8.16.custom"/> 
    2224    <ether:htmlCss cssFile="mainEther"/> 
    2325    <ether:htmlCss cssFile="tapas"/> 
     
    3133    <ether:htmlJs jsFile="classesForJQuery/LoginButton"/> 
    3234    <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"/> 
    3336    <ether:htmlJs jsFile="apycom.com-5-red/menu"/> 
    3437 
     
    129132<script type="text/javascript"> 
    130133    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"/>"; 
    137135 
    138136    // Needed texts if you use the library LoginButton.js 
  • tapas/web/resources/templates/templateEther_script.jsp

    r414 r416  
    11<%@ page import="com.ether.WebHelper" %> 
     2<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %> 
    23 
    34<script type="text/javascript"> 
     
    1314            /** *********** VARIABLES *********** **/ 
    1415            // TODO : vérifier cette adresse de webmaster !!!! 
     16            this.language = '<spring:message code="language"/>'; 
    1517            this.webmaster = "rboipsl@ipsl.jussieu.fr"; 
    1618            this.jSONUser = <%=WebHelper.getJSONUser( request )%> ? <%=WebHelper.getJSONUser( request )%> : false; 
     
    2426        createTools: function() 
    2527        { 
    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 )} ); 
    2729 
    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} ); 
    3133        }, 
    3234 
    3335        createLogin: function() 
    3436        { 
    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 ) } ); 
    3638            loginModule.setJSONUser( this.jSONUser ); 
    3739            loginModule.display(); 
    38 //            setLoginModule( this.loginModule ); 
     40            setLoginModule( this.loginModule ); 
    3941        }, 
    4042 
     
    4345        { 
    4446            $.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"/>", 
    4648                success:function() 
    4749                { 
     
    7274        { 
    7375            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' ); 
    7493        } 
    7594 
    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    } 
    77146 
    78147</script> 
  • tapas/web/src/com/ether/Controller.java

    r414 r416  
    2424    /** *********************** VIEWS ***************************** **/ 
    2525    /** *********************************************************** **/ 
    26     @ControllerMethod(view = VIEW_FORM_TAPAS) 
     26    @ControllerMethod(view = VIEW_FORM_TAPAS, loginMandatory = true, defaultView = VIEW_INDEX) 
    2727    public Map<String, Object> viewForm() 
    2828            throws WebException 
     
    5151    private static final Log LOGGER = LogFactory.getLog( Controller.class ); 
    5252 
     53    private static final String VIEW_INDEX = "init"; 
    5354    private static final String VIEW_FORM_TAPAS = "project/formTapas"; 
    5455} 
  • tapas/web/src/com/ether/ControllerBackoffice.java

    r409 r416  
    5656                               @NotNull @ParamName(ParameterConstants.PARAMETER_PWD) final String pwd, 
    5757                               @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, 
    5860                               @NotNull @ParamName(ParameterConstants.PARAMETER_HAS_ACCESS) final Boolean hasAccessToBO ) 
    5961            throws WebException, ServiceException 
     
    6668                final Date creationDate = new Date(); 
    6769                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 ); 
    6971 
    7072                _backofficeService.createUser( user ); 
     
    102104                                  @Nullable @ParamName(ParameterConstants.PARAMETER_PWD) final String pwd, 
    103105                                  @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, 
    104108                                  @NotNull @ParamName(ParameterConstants.PARAMETER_HAS_ACCESS) final Boolean hasAccessToBO, 
    105109                                  @NotNull @ParamName(ParameterConstants.PARAMETER_KEEP_SAME_PASSWORD) final Boolean keepSamePassword ) 
     
    122126                user.setRole( UserRole.valueOf( role ) ); 
    123127                user.setAccessToBO( hasAccessToBO ); 
     128                user.setLaboratory( laboratory ); 
     129                user.setCountry( country ); 
    124130 
    125131                _backofficeService.updateUser( user ); 
  • tapas/web/src/com/ether/ControllerEponge.java

    r414 r416  
    2828    /** *********************** VIEWS ***************************** **/ 
    2929    /** *********************************************************** **/ 
     30    /** 
     31     * Home method 
     32     * 
     33     * @return 
     34     * @throws WebException 
     35     */ 
    3036    @ControllerMethod(view = VIEW_INIT) 
    3137    public Map<String, Object> home() 
    3238            throws WebException 
    3339    { 
    34         return new HashMap<String, Object>(); 
    35     } 
    36  
    37     @ControllerMethod(view = VIEW_ERRORS) 
    38     public Map<String, Object> viewErrors() 
    39             throws ServiceException 
    40     { 
    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 ServiceException 
    47     { 
    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 //        else 
    53 //            methodDescription.setView( VIEW_DATA_PROTOCOL_EN ); 
    5440        return new HashMap<String, Object>(); 
    5541    } 
     
    120106                                     @Nullable @ParamName(ParameterConstants.PARAMETER_FIRST_NAME) final String firstName, 
    121107                                     @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 ) 
    123111            throws ServiceException, WebException 
    124112    { 
     
    131119 
    132120                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 ); 
    134122 
    135123                getTapasService().createUser( user ); 
     
    186174    } 
    187175 
     176    @ControllerMethod(downloadFile = DOWNLOAD_DATA_PROTOCOL_EN) 
     177    public void downloadFileDataProtocol() 
     178    { 
     179    } 
     180 
    188181    private static final Log LOGGER = LogFactory.getLog( ControllerEponge.class ); 
    189182 
    190183    private static final String VIEW_INIT = "init"; 
    191     private static final String VIEW_ERRORS = "project/errors"; 
    192184    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"; 
    194186} 
  • tapas/web/src/com/ether/ControllerEther.java

    r414 r416  
    2323import javax.servlet.http.HttpServletRequest; 
    2424import javax.servlet.http.HttpServletResponse; 
     25import java.io.BufferedInputStream; 
     26import java.io.File; 
     27import java.io.FileInputStream; 
    2528import java.io.IOException; 
     29import java.io.InputStream; 
     30import java.io.OutputStream; 
    2631import java.io.UnsupportedEncodingException; 
    2732import java.lang.annotation.Annotation; 
     
    9398            // Parse parameters 
    9499            final Object[] params = buildParams( methodDescription, request ); 
     100            final String defaultView = ( null != methodDescription.getDefaultView() && !"".equals( methodDescription.getDefaultView() ) ) ? methodDescription.getDefaultView() : methodDescription.getView(); 
    95101 
    96102            if( methodDescription.isRequestMandatory() ) 
    97103                params[params.length - 1] = request; 
    98104 
     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 
    99112            if( methodDescription.isBackofficeMethod() ) 
    100113            { 
    101                 final String defaultView = null != methodDescription.getDefaultView() ? methodDescription.getDefaultView() : methodDescription.getView(); 
    102114                final User user = (User) request.getSession().getAttribute( "SES_USER" ); 
    103115                if( null == user ) 
     
    137149                final String jsonResult = convertToJson( result ); 
    138150                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                } 
    139186                return null; 
    140187            } 
  • tapas/web/src/com/ether/WebException.java

    r410 r416  
    3737    { 
    3838        IO_EXCEPTION_ERROR_TO_GET_OUTPUTSTREAM, 
     39        ERROR_TO_DOWNLOAD_FILE, 
    3940        ERROR_UNSUPPORTED_UTF8_ENCODING, 
    4041        ERROR_NO_REQUEST_HANDLING_METHOD, 
  • tapas/web/src/messages_en.properties

    r414 r416  
    11inWork=Work in progress.. 
    2 language=English 
     2language=en 
    33label.language.to.switch=French 
    44label.language.value.to.switch=fr 
     
    2626 
    2727################################################################ 
     28####################### ERRORS ################################# 
     29################################################################ 
     30USER_ALREADY_EXISTS=This email is already used, you have to give another one 
     31 
     32 
     33################################################################ 
    2834####################### LOGIN ################################## 
    2935################################################################ 
     
    4147login.dataProtocolAccept=You have to accept the data protocol to ask for an account 
    4248login.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 
     49login.dataProtocol.account=Your account is now activated. You can login with your email and password. 
    4550 
    4651login.error.notAccepted=You are not allowed to access to protected areas. 
     
    8792bo.user.password.same.help=(only to modify a password) 
    8893bo.user.role=Role 
     94bo.user.laboratory=Laboratory 
     95bo.user.country=Country 
    8996bo.user.creationDate=Creation date 
    9097bo.user.state=State 
  • tapas/web/src/messages_fr.properties

    r414 r416  
    11inWork=Page en cours de construction.. 
    2 language=Français 
     2language=fr 
    33label.language.to.switch=Anglais 
    44label.language.value.to.switch=en 
     
    2626 
    2727################################################################ 
     28####################### ERRORS ################################# 
     29################################################################ 
     30USER_ALREADY_EXISTS=Cette email est déjà utilisé par un compte, veuillez en fournir un autre. 
     31 
     32 
     33################################################################ 
    2834####################### LOGIN ################################## 
    2935################################################################ 
    3036login.authentification=Authentification 
    31 login.intro=Veuillez vous identifier afin d'acc\u00E9der aux zones prot\u00E9g\u00E9es de ce site. 
     37login.intro=Veuillez vous identifier afin d'accéder aux zones protégées de ce site. 
    3238login=Login 
    3339login.password=Mot de passe 
     
    3743login.pwdForget=Oubli du mot de passe ? 
    3844login.inscription=Nouvelle inscription 
    39 login.text=Veuillez vous identifier afin d'acc\u00E9der aux zones prot\u00E9g\u00E9es de ce site. 
     45login.text=Veuillez vous identifier afin d'accéder aux zones protégées de ce site. 
    4046 
    41 login.dataProtocolAccept=Vous devez accepter le protocole d'utilisation des donn\u00E9es pour demander un compte 
     47login.dataProtocolAccept=Vous devez accepter le protocole d'utilisation des données pour demander un compte 
    4248login.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. 
     49login.dataProtocol.account=Votre compte est désormais créé. Vous pouvez vous connecter avec votre email et mot de passe. 
    4550 
    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> 
     51login.error.notAccepted=Vous n'êtes pas autorisé à accéder aux zones protégés. 
     52login.error.bo.notAccepted=Vous n'êtes pas autorisé à accéder au backoffice. 
     53login.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> 
    4954login.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\u00E9 ou vous avez perdu votre session, veuillez vous connecter. 
     55login.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> 
     56login.error.unknown=Vous n'êtes pas identifié ou vous avez perdu votre session, veuillez vous connecter. 
    5257 
    5358 
     
    8691bo.user.password.same.help=(only to modify a password) 
    8792bo.user.role=Role 
     93bo.user.laboratory=Laboratory 
     94bo.user.country=Country 
    8895bo.user.creationDate=Creation date 
    8996bo.user.state=State 
Note: See TracChangeset for help on using the changeset viewer.