Changeset 267


Ignore:
Timestamp:
11/29/11 17:07:45 (13 years ago)
Author:
vmipsl
Message:

BO User

Location:
ether_megapoli/trunk
Files:
10 edited
1 copied

Legend:

Unmodified
Added
Removed
  • ether_megapoli/trunk/common/implementation/com/ether/annotation/BackofficeMethod.java

    r249 r267  
    88@Retention(RetentionPolicy.RUNTIME) 
    99@Target(ElementType.PARAMETER) 
    10 public @interface RequestMandatory 
     10public @interface BackofficeMethod 
    1111{ 
    1212} 
  • ether_megapoli/trunk/web/data/access.jsp

    r260 r267  
    4848 
    4949                <nested:root name="datasForm"> 
    50                 <table class="roundTable" border="1" width="100%"> 
     50                <table class="roundTable" border="1"> 
    5151                        <tr> 
    5252 
  • ether_megapoli/trunk/web/data/access2.jsp

    r260 r267  
    4444 
    4545    <nested:root name="datasForm"> 
    46     <table class="roundTable" border="1" width="100%"> 
     46    <table class="roundTable" border="1"> 
    4747    <tr> 
    4848        <td width="250px" rowspan="2" valign="top"> 
  • ether_megapoli/trunk/web/resources/css/backoffice.css

    r265 r267  
    77} 
    88 
     9th { 
     10    text-align: center; 
     11} 
     12 
    913/** ***************************************************** **/ 
    1014/** ********************** CONTAINER ******************** **/ 
    1115/** ***************************************************** **/ 
    12 .containerSmallLogoEther { 
    13     float: right; 
    14     margin-right: 15px; 
    15 } 
    16  
    17 .containerMegapoli { 
    18     -moz-border-radius: 4px 4px 4px 4px; 
    19     -moz-box-shadow: 0 0 4px rgba(0, 0, 0, 0.3); 
    20     -webkit-border-radius: 4px 4px 4px 4px; 
    21     -webkit-box-shadow: 0 0 4px rgba(0, 0, 0, 0.3); 
    22     width: 980px; 
    23     float: left; 
    24     margin-bottom: 10px; 
    25 } 
    2616 
    2717.containerTitle { 
    28     font-size: 20px; 
    2918    color: #778899; 
    30     font-weight: bold; 
    31     float: left; 
    32     margin-top: 9px; 
    3319    padding-left: 236px; 
    3420} 
    3521 
    36 .containerLogo { 
    37     -moz-border-radius: 4px 4px 4px 4px; 
    38     -webkit-border-radius: 4px 4px 4px 4px; 
    39     float: left; 
    40     margin-bottom: 10px; 
    41     margin-right: 20px; 
    42     padding-left: 30px; 
    43     width: 120px; 
    44     top: -32px; 
    45     position: relative; 
    46 } 
    47  
    48 .containerUserLogout { 
    49     float: left; 
    50     margin-right: 5px; 
    51 } 
    52  
    53 .containerImgLogout { 
    54     float: right; 
    55     position: relative; 
    56     top: 13px; 
    57 } 
    58  
    59 .containerNav { 
     22.containerMenu { 
    6023    -moz-border-radius: 4px 4px 4px 4px; 
    6124    -moz-box-shadow: 0 0 4px rgba(0, 0, 0, 0.3); 
     
    6427    float: left; 
    6528    position: relative; 
    66     width: 334px; 
    67     height: 31px; 
     29    width: 800px; 
     30    height: 39px; 
    6831    color: #969696; 
    6932    top: 4px; 
    7033    margin-bottom: 18px; 
    71     padding-top: 6px; 
    7234    padding-left: 10px; 
    7335    font-size: 11px; 
    7436} 
    7537 
    76 .containerMenu { 
    77     float: right; 
    78 } 
    79  
    80 .containerTitleContentBorder { 
    81     float: left; 
    82     position: relative; 
    83     height: 2px; 
    84     border-bottom: 10px solid white; 
    85     z-index: 1; 
    86     left: -10px; 
    87     width: 809px; 
    88 } 
    89  
    9038.containerTitleContent { 
    91     -moz-border-radius: 4px 4px 0 0; 
    92     -moz-box-shadow: 0 0 5px rgba(0, 0, 0, 0.3); 
    93     -webkit-border-radius: 4px 4px 0 0; 
    94     -webkit-box-shadow: 0 0 5px rgba(0, 0, 0, 0.3); 
    95     float: left; 
    96     position: relative; 
    97     width: 800px; 
    98     height: 26px; 
     39    background-image: none; 
    9940    color: #778899; 
    100     font-weight: bold; 
    101     padding-left: 10px; 
    102     padding-top: 4px; 
    10341} 
    10442 
    10543.containerCenter { 
    106     -moz-border-radius-topright: 0; 
    107     -webkit-border-radius: 0; 
    10844    background: -moz-linear-gradient(white, #778899); 
    109     min-height: 400px; 
    110     text-align: justify; 
    111     position: relative; 
    112     top: -32px; 
    113     padding: 10px; 
    114     width: 960px; 
    115 } 
    116  
    117 .containerCenterContent { 
    118     padding: 10px; 
    11945} 
    12046 
    12147.containerBottom { 
     48    background-image: none; 
    12249    background-color: #778899; 
    123     color: #FFFFFF; 
    124     height: 26px; 
    125     padding-right: 10px; 
    126     position: relative; 
    127     top: -32px; 
    128     width: 975px; 
    129 } 
    130  
    131 /** ***************************************************** **/ 
    132 /** ************************ SLIDES ********************** **/ 
    133 /** ***************************************************** **/ 
    134 .containerSlide { 
    135     position: absolute; 
    136     top: 300px; 
    137 } 
    138  
    139 .containerSlideContent { 
    140     float: left; 
    141     min-height: 200px; 
    142     -moz-border-radius: 4px 4px 0 0; 
    143     -moz-box-shadow: 0 0 5px rgba(0, 0, 0, 0.3); 
    144     -webkit-border-radius: 4px 4px 0 0; 
    145     -webkit-box-shadow: 0 0 5px rgba(0, 0, 0, 0.3); 
    146     padding: 10px; 
    147     margin-right: 1px; 
    148     display: none; 
    149     background-color: white; 
    150 } 
    151  
    152 .containerSlideButton { 
    153     float: left; 
    154     -moz-border-radius: 4px; 
    155     -moz-box-shadow: 0 0 5px rgba(0, 0, 0, 0.3); 
    156     -webkit-border-radius: 4px; 
    157     -webkit-box-shadow: 0 0 5px rgba(0, 0, 0, 0.3); 
    158 } 
    159  
    160 .containerSlideButtonMentions { 
    161     margin-top: 51px; 
    162 } 
    163  
    164 .containerSlideButtonInfos { 
    165     margin-top: 102px; 
    166 } 
    167  
    168 #creditSlide { 
    169     z-index: 2; 
    170 } 
    171  
    172 #mentionSlide { 
    173     z-index: 1; 
    174 } 
    175  
    176 #infoSlide { 
    177     z-index: 0; 
    17850} 
    17951 
     
    18153/** ************************ OTHER ********************** **/ 
    18254/** ***************************************************** **/ 
    183 #tools .complexButton { 
    184     float: right; 
     55#loadingForUser, #loadingForWaitingUser { 
     56    margin: auto; 
    18557} 
    186  
    187 .colborder { 
    188     border-right: 1px solid #96A1BA; 
    189     margin-right: 15px; 
    190     padding-right: 29px; 
    191 } 
    192  
    193 .mainContent { 
    194     padding: 15px; 
    195 } 
    196  
    197 .roundTable { 
    198     -moz-border-radius: 4px; 
    199     -webkit-border-radius: 4px; 
    200 } 
    201  
    202 .divMenu_arrow, .divMenu_arrow.deployed { 
    203     height: 13px; 
    204     width: 13px; 
    205     position: relative; 
    206     top: -17px; 
    207     float: right; 
    208 } 
    209  
    210 .divMenu_arrow { 
    211     background-image: url("../images/utils/toggle_down_dark.png"); 
    212 } 
    213  
    214 .divMenu_arrow.deployed { 
    215     background-image: url("../images/utils/toggle_up_dark.png"); 
    216 } 
    217  
    218 .divMenu_content { 
    219     display: none; 
    220 } 
    221  
    222 /** ***************************************************** **/ 
    223 /** ************************ PAGES ********************** **/ 
    224 /** ***************************************************** **/ 
    225 #title_tools, #title_tools .links li a { 
    226     height: 39px; 
    227 } 
    228  
    229 #title_tools { 
    230     font: 12px/18px Trebuchet MS, Arial, san-serif; 
    231     margin: 18px auto 12px; 
    232     position: relative; 
    233 } 
  • ether_megapoli/trunk/web/resources/css/button.css

    r265 r267  
    6060/* POSITIVE */ 
    6161button.positive { 
     62    background-color: #F0FFF0; 
    6263    color: #529214; 
    6364} 
     
    121122/* GRAY BUTTON */ 
    122123button.gray_button { 
    123     background-color: #778899; 
    124     height: 39px; 
     124    background-image: url("../images/elements/button_middle_gray.png"); 
     125    background-repeat: repeat-x; 
     126    height: 41px; 
    125127    float: right; 
    126128    margin-right: 0; 
    127     border: 0; 
     129    position: relative; 
     130    top: -1px; 
    128131} 
    129132 
    130 .gray_button_text { 
    131     color: white; 
    132     font-size: 11px; 
    133     font-weight: bold; 
     133button.action_button { 
     134    margin-left: 5px; 
     135    margin-right: -3px; 
    134136} 
  • ether_megapoli/trunk/web/resources/css/complexButton.css

    r265 r267  
    88} 
    99 
    10 .complexButton_left, .complexButton_left_gray { 
     10.complexButton_left { 
    1111    background-image: url("../images/elements/button_left_3.png"); 
    1212    background-repeat: no-repeat; 
     
    1919 
    2020.complexButton_left_gray { 
    21     background-image: url("../images/elements/button_left_gray.png"); /*background-image: url("../images/elements/button_left.png");*/ 
     21    /*background-image: url("../images/elements/button_left_gray.png"); *//*background-image: url("../images/elements/button_left.png");*/ 
     22    -moz-border-radius: 4px 0 0 4px; 
     23    -webkit-border-radius: 4px 0 0 4px; 
     24 
     25    background-image: url("../images/elements/button_middle_gray.png"); /*background-image: url("../images/elements/button_middle.png");*/ 
     26    background-repeat: repeat-x; 
     27    height: 39px; 
     28    width: 2px; 
     29    float: left; 
    2230} 
    2331 
     
    5361} 
    5462 
    55 .complexButton_right, .complexButton_right_gray { 
     63.complexButton_right { 
    5664    background-image: url("../images/elements/button_right_3.png"); 
    5765    background-repeat: no-repeat; 
     
    6472 
    6573.complexButton_right_gray { 
    66     background-image: url("../images/elements/button_right_gray.png"); 
     74    /*background-image: url("../images/elements/button_right_gray.png");*/ 
     75    -moz-border-radius: 0 4px 4px 0; 
     76    -webkit-border-radius: 0 4px 4px 0; 
     77 
     78    background-image: url("../images/elements/button_middle_gray.png"); /*background-image: url("../images/elements/button_middle.png");*/ 
     79    background-repeat: repeat-x; 
     80    height: 39px; 
     81    width: 2px; 
     82    float: left; 
    6783} 
    6884 
  • ether_megapoli/trunk/web/resources/js/classesForJQuery/Button.js

    r240 r267  
    2424        this.callbackOnMouseOver = param.onMouseOver ? param.onMouseOver : false; 
    2525        this.callbackOnMouseOut = param.onMouseOut ? param.onMouseOut : false; 
     26        this.contextToSave = param.contextToSave ? param.contextToSave : false; 
    2627        this.boolDisabled = false; 
    2728        this.boolSelected = false; 
     
    4344 
    4445        // Define button events 
    45         this.divContainer.bind( 'click', this, this.onClick ); 
     46        if( this.contextToSave ) 
     47            this.divContainer.bind( 'click', [this, this.contextToSave], this.onClick ); 
     48        else 
     49            this.divContainer.bind( 'click', this, this.onClick ); 
    4650        this.divContainer.bind( 'mouseover', this, this.onHover ); 
    4751        this.divContainer.bind( 'mouseout', this, this.onOut ); 
     
    114118    { 
    115119        var contextButton = event.data; 
     120        var isContextToPut = false; 
     121        if( jQuery.isArray( event.data ) ) 
     122        { 
     123            isContextToPut = true; 
     124            contextButton = event.data[0]; 
     125        } 
     126 
    116127        if( !contextButton.isDisable() && (undefined == event.detail || 1 == event.detail) && contextButton.callbackOnClick ) 
    117             contextButton.callbackOnClick(); 
     128            if( isContextToPut ) 
     129                contextButton.callbackOnClick( event.data[1] ); 
     130            else 
     131                contextButton.callbackOnClick(); 
    118132    }, 
    119133 
  • ether_megapoli/trunk/web/resources/jsp/backofficeHead.jsp

    r265 r267  
    1010            this.containerTools = $( "#tools" ); 
    1111            this.containerLogin = $( "#loginModule" ); 
     12            this.containerMenu = $( "#menuBO" ); 
    1213 
    1314            /** *********** VARIABLES *********** **/ 
     
    3940            this.containerTools.append( divSmallLogoEther ); 
    4041            $( "#smallLogoEther" ).show(); 
     42 
     43            this.updateLogoEther(); 
    4144        }, 
    4245 
    4346        createLogin: function() 
    4447        { 
    45             var buttonLogin = new LoginButton( {parent:this.containerLogin, urlLogin:"project?methodName=login", urlLogout:"project?methodName=logout" } ); 
     48            var buttonLogin = new LoginButton( {parent:this.containerLogin, urlLogin:"project?methodName=login", urlLogout:"project?methodName=logout", classNameToAdd:"gray" } ); 
    4649            buttonLogin.setJSONUser( this.jSONUser ); 
    4750            buttonLogin.display(); 
     
    5053        createMenu: function() 
    5154        { 
     55            var usersButton = new Button( {value:templateTexts["bo.user"], parent:this.containerMenu, id:"button_home", className: "gray_button", classNameText:"blue_button_text", onClick:this.onClickUser} ); 
    5256        }, 
    5357 
     
    5862        }, 
    5963 
    60         onClickLogout: function() 
     64        onClickUser: function() 
    6165        { 
    62             alert( "BO" ); 
    63             document.location.href = "Disconnect.do"; 
     66            document.location.href = "backoffice?methodName=viewUser"; 
    6467        }, 
    6568 
    66         onClickLogout: function() 
     69        /** 
     70         * This method display a small Ether logo if the screen is too small to contain the big one 
     71         */ 
     72        updateLogoEther: function() 
    6773        { 
    68             alert( "BO" ); 
    69             document.location.href = "Disconnect.do"; 
     74            if( this.screenWidthLimit > innerWidth ) 
     75            { 
     76                $( "#logoEther" ).hide(); 
     77                $( "#linkLogoEther" ).hide(); 
     78                $( "#smallLogoEther" ).show(); 
     79            } 
     80            else 
     81            { 
     82                $( "#logoEther" ).show(); 
     83                $( "#linkLogoEther" ).show(); 
     84                $( "#smallLogoEther" ).hide(); 
     85            } 
    7086        } 
     87 
    7188    } ); 
    7289 
  • ether_megapoli/trunk/web/src/ApplicationResources.properties

    r261 r267  
    8585data.authentification.intro=Veuillez vous identifier afin d'acc\u00E9der aux zones prot\u00E9g\u00E9es de ce site. 
    8686data.authentification.login=Login 
    87 data.authentification.pwd=Mot de passe 
     87data.authentification.password=Mot de passe 
    8888data.authentification.sign=Connection 
    8989data.authentification.loginForget=Oubli du login ? 
     
    377377errors.logon.notFound=Ce login et/ou ce mot de passe sont inconnus.<br> Si vous voulez vous enregistrer pour obtenir l'acc\u00E8s aux zones prot\u00E9g\u00E9es du site, veuillez \u00E9crire un mail au <a href\='mailto\:{0}?subject\=[MEGAPOLI]'>webmaster</a>. <br> 
    378378errors.logon.login=Veuillez saisir votre login (normalement : votre mail).<br> 
    379 errors.logon.pwd=Veuillez saisir votre mot de passe.<br> 
     379errors.logon.password=Veuillez saisir votre mot de passe.<br> 
    380380 
    381381errors.upload.file=Vous devez s\u00E9lectionner un fichier\!<br> 
     
    408408errors.upload.updateMetadata.failed.contact_pi=Il ne peut y avoir qu'un seul contact scientifique pour un jeu de donn\u00E9es 
    409409errors.upload.updateMetadata.failed.contact_tech=Il ne peut y avoir qu'un seul contact technique pour un jeu de donn\u00E9es 
    410 errors.upload.updateMetadata.failed.pwd=Vous devez saisir un mot de passe pour chacun des contacts 
     410errors.upload.updateMetadata.failed.password=Vous devez saisir un mot de passe pour chacun des contacts 
    411411errors.upload.updateMetadata.failed.plat=Un nom de plate-forme est manquant 
    412412errors.upload.updateMetadata.failed.captfab=Un fabriquant de capteur est manquant (si inconnu, saisir "unknown") 
     
    461461data.visualization.2D=2D 
    462462data.visualization.title=Visualisation des observations 
    463 data.visualization.noPf=Pas de plateforme 
     463data.visualization.noPlateform=Pas de plateforme 
    464464data.visualization.selectPf=Plateformes 
    465465data.visualization.noParameter=Pas de param\u00E8tre 
     
    510510plot.degres=Degr\u00E9s 
    511511 
    512 ####################### BACKOFFICE ####################### 
    513 bo.fulltitle=MEGAPOLI Backoffice 
  • ether_megapoli/trunk/web/src/ApplicationResources_en.properties

    r261 r267  
    8585data.authentification.intro=Please login to access the protected areas of this website. 
    8686data.authentification.login=Login 
    87 data.authentification.pwd=Password 
     87data.authentification.password=Password 
    8888data.authentification.sign=Sign in 
    8989data.authentification.loginForget=Forgot your username ? 
     
    377377errors.logon.notFound=Unknown login and/or password.<br> To register and access the protected areas of this site, please write an email to the <a href\='mailto\:{0}?subject\=[MEGAPOLI]'>webmaster</a>.<br> 
    378378errors.logon.login=Please type your login (should be your email).<br> 
    379 errors.logon.pwd=Please type your password.<br> 
     379errors.logon.password=Please type your password.<br> 
    380380 
    381381errors.upload.file=You must select a file!<br> 
     
    408408errors.upload.updateMetadata.failed.contact_pi=Only one principal investigator is authorized for a data set 
    409409errors.upload.updateMetadata.failed.contact_tech=Only one technical manager is authorized for a data set 
    410 errors.upload.updateMetadata.failed.pwd=You must enter a password for each contact 
     410errors.upload.updateMetadata.failed.password=You must enter a password for each contact 
    411411errors.upload.updateMetadata.failed.plat=A platform name is missing 
    412412errors.upload.updateMetadata.failed.captfab=A sensor manufacturer is missing (if you can't fill in, enter "unknown") 
     
    460460data.visualization.2D=2D 
    461461data.visualization.title=Observations visualisation 
    462 data.visualization.noPf=No plateform 
     462data.visualization.noPlateform=No plateform 
    463463data.visualization.selectPf=Plateforms 
    464464data.visualization.noParameter=No parameter 
     
    513513####################### BACKOFFICE ####################### 
    514514bo.fulltitle=MEGAPOLI Backoffice 
     515bo.id=Id 
     516bo.action=Action 
     517bo.actions=Actions 
     518bo.modify=Modify 
     519bo.remove=Remove 
     520bo.add=Add 
     521bo.accept=Accept 
     522bo.refuse=Refuse 
     523bo.user=Users 
     524bo.user.waitinglist=List of users waiting to have an access to data 
     525bo.user.waitinglist.help=(an email will be sent to the user with your choice (accept or refuse)) 
     526bo.user.list=List of users 
     527bo.noUser=No user 
     528bo.user.lastName=Lastname 
     529bo.user.firstName=Firstname 
     530bo.user.email=Email 
     531bo.user.password=Password 
     532bo.user.role=Role 
     533bo.user.creationDate=Creation date 
     534bo.user.state=State 
     535bo.user.state.help=Inscription state (can be removed, unactif, refused, ...) 
     536bo.user.boAccess=BO 
     537bo.user.boAccess.help=Access to the backoffice 
     538bo.user.add=Add a new user 
     539bo.user.remove.confirm=Do you really want to remove the user 
     540 
     541bo.user.accepted=Accepted 
     542bo.user.refused=Refused 
     543bo.user.waiting=Waiting 
     544bo.user.administrator=Administrator 
     545bo.user.coordinator=Coordinator 
  • ether_megapoli/trunk/web/src/com/ether/ControllerBackoffice.java

    r247 r267  
    22 
    33import com.ether.annotation.ControllerMethod; 
    4 import com.ether.annotation.Mandatory; 
    54import com.ether.annotation.ParamName; 
    6 import com.medias.annuaire.Personne; 
    7 import com.medias.database.objects.Parametre; 
    8 import com.medias.database.objects.Plateforme; 
    9 import com.medias.megapoli.struts.forms.DatasForm; 
    10 import com.medias.megapoli.trade.MesureAdapter; 
    11 import com.medias.megapoli.trade.ValeurAdapter; 
    12 import com.medias.megapoli.utils.Requete; 
     5import com.ether.user.User; 
     6import com.ether.user.UserRole; 
     7import com.ether.user.UserState; 
    138import net.sf.json.JSONObject; 
    149import org.apache.commons.logging.Log; 
    1510import org.apache.commons.logging.LogFactory; 
    16 import org.jdom.Document; 
    17 import org.jdom.output.XMLOutputter; 
    1811import org.jetbrains.annotations.NotNull; 
    1912import org.springframework.beans.factory.annotation.Required; 
    20 import org.springframework.web.servlet.ModelAndView; 
    2113 
    22 import javax.servlet.http.HttpServletRequest; 
    23 import javax.servlet.http.HttpServletResponse; 
    24 import java.io.BufferedReader; 
    25 import java.io.DataOutputStream; 
    26 import java.io.InputStreamReader; 
    27 import java.net.URL; 
    28 import java.net.URLConnection; 
    29 import java.net.URLEncoder; 
    3014import java.util.ArrayList; 
    31 import java.util.Calendar; 
    3215import java.util.Date; 
    3316import java.util.HashMap; 
     
    4629    /** *********************************************************** **/ 
    4730    /** *********************** VIEWS ***************************** **/ 
    48     /** *********************************************************** **/ 
    49     @ControllerMethod(view = VIEW_BO_INDEX) 
     31    /** 
     32     * ********************************************************** * 
     33     */ 
     34    @ControllerMethod(view = VIEW_BO_INDEX, backofficeMethod = true) 
    5035    public Map<String, Object> view() 
    5136            throws ServiceException 
     
    5439    } 
    5540 
    56     @ControllerMethod(view = VIEW_VISUALIZATION_PARAMETER_BY_PLATEFORM) 
    57     public Map<String, Object> viewParametersByPlateform() 
     41    @ControllerMethod(view = VIEW_BO_USER, backofficeMethod = true) 
     42    public Map<String, Object> viewUser() 
    5843            throws ServiceException 
    5944    { 
    60         final List<Plateforme> plateforms = _etherService.getAllPlateforms(); 
    61         final Date firstDate = _etherService.getFirstDate(); 
    62         final Date endDate = _etherService.getLastDate(); 
     45        final List<User> waitingUsers = _etherService.getUsersByState( UserState.WAITING ); 
     46        final List<User> users = _etherService.getAllUsers(); 
    6347 
    6448        final Map<String, Object> model = new HashMap<String, Object>(); 
    65         model.put( "plateforms", getJsonHelper().toJSON( plateforms ) ); 
    66         model.put( "firstDate", DateHelper.formatDate( firstDate, DateHelper.ENGLISH_DATE_PATTERN ) ); 
    67         model.put( "lastDate", DateHelper.formatDate( endDate, DateHelper.ENGLISH_DATE_PATTERN ) ); 
     49        model.put( "jSonWaitingUsers", getJsonHelper().toJSON( waitingUsers ) ); 
     50        model.put( "jSonUsers", getJsonHelper().toJSON( users ) ); 
     51        model.put( "jSonUserStates", getJSONUserStates() ); 
     52        model.put( "jSonUserRoles", getJSONUserRoles() ); 
    6853        return model; 
    6954    } 
     
    7156    /** *********************************************************** **/ 
    7257    /** *********************** CALLS ***************************** **/ 
    73     /** *********************************************************** **/ 
     58    /** 
     59     * ********************************************************** * 
     60     */ 
     61    @ControllerMethod(jsonResult = true) 
     62    public JSONObject addUser( @ParamName(ParameterConstants.PARAMETER_NAME) final String lastName, 
     63                               @ParamName(ParameterConstants.PARAMETER_FIRST_NAME) final String firstName, 
     64                               @ParamName(ParameterConstants.PARAMETER_EMAIL) final String email, 
     65                               @ParamName(ParameterConstants.PARAMETER_PWD) final String pwd, 
     66                               @ParamName(ParameterConstants.PARAMETER_ROLE) final String role, 
     67                               @ParamName(ParameterConstants.PARAMETER_STATE) final String state, 
     68                               @ParamName(ParameterConstants.PARAMETER_HAS_ACCESS) final Boolean hasAccessToBO ) 
     69            throws WebException, ServiceException 
     70    { 
     71        final User existingUser = _etherService.getUserByEmail( email ); 
     72        if( null == existingUser ) 
     73        { 
     74            final Date creationDate = new Date(); 
     75            final User user = new User( lastName, firstName, email, pwd, role, state, hasAccessToBO, creationDate ); 
    7476 
    75    @Required 
     77            _etherService.createUser( user ); 
     78        } 
     79        else 
     80            throw new WebException( WebException.WebCode.USER_ALREADY_EXISTS, "This email already corresponds to an User" ); 
     81 
     82        final List<User> waitingUsers = _etherService.getUsersByState( UserState.WAITING ); 
     83        final List<User> users = _etherService.getAllUsers(); 
     84 
     85        final JSONObject result = new JSONObject(); 
     86        result.put( "jSonWaitingUsers", getJsonHelper().toJSON( waitingUsers ) ); 
     87        result.put( "jSonUsers", getJsonHelper().toJSON( users ) ); 
     88        return result; 
     89    } 
     90 
     91 
     92    private List<JSONObject> getJSONUserStates() 
     93    { 
     94        final UserState[] userStates = UserState.values(); 
     95 
     96        final List<JSONObject> jsonUserStates = new ArrayList<JSONObject>( userStates.length ); 
     97 
     98        for( final UserState userState : userStates ) 
     99        { 
     100            final JSONObject jsonUserState = new JSONObject(); 
     101            jsonUserState.put( "text", userState.name() ); 
     102            jsonUserState.put( "value", userState.name() ); 
     103            jsonUserStates.add( jsonUserState ); 
     104        } 
     105        return jsonUserStates; 
     106    } 
     107 
     108    private List<JSONObject> getJSONUserRoles() 
     109    { 
     110        final UserRole[] userRoles = UserRole.values(); 
     111 
     112        final List<JSONObject> jsonUserRoles = new ArrayList<JSONObject>( userRoles.length ); 
     113 
     114        for( final UserRole userRole : userRoles ) 
     115        { 
     116            final JSONObject jsonUserRole = new JSONObject(); 
     117            jsonUserRole.put( "text", userRole.name() ); 
     118            jsonUserRole.put( "value", userRole.name() ); 
     119            jsonUserRoles.add( jsonUserRole ); 
     120        } 
     121        return jsonUserRoles; 
     122    } 
     123 
     124    @Required 
    76125    public void setEtherService( @NotNull final EtherService etherService ) 
    77126    { 
     
    82131 
    83132    private static final String VIEW_BO_INDEX = "backoffice/index"; 
    84     private static final String VIEW_VISUALIZATION_PARAMETER_BY_PLATEFORM = "visualization/visu_parameter_by_pf"; 
     133    private static final String VIEW_BO_USER = "backoffice/user"; 
    85134 
    86135    private EtherService _etherService; 
Note: See TracChangeset for help on using the changeset viewer.