summaryrefslogtreecommitdiffstats
path: root/extensions/BMO
diff options
context:
space:
mode:
authorDave Lawrence <dlawrence@mozilla.com>2012-04-07 00:08:10 +0200
committerDave Lawrence <dlawrence@mozilla.com>2012-04-07 00:08:10 +0200
commit304df9d6e97140b7a717176302be5d407266b03d (patch)
tree0c6dc76445e321e10670a7522beb78e6d0d51843 /extensions/BMO
parentdb4b414c8ba553a9f11e3303f3bf40d671f23184 (diff)
downloadbugzilla-304df9d6e97140b7a717176302be5d407266b03d.tar.gz
bugzilla-304df9d6e97140b7a717176302be5d407266b03d.tar.xz
Bug 738104 - Need a Project "flag" in bugzilla
r=gerv
Diffstat (limited to 'extensions/BMO')
-rw-r--r--extensions/BMO/Extension.pm12
-rw-r--r--extensions/BMO/lib/Data.pm20
-rw-r--r--extensions/BMO/template/en/default/hook/bug/edit-after_custom_fields.html.tmpl61
-rw-r--r--extensions/BMO/web/styles/edit_bug.css1
4 files changed, 78 insertions, 16 deletions
diff --git a/extensions/BMO/Extension.pm b/extensions/BMO/Extension.pm
index 47f022c97..e7f6554e4 100644
--- a/extensions/BMO/Extension.pm
+++ b/extensions/BMO/Extension.pm
@@ -45,6 +45,7 @@ use Bugzilla::Extension::BMO::Constants;
use Bugzilla::Extension::BMO::FakeBug;
use Bugzilla::Extension::BMO::Data qw($cf_visible_in_products
$cf_flags
+ $cf_project_flags
$cf_disabled_flags
%group_to_cc_map
$blocking_trusted_setters
@@ -77,7 +78,8 @@ sub template_before_process {
my $vars = $args->{'vars'};
$vars->{'cf_hidden_in_product'} = \&cf_hidden_in_product;
- $vars->{'cf_flag_disabled'} = \&cf_flag_disabled;
+ $vars->{'cf_is_project_flag'} = \&cf_is_project_flag;
+ $vars->{'cf_flag_disabled'} = \&cf_flag_disabled;
if ($file =~ /^list\/list/) {
# Purpose: enable correct sorting of list table
@@ -218,6 +220,14 @@ sub active_custom_fields {
$$fields = \@tmp_fields;
}
+sub cf_is_project_flag {
+ my ($field_name) = @_;
+ foreach my $flag_re (@$cf_project_flags) {
+ return 1 if $field_name =~ $flag_re;
+ }
+ return 0;
+}
+
sub cf_hidden_in_product {
my ($field_name, $product_name, $component_name, $custom_flag_mode) = @_;
diff --git a/extensions/BMO/lib/Data.pm b/extensions/BMO/lib/Data.pm
index a99bd7203..594acba1a 100644
--- a/extensions/BMO/lib/Data.pm
+++ b/extensions/BMO/lib/Data.pm
@@ -27,7 +27,8 @@ use base qw(Exporter);
use Tie::IxHash;
our @EXPORT_OK = qw($cf_visible_in_products
- $cf_flags $cf_disabled_flags
+ $cf_flags $cf_project_flags
+ $cf_disabled_flags
%group_to_cc_map
$blocking_trusted_setters
$blocking_trusted_requesters
@@ -47,6 +48,18 @@ our @EXPORT_OK = qw($cf_visible_in_products
# IxHash keeps them in insertion order, and so we get regexp priorities right.
our $cf_visible_in_products;
tie(%$cf_visible_in_products, "Tie::IxHash",
+ qw/^cf_blocking_kilimanjaro/ => {
+ "Firefox" => [],
+ "Thunderbird" => [],
+ "Testing" => [],
+ "mozilla.org" => [],
+ "Core" => [],
+ "NSS" => [],
+ "NSPR" => [],
+ "Toolkit" => [],
+ "Fennec" => [],
+ "Fennec Native" => [],
+ },
qr/^cf_blocking_fennec/ => {
"addons.mozilla.org" => [],
"AUS" => [],
@@ -154,6 +167,10 @@ our $cf_flags = [
qr/^cf_(?:blocking|tracking|status)_/,
];
+our $cf_project_flags = [
+ qr/^cf_blocking_kilimanjaro/,
+];
+
# List of disabled fields.
# Temp kludge until custom fields can be disabled correctly upstream.
# Disabled fields are hidden unless they have a value set
@@ -229,6 +246,7 @@ our $blocking_trusted_setters = {
qr/^cf_tracking_thunderbird/ => 'thunderbird-drivers',
qr/^cf_tracking_seamonkey/ => 'seamonkey-council',
qr/^cf_blocking_seamonkey/ => 'seamonkey-council',
+ qr/^cf_blocking_kilimanjaro/ => 'kilimanjaro-drivers',
'_default' => 'mozilla-stable-branch-drivers',
};
diff --git a/extensions/BMO/template/en/default/hook/bug/edit-after_custom_fields.html.tmpl b/extensions/BMO/template/en/default/hook/bug/edit-after_custom_fields.html.tmpl
index 0c68d8e72..4be267b79 100644
--- a/extensions/BMO/template/en/default/hook/bug/edit-after_custom_fields.html.tmpl
+++ b/extensions/BMO/template/en/default/hook/bug/edit-after_custom_fields.html.tmpl
@@ -23,16 +23,52 @@
# ***** END LICENSE BLOCK *****
#%]
-[% show_custom_flags = 0 %]
-[% FOREACH field = Bugzilla.active_custom_fields %]
+[% tracking_flags = [] %]
+[% project_flags = [] %]
+[% FOREACH field = Bugzilla.active_custom_fields(product=>bug.product_obj,component=>bug.component_obj,type=>2) %]
[% NEXT IF NOT user.id AND bug.${field.name} == "---" %]
- [% NEXT IF cf_hidden_in_product(field.name, bug.product, bug.component, 2) %]
- [% show_custom_flags = 1 %]
- [% LAST %]
+ [% NEXT IF cf_flag_disabled(field.name, bug) %]
+ [% IF cf_is_project_flag(field.name) %]
+ [% project_flags.push(field) %]
+ [% ELSE %]
+ [% tracking_flags.push(field) %]
+ [% END %]
[% END %]
-[% IF show_custom_flags %]
- [% custom_flags = [] %]
+[% IF project_flags.size %]
+ <tr>
+ <th class="field_label">
+ <label>Project Flags:</label>
+ </td>
+ <td>
+ <table id="project-flags">
+ [% FOREACH field = project_flags %]
+ [% NEXT IF NOT user.id AND field.value == "---" %]
+ <tr id="row_[% field.name FILTER js %]">
+ <td>&nbsp;</td>
+ <td>
+ <label for="[% field.name FILTER html %]">
+ [% field_descs.${field.name} FILTER html %]:
+ </label>
+ </td>
+ <td>
+ [% PROCESS bug/field.html.tmpl value = bug.${field.name}
+ editable = user.id
+ no_tds = 1 %]
+ [% IF user.id %]
+ <span id="ro_[% field.name FILTER html %]" class="bz_hidden">
+ [% bug.${field.name} FILTER html %]
+ </span>
+ [% END %]
+ </td>
+ </tr>
+ [% END %]
+ </table>
+ </td>
+ </tr>
+[% END %]
+
+[% IF tracking_flags.size %]
<tr>
<td class="" colspan="2">
<label><b>Tracking Flags:</b></label>
@@ -46,11 +82,8 @@
<tr>
<td colspan="2">
<table id="custom-flags">
- [% FOREACH field = Bugzilla.active_custom_fields %]
+ [% FOREACH field = tracking_flags %]
[% NEXT IF NOT user.id AND field.value == "---" %]
- [% NEXT IF cf_hidden_in_product(field.name, bug.product, bug.component, 2) %]
- [% NEXT IF cf_flag_disabled(field.name, bug) %]
- [% custom_flags.push(field.name) %]
<tr id="row_[% field.name FILTER js %]">
<td>&nbsp;</td>
<td>
@@ -74,9 +107,9 @@
</td>
</tr>
<script type="text/javascript">
- var bmo_custom_flags = new Array([% custom_flags.size FILTER none %]);
- [% FOREACH field_name = custom_flags %]
- bmo_custom_flags['[% field_name FILTER js %]'] = '[% bug.${field_name} FILTER js %]';
+ var bmo_custom_flags = new Array([% tracking_flags.size FILTER none %]);
+ [% FOREACH field = tracking_flags %]
+ bmo_custom_flags['[% field.name FILTER js %]'] = '[% bug.${field.name} FILTER js %]';
[% END %]
bmo_hide_tracking_flags();
</script>
diff --git a/extensions/BMO/web/styles/edit_bug.css b/extensions/BMO/web/styles/edit_bug.css
index ecfb2f80c..901d3befb 100644
--- a/extensions/BMO/web/styles/edit_bug.css
+++ b/extensions/BMO/web/styles/edit_bug.css
@@ -23,6 +23,7 @@
* ***** END LICENSE BLOCK *****
*/
+#project-flags,
#custom-flags {
width: auto;
}