]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 138284 - prepare for Bugzilla Helper replacement enter_bug template. Patch by...
authorgerv%gerv.net <>
Sat, 27 Apr 2002 13:57:11 +0000 (13:57 +0000)
committergerv%gerv.net <>
Sat, 27 Apr 2002 13:57:11 +0000 (13:57 +0000)
enter_bug.cgi
globals.pl
template/en/default/bug/create/create.html.tmpl
template/en/default/global/choose-product.html.tmpl
template/en/default/list/list-simple.html.tmpl

index f2836a5fa4a45f2ac7a63d67599fc3a1c0b8ddcb..4b46b36d4f293d8614acddbebf287b74d2c5b406 100755 (executable)
@@ -86,6 +86,7 @@ if (!defined $::FORM{'product'}) {
         $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.";
@@ -258,9 +259,23 @@ elsif (1 == @{$::components{$product}}) {
     $::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');
@@ -359,7 +374,8 @@ if ($::usergroupset ne '0') {
 
 $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;
index 4c93e800ae89d73640f03bca5446829ab50816e2..2fd047dd47432496455bbbc69dc10666210c7cd5 100644 (file)
@@ -1750,6 +1750,9 @@ $::vars =
 
     # 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;
index 5047a213151c0151ae65d281e40dc0d0653d2248..ee60fdff35d6949a7392407ee3d134b1e08c6200 100644 (file)
@@ -78,8 +78,9 @@
     <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>
index df7e0fb489f5f13614fce9a5b41922a8e6c21b1a..7bd27ffc8675c0e2731ca649eb26279aa3d0be48 100644 (file)
@@ -27,8 +27,9 @@
 [% 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 %]
+                                       [%- "&amp;format=$format" IF format %]">
+      [% p FILTER html %]</a>:
     </th>
 
     [% IF proddesc.$p %]
index 3dd6656d2c28e58b27bed1a16efafca13cf24ad2..b8d8241a3b6b0152c3004d0b12ee232051cf2eb5 100644 (file)
   </head>
 
   <body>
-    [% PROCESS list/table.html.tmpl %]
+    [% IF bugs.size == 0 %]
+      <h3>Zarro Boogs found.</h3>
+    [% ELSE %]
+      [% PROCESS list/table.html.tmpl %]
+    [% END %]
   </body>
 
 </html>