From eca4822f0ad4733af64425c10b9edd1d7ca62772 Mon Sep 17 00:00:00 2001 From: Dave Lawrence Date: Wed, 21 Dec 2011 12:42:51 -0500 Subject: merged with bmo/4.0 --- .htaccess | 2 +- Bugzilla.pm | 19 +++++++++++---- Bugzilla/Product.pm | 4 ++-- config.cgi | 2 +- enter_bug.cgi | 3 +++ extensions/BMO/Extension.pm | 27 +++++++++++++++++++-- extensions/BMO/lib/Data.pm | 8 +++++++ .../en/default/global/choose-product.html.tmpl | 13 +++++++++- extensions/RequestWhiner/bin/whineatrequests.pl | 13 ++++++---- .../en/default/requestwhiner/mail.html.tmpl | 26 +++++++++++++------- .../en/default/requestwhiner/mail.txt.tmpl | 25 ++++++++++--------- skins/custom/global.css | 7 ++++++ template/en/default/bug/create/create.html.tmpl | 28 ++++++++++------------ template/en/default/bug/edit.html.tmpl | 5 ++-- template/en/default/config.rdf.tmpl | 2 +- 15 files changed, 128 insertions(+), 56 deletions(-) diff --git a/.htaccess b/.htaccess index e69fcf01c..adb499967 100644 --- a/.htaccess +++ b/.htaccess @@ -34,7 +34,7 @@ Redirect permanent /duplicates.html https://bugzilla.mozilla.org/duplicates.cgi RewriteEngine On RewriteRule ^favicon\.ico$ extensions/BMO/web/images/favicon.ico -RewriteRule ^form[\.:](itrequest|brownbag|mozlist|mktgevent|poweredby|presentation|swag|trademark)$ enter_bug.cgi?product=mozilla.org&format=$1 +RewriteRule ^form[\.:](itrequest|brownbag|mozlist|mktgevent|poweredby|presentation|swag|trademark|recoverykey)$ enter_bug.cgi?product=mozilla.org&format=$1 RewriteRule ^form[\.:]legal$ enter_bug.cgi?product=Legal&format=legal RewriteRule ^form[\.:]mozpr$ enter_bug.cgi?product=Mozilla+PR&format=mozpr RewriteRule ^form[\.:]reps[\.:]mentorship$ enter_bug.cgi?product=Mozilla+Reps&format=mozreps diff --git a/Bugzilla.pm b/Bugzilla.pm index 65ddcc2bc..29467ef1f 100644 --- a/Bugzilla.pm +++ b/Bugzilla.pm @@ -42,6 +42,7 @@ use Bugzilla::Auth::Persist::Cookie; use Bugzilla::CGI; use Bugzilla::Extension; use Bugzilla::DB; +use Bugzilla::Hook; use Bugzilla::Install::Localconfig qw(read_localconfig); use Bugzilla::Install::Requirements qw(OPTIONAL_MODULES); use Bugzilla::Install::Util qw(init_console); @@ -596,12 +597,20 @@ sub fields { } sub active_custom_fields { - my $class = shift; - if (!exists $class->request_cache->{active_custom_fields}) { - $class->request_cache->{active_custom_fields} = - Bugzilla::Field->match({ custom => 1, obsolete => 0 }); + my ($class, $params) = @_; + my $cache_id = 'active_custom_fields'; + if ($params) { + $cache_id .= ($params->{product} ? '_p' . $params->{product}->id : '') . + ($params->{component} ? '_c' . $params->{component}->id : '') . + ($params->{type} ? '_t' . $params->{type} : ''); + } + if (!exists $class->request_cache->{$cache_id}) { + my $fields = Bugzilla::Field->match({ custom => 1, obsolete => 0}); + Bugzilla::Hook::process('active_custom_fields', + { fields => \$fields, params => $params }); + $class->request_cache->{$cache_id} = $fields; } - return @{$class->request_cache->{active_custom_fields}}; + return @{$class->request_cache->{$cache_id}}; } sub has_flags { diff --git a/Bugzilla/Product.pm b/Bugzilla/Product.pm index 976804cb0..79af9cbf5 100644 --- a/Bugzilla/Product.pm +++ b/Bugzilla/Product.pm @@ -114,7 +114,7 @@ sub create { # for each product in the list, particularly with hundreds or thousands # of products. sub preload { - my ($products, $preload_flagtypes) = @_; + my ($products, $preload_flagtypes, $flagtypes_params) = @_; my %prods = map { $_->id => $_ } @$products; my @prod_ids = keys %prods; return unless @prod_ids; @@ -132,7 +132,7 @@ sub preload { } } if ($preload_flagtypes) { - $_->flag_types foreach @$products; + $_->flag_types($flagtypes_params) foreach @$products; } } diff --git a/config.cgi b/config.cgi index 2c82fdc59..963224638 100755 --- a/config.cgi +++ b/config.cgi @@ -82,7 +82,7 @@ if ($cgi->param('product')) { } # We set the 2nd argument to 1 to also preload flag types. -Bugzilla::Product::preload($vars->{'products'}, 1); +Bugzilla::Product::preload($vars->{'products'}, 1, { is_active => 1 }); # Allow consumers to specify whether or not they want flag data. if (defined $cgi->param('flags')) { diff --git a/enter_bug.cgi b/enter_bug.cgi index 239a731e2..302f84f06 100755 --- a/enter_bug.cgi +++ b/enter_bug.cgi @@ -177,6 +177,9 @@ if ($product_name eq '') { # to enter a bug against this product. $product = $user->can_enter_product($product || $product_name, THROW_ERROR); +# Preloading certain attributes such as components/versions/milestones/flags +Bugzilla::Product::preload([ $product ], 1, { is_active => 1 }); + ############################################################################## # Useful Subroutines ############################################################################## diff --git a/extensions/BMO/Extension.pm b/extensions/BMO/Extension.pm index e8e58db27..44a1a3e69 100644 --- a/extensions/BMO/Extension.pm +++ b/extensions/BMO/Extension.pm @@ -186,6 +186,26 @@ sub _get_field_values_sort_key { return \%field_values; } +sub active_custom_fields { + my ($self, $args) = @_; + my $fields = $args->{'fields'}; + my $params = $args->{'params'}; + my $product = $params->{'product'}; + my $component = $params->{'component'}; + + return if !$product; + + my $product_name = blessed $product ? $product->name : $product; + my $component_name = blessed $component ? $component->name : $component; + + my @tmp_fields; + foreach my $field (@$$fields) { + next if cf_hidden_in_product($field->name, $product_name, $component_name, $params->{'type'}); + push(@tmp_fields, $field); + } + $$fields = \@tmp_fields; +} + sub cf_hidden_in_product { my ($field_name, $product_name, $component_name, $custom_flag_mode) = @_; @@ -196,8 +216,11 @@ sub cf_hidden_in_product { # Also in buglist.cgi, we pass in a list of components instead # of a single compoent name everywhere else. - my $component_list = ref $component_name ? $component_name - : [ $component_name ]; + my $component_list = []; + if ($component_name) { + $component_list = ref $component_name ? $component_name + : [ $component_name ]; + } if ($custom_flag_mode) { if ($custom_flag_mode == 1) { diff --git a/extensions/BMO/lib/Data.pm b/extensions/BMO/lib/Data.pm index be829e786..93118f5b1 100644 --- a/extensions/BMO/lib/Data.pm +++ b/extensions/BMO/lib/Data.pm @@ -52,6 +52,7 @@ tie(%$cf_visible_in_products, "Tie::IxHash", "AUS" => [], "Core" => [], "Fennec" => [], + "Fennec Native" => [], "mozilla.org" => ["Release Engineering"], "Mozilla Services" => [], "NSPR" => [], @@ -82,6 +83,7 @@ tie(%$cf_visible_in_products, "Tie::IxHash", "Core" => [], "Directory" => [], "Fennec" => [], + "Fennec Native" => [], "Firefox" => [], "MailNews Core" => [], "mozilla.org" => ["Release Engineering"], @@ -178,6 +180,12 @@ our $cf_disabled_flags = [ 'cf_status_thunderbird7', 'cf_tracking_seamonkey24', 'cf_status_seamonkey24', + 'cf_tracking_firefox8', + 'cf_status_firefox8', + 'cf_tracking_thunderbird8', + 'cf_status_thunderbird8', + 'cf_tracking_seamonkey25', + 'cf_status_seamonkey25', ]; # Who to CC on particular bugmails when certain groups are added or removed. diff --git a/extensions/BMO/template/en/default/global/choose-product.html.tmpl b/extensions/BMO/template/en/default/global/choose-product.html.tmpl index 7e0a8dc18..9daae1d25 100644 --- a/extensions/BMO/template/en/default/global/choose-product.html.tmpl +++ b/extensions/BMO/template/en/default/global/choose-product.html.tmpl @@ -125,7 +125,18 @@ href="http://www.mozilla.org/support/">Visit the mozilla.org support page be [% END %] [% FOREACH p = c.products %] - + [% class = "" %] + [% has_entry_groups = 0 %] + [% FOREACH gid = p.group_controls.keys %] + [% IF p.group_controls.$gid.entry %] + [% has_entry_groups = 1 %] + [% class = class _ " group_$gid" %] + [% END %] + [% END %] + [% IF p.name == "Mozilla PR" AND target == "enter_bug.cgi" AND NOT format AND NOT cgi.param("debug") %] sql_to_days('NOW()') . @@ -68,6 +69,7 @@ my $requests = {}; while (my ($login_name, $flag_name, + $attach_id, $bug_id, $short_desc, $age_in_days) = $sth_get_requests->fetchrow_array()) @@ -81,9 +83,10 @@ while (my ($login_name, } push(@{ $requests->{$login_name}->{$flag_name} }, { - id => $bug_id, - summary => $short_desc, - age => $age_in_days + bug_id => $bug_id, + attach_id => $attach_id, + summary => $short_desc, + age => $age_in_days }); } @@ -97,7 +100,7 @@ foreach my $recipient (keys %$requests) { mail({ from => Bugzilla->params->{'mailfrom'}, recipient => $user, - subject => "Outstanding Requests", + subject => "Your Outstanding Requests", requests => $requests->{$recipient}, threshold => WHINE_AFTER_DAYS }); diff --git a/extensions/RequestWhiner/template/en/default/requestwhiner/mail.html.tmpl b/extensions/RequestWhiner/template/en/default/requestwhiner/mail.html.tmpl index de2c4dc6a..07b2b31ee 100644 --- a/extensions/RequestWhiner/template/en/default/requestwhiner/mail.html.tmpl +++ b/extensions/RequestWhiner/template/en/default/requestwhiner/mail.html.tmpl @@ -29,17 +29,27 @@ -

