From 40f5156e2e047efb2d863181ae7afb02c460d313 Mon Sep 17 00:00:00 2001 From: Byron Jones Date: Wed, 7 Nov 2012 15:40:53 +0800 Subject: Bug 801713: implement "bug shadowing" feature --- .../hook/bug/comments-aftercomments.html.tmpl | 70 ++++++++++++++++++++++ .../hook/bug/edit-after_comment_textarea.html.tmpl | 13 ++++ .../hook/bug/edit-after_custom_fields.html.tmpl | 27 +++++++++ .../default/hook/bug/edit-custom_field.html.tmpl | 9 +++ .../en/default/hook/bug/show-header-end.html.tmpl | 12 ++++ .../hook/global/user-error-errors.html.tmpl | 14 +++++ 6 files changed, 145 insertions(+) create mode 100644 extensions/ShadowBugs/template/en/default/hook/bug/comments-aftercomments.html.tmpl create mode 100644 extensions/ShadowBugs/template/en/default/hook/bug/edit-after_comment_textarea.html.tmpl create mode 100644 extensions/ShadowBugs/template/en/default/hook/bug/edit-after_custom_fields.html.tmpl create mode 100644 extensions/ShadowBugs/template/en/default/hook/bug/edit-custom_field.html.tmpl create mode 100644 extensions/ShadowBugs/template/en/default/hook/bug/show-header-end.html.tmpl create mode 100644 extensions/ShadowBugs/template/en/default/hook/global/user-error-errors.html.tmpl (limited to 'extensions/ShadowBugs/template/en/default') diff --git a/extensions/ShadowBugs/template/en/default/hook/bug/comments-aftercomments.html.tmpl b/extensions/ShadowBugs/template/en/default/hook/bug/comments-aftercomments.html.tmpl new file mode 100644 index 000000000..d8dae521a --- /dev/null +++ b/extensions/ShadowBugs/template/en/default/hook/bug/comments-aftercomments.html.tmpl @@ -0,0 +1,70 @@ +[%# 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. + #%] + +[% RETURN UNLESS is_shadow_bug %] + +[% public_bug = bug.cf_shadow_bug_obj %] +[% count = 0 %] +[% FOREACH comment = shadow_comments %] + [% IF count >= start_at %] + [% PROCESS a_comment %] + [% END %] + [% count = count + increment %] +[% END %] + +[% BLOCK a_comment %] + [% RETURN IF comment.is_private AND NOT (user.is_insider || user.id == comment.author.id) %] + [% comment_text = comment.body_full %] + [% RETURN IF comment_text == '' %] + +
+ [% IF count == description %] + [% class_name = "bz_first_comment_head" %] + [% comment_label = "Public Description" %] + [% ELSE %] + [% class_name = "bz_comment_head" %] + [% comment_label = "Public Comment " _ count %] + [% END %] + +
+ + + [%- comment_label FILTER html %] + + + + [% commenter_id = comment.author.id %] + [% UNLESS user_cache.$commenter_id %] + [% user_cache.$commenter_id = BLOCK %] + [% INCLUDE global/user.html.tmpl who = comment.author %] + [% END %] + [% END %] + [% user_cache.$commenter_id FILTER none %] + [% Hook.process('user', 'bug/comments.html.tmpl') %] + + + + [% FOREACH group = comment.author.groups_with_icon %] + [% group.name FILTER html %] + [% END %] + + + + [%+ comment.creation_ts FILTER time %] + +
+ +
+  [%- comment_text FILTER quoteUrls(public_bug, comment) -%]
+
+
+[% END %] diff --git a/extensions/ShadowBugs/template/en/default/hook/bug/edit-after_comment_textarea.html.tmpl b/extensions/ShadowBugs/template/en/default/hook/bug/edit-after_comment_textarea.html.tmpl new file mode 100644 index 000000000..9873ea3d7 --- /dev/null +++ b/extensions/ShadowBugs/template/en/default/hook/bug/edit-after_comment_textarea.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. + #%] + +[% RETURN UNLESS is_shadow_bug %] + +
+Add public comment + diff --git a/extensions/ShadowBugs/template/en/default/hook/bug/edit-after_custom_fields.html.tmpl b/extensions/ShadowBugs/template/en/default/hook/bug/edit-after_custom_fields.html.tmpl new file mode 100644 index 000000000..8e8327ef2 --- /dev/null +++ b/extensions/ShadowBugs/template/en/default/hook/bug/edit-after_custom_fields.html.tmpl @@ -0,0 +1,27 @@ +[%# 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. + #%] + +[% RETURN IF Bugzilla.is_cf_shadow_bug_hidden(bug) %] +[% field = Bugzilla.process_cache.shadow_bug_field %] +[% shadowed_by = bug.related_bugs(field).pop %] + + [% IF shadowed_by && user.can_see_bug(shadowed_by) %] + + [% field.reverse_desc FILTER html %]: + + + [% shadowed_by.id FILTER bug_link(shadowed_by, use_alias => 1) FILTER none %][% " " %] + + [% ELSE %] + [% PROCESS bug/field.html.tmpl + value = bug.cf_shadow_bug + editable = bug.check_can_change_field(field.name, 0, 1) + no_tds = false + value_span = 2 %] + [% END %] + diff --git a/extensions/ShadowBugs/template/en/default/hook/bug/edit-custom_field.html.tmpl b/extensions/ShadowBugs/template/en/default/hook/bug/edit-custom_field.html.tmpl new file mode 100644 index 000000000..4389b27ad --- /dev/null +++ b/extensions/ShadowBugs/template/en/default/hook/bug/edit-custom_field.html.tmpl @@ -0,0 +1,9 @@ +[%# 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. + #%] + +[% field.hidden = field.name == 'cf_shadow_bug' %] diff --git a/extensions/ShadowBugs/template/en/default/hook/bug/show-header-end.html.tmpl b/extensions/ShadowBugs/template/en/default/hook/bug/show-header-end.html.tmpl new file mode 100644 index 000000000..5786b3df6 --- /dev/null +++ b/extensions/ShadowBugs/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 is_shadow_bug %] + [% style_urls.push('extensions/ShadowBugs/web/style.css') %] + [% javascript_urls.push('extensions/ShadowBugs/web/shadow-bugs.js') %] +[% END %] diff --git a/extensions/ShadowBugs/template/en/default/hook/global/user-error-errors.html.tmpl b/extensions/ShadowBugs/template/en/default/hook/global/user-error-errors.html.tmpl new file mode 100644 index 000000000..775a7721e --- /dev/null +++ b/extensions/ShadowBugs/template/en/default/hook/global/user-error-errors.html.tmpl @@ -0,0 +1,14 @@ +[%# 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 == 'illegal_shadow_bug_public' %] + [% title = "Invalid Shadow " _ terms.Bug %] + You cannot shadow [% terms.bug %] [%+ id FILTER html %] because it is not a + public [% terms.bug %]. +[% END %] + -- cgit v1.2.3-24-g4f1b