From af7b89549493d09c6acd9d364ab11d2c473c1ae4 Mon Sep 17 00:00:00 2001 From: "myk%mozilla.org" Date: Sat, 9 Nov 2002 01:58:51 +0000 Subject: [PATCH] Fix for bug 171505: shows disabled flags in the UI r=bbaetz a=justdave git-svn-id: svn://10.0.0.236/trunk@133451 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/webtools/bugzilla/attachment.cgi | 7 +++--- mozilla/webtools/bugzilla/bug_form.pl | 25 ++++++++++++------- .../en/default/attachment/list.html.tmpl | 9 +++---- .../template/en/default/flag/list.html.tmpl | 10 +++++--- 4 files changed, 29 insertions(+), 22 deletions(-) diff --git a/mozilla/webtools/bugzilla/attachment.cgi b/mozilla/webtools/bugzilla/attachment.cgi index 33f8c8542a4..04b86dc33d5 100755 --- a/mozilla/webtools/bugzilla/attachment.cgi +++ b/mozilla/webtools/bugzilla/attachment.cgi @@ -555,12 +555,11 @@ sub edit SendSQL("SELECT product_id, component_id FROM bugs WHERE bug_id = $bugid"); my ($product_id, $component_id) = FetchSQLData(); my $flag_types = Bugzilla::FlagType::match({ 'target_type' => 'attachment' , - 'product_id' => $product_id , - 'component_id' => $component_id , - 'is_active' => 1}); + 'product_id' => $product_id , + 'component_id' => $component_id }); foreach my $flag_type (@$flag_types) { $flag_type->{'flags'} = Bugzilla::Flag::match({ 'type_id' => $flag_type->{'id'}, - 'attach_id' => $::FORM{'id'} }); + 'attach_id' => $::FORM{'id'} }); } $vars->{'flag_types'} = $flag_types; diff --git a/mozilla/webtools/bugzilla/bug_form.pl b/mozilla/webtools/bugzilla/bug_form.pl index 0e6b4547de7..946dc4a3153 100644 --- a/mozilla/webtools/bugzilla/bug_form.pl +++ b/mozilla/webtools/bugzilla/bug_form.pl @@ -209,8 +209,7 @@ sub show_bug { my $flag_types = Bugzilla::FlagType::match({ 'target_type' => 'bug', 'product_id' => $bug{'product_id'}, - 'component_id' => $bug{'component_id'}, - 'is_active' => 1 }); + 'component_id' => $bug{'component_id'}); foreach my $flag_type (@$flag_types) { $flag_type->{'flags'} = Bugzilla::Flag::match({ 'bug_id' => $id , @@ -219,13 +218,21 @@ sub show_bug { } $vars->{'flag_types'} = $flag_types; - # The number of types of flags that can be set on attachments - # to this bug. If none, flags won't be shown in the list of attachments. - $vars->{'num_attachment_flag_types'} = - Bugzilla::FlagType::count({ 'target_type' => 'a', - 'product_id' => $bug{'product_id'}, - 'component_id' => $bug{'component_id'}, - 'is_active' => 1 }); + # The number of types of flags that can be set on attachments to this bug + # and the number of flags on those attachments. One of these counts must be + # greater than zero in order for the "flags" column to appear in the table + # of attachments. + my $num_attachment_flag_types = + Bugzilla::FlagType::count({ 'target_type' => 'attachment', + 'product_id' => $bug{'product_id'}, + 'component_id' => $bug{'component_id'}, + 'is_active' => 1 }); + my $num_attachment_flags = + Bugzilla::Flag::count({ 'target_type' => 'attachment', + 'bug_id' => $id }); + + $vars->{'show_attachment_flags'} + = $num_attachment_flag_types || $num_attachment_flags; # Dependencies my @list; diff --git a/mozilla/webtools/bugzilla/template/en/default/attachment/list.html.tmpl b/mozilla/webtools/bugzilla/template/en/default/attachment/list.html.tmpl index 59f749695e2..2658036024d 100644 --- a/mozilla/webtools/bugzilla/template/en/default/attachment/list.html.tmpl +++ b/mozilla/webtools/bugzilla/template/en/default/attachment/list.html.tmpl @@ -19,16 +19,13 @@ # Contributor(s): Myk Melez #%] -[%# Whether or not to include flags. %] -[% display_flags = num_attachment_flag_types > 0 %] -
- [% IF display_flags %] + [% IF show_attachment_flags %] [% END %] @@ -55,7 +52,7 @@ - [% IF display_flags %] + [% IF show_attachment_flags %] -
Attachment Type CreatedFlagsActions[% attachment.date %] [% IF attachment.flags.size == 0 %] none @@ -85,7 +82,7 @@ [% END %]
+ Create a New Attachment (proposed patch, testcase, etc.) diff --git a/mozilla/webtools/bugzilla/template/en/default/flag/list.html.tmpl b/mozilla/webtools/bugzilla/template/en/default/flag/list.html.tmpl index f809a4e0e00..abfac6fcc30 100644 --- a/mozilla/webtools/bugzilla/template/en/default/flag/list.html.tmpl +++ b/mozilla/webtools/bugzilla/template/en/default/flag/list.html.tmpl @@ -33,9 +33,13 @@