Here are your outstanding requests older than [% threshold FILTER html%] -days:

+

The following is a list of requests people have made of you, which have been +outstanding more than [% threshold FILTER html %] days. To avoid disappointing +others, please deal with them as quickly as possible. +(Here is some +guidance on handling requests.) +

-[% FOREACH request = requests.keys %] -

[% request FILTER html %]

+[% FOREACH request_type = requests.keys %] +

[% request_type FILTER html %]

@@ -48,7 +58,5 @@ days:

See all your outstanding requests.

-

A href="https://wiki.mozilla.org/BMO/Handling_Requests">Get guidance on handling requests.

- diff --git a/extensions/RequestWhiner/template/en/default/requestwhiner/mail.txt.tmpl b/extensions/RequestWhiner/template/en/default/requestwhiner/mail.txt.tmpl index a7cfd9668..c8091c057 100644 --- a/extensions/RequestWhiner/template/en/default/requestwhiner/mail.txt.tmpl +++ b/extensions/RequestWhiner/template/en/default/requestwhiner/mail.txt.tmpl @@ -20,19 +20,22 @@ [% PROCESS global/variables.none.tmpl %] [% PROCESS 'global/field-descs.none.tmpl' %] -Here are your outstanding requests older than [% threshold %] days: +The following is a list of requests people have made of you, which have been +outstanding more than [% threshold %] days. To avoid disappointing others, please deal with +them as quickly as possible. Here is some guidance on handling requests: + https://wiki.mozilla.org/BMO/Handling_Requests -[% FOREACH request = requests.keys %] -[%+ request +%] -[%+ "-" FILTER repeat(request.length) +%] +[% FOREACH request_type = requests.keys %] +[%+ request_type +%] +[%+ "-" FILTER repeat(request_type.length) +%] - [% FOREACH bug = requests.$request %] - [%+ terms.Bug +%] [%+ bug.id %]: [% bug.summary +%] ([% bug.age %] days old) - [%+ urlbase %]show_bug.cgi?id=[% bug.id +%] + [% FOREACH request = requests.$request_type %] + [%+ terms.Bug +%] [%+ request.bug_id %]: [% request.summary +%] ([% request.age %] days old) + [%+ urlbase %]show_bug.cgi?id=[% request.bug_id +%] + [% IF request.attach_id %] + [%+ urlbase %]attachment.cgi?id=[% request.attach_id %]&action=edit + [% END %] [%+ END +%] [% END %] To see all your outstanding requests, visit: -[%+ urlbase %]request.cgi?action=queue&requestee=[% recipient.email FILTER uri %]&group=type - -For guidance on handling requests, see: -https://wiki.mozilla.org/BMO/Handling_Requests +[%+ urlbase %]request.cgi?action=queue&requestee=[% recipient.email FILTER url_quote %]&group=type diff --git a/skins/custom/global.css b/skins/custom/global.css index 3aee569f4..b2cbcc397 100644 --- a/skins/custom/global.css +++ b/skins/custom/global.css @@ -71,3 +71,10 @@ a.controller { padding-left:1ex; padding-bottom:1ex; } + +.group_secure > th > a { + background-image: url("../../images/padlock.png"); + background-position: center left; + background-repeat: no-repeat; + padding-left: 18px; +} diff --git a/template/en/default/bug/create/create.html.tmpl b/template/en/default/bug/create/create.html.tmpl index 26278e525..7f2ddc42f 100644 --- a/template/en/default/bug/create/create.html.tmpl +++ b/template/en/default/bug/create/create.html.tmpl @@ -80,10 +80,10 @@ var flags = new Array([% product.components.size %]); comp_desc[[% count %]] = "[% c.description FILTER html_light FILTER js %]"; initialowners[[% count %]] = "[% c.default_assignee.login FILTER js %]"; [% flag_list = [] %] - [% FOREACH f = c.flag_types(is_active=>1).bug %] + [% FOREACH f = c.flag_types.bug %] [% flag_list.push(f.id) %] [% END %] - [% FOREACH f = c.flag_types(is_active=>1).attachment %] + [% FOREACH f = c.flag_types.attachment %] [% flag_list.push(f.id) %] [% END %] flags[[% count %]] = [[% flag_list.join(",") FILTER js %]]; @@ -560,7 +560,7 @@ TUI_hide_default('attachment_text_field'); Add an attachment [% PROCESS attachment/createformcontents.html.tmpl - flag_types = product.flag_types(is_active=>1).attachment + flag_types = product.flag_types.attachment any_flags_requesteeble = 1 flag_table_id ="attachment_flags" %]
@@ -634,12 +634,13 @@ TUI_hide_default('attachment_text_field'); [%# non-tracking flags custom fields %] -[% FOREACH field = Bugzilla.active_custom_fields %] +[% FOREACH field = Bugzilla.active_custom_fields(product=>product,type=>1) %] [% NEXT UNLESS field.enter_bug %] - [% NEXT IF cf_hidden_in_product(field.name, product.name, component.name, 1) %] [%# crash-signature gets custom handling %] - [% NEXT IF field.name == 'cf_crash_signature' %] - + [% IF field.name == 'cf_crash_signature' %] + [% show_crash_signature = 1 %] + [% NEXT %] + [% END %] [% SET value = ${field.name}.defined ? ${field.name} : "" %] [% INCLUDE bug/field.html.tmpl @@ -650,7 +651,7 @@ TUI_hide_default('attachment_text_field'); [%# crash-signature handling %] -[% UNLESS cf_hidden_in_product('cf_crash_signature', product.name, component.name, 1) %] +[% IF show_crash_signature %] @@ -671,16 +672,15 @@ TUI_hide_default('attachment_text_field'); [% END %] [% display_bug_flags = 0 %] -[% FOREACH field = Bugzilla.active_custom_fields %] +[% FOREACH field = Bugzilla.active_custom_fields(product=>product,type=>2) %] [% NEXT UNLESS field.enter_bug %] - [% NEXT IF cf_hidden_in_product(field.name, product.name, component.name, 2) %] [% display_bug_flags = 1 %] [% LAST %] [% END %] [% display_flags = 0 %] [% any_flags_requesteeble = 0 %] -[% FOREACH flag_type = product.flag_types(is_active=>1).bug %] +[% FOREACH flag_type = product.flag_types.bug %] [% display_flags = 1 %] [% SET any_flags_requesteeble = 1 IF flag_type.is_requestable && flag_type.is_requesteeble %] [% LAST IF display_flags && any_flags_requesteeable %] @@ -711,10 +711,8 @@ TUI_hide_default('attachment_text_field'); Tracking Flags: - [% FOREACH field = Bugzilla.active_custom_fields %] + [% FOREACH field = Bugzilla.active_custom_fields(product=>product,type=>2) %] [% NEXT UNLESS field.enter_bug %] - [% NEXT IF cf_hidden_in_product(field.name, product.name, component.name, 2) %] - [% SET value = ${field.name}.defined ? ${field.name} : "" %] [% INCLUDE bug/field.html.tmpl @@ -728,7 +726,7 @@ TUI_hide_default('attachment_text_field'); [% END %] [% IF display_flags %] - [% PROCESS "flag/list.html.tmpl" flag_types = product.flag_types(is_active=>1).bug + [% PROCESS "flag/list.html.tmpl" flag_types = product.flag_types.bug any_flags_requesteeble = any_flags_requesteeble flag_table_id = "bug_flags" %] diff --git a/template/en/default/bug/edit.html.tmpl b/template/en/default/bug/edit.html.tmpl index 4d1e12597..a55be45fe 100644 --- a/template/en/default/bug/edit.html.tmpl +++ b/template/en/default/bug/edit.html.tmpl @@ -870,7 +870,7 @@ [% show_bug_flags = 0 %] [% bug_flags_set = 0 %] [% show_more_flags = 0 %] - [% FOREACH type = bug.flag_types %] + [% FOREACH type = bug.flag_types(is_active=>1) %] [% IF (type.flags && type.flags.size > 0) || (user.id && type.is_active) %] [% show_bug_flags = 1 %] [% END %] @@ -929,9 +929,8 @@ [% BLOCK section_customfields %] [%# *** Custom Fields *** %] [% USE Bugzilla %] - [% FOREACH field = Bugzilla.active_custom_fields %] + [% FOREACH field = Bugzilla.active_custom_fields(product=>bug.product_obj,component=>bug.component_obj,type=>1) %] [% NEXT IF NOT user.id AND field.value == "---" %] - [% NEXT IF cf_hidden_in_product(field.name, bug.product, bug.component, 1) %] [% PROCESS bug/field.html.tmpl value = bug.${field.name} editable = bug.check_can_change_field(field.name, 0, 1) diff --git a/template/en/default/config.rdf.tmpl b/template/en/default/config.rdf.tmpl index d7b282776..16666175f 100644 --- a/template/en/default/config.rdf.tmpl +++ b/template/en/default/config.rdf.tmpl @@ -171,7 +171,7 @@ [% IF show_flags %] - [% flag_types = component.flag_types(is_active=>1).bug.merge(component.flag_types(is_active=>1).attachment) %] + [% flag_types = component.flag_types.bug.merge(component.flag_types.attachment) %] [% FOREACH flag_type = flag_types %] [% all_visible_flag_types.${flag_type.id} = flag_type %]