Show
Ignore:
Timestamp:
03/29/08 06:39:13 (20 months ago)
Author:
fumiakiy
Message:

Merged enzo@r1555 to release-32. BugId:70191

  • r1555 was to fix "malformed header" failiure due to large size of cookie values.
Files:
1 modified

Legend:

Unmodified
Added
Removed
  • branches/release-32/default_templates/javascript.mtml

    r1561 r1635  
    2828</MTIfNonEmpty> 
    2929 
     30var AUTHOR = 1; 
     31var COMMENTER = 2; 
    3032var commenter_name; 
    31 var commenter_blog_ids; 
     33var commenter_status; 
     34var commenter_id; 
     35var commenter_url 
    3236var is_preview; 
    3337var mtcmtmail; 
     
    4751<MTIfRegistrationAllowed> 
    4852    <MTIfRegistrationRequired> 
    49     if ( commenter_name && 
    50          ( !commenter_id 
    51         || commenter_blog_ids.indexOf("'<$MTBlogID$>'") > -1)) 
     53    if ( commenter_status == COMMENTER ) 
    5254    { 
    5355        hideDocumentElement('comment-form-name'); 
     
    6264    <MTElse> 
    6365    // comments are allowed but registration not required 
    64     if ( commenter_name && 
    65          ( !commenter_id 
    66         || commenter_blog_ids.indexOf("'<$MTBlogID$>'") > -1)) 
     66    if ( commenter_status == COMMENTER ) 
    6767    { 
    6868        hideDocumentElement('comment-form-name'); 
     
    101101function writeCommenterGreeting(commenter_name, entry_id, blog_id, commenter_id, commenter_url) { 
    102102<MTIfRegistrationAllowed> 
    103     if ( commenter_name && 
    104          ( !commenter_id 
    105         || commenter_blog_ids.indexOf("'" + blog_id + "'") > -1)) 
    106     { 
    107         var url; 
    108         if (commenter_id) { 
    109             url = '<$MTCGIPath$><$MTCommentScript$>?__mode=edit_profile&commenter=' + commenter_id + '&blog_id=' + blog_id; 
    110             if (entry_id) { 
    111                 url += '&entry_id=' + entry_id; 
     103    if ( commenter_status > 0 ) { 
     104        var commenter_link; 
     105        if ( commenter_status == COMMENTER ) { 
     106            if (commenter_url) { 
     107                commenter_link = '<a href="' + commenter_url + '">' + commenter_name + '</a>'; 
    112108            } else { 
    113                 url += '&static=1'; 
     109                commenter_link = commenter_name; 
    114110            } 
    115         } else if (commenter_url) { 
    116             url = commenter_url; 
    117         } else { 
    118             url = null; 
     111        } else if ( commenter_status == AUTHOR ) { 
     112            if (commenter_id) { 
     113                commenter_link = '<a href="<$MTCGIPath$><$MTCommentScript$>?__mode=edit_profile&commenter=' + commenter_id + '&blog_id=' + blog_id; 
     114                if (entry_id) { 
     115                    commenter_link += '&entry_id=' + entry_id; 
     116                } else { 
     117                    commenter_link += '&static=1'; 
     118                } 
     119                commenter_link += '">' + commenter_name + '</a>'; 
     120            } 
     121 
    119122        } 
    120         var content = '<__trans phrase="Thanks for signing in," escape="js"> '; 
    121         if (url) { 
    122             content += '<a href="' + url + '">' + commenter_name + '</a>'; 
    123         } else { 
    124             content += commenter_name; 
    125         } 
    126         content += '<__trans phrase=". Now you can comment." escape="js"> (<a href="<$MTRemoteSignOutLink static="1"$>&entry_id=' + entry_id + '"><__trans phrase="sign out" escape="js"></a>)'; 
    127         document.write(content); 
     123        document.write( 
     124            '<__trans phrase="Thanks for signing in, [_1]. Now you can comment. ([_2]sign out[_3])" params="' + commenter_link + '%%<a href="<$MTRemoteSignOutLink static="1"$>&entry_id=' + entry_id + '">%%</a>">' 
     125        ); 
    128126    } else if (commenter_name) { 
    129             document.write('<__trans phrase="You do not have permission to comment on this blog." escape="js"> (<a href="<$MTRemoteSignOutLink static="1"$>&entry_id=' + entry_id + '"><__trans phrase="sign out" escape="js"></a>)'); 
     127        document.write('<__trans phrase="You do not have permission to comment on this blog. ([_1]sign out[_2])" params="<a href="<$MTRemoteSignOutLink static="1"$>&entry_id=' + entry_id + '">%%</a>">'); 
    130128    } else { 
    131129<MTIfRegistrationRequired> 
    132         document.write('<a href="<$MTCGIPath$><$MTCommentScript$>?__mode=login&entry_id=' + entry_id + '&blog_id=' + blog_id + '&static=1"><__trans phrase="Sign in" escape="js">' + '</a>' + '<__trans phrase=" to comment on this entry." escape="js">'); 
     130        var phrase = '<__trans phrase="[_1]Sign in[_2] to comment on this entry." params="<a href="<$MTCGIPath$><$MTCommentScript$>?__mode=login&entry_id=' + entry_id + '&blog_id=' + blog_id + '&static=1">%%</a>">'; 
    133131<MTElse> 
    134         document.write('<a href="<$MTCGIPath$><$MTCommentScript$>?__mode=login&entry_id=' + entry_id + '&blog_id=' + blog_id + '&static=1"><__trans phrase="Sign in" escape="js">' + '</a>' + '<__trans phrase=" to comment on this entry," escape="js"> <__trans phrase="or " escape="js"><a href="javascript:void(0);" onclick="showAnonymousForm();"><__trans phrase="comment anonymously." escape="js"></a>'); 
     132        var phrase = '<__trans phrase="[_1]Sign in[_2] to comment on this entry, or [_3]comment anonymously[_2]." params="<a href="<$MTCGIPath$><$MTCommentScript$>?__mode=login&entry_id=' + entry_id + '&blog_id=' + blog_id + '&static=1">%%</a>%%<a href="javascript:void(0);" onclick="showAnonymousForm();">">'; 
    135133</MTIfRegistrationRequired> 
     134        document.write(phrase); 
    136135    } 
    137136</MTIfRegistrationAllowed> 
     
    139138 
    140139<MTIfRegistrationAllowed> 
    141 <MTsetvarblock name="cgi_host"><$MTCGIHost exclude_port="1"></MTsetvarblock> 
    142 <MTIf tag="MTBlogHost" exclude_port="1" eq="cgi_host"> 
     140<$MTCGIHost exclude_port="1" setvar="cgi_host"$><$MTBlogHost exclude_port="1" setvar="blog_host"$> 
     141<MTIf name="cgi_host" eq="$blog_host"> 
    143142commenter_name = getCookie('commenter_name'); 
     143commenter_url = getCookie('commenter_url'); 
    144144ids = getCookie('commenter_id').split(':'); 
    145145commenter_id = ids[0]; 
    146 commenter_blog_ids = ids[1]; 
    147 commenter_url = getCookie('commenter_url'); 
    148 <MTelse> 
     146if ( ids[1] == 'S' ) { 
     147    commenter_status = AUTHOR; 
     148} 
     149else if ( ids[1] == 'N' ) { 
     150    document.write('<script src="<$MTCGIPath$><$MTCommentScript$>?__mode=cmtr_status_js&blog_id=<$MTBlogID$>"></script>'); 
     151} 
     152else if ( commenter_name && !commenter_id ) { 
     153    commenter_status = COMMENTER; 
     154} 
     155else if ( commenter_name  
     156  && commenter_id 
     157  && ( ids[1].indexOf("'<$MTBlogID$>'") > -1 ) ) { 
     158    commenter_status = AUTHOR; 
     159} 
     160else { 
     161    commenter_status = 0; 
     162} 
     163<MTElse> 
    149164document.write('<script src="<$MTCGIPath$><$MTCommentScript$>?__mode=cmtr_name_js&blog_id=<$MTBlogID$>"></script>'); 
    150165</MTIf>