Show
Ignore:
Timestamp:
07/29/08 02:47:24 (16 months ago)
Author:
bsmith
Message:

adding vanilla+authentication+comments+userpics and updates to vanilla+authentication+comments

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/Vanilla/templates/vanilla+authentication+comments/javascript.mtml

    r891 r916  
    11<$mt:var name="user-auth" value="signin-content"$> 
     2<mt:Ignore> 
     3    Set show_userpic to 1 to enable userpics in the signin line 
     4    - Requires Community Solution 
     5    - Note: This will update username to link to Community Solution "edit profile" script. This script assumes that you are using profiles and thus links to "view profile" screen. If the template set is not using profiles then the Community Solution "Profile Edit" Global System Template should be updated. 
     6</mt:Ignore> 
     7<$mt:var name="show_userpic" value="0"$> 
    28 
    39/* section *****************************************************************/ 
     
    1016var is_preview; 
    1117var user; 
     18 
     19/* Login Functions *****************************************************************/ 
    1220 
    1321<mt:Ignore> 
     
    6573    } 
    6674    if (u && u.name) { 
     75<mt:If name="show_userpic"> 
     76        if (u.userpic) 
     77            content += '<img src="' + u.userpic + '" width="50" height="50" />'; 
     78</mt:If> 
    6779        var url; 
    6880        if (u.is_authenticated) { 
    6981            if (u.is_author) { 
     82<mt:If name="show_userpic"> 
     83                url = '<$mt:CGIPath$><$mt:CommunityScript$>?__mode=edit&blog_id=<$mt:BlogID$>'; 
     84                url += '&return_to=' + encodeURIComponent(document.URL); 
     85<mt:Else> 
    7086                url = '<$mt:CGIPath$><$mt:CommentScript$>?__mode=edit_profile&blog_id=<$mt:BlogID$>'; 
    7187                url += '&static=' + encodeURIComponent( location.href ); 
     88</mt:If> 
    7289            } else { 
    7390                url = u.url; 
     
    7895            url = null; 
    7996        } 
    80         var content = '<__trans phrase="You are signed in as " escape="js">'; 
     97        content += '<__trans phrase="You are signed in as " escape="js">'; 
    8198        if (url) 
    8299            content += '<a href="' + url + '">' + u.name + '</a>'; 
     
    94111    } 
    95112} 
     113 
     114<mt:IfBlog> 
     115<mt:IfRegistrationAllowed> 
     116/*** 
     117 * If request contains a '#_login' or '#_logout' hash, use this to 
     118 * also delete the blog-side user cookie, since we're coming back from 
     119 * a login, logout or edit profile operation. 
     120 */ 
     121var clearCookie = ( window.location.hash && window.location.hash.match( /^#_log(in|out)/ ) ) ? true : false; 
     122if (clearCookie) { 
     123    // clear any logged in state 
     124    mtClearUser(); 
     125    if (RegExp.$1 == 'in') 
     126        mtFetchUser(); 
     127} else { 
     128    <mt:Ignore> 
     129    /*** 
     130     * Uncondition this call to fetch the current user state (if available) 
     131     * from MT upon page load if no user cookie is already present. 
     132     * This is okay if you have a private install, such as an Intranet; 
     133     * not recommended for public web sites! 
     134     */ 
     135    </mt:Ignore> 
     136    if ( is_preview && !user ) 
     137        mtFetchUser(); 
     138} 
     139</mt:IfRegistrationAllowed> 
     140</mt:IfBlog> 
    96141 
    97142<mt:Ignore> 
     
    894939// END: fast browser onload init 
    895940 
    896 <mt:IfBlog> 
    897 <mt:IfRegistrationAllowed> 
    898 /*** 
    899  * If request contains a '#_login' or '#_logout' hash, use this to 
    900  * also delete the blog-side user cookie, since we're coming back from 
    901  * a login, logout or edit profile operation. 
    902  */ 
    903 var clearCookie = ( window.location.hash && window.location.hash.match( /^#_log(in|out)/ ) ) ? true : false; 
    904 if (clearCookie) { 
    905     // clear any logged in state 
    906     mtClearUser(); 
    907     if (RegExp.$1 == 'in') 
    908         mtFetchUser(); 
    909 } else { 
    910     <mt:Ignore> 
    911     /*** 
    912      * Uncondition this call to fetch the current user state (if available) 
    913      * from MT upon page load if no user cookie is already present. 
    914      * This is okay if you have a private install, such as an Intranet; 
    915      * not recommended for public web sites! 
    916      */ 
    917     </mt:Ignore> 
    918     if ( is_preview && !user ) 
    919         mtFetchUser(); 
    920 } 
    921 </mt:IfRegistrationAllowed> 
    922 </mt:IfBlog> 
    923  
    924  
    925 /* Section *****************************************************************/ 
     941/* END Movable Type Javascript *****************************************************************/