Changeset 1635 for branches/release-32/default_templates/javascript.mtml
- Timestamp:
- 03/29/08 06:39:13 (20 months ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
branches/release-32/default_templates/javascript.mtml
r1561 r1635 28 28 </MTIfNonEmpty> 29 29 30 var AUTHOR = 1; 31 var COMMENTER = 2; 30 32 var commenter_name; 31 var commenter_blog_ids; 33 var commenter_status; 34 var commenter_id; 35 var commenter_url 32 36 var is_preview; 33 37 var mtcmtmail; … … 47 51 <MTIfRegistrationAllowed> 48 52 <MTIfRegistrationRequired> 49 if ( commenter_name && 50 ( !commenter_id 51 || commenter_blog_ids.indexOf("'<$MTBlogID$>'") > -1)) 53 if ( commenter_status == COMMENTER ) 52 54 { 53 55 hideDocumentElement('comment-form-name'); … … 62 64 <MTElse> 63 65 // 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 ) 67 67 { 68 68 hideDocumentElement('comment-form-name'); … … 101 101 function writeCommenterGreeting(commenter_name, entry_id, blog_id, commenter_id, commenter_url) { 102 102 <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>'; 112 108 } else { 113 url += '&static=1';109 commenter_link = commenter_name; 114 110 } 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 119 122 } 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 ); 128 126 } 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>">'); 130 128 } else { 131 129 <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>">'; 133 131 <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();">">'; 135 133 </MTIfRegistrationRequired> 134 document.write(phrase); 136 135 } 137 136 </MTIfRegistrationAllowed> … … 139 138 140 139 <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"> 143 142 commenter_name = getCookie('commenter_name'); 143 commenter_url = getCookie('commenter_url'); 144 144 ids = getCookie('commenter_id').split(':'); 145 145 commenter_id = ids[0]; 146 commenter_blog_ids = ids[1]; 147 commenter_url = getCookie('commenter_url'); 148 <MTelse> 146 if ( ids[1] == 'S' ) { 147 commenter_status = AUTHOR; 148 } 149 else if ( ids[1] == 'N' ) { 150 document.write('<script src="<$MTCGIPath$><$MTCommentScript$>?__mode=cmtr_status_js&blog_id=<$MTBlogID$>"></script>'); 151 } 152 else if ( commenter_name && !commenter_id ) { 153 commenter_status = COMMENTER; 154 } 155 else if ( commenter_name 156 && commenter_id 157 && ( ids[1].indexOf("'<$MTBlogID$>'") > -1 ) ) { 158 commenter_status = AUTHOR; 159 } 160 else { 161 commenter_status = 0; 162 } 163 <MTElse> 149 164 document.write('<script src="<$MTCGIPath$><$MTCommentScript$>?__mode=cmtr_name_js&blog_id=<$MTBlogID$>"></script>'); 150 165 </MTIf>
