]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 417551: Make it possible for CSV headers to be the field description
authorMichael J Tosh <michael.j.tosh@lmco.com>
Mon, 14 Feb 2011 19:50:25 +0000 (11:50 -0800)
committerMax Kanat-Alexander <mkanat@bugzilla.org>
Mon, 14 Feb 2011 19:50:25 +0000 (11:50 -0800)
instead of the field name, and have the buglist.cgi link give you CSV like
this by default.
r=mkanat, a=mkanat

buglist.cgi
template/en/default/list/list.csv.tmpl
template/en/default/list/list.html.tmpl

index 4b7fe8f5ad801e64ae954ddfe79e768d16acc78c..64681b2cdf52cce86527303c41015d7d061145bc 100755 (executable)
@@ -1130,6 +1130,10 @@ if ($format->{'extension'} eq "csv") {
     # We set CSV files to be downloaded, as they are designed for importing
     # into other programs.
     $disposition = "attachment";
+
+    # If the user clicked the CSV link in the search results,
+    # They should get the Field Description, not the column name in the db
+    $vars->{'human'} = $cgi->param('human');
 }
 
 # Suggest a name for the bug list if the user wants to save it as a file.
index 6114d6fae72b004fa68d728d7f32997793fdbb6c..be0a5bc69060f5f3d8d007b222d5775310a103ef 100644 (file)
   #
   # Contributor(s): Myk Melez <myk@mozilla.org>
   #                 Gervase Markham <gerv@gerv.net>
+  #                 miketosh
   #%]
 
 [% PROCESS "global/field-descs.none.tmpl" %]
 
 [% colsepchar = user.settings.csv_colsepchar.value %]
 
-bug_id
-[% FOREACH column = displaycolumns %]
-  [% colsepchar %][% column FILTER csv %]
+[% IF human %]
+  [% field_descs.bug_id FILTER csv %]
+  [% FOREACH column = displaycolumns %]
+    [% colsepchar %][% field_descs.$column FILTER csv %]
+  [% END %]
+[% ELSE %]
+  bug_id
+  [% FOREACH column = displaycolumns %]
+    [% colsepchar %][% column FILTER csv %]
+  [% END %]
 [% END %]
 
 [% FOREACH bug = bugs %]
index 924ce23dcfd0f64fc54ca2cefc0085c24c62dcb0..a669aecb928c4a9791f4db11f3b4015709883252 100644 (file)
       
       <td valign="middle" class="bz_query_links">
         <a href="buglist.cgi?
-        [% urlquerypart FILTER html %]&amp;ctype=csv">CSV</a> |
+        [% urlquerypart FILTER html %]&amp;ctype=csv&human=1">CSV</a> |
         <a href="buglist.cgi?
         [% urlquerypart FILTER html %]&amp;title=
         [%- title FILTER html %]&amp;ctype=atom">Feed</a> |