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,29 +38,37 @@ ...@@ -38,29 +38,37 @@
[% ELSE %] [% ELSE %]
<bug> <bug>
[% FOREACH field = bug.fields %] [% FOREACH field = bug.fields %]
[%+ PROCESS bug_field %] [% IF displayfields.$field %]
[%+ PROCESS bug_field %]
[% END %]
[% END %] [% END %]
[%# Now handle 'special' fields #%] [%# Now handle 'special' fields #%]
[% FOREACH g = bug.groups %] [% IF displayfields.group %]
[% NEXT UNLESS g.ison %] [% FOREACH g = bug.groups %]
<group>[% g.name FILTER xml %]</group> [% NEXT UNLESS g.ison %]
<group>[% g.name FILTER xml %]</group>
[% END %]
[% END %] [% END %]
[% FOREACH c = bug.longdescs %] [% IF displayfields.long_desc %]
<long_desc> [% FOREACH c = bug.longdescs %]
<who>[% c.email FILTER xml %]</who> <long_desc>
<bug_when>[% c.time FILTER time FILTER xml %]</bug_when> <who>[% c.email FILTER xml %]</who>
<thetext>[% c.body FILTER xml %]</thetext> <bug_when>[% c.time FILTER time FILTER xml %]</bug_when>
</long_desc> <thetext>[% c.body FILTER xml %]</thetext>
</long_desc>
[% END %]
[% END %] [% END %]
[% FOREACH a = bug.attachments %] [% IF displayfields.attachment %]
<attachment> [% FOREACH a = bug.attachments %]
<attachid>[% a.attachid %]</attachid> <attachment>
<date>[% a.date FILTER time FILTER xml %]</date> <attachid>[% a.attachid %]</attachid>
<desc>[% a.description FILTER xml %]</desc> <date>[% a.date FILTER time FILTER xml %]</date>
</attachment> <desc>[% a.description FILTER xml %]</desc>
</attachment>
[% END %]
[% END %] [% END %]
</bug> </bug>
[% 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