Commit 4055a481 authored by David Lawrence's avatar David Lawrence

Bug 653634 - Change the comment reply header to include the name of the person who has commented

r/a=LpSolit
parent af9cc042
......@@ -145,3 +145,30 @@ function goto_add_comments( anchor ){
},10);
return false;
}
if (typeof Node == 'undefined') {
/* MSIE doesn't define Node, so provide a compatibility object */
window.Node = {
TEXT_NODE: 3,
ENTITY_REFERENCE_NODE: 5
};
}
/* Concatenates all text from element's childNodes. This is used
* instead of innerHTML because we want the actual text (and
* innerText is non-standard).
*/
function getText(element) {
var child, text = "";
for (var i=0; i < element.childNodes.length; i++) {
child = element.childNodes[i];
var type = child.nodeType;
if (type == Node.TEXT_NODE || type == Node.ENTITY_REFERENCE_NODE) {
text += child.nodeValue;
} else {
/* recurse into nodes of other types */
text += getText(child);
}
}
return text;
}
......@@ -25,6 +25,37 @@
<script src="[% 'js/comments.js' FILTER mtime %]" type="text/javascript">
</script>
<script type="text/javascript">
<!--
/* Adds the reply text to the `comment' textarea */
function replyToComment(id, real_id, name) {
var prefix = "(In reply to " + name + " from comment #" + id + ")\n";
var replytext = "";
[% IF user.settings.quote_replies.value == 'quoted_reply' %]
/* pre id="comment_name_N" */
var text_elem = document.getElementById('comment_text_'+id);
var text = getText(text_elem);
replytext = prefix + wrapReplyText(text);
[% ELSIF user.settings.quote_replies.value == 'simple_reply' %]
replytext = prefix;
[% END %]
[% IF user.is_insider %]
if (document.getElementById('isprivate_' + real_id).checked) {
document.getElementById('newcommentprivacy').checked = 'checked';
updateCommentTagControl(document.getElementById('newcommentprivacy'), 'comment');
}
[% END %]
/* <textarea id="comment"> */
var textarea = document.getElementById('comment');
textarea.value += replytext;
textarea.focus();
}
//-->
</script>
[% DEFAULT start_at = 0 mode = "show" %]
[% sort_order = user.settings.comment_sort_order.value %]
......@@ -120,8 +151,12 @@
[% IF mode == "edit" %]
<span class="bz_comment_actions">
[<a class="bz_reply_link" href="#add_comment"
[% IF user.settings.quote_replies.value != 'off' %]
onclick="replyToComment('[% count %]', '[% comment.id %]', '[% comment.author.name || comment.author.nick FILTER js %]'); return false;"
[% END %]
>reply</a>]
<script type="text/javascript"><!--
addReplyLink([% count %], [% comment.id %]);
addCollapseLink([% count %]); // -->
</script>
</span>
......
......@@ -32,72 +32,6 @@
<script type="text/javascript">
<!--
/* Outputs a link to call replyToComment(); used to reduce HTML output */
function addReplyLink(id, real_id) {
/* XXX this should really be updated to use the DOM Core's
* createElement, but finding a container isn't trivial.
*/
[% IF user.settings.quote_replies.value != 'off' %]
document.write('[<a href="#add_comment" onclick="replyToComment(' +
id + ',' + real_id + '); return false;">reply<' + '/a>]');
[% END %]
}
/* Adds the reply text to the `comment' textarea */
function replyToComment(id, real_id) {
var prefix = "(In reply to comment #" + id + ")\n";
var replytext = "";
[% IF user.settings.quote_replies.value == 'quoted_reply' %]
/* pre id="comment_name_N" */
var text_elem = document.getElementById('comment_text_'+id);
var text = getText(text_elem);
replytext = prefix + wrapReplyText(text);
[% ELSIF user.settings.quote_replies.value == 'simple_reply' %]
replytext = prefix;
[% END %]
[% IF user.is_insider %]
if (document.getElementById('isprivate_' + real_id).checked) {
document.getElementById('newcommentprivacy').checked = 'checked';
updateCommentTagControl(document.getElementById('newcommentprivacy'), 'comment');
}
[% END %]
/* <textarea id="comment"> */
var textarea = document.getElementById('comment');
textarea.value += replytext;
textarea.focus();
}
if (typeof Node == 'undefined') {
/* MSIE doesn't define Node, so provide a compatibility object */
window.Node = {
TEXT_NODE: 3,
ENTITY_REFERENCE_NODE: 5
};
}
/* Concatenates all text from element's childNodes. This is used
* instead of innerHTML because we want the actual text (and
* innerText is non-standard).
*/
function getText(element) {
var child, text = "";
for (var i=0; i < element.childNodes.length; i++) {
child = element.childNodes[i];
var type = child.nodeType;
if (type == Node.TEXT_NODE || type == Node.ENTITY_REFERENCE_NODE) {
text += child.nodeValue;
} else {
/* recurse into nodes of other types */
text += getText(child);
}
}
return text;
}
[% IF user.is_timetracker %]
var fRemainingTime = [% bug.remaining_time %]; // holds the original value
function adjustRemainingTime() {
......@@ -116,7 +50,6 @@
// if the remaining time is changed manually, update fRemainingTime
fRemainingTime = document.changeform.remaining_time.value;
}
[% END %]
/* Index all classifications so we can keep track of the classification
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment