Commit 7d4370dc authored by gerv%gerv.net's avatar gerv%gerv.net

Bug 136603 - show_bug.cgi's XML retrieval needs a summary mode. Patch by gerv;…

Bug 136603 - show_bug.cgi's XML retrieval needs a summary mode. Patch by gerv; r=bbaetz, a=justdave.
parent 77b86e4c
...@@ -76,9 +76,30 @@ my @bug_list; ...@@ -76,9 +76,30 @@ my @bug_list;
if ($::COOKIE{"BUGLIST"}) { if ($::COOKIE{"BUGLIST"}) {
@bug_list = split(/:/, $::COOKIE{"BUGLIST"}); @bug_list = split(/:/, $::COOKIE{"BUGLIST"});
} }
$vars->{'bug_list'} = \@bug_list; $vars->{'bug_list'} = \@bug_list;
# Work out which fields we are displaying (currently XML only.)
# If no explicit list is defined, we show all fields. We then exclude any
# on the exclusion list. This is so you can say e.g. "Everything except
# attachments" without listing almost all the fields.
my @fieldlist = (Bug::fields(), 'group', 'long_desc', 'attachment');
my %displayfields;
if ($cgi->param("field")) {
@fieldlist = $cgi->param("field");
}
foreach (@fieldlist) {
$displayfields{$_} = 1;
}
foreach ($cgi->param("excludefield")) {
$displayfields{$_} = undef;
}
$vars->{'displayfields'} = \%displayfields;
print "Content-type: $format->{'ctype'}\n\n"; print "Content-type: $format->{'ctype'}\n\n";
$template->process("$format->{'template'}", $vars) $template->process("$format->{'template'}", $vars)
|| ThrowTemplateError($template->error()); || ThrowTemplateError($template->error());
...@@ -38,15 +38,20 @@ ...@@ -38,15 +38,20 @@
[% ELSE %] [% ELSE %]
<bug> <bug>
[% FOREACH field = bug.fields %] [% FOREACH field = bug.fields %]
[% IF displayfields.$field %]
[%+ PROCESS bug_field %] [%+ PROCESS bug_field %]
[% END %] [% END %]
[% END %]
[%# Now handle 'special' fields #%] [%# Now handle 'special' fields #%]
[% IF displayfields.group %]
[% FOREACH g = bug.groups %] [% FOREACH g = bug.groups %]
[% NEXT UNLESS g.ison %] [% NEXT UNLESS g.ison %]
<group>[% g.name FILTER xml %]</group> <group>[% g.name FILTER xml %]</group>
[% END %] [% END %]
[% END %]
[% IF displayfields.long_desc %]
[% FOREACH c = bug.longdescs %] [% FOREACH c = bug.longdescs %]
<long_desc> <long_desc>
<who>[% c.email FILTER xml %]</who> <who>[% c.email FILTER xml %]</who>
...@@ -54,7 +59,9 @@ ...@@ -54,7 +59,9 @@
<thetext>[% c.body FILTER xml %]</thetext> <thetext>[% c.body FILTER xml %]</thetext>
</long_desc> </long_desc>
[% END %] [% END %]
[% END %]
[% IF displayfields.attachment %]
[% FOREACH a = bug.attachments %] [% FOREACH a = bug.attachments %]
<attachment> <attachment>
<attachid>[% a.attachid %]</attachid> <attachid>[% a.attachid %]</attachid>
...@@ -62,6 +69,7 @@ ...@@ -62,6 +69,7 @@
<desc>[% a.description FILTER xml %]</desc> <desc>[% a.description FILTER xml %]</desc>
</attachment> </attachment>
[% END %] [% END %]
[% END %]
</bug> </bug>
[% END %] [% END %]
[% END %] [% END %]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment