Ignore:
Timestamp:
12/07/11 16:10:28 (13 years ago)
Author:
vmipsl
Message:

Ajout bouton BO

Location:
ether_megapoli/trunk/web/resources/js/classesForJQuery
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • ether_megapoli/trunk/web/resources/js/classesForJQuery/Button.js

    r267 r290  
    1919        this.parent = param.parent ? param.parent : false; 
    2020        this.value = param.value ? param.value : ""; 
     21        this.title = param.title ? param.title : false; 
    2122        this.className = param.className ? param.className : false; 
    2223        this.classNameText = param.classNameText ? param.classNameText : false; 
     
    3334        if( this.className ) 
    3435            this.divContainer.addClass( this.className ); 
    35         this.divContainer.attr( {id:this.id} ); 
     36        if( this.title ) 
     37            this.divContainer.attr( {id:this.id, title:this.title} ); 
     38        else 
     39            this.divContainer.attr( {id:this.id} ); 
    3640        if( this.parent ) 
    3741            this.parent.append( this.divContainer ); 
  • ether_megapoli/trunk/web/resources/js/classesForJQuery/LoginButton.js

    r281 r290  
    1313        // Init 
    1414        this.parent = param.parent ? param.parent : document.body; 
    15         this.onClickLogin = param.anotherOnClickLogin ? param.anotherOnClickLogin : this.onClickLogin; 
    16         this.onClickLogout = param.anotherOnClickLogout ? param.anotherOnClickLogout : this.onClickLogout; 
     15        this.anotherOnClickLogin = param.anotherOnClickLogin ? param.anotherOnClickLogin : false; 
     16        this.anotherOnClickLogout = param.anotherOnClickLogout ? param.anotherOnClickLogout : false; 
    1717        this.jSONUser = param.jSONUser ? param.jSONUser : false; 
    1818        this.urlLogin = param.urlLogin ? param.urlLogin : false; 
     
    3131        this.forgotUNPText = param.forgotUNPText ? param.forgotUNPText : loginTexts["data.authentification.loginForget"]; 
    3232        this.inscriptionText = param.inscriptionText ? param.inscriptionText : loginTexts["data.authentification.inscription"]; 
    33         this.text1 = param.text1 ? param.text1 : loginTexts["app.admin"]; 
    3433        this.errorText = param.errorText ? param.errorText : loginTexts[this.errors]; 
    3534    }, 
     
    4443    { 
    4544        return this.jSONUser; 
     45    }, 
     46 
     47    getJSONUserRole: function() 
     48    { 
     49        return this.jSONUser.role; 
    4650    }, 
    4751 
     
    115119        if( this.jSONUser ) 
    116120        { 
    117             var textLogin = this.jSONUser.name + " " + this.jSONUser.firstName; 
    118             // TODO : revoir les rÃŽles 
    119             if( this.jSONUser.role && "COORDINATOR" == this.jSONUser.role ) 
    120                 textLogin += " (" + this.text1 + ")"; 
     121            var textLogin = this.jSONUser.name + " " + this.jSONUser.firstName + " (" + loginTexts[this.jSONUser.role] + ")"; 
    121122 
    122123            var loginButton = new ComplexButton( {value:textLogin, parent:this.parent, id:"button_login", classNameToAdd: this.classNameToAdd} ); 
     
    169170    }, 
    170171 
    171     updateLogin: function() 
     172    updateLoginOrLogout: function() 
    172173    { 
    173174        this.parent.empty(); 
     
    200201            return; 
    201202 
    202         // TODO : passer en crypter ces infos !!!!! 
    203203        var login = $( "#login" ).val(); 
    204204        var pwd = $( "#pwd" ).val(); 
     
    226226        this.setJSONUser( null != jQuery.parseJSON( result ).jSONPeople ? jQuery.parseJSON( result ).jSONPeople : false ); 
    227227        if( null == this.errors ) 
    228             this.updateLogin(); 
     228            this.updateLoginOrLogout(); 
    229229        else 
    230230            this.displayLoginErrors( loginTexts[this.errors] ); 
     231 
     232        if( this.anotherOnClickLogin ) 
     233            this.anotherOnClickLogin(); 
    231234    }, 
    232235 
     
    237240        { 
    238241            this.setJSONUser( false ); 
    239             this.updateLogin(); 
     242            this.updateLoginOrLogout(); 
    240243        } 
    241244        else 
    242245            this.displayLoginErrors( loginTexts[this.errors] ); 
     246 
     247        if( this.anotherOnClickLogout ) 
     248            this.anotherOnClickLogout(); 
    243249    }, 
    244250 
  • ether_megapoli/trunk/web/resources/js/classesForJQuery/etherHelper.js

    r287 r290  
    1717{ 
    1818    return getLoginModule().getJSONUser(); 
     19} 
     20 
     21function getJSONUserRole() 
     22{ 
     23    return getLoginModule().getJSONUserRole(); 
    1924} 
    2025 
Note: See TracChangeset for help on using the changeset viewer.