$vars->{'proddesc'} = \%products;
$vars->{'target'} = "enter_bug.cgi";
+ $vars->{'format'} = $::FORM{'format'};
$vars->{'title'} = "Enter Bug";
$vars->{'h2'} =
"First, you must pick a product on which to enter a bug.";
$::FORM{'component'} = $::components{$product}->[0];
}
+my @components;
+SendSQL("SELECT value, description FROM components " .
+ "WHERE program = " . SqlQuote($product) . " ORDER BY value");
+while (MoreSQLData()) {
+ my ($name, $description) = FetchSQLData();
+
+ my %component;
+
+ $component{'name'} = $name;
+ $component{'description'} = $description;
+
+ push @components, \%component;
+}
+
my %default;
-$vars->{'component_'} = $::components{$product};
+$vars->{'component_'} = \@components;
$default{'component_'} = formvalue('component');
$vars->{'assigned_to'} = formvalue('assigned_to');
$vars->{'default'} = \%default;
-print "Content-type: text/html\n\n";
-$template->process("bug/create/create.html.tmpl", $vars)
+my $format = ValidateOutputFormat($::FORM{'format'}, "create");
+
+print "Content-type: $format->{'contenttype'}\n\n";
+$template->process("bug/create/$format->{'template'}", $vars)
|| ThrowTemplateError($template->error());
-exit;
# SyncAnyPendingShadowChanges - called in the footer to sync the shadowdb
'SyncAnyPendingShadowChanges' => \&SyncAnyPendingShadowChanges ,
+
+ # User Agent - useful for detecting in templates
+ 'user_agent' => $ENV{'HTTP_USER_AGENT'} ,
};
1;
<td>
<select name="component" size="5">
[%- FOREACH c = component_ %]
- <option value="[% c FILTER html %]"
- [% " selected=\"selected\"" IF c == default.component_ %]>[% c FILTER html -%]
+ <option value="[% c.name FILTER html %]"
+ [% " selected=\"selected\"" IF c.name == default.component_ %]>
+ [% c.name FILTER html -%]
</option>
[%- END %]
</select>
[% FOREACH p = proddesc.keys.sort %]
<tr>
<th align="right" valign="top">
- <a href="[% target %]?product=[% p FILTER url_quote %]">
- [% p FILTER html %]</a>:
+ <a href="[% target %]?product=[% p FILTER url_quote %]
+ [%- "&format=$format" IF format %]">
+ [% p FILTER html %]</a>:
</th>
[% IF proddesc.$p %]