diff options
-rw-r--r-- | extensions/BMO/Extension.pm | 12 | ||||
-rw-r--r-- | extensions/BMO/lib/Data.pm | 20 | ||||
-rw-r--r-- | extensions/BMO/template/en/default/hook/bug/edit-after_custom_fields.html.tmpl | 61 | ||||
-rw-r--r-- | extensions/BMO/web/styles/edit_bug.css | 1 | ||||
-rw-r--r-- | skins/custom/create_bug.css | 1 | ||||
-rw-r--r-- | template/en/default/bug/create/create.html.tmpl | 36 |
6 files changed, 108 insertions, 23 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> </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> </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; } diff --git a/skins/custom/create_bug.css b/skins/custom/create_bug.css index 044896d68..30f8c5d03 100644 --- a/skins/custom/create_bug.css +++ b/skins/custom/create_bug.css @@ -1,4 +1,5 @@ +#bug_project_flags .field_label, #bug_tracking_flags .field_label { font-weight: normal !important; } diff --git a/template/en/default/bug/create/create.html.tmpl b/template/en/default/bug/create/create.html.tmpl index 32f39a3c5..b52657147 100644 --- a/template/en/default/bug/create/create.html.tmpl +++ b/template/en/default/bug/create/create.html.tmpl @@ -670,11 +670,15 @@ TUI_hide_default('attachment_text_field'); </tbody> [% END %] -[% display_bug_flags = 0 %] +[% tracking_flags = [] %] +[% project_flags = [] %] [% FOREACH field = Bugzilla.active_custom_fields(product=>product,type=>2) %] [% NEXT UNLESS field.enter_bug %] - [% display_bug_flags = 1 %] - [% LAST %] + [% IF cf_is_project_flag(field.name) %] + [% project_flags.push(field) %] + [% ELSE %] + [% tracking_flags.push(field) %] + [% END %] [% END %] [% display_flags = 0 %] @@ -685,7 +689,7 @@ TUI_hide_default('attachment_text_field'); [% LAST IF display_flags && any_flags_requesteeable %] [% END %] -[% IF display_bug_flags || display_flags %] +[% IF project_flags.size || tracking_flags.size || display_flags %] <tbody class="expert_fields"> <tr> <th>Flags:</th> @@ -703,15 +707,33 @@ TUI_hide_default('attachment_text_field'); <table cellpadding="0" cellspacing="0"> <tr> - [% IF display_bug_flags %] + [% IF project_flags.size %] + <td> + <table id="bug_project_flags"> + <tr> + <th colspan="2" style="text-align:left">Project Flags:</th> + </tr> + <tr> + [% FOREACH field = project_flags %] + [% SET value = ${field.name}.defined ? ${field.name} : "" %] + <tr> + [% INCLUDE bug/field.html.tmpl + bug = default, field = field, value = value, editable = 1, + value_span = 3 %] + </tr> + [% END %] + </tr> + </table> + </td> + [% END %] + [% IF tracking_flags.size %] <td> <table id="bug_tracking_flags"> <tr> <th colspan="2" style="text-align:left">Tracking Flags:</th> </tr> <tr> - [% FOREACH field = Bugzilla.active_custom_fields(product=>product,type=>2) %] - [% NEXT UNLESS field.enter_bug %] + [% FOREACH field = tracking_flags %] [% SET value = ${field.name}.defined ? ${field.name} : "" %] <tr> [% INCLUDE bug/field.html.tmpl |