Changeset 1561
- Timestamp:
- 03/24/08 22:48:47 (7 months ago)
- Files:
-
- branches/release-32/default_templates/comment_detail.mtml (modified) (1 diff)
- branches/release-32/default_templates/comment_form.mtml (modified) (2 diffs)
- branches/release-32/default_templates/javascript.mtml (modified) (2 diffs)
- branches/release-32/lib/MT/App/Comments.pm (modified) (1 diff)
- branches/release-32/lib/MT/Template/ContextHandlers.pm (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/release-32/default_templates/comment_detail.mtml
r1350 r1561 3 3 <div class="comment-header"> 4 4 <div class="asset-meta"> 5 <span class="byline"><__trans phrase="By [_1] on [_2]" params='<span class="vcard author"><$MTCommentAuthorLink default_name="Anonymous" show_email="0"$></span><MTIfNonEmpty tag="CommentAuthorIdentity"><$MTCommentAuthorIdentity$></MTIfNonEmpty>%%<a href="#comment-<$MTCommentID$>"><abbr class="published" title="<$MTCommentDate format_name="iso8601"$>"><$MTCommentDate$></abbr></a>'></span> 5 <span class="byline"> 6 <__trans phrase="By"> <span class="vcard author"><$MTCommentAuthorLink default_name="Anonymous" show_email="0"$></span><MTIfNonEmpty tag="CommentAuthorIdentity"><$MTCommentAuthorIdentity$></MTIfNonEmpty> 7 <MTCommentParent> 8 <__trans phrase="replied to"> <a href="#comment-<$MTCommentID$>"><MTCommentAuthor></a> 9 </MTCommentParent> 10 <__trans phrase="on"> <a href="#comment-<$MTCommentID$>"><abbr class="published" title="<$MTCommentDate format_name="iso8601"$>"><$MTCommentDate$></abbr></a> 11 <MTIfCommentsAccepted> | <$MTCommentReplyLink$></MTIfCommentsAccepted> 12 </span> 6 13 </div> 7 14 </div> branches/release-32/default_templates/comment_form.mtml
r1309 r1561 17 17 <input type="hidden" name="entry_id" value="<$MTEntryID$>" /> 18 18 <input type="hidden" name="__lang" value="<$MTBlogLanguage$>" /> 19 <input type="hidden" name="parent_id" value="<MTIf name="comment_preview_template"><$MTCommentParentID$></MTIf>" id="comment-parent-id" /> 19 20 <div id="comments-open-data"> 20 21 <div id="comment-form-name"> … … 33 34 <label for="comment-bake-cookie"><input type="checkbox" id="comment-bake-cookie" name="bakecookie" onclick="if (!this.checked) forgetMe(document.comments_form)" value="1" /> 34 35 <__trans phrase="Remember personal info?"></label> 36 </div> 37 <div id="comment-form-reply"> 38 <label for="comment-reply" id="comment-reply-label"><input type="checkbox" id="comment-reply" name="comment_reply" value="" onclick="setCommentParentID();" /> 39 <__trans phrase="Replying to"></label> 35 40 </div> 36 41 </div> branches/release-32/default_templates/javascript.mtml
r1354 r1561 36 36 37 37 function individualArchivesOnLoad(commenter_name) { 38 hideDocumentElement('comment-form-reply'); 38 39 <MTIfCommentsAccepted> 39 40 <MTElse> … … 150 151 </MTIfRegistrationAllowed> 151 152 153 function replyComment(parent_id, author) { 154 showDocumentElement('comment-form-reply'); 155 156 var checkbox = document.getElementById('comment-reply'); 157 158 // Clear the current label but NOT our checkbox! 159 var label = document.getElementById('comment-reply-label'); 160 for(var i = 1; i < label.childNodes.length; i++) { 161 label.removeChild(label.childNodes[i]); 162 } 163 164 // Populate label with new values 165 var reply_text = document.createTextNode(' <__trans phrase="Replying to"> '); 166 label.appendChild(reply_text); 167 168 var anchor = document.createElement('a'); 169 anchor.setAttribute('href', '#comment-' + parent_id); 170 anchor.innerHTML = author; 171 label.appendChild(anchor); 172 173 checkbox.value = parent_id; 174 checkbox.setAttribute('checked', true); 175 checkbox.focus(); 176 177 setCommentParentID(); 178 } 179 180 function setCommentParentID() { 181 var checkbox = document.getElementById('comment-reply'); 182 var parent_id_field = document.getElementById('comment-parent-id'); 183 var pid = 0; 184 185 if(checkbox.checked == true) 186 pid = checkbox.value; 187 188 parent_id_field.value = pid; 189 } 190 152 191 153 192 // Copyright (c) 1996-1997 Athenia Associates. branches/release-32/lib/MT/App/Comments.pm
r1394 r1561 1269 1269 # published for this entry 1270 1270 my $parent_comment = MT::Comment->load( $parent_id ); 1271 if ($parent_comment && $parent _comment->entry_id == $entry->id) {1271 if ($parent_comment && $parent->is_published() && $parent_comment->entry_id == $entry->id) { 1272 1272 $comment->parent_id( $parent_id ); 1273 1273 } branches/release-32/lib/MT/Template/ContextHandlers.pm
r1554 r1561 377 377 CommentOrderNumber => \&_hdlr_comment_order_num, 378 378 CommentDate => \&_hdlr_comment_date, 379 CommentParentID => \&_hdlr_comment_parent_id, 380 CommentReplyLink => \&_hdlr_comment_reply_link, 379 381 CommentPreviewAuthor => \&_hdlr_comment_author, 380 382 CommentPreviewIP => \&_hdlr_comment_ip, … … 5280 5282 } 5281 5283 5284 sub _hdlr_comment_reply_link { 5285 my($ctx, $args) = @_; 5286 my $comment = $ctx->stash('comment') or 5287 return $ctx->_no_comment_error('MTCommentReplyLink'); 5288 5289 my $label = $args->{label} || $args->{text} || MT->translate('Reply'); 5290 my $comment_author = MT::Util::encode_js($comment->author); 5291 5292 return sprintf(qq(<a title="%s" href="javascript:void(0);" onclick="replyComment(%d, '%s')">%s</a>), 5293 $label, $comment->id, $comment_author, $label); 5294 } 5295 5296 sub _hdlr_comment_parent_id { 5297 my $args = $_[1]; 5298 my $c = $_[0]->stash('comment') 5299 or return $_[0]->_no_comment_error('MTCommentParentID'); 5300 my $id = $c->parent_id || 0; 5301 $args && $args->{pad} ? (sprintf "%06d", $id) : $id; 5302 } 5303 5282 5304 sub _hdlr_comment_replies { 5283 5305 my($ctx, $args, $cond) = @_;
