summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--extensions/MozReview/Extension.pm30
-rw-r--r--extensions/MozReview/template/en/default/hook/attachment/create-before_form.html.tmpl17
-rw-r--r--extensions/MozReview/template/en/default/hook/global/header-start.html.tmpl11
-rw-r--r--extensions/MozReview/web/style/attachment.css13
-rw-r--r--template/en/default/attachment/create.html.tmpl3
5 files changed, 63 insertions, 11 deletions
diff --git a/extensions/MozReview/Extension.pm b/extensions/MozReview/Extension.pm
index 2287a2136..ab7afb18a 100644
--- a/extensions/MozReview/Extension.pm
+++ b/extensions/MozReview/Extension.pm
@@ -22,25 +22,33 @@ sub template_before_process {
my $vars = $args->{'vars'};
return unless (($file eq 'bug/show-header.html.tmpl' ||
- $file eq 'bug/edit.html.tmpl') &&
+ $file eq 'bug/edit.html.tmpl' ||
+ $file eq 'attachment/create.html.tmpl') &&
Bugzilla->params->{mozreview_base_url});
my $bug = exists $vars->{'bugs'} ? $vars->{'bugs'}[0] : $vars->{'bug'};
if ($bug) {
- my @rrids;
- my $attachments = Bugzilla::Attachment->get_attachments_by_bug($bug);
+ if ($file eq 'attachment/create.html.tmpl') {
+ if ($bug->product eq 'Core' || $bug->product eq 'Firefox' ||
+ $bug->product eq 'Firefox for Android') {
+ $vars->{'mozreview_enabled'} = 1;
+ }
+ } else {
+ my @rrids;
+ my $attachments = Bugzilla::Attachment->get_attachments_by_bug($bug);
- foreach my $attachment (@$attachments) {
- if ($attachment->contenttype eq 'text/x-review-board-request' &&
- !$attachment->isobsolete) {
- push @rrids, ($attachment->data =~ m#/r/(\d+)/?$#);
+ foreach my $attachment (@$attachments) {
+ if ($attachment->contenttype eq 'text/x-review-board-request'
+ && !$attachment->isobsolete) {
+ push @rrids, ($attachment->data =~ m#/r/(\d+)/?$#);
+ }
}
- }
- if (scalar @rrids) {
- $vars->{'mozreview'} = 1;
- $vars->{'review_request_ids'} = \@rrids;
+ if (scalar @rrids) {
+ $vars->{'mozreview'} = 1;
+ $vars->{'review_request_ids'} = \@rrids;
+ }
}
}
}
diff --git a/extensions/MozReview/template/en/default/hook/attachment/create-before_form.html.tmpl b/extensions/MozReview/template/en/default/hook/attachment/create-before_form.html.tmpl
new file mode 100644
index 000000000..0bf6fe543
--- /dev/null
+++ b/extensions/MozReview/template/en/default/hook/attachment/create-before_form.html.tmpl
@@ -0,0 +1,17 @@
+[%# 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 mozreview_enabled %]
+
+<div class="mozreview-ad">
+ Are you attaching a patch? Consider trying out
+ <a href="https://reviewboard.mozilla.org/">MozReview</a>, Mozilla's
+ new repository-based code-review tool.
+ <a href="http://mozilla-version-control-tools.readthedocs.org/en/latest/mozreview.html">Read
+ the docs</a> to get started.
+</div>
diff --git a/extensions/MozReview/template/en/default/hook/global/header-start.html.tmpl b/extensions/MozReview/template/en/default/hook/global/header-start.html.tmpl
new file mode 100644
index 000000000..6ad026de6
--- /dev/null
+++ b/extensions/MozReview/template/en/default/hook/global/header-start.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 template.name == 'attachment/create.html.tmpl' %]
+ [% style_urls.push('extensions/MozReview/web/style/attachment.css') %]
+[% END %]
diff --git a/extensions/MozReview/web/style/attachment.css b/extensions/MozReview/web/style/attachment.css
new file mode 100644
index 000000000..474bf466e
--- /dev/null
+++ b/extensions/MozReview/web/style/attachment.css
@@ -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. */
+
+.mozreview-ad {
+ background-color: #fff9db;
+ color: #666458;
+ padding: 5px;
+ margin-bottom: 10px;
+}
diff --git a/template/en/default/attachment/create.html.tmpl b/template/en/default/attachment/create.html.tmpl
index 45c61d5a1..ad2b13a99 100644
--- a/template/en/default/attachment/create.html.tmpl
+++ b/template/en/default/attachment/create.html.tmpl
@@ -45,6 +45,9 @@ TUI_hide_default('attachment_text_field');
-->
</script>
+[%# BMO hook for displaying MozReview message %]
+[% Hook.process('before_form') %]
+
<form name="entryform" method="post" action="attachment.cgi"
enctype="multipart/form-data"
onsubmit="return validateAttachmentForm(this)">