Changeset 667


Ignore:
Timestamp:
11/15/12 11:01:02 (11 years ago)
Author:
vmipsl
Message:

account BD

Location:
ether_statistics
Files:
10 added
11 deleted
22 edited
4 copied
1 moved

Legend:

Unmodified
Added
Removed
  • ether_statistics/common/implementation/log4j.xml

    r575 r667  
    2525    <logger name="oracle.jdbc" additivity="false"> 
    2626        <level value="info"/> 
    27         <appender-ref ref="file"/> 
    28         <appender-ref ref="console"/> 
     27        <!--<appender-ref ref="file"/>--> 
     28        <!--<appender-ref ref="console"/>--> 
    2929    </logger> 
    3030 
    3131    <logger name="oracle.ons" additivity="false"> 
    3232        <level value="debug"/> 
    33         <appender-ref ref="file"/> 
    34         <appender-ref ref="console"/> 
     33        <!--<appender-ref ref="file"/>--> 
     34        <!--<appender-ref ref="console"/>--> 
    3535    </logger> 
    3636 
    3737    <logger name="org.hibernate"> 
    3838        <level value="trace"/> 
    39         <appender-ref ref="file"/> 
    40         <appender-ref ref="consoleHibernate"/> 
     39        <!--<appender-ref ref="file"/>--> 
     40        <!--<appender-ref ref="consoleHibernate"/>--> 
    4141    </logger> 
    4242 
     
    6767    <logger name="net.sf.cglib" additivity="false"> 
    6868        <level value="warn"/> 
    69         <appender-ref ref="file"/> 
    70         <appender-ref ref="console"/> 
     69        <!--<appender-ref ref="file"/>--> 
     70        <!--<appender-ref ref="console"/>--> 
    7171    </logger> 
    7272 
     
    7474    <root> 
    7575        <level value="warn"/> 
    76         <appender-ref ref="console"/> 
    77         <appender-ref ref="file"/> 
     76        <!--<appender-ref ref="console"/>--> 
     77        <!--<appender-ref ref="file"/>--> 
    7878    </root> 
    7979 
  • ether_statistics/persistence/implementation/com/ether/dao/account/Account.hbm.xml

    r549 r667  
    44 
    55<hibernate-mapping> 
    6     <class name="com.ether.simulation.Simulation" table="simulation" schema="public"> 
     6    <class name="com.ether.account.Account" table="account" schema="public"> 
    77        <id name="id"> 
    88            <column name="id"/> 
    9  
    10             <generator class="sequence"> 
    11                 <param name="sequence">s_simulation</param> 
    12             </generator> 
    139        </id> 
    1410 
    15         <property name="location"> 
    16             <column name="location"/> 
     11        <property name="name"> 
     12            <column name="name"/> 
    1713        </property> 
    1814 
    19         <property name="xmlnsHeader"> 
    20             <column name="xmlnsheader"/> 
     15        <property name="login"> 
     16            <column name="login"/> 
    2117        </property> 
    2218 
    23         <set name="dimension" table="rel_simulation_dimension"> 
    24             <key> 
    25                 <column name="simulation_id" not-null="true"> 
    26                     <comment>The primary key</comment> 
    27                 </column> 
    28             </key> 
     19        <property name="password"> 
     20            <column name="password"/> 
     21        </property> 
    2922 
    30             <many-to-many entity-name="com.ether.simulation.Dimension"> 
    31                 <column name="dimension_id" not-null="true"/> 
    32             </many-to-many> 
    33         </set> 
    34  
    35         <set name="attribute" table="rel_simulation_attribute"> 
    36             <key> 
    37                 <column name="simulation_id" not-null="true"> 
    38                     <comment>The primary key</comment> 
    39                 </column> 
    40             </key> 
    41  
    42             <many-to-many entity-name="com.ether.simulation.Attribute"> 
    43                 <column name="attribute_id" not-null="true"/> 
    44             </many-to-many> 
    45         </set> 
    46  
    47         <set name="variable" table="rel_simulation_variable"> 
    48             <key> 
    49                 <column name="simulation_id" not-null="true"> 
    50                     <comment>The primary key</comment> 
    51                 </column> 
    52             </key> 
    53  
    54             <many-to-many entity-name="com.ether.simulation.Variable"> 
    55                 <column name="variable_id" not-null="true"/> 
    56             </many-to-many> 
    57         </set> 
    58  
    59         <property name="dates"> 
    60             <column name="dates"/> 
     23        <property name="role" type="com.ether.dao.account.AccountRoleEnum"> 
     24            <column name="role"/> 
    6125        </property> 
    6226 
  • ether_statistics/persistence/implementation/com/ether/dao/account/AccountDAOImpl.java

    r550 r667  
    1 package com.ether.dao.simulation; 
     1package com.ether.dao.account; 
    22 
    33import com.ether.PersistenceException; 
    4 import com.ether.dao.SearchableAbstractHibernateMappingDAO; 
    5 import com.ether.simulation.Simulation; 
    6 import com.ether.simulation.SimulationFilter; 
     4import com.ether.account.Account; 
     5import com.ether.dao.AccountDAO; 
     6import com.ether.dao.DomainAccessObjectImpl; 
    77import org.hibernate.criterion.DetachedCriteria; 
    8 import org.hibernate.criterion.Order; 
    9 import org.hibernate.criterion.Projections; 
    108import org.hibernate.criterion.Restrictions; 
    119import org.jetbrains.annotations.NotNull; 
    1210import org.jetbrains.annotations.Nullable; 
    13 import org.springframework.util.StringUtils; 
    14  
    15 import java.util.ArrayList; 
    16 import java.util.List; 
    1711 
    1812/** 
    1913 * @author vmipsl 
    20  * @date 13 juillet 2012 
     14 * @date 12 nov. 2012 
    2115 */ 
    22 public class SimulationDAOImpl 
    23         extends SearchableAbstractHibernateMappingDAO<Simulation, Integer, SimulationFilter> 
    24         implements SimulationDAO 
     16public class AccountDAOImpl 
     17        extends DomainAccessObjectImpl<Account, Integer> 
     18        implements AccountDAO 
    2519{ 
    26     protected SimulationDAOImpl() 
     20    protected AccountDAOImpl() 
    2721    { 
    28         super( Simulation.class, Integer.class ); 
     22        super( Account.class, Integer.class ); 
    2923    } 
    3024 
    3125    @Nullable 
    32     public Simulation getSimulationByLocation( @NotNull final String location ) 
     26    public Account getAccountByLogin( @NotNull final String login ) 
    3327            throws PersistenceException 
    3428    { 
    35         final DetachedCriteria criteria = DetachedCriteria.forClass( Simulation.class ) 
    36                 .add( Restrictions.eq( "location", location ) ); 
    37         return selectByCriteria( Simulation.class, criteria ); 
    38     } 
    39  
    40     @Nullable 
    41     public List<List<String>> getAllModels() 
    42             throws PersistenceException 
    43     { 
    44         final DetachedCriteria criteriaTitles = createCriteriaForModels( "Title", true ); 
    45         final List<Object[]> listTitles = selectAllByCriteria( Object[].class, criteriaTitles ); 
    46  
    47         final DetachedCriteria criteriaVersions = createCriteriaForModels( "Chimere_version", true ); 
    48         final List<Object[]> listVersions = selectAllByCriteria( Object[].class, criteriaVersions ); 
    49  
    50         final DetachedCriteria criteriaLevels = createCriteriaForModels( "bottom_top", false ); 
    51         final List<Object[]> listLevels = selectAllByCriteria( Object[].class, criteriaLevels ); 
    52  
    53         final List<List<String>> modelsList = new ArrayList<List<String>>(); 
    54         int i = 0; 
    55         for( final Object[] title : listTitles ) 
    56         { 
    57             final String version = (String) listVersions.get( i )[1]; 
    58             final String level = (String) listLevels.get( i )[1]; 
    59             final List<String> values = new ArrayList<String>( 3 ); 
    60             values.add( title[0].toString() ); 
    61             values.add( (String) title[1] ); 
    62             values.add( version ); 
    63             values.add( (String) title[2] ); 
    64             values.add( level ); 
    65             i++; 
    66             modelsList.add( values ); 
    67         } 
    68  
    69         return modelsList; 
    70     } 
    71  
    72     @Nullable 
    73     public String getLocationByModelId( @NotNull final Integer modelId ) 
    74             throws PersistenceException 
    75     { 
    76         final DetachedCriteria criteria = DetachedCriteria.forClass( Simulation.class ) 
    77                 .add( Restrictions.idEq( modelId ) ) 
    78                 .setProjection( Projections.property( "location" ) ); 
    79  
    80         return selectByCriteria( String.class, criteria ); 
    81     } 
    82  
    83     @Override 
    84     protected DetachedCriteria searchCriteria( @NotNull final SimulationFilter filter, final boolean isForCount ) 
    85     { 
    86         final DetachedCriteria criteria = DetachedCriteria.forClass( Simulation.class ); 
    87  
    88         if( StringUtils.hasText( filter.getSearchText() ) ) 
    89             criteria.add( Restrictions.or( escapedLike( "location", filter.getSearchText() ), escapedLike( "xmlnsHeader", filter.getSearchText() ) ) ); 
    90  
    91         if( !isForCount ) 
    92             criteria.addOrder( Order.asc( filter.getSort() ) ); 
    93         return criteria; 
    94     } 
    95  
    96     @NotNull 
    97     private DetachedCriteria createCriteriaForModels( @NotNull final String attributeName, final boolean isAttribute ) 
    98     { 
    99         final DetachedCriteria criteria = DetachedCriteria.forClass( Simulation.class, "simulation" ); 
    100         if( isAttribute ) 
    101             criteria.createCriteria( "attribute", "attribute" ) 
    102                     .add( Restrictions.eq( "attribute.name", attributeName ) ) 
    103                     .setProjection( Projections.projectionList() 
    104                             .add( Projections.property( "simulation.id" ) ) 
    105                             .add( Projections.property( "attribute.value" ) ) 
    106                             .add( Projections.property( "simulation.dates" ) ) 
    107                     ); 
    108         else 
    109             criteria.createCriteria( "dimension", "dimension" ) 
    110                     .add( Restrictions.eq( "dimension.name", attributeName ) ) 
    111                     .setProjection( Projections.projectionList() 
    112                             .add( Projections.property( "simulation.id" ) ) 
    113                             .add( Projections.property( "dimension.length" ) ) 
    114                             .add( Projections.property( "simulation.dates" ) ) 
    115                     ); 
    116  
    117         return criteria.addOrder( Order.asc( "simulation.id" ) ); 
     29        final DetachedCriteria criteria = DetachedCriteria.forClass( Account.class ) 
     30                .add( Restrictions.eq( "login", login ) ); 
     31        return selectByCriteria( Account.class, criteria ); 
    11832    } 
    11933} 
  • ether_statistics/persistence/implementation/com/ether/dao/account/AccountRoleEnum.java

    r423 r667  
    1 package com.ether.dao.user; 
     1package com.ether.dao.account; 
    22 
    33import com.ether.EnumUserType; 
    4 import com.ether.user.UserRole; 
     4import com.ether.account.AccountRole; 
    55 
    66/** 
    7  * User: vmipsl 
    8  * Date: 25 nov. 2011 
     7 * @author vmipsl 
     8 * @date 12 nov. 2012 
    99 */ 
    10 public class UserRoleEnum 
    11         extends EnumUserType<UserRole> 
     10public class AccountRoleEnum 
     11        extends EnumUserType<AccountRole> 
    1212{ 
    13     public UserRoleEnum() 
     13    public AccountRoleEnum() 
    1414    { 
    15         super( UserRole.class ); 
     15        super( AccountRole.class ); 
    1616    } 
    1717} 
  • ether_statistics/persistence/implementation/dao-context.xml

    r575 r667  
    44<!-- Application context DAO layer --> 
    55<beans> 
    6     <!--<bean id="refPlateformDAO" class="com.ether.dao.PlateformDAOImpl">--> 
    7         <!--<property name="sessionFactory">--> 
    8             <!--<ref bean="sessionFactory"/>--> 
    9         <!--</property>--> 
    10     <!--</bean>--> 
     6 
     7    <bean id="refAccountDAO" class="com.ether.dao.account.AccountDAOImpl"> 
     8        <property name="sessionFactory"> 
     9            <ref bean="sessionFactory"/> 
     10        </property> 
     11    </bean> 
    1112 
    1213</beans> 
  • ether_statistics/persistence/implementation/hibernate-domain.cfg.xml

    r572 r667  
    77    <session-factory> 
    88 
    9         <!--<mapping resource="com/ether/dao/user/User.hbm.xml"/>--> 
    10         <!--<mapping resource="com/ether/dao/person/Personne.hbm.xml"/>--> 
    11         <!--<mapping resource="com/ether/dao/mco/Mco.hbm.xml"/>--> 
    12         <!--<mapping resource="com/ether/dao/simulation/Dimension.hbm.xml"/>--> 
    13         <!--<mapping resource="com/ether/dao/simulation/Attribute.hbm.xml"/>--> 
    14         <!--<mapping resource="com/ether/dao/simulation/Variable.hbm.xml"/>--> 
    15         <!--<mapping resource="com/ether/dao/simulation/Simulation.hbm.xml"/>--> 
     9        <mapping resource="com/ether/dao/account/Account.hbm.xml"/> 
    1610 
    17         <!--<mapping resource="com/ether/dao/Query.hbm.xml"/>--> 
    1811    </session-factory> 
    1912</hibernate-configuration> 
     13 
  • ether_statistics/persistence/interface/com/ether/dao/AccountDAO.java

    r547 r667  
    1 package com.ether.dao.simulation; 
     1package com.ether.dao; 
    22 
    33import com.ether.PersistenceException; 
    4 import com.ether.dao.SearchableDomainAccessObject; 
    5 import com.ether.simulation.Simulation; 
    6 import com.ether.simulation.SimulationFilter; 
     4import com.ether.account.Account; 
    75import org.jetbrains.annotations.NotNull; 
    86import org.jetbrains.annotations.Nullable; 
    97 
    10 import java.util.List; 
    11  
    128/** 
    139 * @author vmipsl 
    14  * @date 13 juillet 2012 
     10 * @date 12 nov. 2012 
    1511 */ 
    16 public interface SimulationDAO 
    17         extends SearchableDomainAccessObject<Simulation, Integer, SimulationFilter> 
     12public interface AccountDAO 
     13        extends DomainAccessObject<Account, Integer> 
    1814{ 
    1915    @Nullable 
    20     Simulation getSimulationByLocation( @NotNull final String location ) 
    21             throws PersistenceException; 
    22  
    23     @Nullable 
    24     List<List<String>> getAllModels() 
    25             throws PersistenceException; 
    26  
    27     String getLocationByModelId( @NotNull final Integer modelId ) 
     16    Account getAccountByLogin( @NotNull final String login ) 
    2817            throws PersistenceException; 
    2918} 
  • ether_statistics/service/implementation/com/ether/EtherServiceImpl.java

    r572 r667  
    11package com.ether; 
    22 
     3import com.ether.account.Account; 
     4import com.ether.dao.AccountDAO; 
    35import org.apache.commons.logging.Log; 
    46import org.apache.commons.logging.LogFactory; 
     7import org.jetbrains.annotations.NotNull; 
     8import org.jetbrains.annotations.Nullable; 
     9import org.springframework.beans.factory.annotation.Required; 
     10import org.springframework.transaction.annotation.Transactional; 
    511 
    612/** 
     
    1117        implements EtherService 
    1218{ 
    13 //    @Nullable 
    14 //    @Transactional(readOnly = true) 
    15 //    public List<Plateforme> getAllPlateforms() 
    16 //            throws ServiceException 
    17 //    { 
    18 //        try 
    19 //        { 
    20 //            return _plateformDAO.getAllPlateforms(); 
    21 //        } 
    22 //        catch( PersistenceException e ) 
    23 //        { 
    24 //            throw new ServiceException( ServiceException.ServiceCode.PLATEFORM_NOT_FOUND, e ); 
    25 //        } 
    26 //    } 
    27 // 
     19    @Nullable 
     20    @Transactional(readOnly = true) 
     21    public Account getAccountByLogin( @NotNull final String login ) 
     22            throws ServiceException 
     23    { 
     24        try 
     25        { 
     26            return _accountDAO.getAccountByLogin( login ); 
     27        } 
     28        catch( PersistenceException e ) 
     29        { 
     30            throw new ServiceException( ServiceException.ServiceCode.PLATEFORM_NOT_FOUND, e ); 
     31        } 
     32    } 
     33 
    2834//    @NotNull 
    2935//    @Transactional(rollbackFor = Exception.class) 
     
    4147//    } 
    4248 
     49    @Required 
     50    public void setAccountDAO( final AccountDAO accountDAO ) 
     51    { 
     52        _accountDAO = accountDAO; 
     53    } 
     54 
    4355    private static final Log LOGGER = LogFactory.getLog( EtherServiceImpl.class ); 
     56 
     57    private AccountDAO _accountDAO; 
    4458} 
  • ether_statistics/service/implementation/service-context.xml

    r575 r667  
    44<beans> 
    55    <bean id="etherServiceTarget" class="com.ether.EtherServiceImpl"> 
    6         <!--<property name="simulationDAO" ref="refSimulationDAO"/>--> 
     6        <property name="accountDAO" ref="refAccountDAO"/> 
    77    </bean> 
    88    <bean id="etherService" parent="transactionProxy"> 
  • ether_statistics/service/interface/com/ether/EtherService.java

    r572 r667  
    11package com.ether; 
     2 
     3import com.ether.account.Account; 
     4import org.jetbrains.annotations.NotNull; 
     5import org.jetbrains.annotations.Nullable; 
    26 
    37/** 
    48 * @author vmipsl 
    5  * @date 07 mar 2011 
     9 * @date 12 nov. 2012 
    610 */ 
    711public interface EtherService 
    812        extends Service 
    913{ 
    10 //    @Nullable 
    11 //    List<Plateforme> getAllPlateforms() 
    12 //            throws ServiceException; 
     14    @Nullable 
     15    Account getAccountByLogin( @NotNull final String login ) 
     16            throws ServiceException; 
    1317} 
  • ether_statistics/web/WEB-INF/xml/uploadFiles.xsl

    r569 r667  
    1111    <!-- Début : on cherche le jeu désigné par le path "target" --> 
    1212    <xsl:template match="/hierarchie"> 
    13                 <xsl:text><![CDATA[<%@ page import="com.medias.Context" contentType="text/html; charset=UTF-8"%> 
     13                <xsl:text><![CDATA[<![CDATA[<%@ page import="com.medias.Context" contentType="text/html; charset=UTF-8"%> 
    1414<%@ page import="com.medias.xml.hierarchie.Hierarchie"%> 
    15 <%@ page import="com.ether.user.UserRole" %> 
    16                  
     15<%@ page import="com.ether.account.UserRole" %> 
     16 
    1717<%@ page language="java" contentType="text/html; charset=UTF-8"%> 
    1818<%@ taglib uri="/WEB-INF/tlds/struts-tiles.tld" prefix="tiles"%> 
     
    2121<%@ taglib uri="/WEB-INF/tlds/struts-logic.tld" prefix="logic"%> 
    2222 
    23 <div id="level1">]]></xsl:text> 
     23<div id="level1">]]>]]></xsl:text> 
    2424        <xsl:apply-templates select="level[@name=substring-before($target,'/')]"> 
    2525            <xsl:with-param name="new_path" select="substring-after($target,'/')"/> 
  • ether_statistics/web/WEB-INF/xml/uploadTree.xsl

    r569 r667  
    1010    <!-- On commence par écrire l'en-tête de la jsp --> 
    1111    <xsl:template match="/hierarchie"> 
    12                 <xsl:text><![CDATA[<%@ page import="com.medias.Context" contentType="text/html; charset=UTF-8"%> 
     12                <xsl:text><![CDATA[<![CDATA[<%@ page import="com.medias.Context" contentType="text/html; charset=UTF-8"%> 
    1313<%@ page import="com.medias.xml.hierarchie.Hierarchie"%> 
    14 <%@ page import="com.ether.user.UserRole" %> 
     14<%@ page import="com.ether.account.UserRole" %> 
    1515 
    1616<%@ page language="java" contentType="text/html; charset=UTF-8"%> 
     
    2020<%@ taglib uri="/WEB-INF/tlds/struts-logic.tld" prefix="logic"%> 
    2121 
    22 ]]></xsl:text> 
     22]]>]]></xsl:text> 
    2323        <xsl:apply-templates select="*"/> 
    2424        <xsl:text><![CDATA[<br><br>]]></xsl:text> 
  • ether_statistics/web/init.jsp

    r586 r667  
    11<%--This redirect is used to allow messages sources in the index page--%> 
    2 <jsp:forward page="data?methodName=view"/> 
     2<jsp:forward page="statistic?methodName=view"/> 
  • ether_statistics/web/project/credits_en.jsp

    r596 r667  
    44 
    55<div class="containerCredits"> 
    6     <div class="title2">Web site Megapoli</div> 
     6    <div class="title2">Web site Statistics</div> 
    77    This web site design was created by the CGTD IPSL. 
    88    <BR/><BR/> 
  • ether_statistics/web/project/credits_fr.jsp

    r596 r667  
    44 
    55<div class="containerCredits"> 
    6     <div class="title2">Site web Megapoli</div> 
     6    <div class="title2">Site web de Statistiques</div> 
    77    Le design de ce site a été conçu et réalisé par le CGTD IPSL. 
    88    <BR/><BR/> 
  • ether_statistics/web/project/statistics-script.jsp

    r663 r667  
    99        /** *********** CONTAINERS *********** **/ 
    1010        this.parent = $( "#containerMiddle" ); 
    11         this.containerMenu = $( "#menuCircle" ); 
     11        this.containerMenu = $( "#menuLogo" ); 
    1212        this.containerErrors = $( "#errors" ); 
    1313 
     
    1515        this.language = '<spring:message code="language"/>'; 
    1616        this.webmaster = "<%=WebHelper.getProperty(request, "mail.webmaster")%>"; 
    17         this.projectsPath = "resources/images/"; 
     17        this.jSONUser = <%=WebHelper.getJSONUser( request )%> ? <%=WebHelper.getJSONUser( request )%> : false; 
     18        this.logoSizeSmall = 30; 
     19        this.logoSizeBig = 50; 
     20 
    1821        this.projectsArray = [ 
    1922            {id:"ETHER", img:"logo_Ether_50.jpg", top:"-16px", left:"125px"}, 
     
    3437            {id:"ARLETTY", img:"logo_arletty_50.jpg", top:"-79px", left:"161.667px"} 
    3538        ]; 
    36         this.widthInitLogin = $( "#login_bg" ).width(); 
    3739        this.widthInitMentionsOrCredits = $( "#mentions" ).width(); 
    3840 
     
    4042        this.yArray = [0, 10, 30, 50, 100]; 
    4143 
    42  
    4344        this.bindButtons(); 
    44         this.createDraggableSlides(); 
    45         this.createMenuCircle(); 
     45        this.createMenuLogo(); 
    4646 
    4747        $( document ).ready( jQuery.proxy( function() 
     
    4949            $( ".containerToDrag" ).draggable(); 
    5050            // Menu 
    51             this.animateMenuCircle(); 
    52             this.bindMenuCircle(); 
    53             // Slides 
    54 //            this.onClickHelp(); 
    55             this.selectedLogo = $( "#ETHER" )[0]; 
    56             this.isSelectedLogoEther = true; 
    57             this.onClickLogo(); 
    58  
    59             this.changeRightSlide(); 
     51            this.animateMenuLogos(); 
     52            this.bindMenuLogos(); 
     53            this.createRightSlide(); 
     54 
     55            if( !this.jSONUser ) 
     56                this.onClickHelp(); 
     57            else 
     58                this.handleLogin(); 
    6059        }, this ) ); 
    6160    }, 
     
    6766        $( "#home_button" ).bind( "dblclick", this.onClickHome ); 
    6867        $( "#language_button" ).bind( "dblclick", jQuery.proxy( this.onClickLanguage, this ) ); 
    69         $( "#mail_button" ).bind( "dblclick", this.onClickMail ); 
    70         $( "#login_button" ).bind( "dblclick", jQuery.proxy( this.onClickLogin, this ) ); 
     68        $( "#mail_button" ).bind( "dblclick", jQuery.proxy( this.onClickMail, this ) ); 
    7169        $( "#help" ).bind( "click", jQuery.proxy( this.onClickHelp, this ) ); 
    7270        $( "#credits" ).bind( "dblclick", jQuery.proxy( this.onClickCredits, this ) ); 
    7371        $( "#mentions" ).bind( "dblclick", jQuery.proxy( this.onClickMentions, this ) ); 
    74     }, 
    75  
    76     createMenuCircle: function() 
    77     { 
    78         var menuSize = this.containerMenu.width(); 
    79         var nbLogosForSize = (this.projectsArray.length / 2) + 1; 
    80         var divLogoSize = menuSize / nbLogosForSize; 
    81         this.logoSize = divLogoSize - 5; 
    82  
     72        $( "#login_button" ).bind( "click", jQuery.proxy( this.onClickLogin, this ) ); 
     73        $( "#logout_button" ).bind( "dblclick", jQuery.proxy( this.onClickLogout, this ) ); 
     74    }, 
     75 
     76    createMenuLogo: function() 
     77    { 
    8378        var initTop = this.projectsArray[0].top; 
    8479        var initLeft = this.projectsArray[0].left; 
     
    8984            divLogo.addClass( "divLogo containerToDrag" ); 
    9085            divLogo.attr( {id:logo.id, style:"position:absolute; top:" + initTop + "; left:" + initLeft} ); 
    91             divLogo.html( '<img id="img_' + logo.id + '"src="' + this.projectsPath + '' + logo.img + '" width="' + this.logoSize + 'px" height="' + this.logoSize + 'px"/>' ); 
    92             $( "#menuCircle" ).append( divLogo ); 
     86            divLogo.html( '<img id="img_' + logo.id + '"src="resources/images/' + logo.img + '" width="' + this.logoSizeSmall + 'px" height="' + this.logoSizeSmall + 'px"/>' ); 
     87            this.containerMenu.append( divLogo ); 
    9388        }, this ) ); 
    9489    }, 
    9590 
    96     createDraggableSlides: function() 
     91    createAllSlides: function() 
    9792    { 
    9893        this.leftTopSlide = new DragSlide( {id:"leftTop", parent:this.parent, width:"170", height:"200", top:"140px", left:"53px", 
     
    110105            specificClass:"containerStatistics", specificTitleClass:"containerStatisticsTitle", specificContentClass:"containerStatisticsContent"} ); 
    111106 
    112         this.rightSlide = new DragSlide( {id:"right", parent:this.parent, width:"200", height:"300", top:"180px", left:"698px", 
     107        this.rightSlide = new DragSlide( {id:"right", parent:this.parent, width:"200", height:"270", top:"210px", left:"698px", 
     108            specificClass:"containerStatistics", specificTitleClass:"containerStatisticsTitle", specificContentClass:"containerStatisticsContent"} ); 
     109 
     110        this.rightLoginSlide = new DragSlide( {id:"loginRight", parent:this.parent, width:"200", height:"25", top:"170px", left:"697px", 
     111            specificClass:"containerStatistics", specificTitleClass:"containerStatisticsTitle", specificContentClass:"containerStatisticsContent"} ); 
     112    }, 
     113 
     114    createRightSlide: function() 
     115    { 
     116        this.rightSlide = new DragSlide( {id:"right", parent:this.parent, width:"200", height:"270", top:"210px", left:"698px", 
    113117            specificClass:"containerStatistics", specificTitleClass:"containerStatisticsTitle", specificContentClass:"containerStatisticsContent"} ); 
    114118    }, 
     
    122126            { 
    123127                location.reload(); 
    124             } 
     128            }, 
     129            error: jQuery.proxy( this.showErrors, [this] ) 
     130        } ); 
     131    }, 
     132 
     133    requestLogin: function() 
     134    { 
     135        var login = $( "#loginValue" ).val(); 
     136        var pwd = $( "#pwdValue" ).val(); 
     137        $.ajax( { 
     138            url: "project?methodName=login&login=" + login + "&pwd=" + pwd, 
     139            dataType: 'json', // Info needed since jquery.1.7 !! 
     140            success:jQuery.proxy( this.handleLogin, this ), 
     141            error: jQuery.proxy( this.showErrors, [this, "489px", "566px"] ) 
     142        } ); 
     143    }, 
     144 
     145    requestLogout: function() 
     146    { 
     147        $.ajax( { 
     148            url: "project?methodName=logout", 
     149            dataType: 'json', // Info needed since jquery.1.7 !! 
     150            success:jQuery.proxy( this.handleLogout, this ), 
     151            error: jQuery.proxy( this.showErrors, [this] ) 
    125152        } ); 
    126153    }, 
     
    134161            url: "statistic?methodName=searchMainStatisticsByProject&name=" + this.selectedLogo.id, 
    135162            success:jQuery.proxy( this.handleDataByLogo, this ), 
    136             error: jQuery.proxy( this.showErrors, [this] ) 
    137         } ); 
    138     }, 
    139  
    140     // HANDLES ******************************************************** = retours ajax 
     163            error: jQuery.proxy( this.showLoginError, this ) 
     164        } ); 
     165    }, 
     166 
     167    // HANDLES ******************************************************** 
    141168    handleDataByLogo: function( result ) 
    142169    { 
     
    147174    }, 
    148175 
     176    handleLogin: function( result ) 
     177    { 
     178        this.containerErrors.empty(); 
     179        this.containerErrors.css( "visibility", "hidden" ); 
     180 
     181        if( result ) 
     182            this.jSONUser = result.jSONUser; 
     183 
     184        $( "#loginValue" ).empty(); 
     185        $( "#pwdValue" ).empty(); 
     186        $( "#login_text" ).css( "visibility", "hidden" ); 
     187        $( "#login" ).animate( { 
     188            top:'47px', 
     189            left:'126px' 
     190        }, 2000, function() 
     191        { 
     192        } ); 
     193 
     194        $( "#login_bg" ).animate( { 
     195            opacity: 1, 
     196            height:'60px', 
     197            width:'67px' 
     198        }, 2000, function() 
     199        { 
     200        } ); 
     201 
     202        $( "#login_img" ).animate( { 
     203            top:'25px', 
     204            left: '16px', 
     205            width: '0', 
     206            height: '0' 
     207        }, 2000, jQuery.proxy( function() 
     208        { 
     209            // Slides 
     210            this.parent.empty(); 
     211            this.createAllSlides(); 
     212            this.changeRightSlide(); 
     213 
     214            // User 
     215            if( this.jSONUser.name ) 
     216                this.rightLoginSlide.setTitle( this.jSONUser.name ); 
     217            else 
     218                this.rightLoginSlide.setTitle( '<spring:message code="label.unknown"/>' ); 
     219            $( "#logout_button" ).css( "visibility", "visible" ); 
     220 
     221            // Logo 
     222            this.selectedLogo = $( "#ETHER" )[0]; 
     223            this.isSelectedLogoEther = true; 
     224            this.onClickLogo(); 
     225        }, this ) ); 
     226    }, 
     227 
     228    handleLogout: function() 
     229    { 
     230        this.jSONUser = false; 
     231        this.parent.empty(); 
     232        this.createRightSlide(); 
     233        this.onClickHelp(); 
     234 
     235        $( "#logout_button" ).css( "visibility", "hidden" ); 
     236        $( "#login" ).css( { zIndex:1 } ).animate( { 
     237            top:'79px', 
     238            left:'88px' 
     239        }, 2000, function() 
     240        { 
     241        } ); 
     242 
     243        $( "#login_bg" ).animate( { 
     244            opacity: 0.85, 
     245            height:'500px', 
     246            width:'500px' 
     247        }, 2000, function() 
     248        { 
     249            $( "#login_text" ).css( "visibility", "visible" ); 
     250        } ); 
     251 
     252        $( "#login_img" ).animate( { 
     253            top:'103px', 
     254            left: '148px', 
     255            width: '30px', 
     256            height: '30px' 
     257        }, 2000, function() 
     258        { 
     259        } ); 
     260    }, 
     261 
    149262    // EVENTS ******************************************************** 
    150263    onClickHome: function() 
     
    161274    { 
    162275        document.location.href = "mailto:" + this.webmaster + "?subject=[STATISTICS]"; 
    163     }, 
    164  
    165     onClickLogin: function() 
    166     { 
    167         if( this.widthInitLogin == $( "#login_bg" ).width() ) 
    168             this.enlargeLogin(); 
    169         else 
    170             this.reduceLogin(); 
    171276    }, 
    172277 
     
    191296        this.rightSlide.setTitle( '<spring:message code="label.help"/>' ); 
    192297        this.rightSlide.setContent( "<spring:message code='label.help.content'/>" ); 
    193         var backHelpButton = new Button( {value:"<spring:message code="label.display.actions"/>", parent:this.rightSlide.getDivContent(), className: "small positive back_button", onClick:jQuery.proxy( this.changeRightSlide, this )} ); 
    194     }, 
    195  
    196     onClickButtonLogin: function() 
    197     { 
    198         // TODO reduce cloud 
    199  
     298        if( this.jSONUser ) 
     299            var backHelpButton = new Button( {value:"<spring:message code="label.display.actions"/>", parent:this.rightSlide.getDivContent(), className: "small positive back_button", onClick:jQuery.proxy( this.changeRightSlide, this )} ); 
     300    }, 
     301 
     302    onClickLogin: function() 
     303    { 
     304        this.containerErrors.empty(); 
     305        this.containerErrors.css( "visibility", "hidden" ); 
     306        this.requestLogin(); 
     307    }, 
     308 
     309    onClickLogout: function() 
     310    { 
     311        this.requestLogout(); 
    200312    }, 
    201313 
     
    203315    { 
    204316        this.isSelectedLogoEther = (this.selectedLogo == $( "#ETHER" )[0]); 
    205         this.requestDataByLogo(); 
     317 
     318        if( this.jSONUser ) 
     319            this.requestDataByLogo(); 
     320        else 
     321        { 
     322            this.showErrors( "<spring:message code="error.connection.need"/>" ); 
     323            this.containerErrors.css( {top:"489px", left:"566px"} ); 
     324            this.containerErrors.css( "visibility", "visible" ); 
     325        } 
    206326    }, 
    207327 
     
    221341    { 
    222342        var context = this[0] ? this[0] : this; 
    223         var text = this[1]; 
     343        var topValue = this[1] ? this[1] : false; 
     344        var leftValue = this[2] ? this[2] : false; 
    224345        context.containerErrors.show(); 
    225 //        if( text ) 
    226 //            context.containerErrors.html( interfaceTexts[result.responseText] + " " + text ); 
    227 //        else if( interfaceTexts[result.responseText] ) 
    228 //            context.containerErrors.html( interfaceTexts[result.responseText] ); 
    229         if( result.responseText ) 
     346        if( result.responseText && interfaceTexts[result.responseText] ) 
     347            context.containerErrors.html( interfaceTexts[result.responseText] ); 
     348        else if( result.responseText ) 
    230349            context.containerErrors.html( result.responseText ); 
    231350        else 
    232351            context.containerErrors.html( result ); 
    233     }, 
    234  
    235     reduceLogin: function() 
    236     { 
    237         $( "#login" ).css( { zIndex:0 } ); 
    238         $( "#login_text" ).css( "visibility", "hidden" ); 
    239         $( "#login_bg" ).animate( { 
    240             opacity: 1, 
    241             height:'60px', 
    242             width:'78px', 
    243             zIndex:'0' 
    244         }, 2000, function() 
    245         { 
    246         } ); 
    247  
    248         $( "#login_button" ).animate( { 
    249             top:'16px', 
    250             left: '20px' 
    251         }, 2000, function() 
    252         { 
    253         } ); 
    254     }, 
    255  
    256     enlargeLogin: function() 
    257     { 
    258         $( "#login" ).css( { zIndex:1 } ); 
    259         $( "#login_bg" ).animate( { 
    260             opacity: 0.45, 
    261             height:'500px', 
    262             width:'500px' 
    263         }, 2000, function() 
    264         { 
    265             $( "#login_text" ).css( "visibility", "visible" ); 
    266         } ); 
    267  
    268         $( "#login_button" ).animate( { 
    269             top:'82px', 
    270             left: '155px' 
    271         }, 2000, function() 
    272         { 
    273         } ); 
     352        if( topValue && leftValue ) 
     353            context.containerErrors.css( {top: topValue, left: leftValue} ); 
     354        context.containerErrors.css( "visibility", "visible" ); 
     355    }, 
     356 
     357    showLoginError: function( result ) 
     358    { 
     359        this.onClickLogout(); 
     360        this.onClickLogo(); 
    274361    }, 
    275362 
     
    287374            opacity: 1, 
    288375            height:'42px', 
    289             width:'59px', 
     376            width:this.widthInitMentionsOrCredits + 'px', 
    290377            zIndex:'0' 
    291378        }, 2000, function() 
     
    317404    }, 
    318405 
    319     animateMenuCircle: function() 
     406    animateMenuLogos: function() 
    320407    { 
    321408        jQuery.each( this.projectsArray, jQuery.proxy( function( i, logo ) 
     
    330417    }, 
    331418 
    332     bindMenuCircle: function() 
    333     { 
     419    bindMenuLogos: function() 
     420    { 
     421        var gap = (this.logoSizeBig - this.logoSizeSmall) / 2; 
     422        var logoSizeBig = this.logoSizeBig + "px"; 
     423        var logoSizeSmall = this.logoSizeSmall + "px"; 
    334424        var gridimage; 
    335         $( '.divLogo' ).mouseover( 
    336                 function() 
    337                 { 
    338                     gridimage = $( this ).find( 'img' ); //Define target as a variable 
    339                     gridimage.stop().animate( {width: 50, height:50}, 150 ); 
    340                 } ).mouseout( 
    341                 jQuery.proxy( function( element ) 
    342                 { 
    343                     this.selectedLogo = element.currentTarget; 
    344                     gridimage.stop().animate( {width: this.logoSize, height:this.logoSize}, 150 ); 
    345                 }, this ) ).dblclick( 
    346                 jQuery.proxy( function() 
    347                 { 
    348                     this.onClickLogo(); 
    349                 }, this ) ); 
     425 
     426        $( '.divLogo' ).mouseover( function( element ) 
     427        { 
     428            gridimage = $( this ).find( 'img' ); //Define target as a variable 
     429            gridimage.stop().animate( { 
     430                width: logoSizeBig, 
     431                height: logoSizeBig 
     432            }, 150 ); 
     433            $( this ).animate( { 
     434                top: "-=10px", 
     435                left: "-=10px" 
     436            }, 150 ); 
     437        } ); 
     438 
     439        $( '.divLogo' ).mouseout( function( element ) 
     440        { 
     441            $( this ).animate( { 
     442                top: "+=10px", 
     443                left: "+=10px" 
     444            }, 150 ); 
     445            gridimage.stop().animate( { 
     446                width: logoSizeSmall, 
     447                height:logoSizeSmall 
     448            }, 150 ); 
     449        } ); 
     450 
     451        $( '.divLogo' ).dblclick( jQuery.proxy( function( element ) 
     452        { 
     453            this.selectedLogo = element.currentTarget; 
     454            this.onClickLogo(); 
     455        }, this ) ); 
    350456    }, 
    351457 
     
    379485        new Button( {value:"<spring:message code="statistics.data.download"/>", parent:this.rightSlide.getDivContent(), className: "positive action_button", onClick:jQuery.proxy( this.displayDownloadEvolution, this )} ); 
    380486        new Button( {value:"<spring:message code="statistics.map.distribution"/>", parent:this.rightSlide.getDivContent(), className: "positive action_button", onClick:jQuery.proxy( this.displayMapDistribution, this )} ); 
    381         new Button( {value:"<spring:message code="label.export"/>", parent:this.rightSlide.getDivContent(), className: "blue export_button print-preview", onClick:jQuery.proxy( this.onClickPrint, this )} ); 
     487        new Button( {value:"<spring:message code="label.print"/>", parent:this.rightSlide.getDivContent(), className: "blue export_button print-preview", onClick:jQuery.proxy( this.onClickPrint, this )} ); 
    382488    }, 
    383489 
     
    547653        this.changeMiddleSlideForMap(); 
    548654    } 
     655 
    549656} ); 
    550657 
  • ether_statistics/web/project/statistics.jsp

    r663 r667  
    2222    <ether:htmlCss cssFile="printContent"/> 
    2323 
    24     <ether:htmlJs jsFile="library/jquery-1.8.2"/> 
     24    <ether:htmlJs jsFile="library/jquery-1.8.2.min"/> 
    2525    <ether:htmlJs jsFile="library/jquery-ui-1.9.0.custom"/> 
    2626    <ether:htmlJs jsFile="library/jquery.class"/> 
     
    5050 
    5151        <div id="login" class="containerToDrag"> 
    52             <img id="login_bg" src='resources/images/cloud.png' width="88px" height="71px"/> 
    53             <img id="login_button" src='resources/images/Milky/Chat.png' width="30px" height="30px"/> 
     52            <img id="login_bg" src='resources/images/cloud.png' width="500px" height="500px"/> 
     53            <img id="login_img" src='resources/images/Milky/Chat.png' width="30px" height="30px"/> 
    5454 
    5555            <div id="login_text"> 
    5656                <div id="login_text_title"><spring:message code="label.connection"/></div> 
    5757                <div id="login_text_content"> 
    58                     <spring:message code="label.firstname"/> : <input type="text" size="30"><BR/><BR/> 
    59                     <spring:message code="label.lastname"/> : <input type="text" size="30"><BR/><BR/><BR/> 
     58                    <spring:message code="label.login"/> : <input id="loginValue" type="text" size="30"><BR/><BR/> 
     59                    <spring:message code="label.pwd"/> : <input id="pwdValue" type="text" size="30"><BR/><BR/><BR/> 
    6060 
    6161                    <div style="float:right"> 
    62                         <button><spring:message code="label.connection"/></button> 
     62                        <button id="login_button"><spring:message code="label.connection"/></button> 
    6363                    </div> 
    6464                </div> 
    6565            </div> 
     66            <div id="login_user"></div> 
     67            <img id="logout_button" src='resources/images/utils/man_logout_small.png' width="25px" height="25px"/> 
    6668        </div> 
    6769 
     
    9496    </div> 
    9597 
    96     <div class="menuCircle" id="menuCircle"></div> 
     98    <div id="menuLogo" class="menuLogo"></div> 
    9799 
    98100    <div id="containerMiddle"></div> 
    99101 
    100     <div id="errors"></div> 
     102    <div id="errors" class="containerToDrag"></div> 
    101103 
    102104    <script type="text/javascript"> 
    103         var texts = $A( "" ); 
     105        var interfaceTexts = $A( "" ); 
     106        interfaceTexts["ERROR_PASSWORD"] = "<spring:message code='ERROR_PASSWORD'/>"; 
     107        interfaceTexts["ERROR_LOGIN_NOT_FOUND"] = "<spring:message code='ERROR_LOGIN_NOT_FOUND'/>"; 
     108        interfaceTexts["ERROR_ENCRYPT_PASSWORD"] = "<spring:message code='ERROR_ENCRYPT_PASSWORD'/>"; 
    104109 
    105110        new InterfaceStatistics(); 
  • ether_statistics/web/resources/css/statistics.css

    r654 r667  
    7575} 
    7676 
    77 .menuCircle { 
     77.menuLogo { 
    7878    position: relative; 
    7979    float: right; 
     
    8282} 
    8383 
    84 .containerErrors, #errors { 
     84#errors { 
     85    position: absolute; 
    8586    background: #FEF1EC; 
    8687    -moz-border-radius: 4px 4px 4px 4px; 
     
    9192    margin: 10px; 
    9293    float: right; 
    93     display:none; 
    94 } 
    95  
    96 .containerErrors { 
    9794    display: none; 
     95    z-index: 2; 
    9896} 
    9997 
     
    194192 
    195193#login { 
    196     position: relative; 
     194    position: absolute; 
    197195    float: left; 
    198     margin-right: 10px; 
    199     top: 41px; 
    200     left: 4px; 
     196    top: 79px; 
     197    left: 88px; 
    201198} 
    202199 
    203200#login_bg { 
    204201    position: absolute; 
    205     top: 0; 
    206     left: 0; 
    207 } 
    208  
    209 #login_button { 
    210     position: absolute; 
    211     top: 21px; 
    212     left: 25px; 
     202} 
     203 
     204#login_img { 
     205    position: relative; 
     206    top: 103px; 
     207    left: 148px; 
     208} 
     209 
     210#logout_button { 
     211    position: relative; 
     212    top: 17px; 
     213    left: 18px; 
     214    visibility: hidden; 
    213215} 
    214216 
    215217#login_text, #credits_text, #mentions_text { 
    216     visibility: hidden; 
    217218    position: absolute; 
    218219} 
    219220 
    220221#login_text_title { 
    221     position: absolute; 
    222     top: 76px; 
    223     left: 171px; 
     222    position: relative; 
     223    top: 81px; 
     224    left: 186px; 
    224225    font-weight: bold; 
    225226} 
    226227 
    227228#login_text_content { 
    228     position: absolute; 
    229     top: 163px; 
    230     left: 80px; 
     229    position: relative; 
     230    top: 143px; 
     231    left: 96px; 
    231232    width: 273px; 
     233} 
     234 
     235#login_user { 
     236    position: relative; 
     237    color: #65981E; 
     238    font-size: 9px; 
     239    font-weight: bold; 
     240    top: 6px; 
     241    left: 39px; 
     242} 
     243 
     244#loginRight { 
     245    color: white; 
     246} 
     247 
     248#loginRight .containerStatisticsTitle { 
     249    text-align: center; 
    232250} 
    233251 
  • ether_statistics/web/src/com/ether/ControllerEponge.java

    r574 r667  
    11package com.ether; 
    22 
     3import com.ether.account.Account; 
    34import com.ether.annotation.ControllerMethod; 
    45import com.ether.annotation.ParamName; 
    5 import com.ether.user.User; 
    66import net.sf.json.JSONObject; 
    77import org.apache.commons.logging.Log; 
    88import org.apache.commons.logging.LogFactory; 
    99import org.jetbrains.annotations.NotNull; 
    10 import org.springframework.mail.javamail.JavaMailSenderImpl; 
    11 import org.springframework.mail.javamail.MimeMessageHelper; 
    1210 
    13 import javax.mail.MessagingException; 
    14 import javax.mail.internet.MimeMessage; 
    1511import javax.servlet.http.HttpServletRequest; 
     12import java.security.DigestException; 
     13import java.security.NoSuchAlgorithmException; 
    1614import java.util.HashMap; 
    1715import java.util.Map; 
     
    5654                             @ParamName(ParameterConstants.PARAMETER_PWD) final String password, 
    5755                             @NotNull final HttpServletRequest request ) 
    58             throws ServiceException 
     56            throws WebException 
    5957    { 
    6058        final JSONObject jSONUser = new JSONObject(); 
     
    6563            try 
    6664            { 
    67 //                final User user = getTapasService().getUserByEmail( login ); 
    68 //                final String encryptedPassword = EtherHelper.encryptPassword( password ); 
    69 //                if( user == null ) 
    70 //                    result.put( "errors", "login.error.notFound" ); 
    71 //                else if( !encryptedPassword.equals( user.getPassword() ) ) 
    72 //                    result.put( "errors", "login.error.wrongPassword" ); 
    73 //                else 
    74 //                { 
    75 //                    request.getSession().setAttribute( "SES_USER", user ); 
    76 //                    jSONUser.put( "name", user.getLastName() ); 
    77 //                    jSONUser.put( "firstName", user.getFirstName() ); 
    78 //                    jSONUser.put( "role", user.getRole().name() ); 
    79 //                } 
     65                final Account account = getEtherService().getAccountByLogin( login ); 
     66                final String encryptedPassword = EtherHelper.encryptPassword( password ); 
     67                if( account == null ) 
     68                    throw new WebException( WebException.WebCode.ERROR_LOGIN_NOT_FOUND, "No login found", WebException.getExceptionThrowable() ); 
     69                else if( !encryptedPassword.equals( account.getPassword() ) ) 
     70                    throw new WebException( WebException.WebCode.ERROR_PASSWORD, "Wrong password", WebException.getExceptionThrowable() ); 
     71                else 
     72                { 
     73                    request.getSession().setAttribute( "SES_ACCOUNT", account ); 
     74                    jSONUser.put( "name", account.getName() ); 
     75                    jSONUser.put( "role", account.getRole() ); 
     76                } 
    8077            } 
    81             catch( Exception e ) 
     78            catch( DigestException e ) 
    8279            { 
    83                 result.put( "errors", "login.error.failed" ); 
     80                throw new WebException( WebException.WebCode.ERROR_ENCRYPT_PASSWORD, "Error to encrypt password", WebException.getExceptionThrowable() ); 
     81            } 
     82            catch( NoSuchAlgorithmException e ) 
     83            { 
     84                throw new WebException( WebException.WebCode.ERROR_ENCRYPT_PASSWORD, "Error to encrypt password", WebException.getExceptionThrowable() ); 
     85            } 
     86            catch( ServiceException e ) 
     87            { 
     88                throw new WebException( WebException.WebCode.ERROR_LOGIN_NOT_FOUND, "Error no login found", WebException.getExceptionThrowable() ); 
    8489            } 
    8590        } 
     
    9297    @ControllerMethod(requestMandatory = true, jsonResult = true) 
    9398    public JSONObject logout( @NotNull final HttpServletRequest request ) 
    94             throws ServiceException 
     99            throws WebException 
    95100    { 
    96         request.getSession().setAttribute( "SES_USER", null ); 
     101        request.getSession().setAttribute( "SES_ACCOUNT", null ); 
    97102        request.getSession().invalidate(); 
    98103 
     
    100105    } 
    101106 
    102  
    103 //    @ControllerMethod(jsonResult = true) 
    104 //    public JSONObject createAccount( @NotNull @ParamName(ParameterConstants.PARAMETER_NAME) final String lastName, 
    105 //                                     @Nullable @ParamName(ParameterConstants.PARAMETER_FIRST_NAME) final String firstName, 
    106 //                                     @NotNull @ParamName(ParameterConstants.PARAMETER_EMAIL) final String email, 
    107 //                                     @NotNull @ParamName(ParameterConstants.PARAMETER_PWD) final String password, 
    108 //                                     @Nullable @ParamName(ParameterConstants.PARAMETER_LABORATORY) final String laboratory, 
    109 //                                     @Nullable @ParamName(ParameterConstants.PARAMETER_COUNTRY) final String country ) 
    110 //            throws ServiceException, WebException 
    111 //    { 
    112 //        try 
    113 //        { 
    114 //            final User existingUser = getTapasService().getUserByEmail( email ); 
    115 //            if( null == existingUser ) 
    116 //            { 
    117 //                final Date creationDate = new Date(); 
    118 // 
    119 //                final String encryptedPassword = EtherHelper.encryptPassword( password ); 
    120 //                final User user = new User( lastName, firstName, email, encryptedPassword, UserRole.USER, false, laboratory, country, creationDate ); 
    121 // 
    122 //                getTapasService().createUser( user ); 
    123 // 
    124 //                // Send email to administrator to inform there is a new account 
    125 //                sendEmailToAdministratorAndUser( user ); 
    126 //            } 
    127 //            else 
    128 //                throw new WebException( WebException.WebCode.USER_ALREADY_EXISTS, "This email already corresponds to an User", WebException.getExceptionThrowable() ); 
    129 //        } 
    130 //        catch( DigestException e ) 
    131 //        { 
    132 //            throw new WebException( WebException.WebCode.ERROR_ENCRYPT_PASSWORD, "This password cannot be encrypted" ); 
    133 //        } 
    134 //        catch( NoSuchAlgorithmException e ) 
    135 //        { 
    136 //            throw new WebException( WebException.WebCode.ERROR_ENCRYPT_PASSWORD, "This password cannot be encrypted" ); 
    137 //        } 
    138 // 
    139 //        return new JSONObject(); 
    140 //    } 
    141  
    142     /** 
    143      * This method create and send an email to : 
    144      * - the administrator to inform there is a new created account 
    145      * - the user to inform his account is created 
    146      * 
    147      * @param user 
    148      * @throws WebException 
    149      */ 
    150     private void sendEmailToAdministratorAndUser( @NotNull final User user ) 
    151             throws WebException 
    152     { 
    153         try 
    154         { 
    155             final String host = getProperty( "mail.host" ); 
    156             final String webMaster = getProperty( "mail.webmaster" ); 
    157             final JavaMailSenderImpl sender = new JavaMailSenderImpl(); 
    158             sender.setHost( host ); 
    159  
    160             final MimeMessage message = sender.createMimeMessage(); 
    161             final MimeMessageHelper helper = new MimeMessageHelper( message ); 
    162  
    163             // Mail Admin 
    164             final String subjectAdmin = "[TAPAS] Nouveau compte utilisateur"; 
    165             final String contentAdmin = "Nouvelle création de compte : \n\n" + 
    166                     "   - Nom : " + user.getLastName() + '\n' + 
    167                     "   - Prénom : " + user.getFirstName() + '\n' + 
    168                     "   - Email : " + user.getEmail() + "\n\n" + 
    169                     "Le serveur de mail masqué"; 
    170  
    171             helper.setFrom( webMaster ); 
    172             helper.setTo( webMaster ); 
    173             helper.setSubject( subjectAdmin ); 
    174             helper.setText( contentAdmin ); 
    175             sender.send( message ); 
    176  
    177             // Mail User 
    178             final String subjectUser = "[TAPAS] New account"; 
    179             final String contentUser = "Dear " + user.getLastName() + "\n\n" + 
    180                     "Your account on TAPAS is now created. You can access to the website with your email as login and your password.\n\n" + 
    181                     "The TAPAS Administrator"; 
    182  
    183             helper.setFrom( webMaster ); 
    184             helper.setTo( user.getEmail() ); 
    185             helper.setSubject( subjectUser ); 
    186             helper.setText( contentUser ); 
    187             sender.send( message ); 
    188         } 
    189         catch( MessagingException e ) 
    190         { 
    191             throw new WebException( WebException.WebCode.ERROR_EMAIL_CANNOT_BE_SEND, "The email cannot be send to the TAPAS administrator or USER" ); 
    192         } 
    193     } 
    194  
    195 //    @ControllerMethod(downloadFile = DOWNLOAD_DATA_PROTOCOL_EN) 
    196 //    public void downloadFileDataProtocolEn() 
    197 //    { 
    198 //    } 
    199 // 
    200 //    @ControllerMethod(downloadFile = DOWNLOAD_DATA_PROTOCOL_FR) 
    201 //    public void downloadFileDataProtocolFr() 
    202 //    { 
    203 //    } 
    204 // 
    205107    private static final Log LOGGER = LogFactory.getLog( ControllerEponge.class ); 
    206  
    207108    private static final String VIEW_INIT = "init"; 
    208     private static final String VIEW_DATA_PROTOCOL_EN = "project/home_dataProtocol_en"; 
    209     // TODO : mettre les bons fichiers de Dataprotocol 
    210     private static final String DOWNLOAD_DATA_PROTOCOL_EN = "bib.txt"; 
    211     private static final String DOWNLOAD_DATA_PROTOCOL_FR = "bib.txt"; 
    212109} 
  • ether_statistics/web/src/com/ether/ControllerEther.java

    r574 r667  
    11package com.ether; 
    22 
     3import com.ether.account.Account; 
    34import com.ether.annotation.ControllerMethod; 
    45import com.ether.annotation.Mandatory; 
    56import com.ether.annotation.ParamName; 
    67import com.ether.annotation.UseJSON; 
    7 import com.ether.user.User; 
    88import net.sf.json.JSON; 
    99import net.sf.json.JSONArray; 
     
    113113            // Parse parameters 
    114114            final Object[] params = buildParams( methodDescription, request ); 
    115             final String defaultView = ( null != methodDescription.getDefaultView() && !"".equals( methodDescription.getDefaultView() ) ) ? methodDescription.getDefaultView() : methodDescription.getView(); 
    116  
    117115 
    118116            if( methodDescription.isRequestMandatory() ) 
    119117                params[params.length - 1] = request; //params = parametre de la methode du Controller 
    120118 
    121  
    122119            if( methodDescription.isLoginMandatory() ) 
    123120            { 
    124                 final User user = (User) request.getSession().getAttribute( "SES_USER" ); 
    125                 if( null == user ) 
    126                     return new ModelAndView( defaultView, "errors", "login.error.unknown" ); 
     121                final Account account = (Account) request.getSession().getAttribute( "SES_ACCOUNT" ); 
     122                if( null == account ) 
     123                { 
     124                    sendSerializedException( response, new WebException( WebException.WebCode.ERROR_LOGIN_NOT_FOUND, "No login found", WebException.getExceptionThrowable() ) ); 
     125                    return null; 
     126                } 
    127127            } 
    128128 
     
    135135//                    params[params.length - 1] = user; 
    136136//            } 
    137 // 
    138             if( methodDescription.isBackofficeMethod() ) 
    139             { 
    140                 final User user = (User) request.getSession().getAttribute( "SES_USER" ); 
    141                 if( null == user ) 
    142                 { 
    143                     return new ModelAndView( defaultView, "errors", "login.error.unknown" ); 
    144                 } 
    145                 else if( null != user && !user.isAccessToBO() ) 
    146                 { 
    147                     return new ModelAndView( defaultView, "errors", "login.error.bo.notAccepted" ); 
    148                 } 
    149             } 
    150137 
    151138            final Object result; 
     
    177164                return null; 
    178165            } 
    179 //            else if( null != methodDescription.getDownloadFile() && !"".equals( methodDescription.getDownloadFile() ) ) 
    180 //            { 
    181 //                final String fileName = methodDescription.getDownloadFile(); 
    182 //                final String downloadPath = getProperty( "downloadPath" ); 
    183 //                WebHelper.downloadFileToResponse( fileName, downloadPath, response ); 
    184 //                return null; 
    185 //            } 
    186166            else 
    187167            { 
     
    190170            } 
    191171        } 
    192         catch( Throwable e ) 
    193         { 
    194             throw new WebException( e ); 
     172        catch( IOException e ) 
     173        { 
     174            throw new WebException( WebException.WebCode.IO_EXCEPTION_ERROR, e ); 
    195175        } 
    196176    } 
  • ether_statistics/web/src/com/ether/ControllerStatistics.java

    r657 r667  
    3030            throws ServiceException 
    3131    { 
    32         return new ModelAndView( VIEW_ERRORS ); 
     32        return new ModelAndView( VIEW_INIT ); 
    3333    } 
    3434 
     
    3737            throws ServiceException 
    3838    { 
    39 //        final Calendar cal = Calendar.getInstance(); 
    40 //        final Date today = cal.getTime(); 
    41 //        cal.set( 1900, Calendar.JANUARY, 1 ); 
    42 //        final Date begin = cal.getTime(); 
    43 //        cal.set( Calendar.DST_OFFSET, 40001 ); 
    44 //        final Date bob = cal.getTime(); 
    4539        return new HashMap<String, Object>(); 
    4640    } 
     
    5650     * @throws ServiceException 
    5751     */ 
    58     @ControllerMethod(jsonResult = true) 
     52    @ControllerMethod(jsonResult = true, loginMandatory = true) 
    5953    public JSONObject searchMainStatisticsByProject( @Mandatory @ParamName(ParameterConstants.PARAMETER_NAME) final String projectName ) 
    6054            throws ServiceException 
     
    7064    private static final Log LOGGER = LogFactory.getLog( ControllerStatistics.class ); 
    7165 
     66    private static final String VIEW_INIT = "init"; 
    7267    private static final String VIEW_STATISTICS = "project/statistics"; 
    73     private static final String VIEW_VISUALIZATION_PARAMETER_BY_PLATEFORM = "visualization/visu_parameter_by_pf"; 
    74     private static final String VIEW_DOWNLOAD_OK = "data/access/extract3"; 
    75     private static final String VIEW_WORK = "project/inWork"; 
    76     public static final String VIEW_ERRORS = "project/errors"; 
    77  
    78     private static final String FORMAT_DEFAULT = "NASA-AMES"; 
    79     private static final String COMPRESSION_DEFAULT = "None"; 
    8068} 
  • ether_statistics/web/src/com/ether/WebException.java

    r574 r667  
    4141        ERROR_NO_REQUEST_HANDLING_METHOD, 
    4242        ERROR_NUMBER_OF_PARAM_TYPES_NOT_EQUAL_TO_PARAM_ANNOTATIONS, 
    43         USER_ALREADY_EXISTS, 
    4443        ERROR_ENCRYPT_PASSWORD, 
    45         ERROR_EMAIL_CANNOT_BE_SEND, 
    46         ERROR_XML_CREATION, 
    47         ERROR_NO_OBSERVATORY_FOUND, 
    48         ERROR_NO_USER_FOUND, 
     44        ERROR_PASSWORD, 
     45        ERROR_LOGIN_NOT_FOUND, 
    4946        ERROR_TO_READ_FILE_PROPERTIES, 
    50         ERROR_TO_REMOVE_USER, 
    51         ERROR_USERS_CREATION 
     47        IO_EXCEPTION_ERROR 
    5248    } 
    5349 
  • ether_statistics/web/src/com/ether/WebHelper.java

    r587 r667  
    22 
    33import com.ether.WebException.WebCode; 
    4 import com.ether.user.User; 
     4import com.ether.account.Account; 
    55import net.sf.json.JSONObject; 
    66import org.apache.commons.logging.Log; 
     
    8686        final JSONObject jSONPeople = new JSONObject(); 
    8787 
    88         final User user = (User) request.getSession().getAttribute( "SES_USER" ); 
    89         if( null == user ) 
     88        final Account account = (Account) request.getSession().getAttribute( "SES_ACCOUNT" ); 
     89        if( null == account ) 
    9090            return null; 
    9191 
    92         jSONPeople.put( "name", user.getLastName() ); 
    93         jSONPeople.put( "firstName", user.getFirstName() ); 
    94         jSONPeople.put( "role", user.getRole() ); 
     92        jSONPeople.put( "name", account.getName() ); 
     93        jSONPeople.put( "role", account.getRole() ); 
    9594        return jSONPeople; 
    9695    } 
  • ether_statistics/web/src/messages_en.properties

    r654 r667  
    88label.firstname=First name 
    99label.lastname=Last name 
     10label.login=Login 
     11label.pwd=Password 
    1012label.help=Help 
    11 label.help.content=All slides and objects on this site are <B>draggable</B>. You can move them to arrange your own desktop.<BR/>To do some actions such as login or select a logo, please use the <B>double click</B> ! 
     13label.help.content=All slides and objects on this site are <B>draggable</B>. You can move them to arrange your own desktop.<BR/>To do some actions such as logout or select a logo, please use the <B>double click</B> ! 
    1214label.display.actions=Display actions 
    1315label.actions=Actions 
    1416label.mentions=Mentions 
    1517label.credits=Credits 
    16 label.export=Export PDF 
     18label.print=Print 
     19label.unknown=Unknown 
    1720 
    1821statistics.online=Online since 
     
    4043statistics.distribution.download=Downloads distribution 
    4144statistics.map.distribution=Geographic distribution 
     45 
     46error.connection.need=Please connect to access to statistics 
     47error.login.failed=Error to connect 
     48ERROR_LOGIN_NOT_FOUND=Error : unknown login 
     49ERROR_PASSWORD=Error : wrong password 
     50ERROR_ENCRYPT_PASSWORD=Error : password can't be encrypted 
  • ether_statistics/web/src/messages_fr.properties

    r654 r667  
    88label.firstname=Prénom 
    99label.lastname=Nom 
     10label.login=Login 
     11label.pwd=Mot de passe 
    1012label.help=Aide 
    11 label.help.content=Tous les objets de ce site sont <B>déplacables</B>, vous pouvez donc ainsi arranger leur positionnement à votre convenance. <BR/>Pour effectuer des actions telles login ou sélection d\'un projet via son logo, veuillez utiliser le <B>double click</B> ! 
     13label.help.content=Tous les objets de ce site sont <B>déplacables</B>, vous pouvez donc ainsi arranger leur positionnement à votre convenance. <BR/>Pour effectuer des actions telles déconnexion ou sélection d\'un projet via son logo, veuillez utiliser le <B>double click</B> ! 
    1214label.display.actions=Afficher les actions 
    1315label.actions=Actions 
    1416label.mentions=Mentions 
    1517label.credits=Crédits 
    16 label.export=Export PDF 
     18label.print=Imprimer 
     19label.unknown=Inconnu 
    1720 
    1821statistics.online=En ligne depuis le 
     
    4043statistics.distribution.download=Répartition des téléchargements 
    4144statistics.map.distribution=Répartition géographique 
     45 
     46error.connection.need=Veuillez tout d'abord vous connecter 
     47error.login.failed=Erreur de connexion 
     48ERROR_LOGIN_NOT_FOUND=Erreur : login inconnu 
     49ERROR_PASSWORD=Erreur : mot de passe incorrect 
     50ERROR_ENCRYPT_PASSWORD=Erreur d'encryptage du mot de passe 
  • ether_statistics/web/src/statistics.properties

    r580 r667  
    11mail.host=mailhost.ipsl.jussieu.fr 
    22mail.webmaster=vmipsl@ipsl.jussieu.fr 
    3 downloadPath=/home_local/ 
    4 service_path=/home_local/workspaces/ 
    5 src_path=/home_local/workspaces/statistics/ 
    6 data_path=/home_local/workspaces/ 
    7  
Note: See TracChangeset for help on using the changeset viewer.