summaryrefslogtreecommitdiffstats
path: root/extensions/EditComments/template/en
diff options
context:
space:
mode:
authorDave Lawrence <dlawrence@mozilla.com>2014-01-11 18:12:42 +0100
committerDave Lawrence <dlawrence@mozilla.com>2014-01-11 18:12:42 +0100
commit01db31261bcaa73dfeb6c287c1a22ece47d119eb (patch)
tree46c51ec369b81d2b13dc5a58dee9400ad7d8234e /extensions/EditComments/template/en
parent86f6ac8e6f57e2355691f95935330e5b1040f096 (diff)
downloadbugzilla-01db31261bcaa73dfeb6c287c1a22ece47d119eb.tar.gz
bugzilla-01db31261bcaa73dfeb6c287c1a22ece47d119eb.tar.xz
Bug 936165 - Allow for privileged users to edit past comments and preserve comment history (BMO extension)
r=glob
Diffstat (limited to 'extensions/EditComments/template/en')
-rw-r--r--extensions/EditComments/template/en/default/hook/admin/params/editparams-current_panel.html.tmpl13
-rw-r--r--extensions/EditComments/template/en/default/hook/bug/comments-a_comment-end.html.tmpl45
-rw-r--r--extensions/EditComments/template/en/default/hook/bug/show-header-end.html.tmpl12
-rw-r--r--extensions/EditComments/template/en/default/hook/global/user-error-auth_failure_object.html.tmpl11
-rw-r--r--extensions/EditComments/template/en/default/hook/global/user-error-errors.html.tmpl12
-rw-r--r--extensions/EditComments/template/en/default/pages/editcomments.html.tmpl122
6 files changed, 215 insertions, 0 deletions
diff --git a/extensions/EditComments/template/en/default/hook/admin/params/editparams-current_panel.html.tmpl b/extensions/EditComments/template/en/default/hook/admin/params/editparams-current_panel.html.tmpl
new file mode 100644
index 000000000..01ca7bbb7
--- /dev/null
+++ b/extensions/EditComments/template/en/default/hook/admin/params/editparams-current_panel.html.tmpl
@@ -0,0 +1,13 @@
+[%# This Source Code Form is subject to the terms of the Mozilla Public
+ # License, v. 2.0. If a copy of the MPL was not distributed with this
+ # file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ #
+ # This Source Code Form is "Incompatible With Secondary Licenses", as
+ # defined by the Mozilla Public License, v. 2.0.
+ #%]
+
+[% IF panel.name == "groupsecurity" %]
+ [% panel.param_descs.edit_comments_group =
+ 'The name of the group of users who can edit comments. Leave blank to disable comment editing.'
+ %]
+[% END -%]
diff --git a/extensions/EditComments/template/en/default/hook/bug/comments-a_comment-end.html.tmpl b/extensions/EditComments/template/en/default/hook/bug/comments-a_comment-end.html.tmpl
new file mode 100644
index 000000000..28482c6c3
--- /dev/null
+++ b/extensions/EditComments/template/en/default/hook/bug/comments-a_comment-end.html.tmpl
@@ -0,0 +1,45 @@
+[%# This Source Code Form is subject to the terms of the Mozilla Public
+ # License, v. 2.0. If a copy of the MPL was not distributed with this
+ # file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ #
+ # This Source Code Form is "Incompatible With Secondary Licenses", as
+ # defined by the Mozilla Public License, v. 2.0.
+ #%]
+
+[% IF Param('edit_comments_group') && user.in_group(Param('edit_comments_group')) %]
+ <span id="edit_comment_link_[% comment.count FILTER html %]">
+ [<a href="javascript:void(0);" id="edit_comment_edit_link_[% comment.count FILTER html %]"
+ onclick="editComment('[% comment.count FILTER js %]','[% comment.id FILTER js %]');">edit</a>
+ [% IF comment.edit_count %]
+ | <a href="page.cgi?id=editcomments.html&bug_id=[% bug.id FILTER uri %]&comment_id=[% comment.id FILTER uri %]">history</a>
+ ([% comment.edit_count FILTER html %])
+ [% END %]]
+ </span>
+ <div id="edit_comment_[% comment.count FILTER html %]">
+ <div class="bz_comment_text bz_default_hidden" id="edit_comment_loading_[% comment.count FILTER html %]">Loading...</div>
+ [% INCLUDE global/textarea.html.tmpl
+ name = "edit_comment_textarea_${comment.id}"
+ id = "edit_comment_textarea_${comment.count}"
+ minrows = 10
+ maxrows = 25
+ classes = "edit_comment_textarea bz_default_hidden"
+ cols = constants.COMMENT_COLS
+ disabled = 1
+ %]
+ </div>
+ <script>
+ YAHOO.util.Event.onDOMReady(function() {
+ // Insert edit links near other comment actions such as reply
+ var comment_div = YAHOO.util.Dom.get('c[% comment.count FILTER js %]');
+ var bz_comment_actions = YAHOO.util.Dom.getElementsByClassName('bz_comment_actions', 'span', comment_div)[0];
+ var edit_comment_link = YAHOO.util.Dom.get('edit_comment_link_[% comment.count FILTER js %]');
+ bz_comment_actions.insertBefore(edit_comment_link, bz_comment_actions.firstChild);
+
+ // Insert blank textarea right below formatted comment
+ var comment_div = YAHOO.util.Dom.get('c[% comment.count FILTER js %]');
+ var comment_pre = YAHOO.util.Dom.get('comment_text_[% comment.count FILTER js %]');
+ var edit_comment_div = YAHOO.util.Dom.get('edit_comment_[% comment.count FILTER js %]');
+ comment_div.insertBefore(edit_comment_div, comment_pre);
+ });
+ </script>
+[% END %]
diff --git a/extensions/EditComments/template/en/default/hook/bug/show-header-end.html.tmpl b/extensions/EditComments/template/en/default/hook/bug/show-header-end.html.tmpl
new file mode 100644
index 000000000..331d7e6df
--- /dev/null
+++ b/extensions/EditComments/template/en/default/hook/bug/show-header-end.html.tmpl
@@ -0,0 +1,12 @@
+[%# This Source Code Form is subject to the terms of the Mozilla Public
+ # License, v. 2.0. If a copy of the MPL was not distributed with this
+ # file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ #
+ # This Source Code Form is "Incompatible With Secondary Licenses", as
+ # defined by the Mozilla Public License, v. 2.0.
+ #%]
+
+[% IF Param('edit_comments_group') && user.in_group(Param('edit_comments_group')) %]
+ [% style_urls.push('extensions/EditComments/web/styles/editcomments.css') %]
+ [% javascript_urls.push('extensions/EditComments/web/js/editcomments.js') %]
+[% END %]
diff --git a/extensions/EditComments/template/en/default/hook/global/user-error-auth_failure_object.html.tmpl b/extensions/EditComments/template/en/default/hook/global/user-error-auth_failure_object.html.tmpl
new file mode 100644
index 000000000..4325aab30
--- /dev/null
+++ b/extensions/EditComments/template/en/default/hook/global/user-error-auth_failure_object.html.tmpl
@@ -0,0 +1,11 @@
+[%# This Source Code Form is subject to the terms of the Mozilla Public
+ # License, v. 2.0. If a copy of the MPL was not distributed with this
+ # file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ #
+ # This Source Code Form is "Incompatible With Secondary Licenses", as
+ # defined by the Mozilla Public License, v. 2.0.
+ #%]
+
+[% IF object == 'editcomments' %]
+ edit comments
+[% END %]
diff --git a/extensions/EditComments/template/en/default/hook/global/user-error-errors.html.tmpl b/extensions/EditComments/template/en/default/hook/global/user-error-errors.html.tmpl
new file mode 100644
index 000000000..bc02b52f0
--- /dev/null
+++ b/extensions/EditComments/template/en/default/hook/global/user-error-errors.html.tmpl
@@ -0,0 +1,12 @@
+[%# This Source Code Form is subject to the terms of the Mozilla Public
+ # License, v. 2.0. If a copy of the MPL was not distributed with this
+ # file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ #
+ # This Source Code Form is "Incompatible With Secondary Licenses", as
+ # defined by the Mozilla Public License, v. 2.0.
+ #%]
+
+[% IF error == "edit_comment_invalid_comment_id" %]
+ [% title = "Invalid Comment ID" %]
+ The comment id '[% comment_id FILTER html %]' is invalid.
+[% END %]
diff --git a/extensions/EditComments/template/en/default/pages/editcomments.html.tmpl b/extensions/EditComments/template/en/default/pages/editcomments.html.tmpl
new file mode 100644
index 000000000..8b3b90c9e
--- /dev/null
+++ b/extensions/EditComments/template/en/default/pages/editcomments.html.tmpl
@@ -0,0 +1,122 @@
+[%# This Source Code Form is subject to the terms of the Mozilla Public
+ # License, v. 2.0. If a copy of the MPL was not distributed with this
+ # file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ #
+ # This Source Code Form is "Incompatible With Secondary Licenses", as
+ # defined by the Mozilla Public License, v. 2.0.
+ #%]
+
+[% PROCESS global/variables.none.tmpl %]
+
+[% PROCESS global/header.html.tmpl
+ title = "Comment changes made to $terms.bug $bug.id, comment $comment.id"
+ header = "Activity log for $terms.bug $bug.id, comment $comment.id"
+ %]
+
+<script type="text/javascript">
+/* The functions below expand and collapse comments */
+function toggle_comment_display(link, comment_id) {
+ if (YAHOO.util.Dom.hasClass('comment_text_' + comment_id, 'collapsed')) {
+ expand_comment(link, comment);
+ }
+ else {
+ collapse_comment(link, comment);
+ }
+}
+
+function toggle_all_comments(action) {
+ var num_comments = [% comment.activity.size FILTER html %];
+
+ // If for some given ID the comment doesn't exist, this doesn't mean
+ // there are no more comments, but that the comment is private and
+ // the user is not allowed to view it.
+
+ for (var id = 0; id < num_comments; id++) {
+ var comment = document.getElementById('comment_text_' + id);
+ if (!comment) {
+ continue;
+ }
+
+ var link = document.getElementById('comment_link_' + id);
+ if (action == 'collapse') {
+ collapse_comment(link, comment);
+ }
+ else {
+ expand_comment(link, comment);
+ }
+ }
+}
+
+function collapse_comment(link, comment) {
+ link.innerHTML = "[+]";
+ link.title = "Expand the comment.";
+ YAHOO.util.Dom.addClass(comment, 'collapsed');
+}
+
+function expand_comment(link, comment) {
+ link.innerHTML = "[-]";
+ link.title = "Collapse the comment";
+ YAHOO.util.Dom.removeClass(comment, 'collapsed');
+}
+</script>
+
+<p>
+ [% "Back to $terms.bug $bug.id" FILTER bug_link(bug.id) FILTER none %]
+</p>
+
+<p>
+ <strong>Note</strong>: The actual edited comment in the [% terms.bug %] view page will always show the original commentor's name and original timestamp.
+</p>
+
+<p>
+ <a href="#" onclick="toggle_all_comments('collapse'); return false;">Collapse All Changes</a> -
+ <a href="#" onclick="toggle_all_comments('expand'); return false;">Expand All Changes</a>
+</p>
+
+[% count = 0 %]
+[% FOREACH a = comment.activity %]
+ <div class="bz_comment">
+ <div class="bz_comment_head">
+ <i>
+ [% IF a.original %]
+ Original comment by [% (a.author.name || "Need Real Name") FILTER html %]
+ <span class="vcard">
+ (<a class="fn email" href="mailto:[% a.author.email FILTER html %]">
+ [%- a.author.email FILTER html -%]</a>)
+ </span>
+ on [%+ a.time FILTER time %]
+ [% ELSE %]
+ Revision by [% (a.author.name || "Need Real Name") FILTER html %]
+ <span class="vcard">
+ (<a class="fn email" href="mailto:[% a.author.email FILTER html %]">
+ [%- a.author.email FILTER html -%]</a>)
+ </span>
+ on [%+ a.time FILTER time %]
+ [% END %]
+ </i>
+ <a href="#" id="comment_link_[% count FILTER html %]"
+ onclick="toggle_comment_display(this, '[% count FILTER html FILTER js %]'); return false;"
+ title="Collapse the comment.">[-]</a>
+ </div>
+ [% IF a.original %]
+ [% wrapped_comment = a.body FILTER wrap_comment %]
+ [% ELSE %]
+ [% wrapped_comment = a.new FILTER wrap_comment %]
+ [% END %]
+[%# Don't indent the <pre> block, since then the spaces are displayed in the
+ # generated HTML %]
+<pre class="bz_comment_text" id="comment_text_[% count FILTER html %]">
+ [%- wrapped_comment FILTER quoteUrls(bug) -%]
+</pre>
+ </div>
+ [% count = count + 1 %]
+[% END %]
+
+[% IF comment.activity.size > 0 %]
+ <p>
+ [% "Back to $terms.bug $bug.id" FILTER bug_link(bug.id) FILTER none %]
+ </p>
+[% END %]
+
+[% PROCESS global/footer.html.tmpl %]
+