]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 653634 - Change the comment reply header to include the name of the person who...
authorDavid Lawrence <dlawrence@mozilla.com>
Thu, 1 Sep 2011 18:30:51 +0000 (14:30 -0400)
committerDavid Lawrence <dlawrence@mozilla.com>
Thu, 1 Sep 2011 18:30:51 +0000 (14:30 -0400)
r/a=LpSolit

js/comments.js
template/en/default/bug/comments.html.tmpl
template/en/default/bug/edit.html.tmpl

index f46499b62f37676ff28229957ed41aae34b2464d..28ef54397bdc3bdccb33f2456c2a468b6d47526b 100644 (file)
@@ -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;
+}
index cbd1d0b836294b84e9087acbc5416615b5a8317f..7b383daf5ac2e7927b5ac3e0b7a5b9c8ec47db12 100644 (file)
 <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 %]
 
 
         [% 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>
index c2f8894d7dd3a20546781fb0f2550ec071cdcc2e..6a7f76c876c96ce40a3bf0b3513cadf75806970f 100644 (file)
 
   <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() {
       // 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