summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjocuri%softhome.net <>2004-09-01 08:28:09 +0200
committerjocuri%softhome.net <>2004-09-01 08:28:09 +0200
commitfcd317eee72a7eb2d439a68e47e988997d709b25 (patch)
tree3ae7b892f769d9e90603950fd57bcb9c219de98f
parent3327b874b8cceeefbef526efa6a682160b2c12c7 (diff)
downloadbugzilla-fcd317eee72a7eb2d439a68e47e988997d709b25.tar.gz
bugzilla-fcd317eee72a7eb2d439a68e47e988997d709b25.tar.xz
Patch for bug 254371: include Flag Types in create new attachments form; patch by Alexandre Michetti Manduca <michetti@grad.icmc.usp.br>; r=jouni, a=myk.
-rwxr-xr-xattachment.cgi26
-rw-r--r--template/en/default/attachment/create.html.tmpl14
2 files changed, 40 insertions, 0 deletions
diff --git a/attachment.cgi b/attachment.cgi
index 8518d0278..96a8ba6f8 100755
--- a/attachment.cgi
+++ b/attachment.cgi
@@ -120,6 +120,15 @@ elsif ($action eq "insert")
validateDescription();
validateContentType() unless $::FORM{'ispatch'};
validateObsolete() if $::FORM{'obsolete'};
+
+ # The order of these function calls is important, as both Flag::validate
+ # and FlagType::validate assume User::match_field has ensured that the values
+ # in the requestee fields are legitimate user email addresses.
+ Bugzilla::User::match_field({ '^requestee(_type)?-(\d+)$' =>
+ { 'type' => 'single' } });
+ Bugzilla::Flag::validate(\%::FORM, $bugid);
+ Bugzilla::FlagType::validate(\%::FORM, $bugid, $::FORM{'id'});
+
insert($data);
}
elsif ($action eq "edit")
@@ -837,6 +846,16 @@ sub enter
$vars->{'bugsummary'} = $bugsummary;
$vars->{'GetBugLink'} = \&GetBugLink;
+ SendSQL("SELECT product_id, component_id FROM bugs
+ WHERE bug_id = $::FORM{'bugid'}");
+ my ($product_id, $component_id) = FetchSQLData();
+ my $flag_types = Bugzilla::FlagType::match({'target_type' => 'attachment',
+ 'product_id' => $product_id,
+ 'component_id' => $component_id});
+ $vars->{'flag_types'} = $flag_types;
+ $vars->{'any_flags_requesteeble'} = grep($_->{'is_requesteeble'},
+ @$flag_types);
+
print Bugzilla->cgi->header();
# Generate and return the UI (HTML page) from the appropriate template.
@@ -939,6 +958,13 @@ sub insert
}
}
+ # Figure out when the changes were made.
+ my ($timestamp) = Bugzilla->dbh->selectrow_array("SELECT NOW()");
+
+ # Create flags.
+ my $target = Bugzilla::Flag::GetTarget(undef, $attachid);
+ Bugzilla::Flag::process($target, $timestamp, \%::FORM);
+
# Define the variables and functions that will be passed to the UI template.
$vars->{'mailrecipients'} = { 'changer' => Bugzilla->user->login,
'owner' => $owner };
diff --git a/template/en/default/attachment/create.html.tmpl b/template/en/default/attachment/create.html.tmpl
index e97812181..3089c0d5f 100644
--- a/template/en/default/attachment/create.html.tmpl
+++ b/template/en/default/attachment/create.html.tmpl
@@ -43,6 +43,12 @@
vertical-align: baseline;
padding-bottom: 5px;
}
+
+ table#flags th, table#flags td {
+ text-align: left;
+ vertical-align: baseline;
+ font-size: small;
+ }
"
onload="setContentTypeDisabledState();"
%]
@@ -138,6 +144,14 @@
</tr>
[% END %]
<tr>
+ <td> </td>
+ <td>
+ [% IF flag_types.size > 0 %]
+ [% PROCESS "flag/list.html.tmpl" bug_id=bugid attach_id=attachid %]<br>
+ [% END %]
+ </td>
+ </tr>
+ <tr>
<th>Comment:</th>
<td>
<em>(optional) Add a comment about this attachment to the [% terms.bug %].</em><br>