1[%# This Source Code Form is subject to the terms of the Mozilla Public
2  # License, v. 2.0. If a copy of the MPL was not distributed with this
3  # file, You can obtain one at http://mozilla.org/MPL/2.0/.
4  #
5  # This Source Code Form is "Incompatible With Secondary Licenses", as
6  # defined by the Mozilla Public License, v. 2.0.
7  #%]
8[% PROCESS bug/time.html.tmpl %]
9[% USE Bugzilla %]
10[% cgi = Bugzilla.cgi %]
11<?xml version="1.0" [% IF Param('utf8') %]encoding="UTF-8" [% END %]standalone="yes" ?>
12<!DOCTYPE bugzilla [% IF cgi.param('dtd') %][[% PROCESS pages/bugzilla.dtd.tmpl %]][% ELSE %]SYSTEM "[% urlbase FILTER xml %]page.cgi?id=bugzilla.dtd"[% END %]>
13
14<bugzilla version="[% constants.BUGZILLA_VERSION %]"
15          urlbase="[% urlbase FILTER xml %]"
16          [%# Note that the maintainer's email is not filtered,
17            # intentionally. Even logged-out users should be able
18            # to see that, since it will be in error messages anyway.
19          %]
20          maintainer="[% Param('maintainer') FILTER xml %]"
21[% IF user.id %]
22          exporter="[% user.email FILTER email FILTER xml %]"
23[% END %]
24>
25
26[% FOREACH bug = bugs %]
27  [% IF bug.error %]
28    <bug error="[% bug.error FILTER xml %]">
29      <bug_id>[% bug.bug_id FILTER xml %]</bug_id>
30    </bug>
31  [% ELSE %]
32    <bug>
33      [% FOREACH field = bug.fields %]
34        [% IF displayfields.$field %]
35          [%+ PROCESS bug_field %]
36        [% END %]
37      [% END %]
38
39      [%# This is here so automated clients can still use process_bug.cgi %]
40      [% IF displayfields.token && user.id %]
41          <token>[% issue_hash_token([bug.id, bug.delta_ts]) FILTER xml %]</token>
42      [% END %]
43
44      [%# Now handle 'special' fields #%]
45      [% IF displayfields.group %]
46        [% FOREACH g = bug.groups %]
47          [% NEXT UNLESS g.ison %]
48          <group id="[% g.bit FILTER xml %]">[% g.name FILTER xml %]</group>
49        [% END %]
50      [% END %]
51
52      [%# Bug Flags %]
53      [% PROCESS section_flags obj => bug %]
54
55      [% IF displayfields.long_desc %]
56          [% sort_order = user.settings.comment_sort_order.value %]
57          <comment_sort_order>[% sort_order FILTER xml %]</comment_sort_order>
58
59        [% FOREACH c = bug.comments %]
60          [% PROCESS a_comment %]
61        [% END %]
62      [% END %]
63
64      [% IF displayfields.attachment %]
65        [% FOREACH a = bug.attachments %]
66          [% NEXT IF a.isprivate && !user.is_insider %]
67          <attachment
68              isobsolete="[% a.isobsolete FILTER xml %]"
69              ispatch="[% a.ispatch FILTER xml %]"
70              isprivate="[% a.isprivate FILTER xml %]"
71          >
72            <attachid>[% a.id %]</attachid>
73            <date>[% a.attached FILTER time("%Y-%m-%d %T %z") FILTER xml %]</date>
74            <delta_ts>[% a.modification_time FILTER time("%Y-%m-%d %T %z") FILTER xml %]</delta_ts>
75            <desc>[% a.description FILTER xml %]</desc>
76            <filename>[% a.filename FILTER xml %]</filename>
77            <type>[% a.contenttype FILTER xml %]</type>
78            <size>[% a.datasize FILTER xml %]</size>
79            <attacher[% IF a.attacher.name != '' %] name="[% a.attacher.name FILTER xml %]"[% END -%]>
80            [% a.attacher.email FILTER email FILTER xml %]</attacher>
81            [%# This is here so automated clients can still use attachment.cgi %]
82            [% IF displayfields.token && user.id %]
83              <token>[% issue_hash_token([a.id, a.modification_time]) FILTER xml %]</token>
84            [% END %]
85            [% IF displayfields.attachmentdata %]
86              <data encoding="base64">[% a.data FILTER base64 %]</data>
87            [% END %]
88
89            [% PROCESS section_flags obj => a %]
90          </attachment>
91        [% END %]
92      [% END %]
93
94      [% Hook.process("bug_end") %]
95
96    </bug>
97  [% END %]
98[% END %]
99
100</bugzilla>
101
102[% BLOCK bug_field %]
103  [% field_values = bug.$field %]
104  [%# Work around TT bug https://rt.cpan.org/Public/Bug/Display.html?id=9802 %]
105  [% IF bug.$field.size == 1 %]
106    [% field_values = [bug.$field.first] %]
107  [% END %]
108
109  [% FOREACH val = field_values %]
110    [%# We need to handle some fields differently. This should become
111      # nicer once we have custfields, and a type attribute for the fields
112      #%]
113    [% name = '' %]
114    [% IF field == 'reporter' OR field == 'assigned_to' OR
115          field == 'qa_contact' %]
116      [% name = val.name %]
117      [% val = val.email FILTER email %]
118    [% ELSIF field == 'cc' %]
119        [% val = val FILTER email %]
120    [% ELSIF field == 'creation_ts' OR field == 'delta_ts' %]
121      [% val = val FILTER time("%Y-%m-%d %T %z") %]
122    [% ELSIF field == "see_also" %]
123      [% val = val.name %]
124    [% END %]
125    <[% field %][% IF name != '' %] name="[% name FILTER xml %]"[% END -%]>
126      [%- val FILTER xml %]</[% field %]>
127  [% END %]
128[% END %]
129
130[% BLOCK section_flags %]
131  [% RETURN UNLESS displayfields.flag %]
132
133  [% FOREACH flag = obj.flags %]
134    <flag name="[% flag.type.name FILTER xml %]"
135          id="[% flag.id FILTER xml %]"
136          type_id="[% flag.type_id FILTER xml %]"
137          status="[% flag.status FILTER xml %]"
138          setter="[% flag.setter.email FILTER email FILTER xml %]"
139      [% IF flag.status == "?" && flag.requestee %]
140          requestee="[% flag.requestee.email FILTER email FILTER xml %]"
141      [% END %]
142    />
143  [% END %]
144[% END %]
145
146[% BLOCK a_comment %]
147  [% RETURN IF c.is_private && !user.is_insider %]
148  <long_desc isprivate="[% c.is_private FILTER xml %]" >
149    <commentid>[% c.id FILTER xml %]</commentid>
150    <comment_count>[% c.count FILTER xml %]</comment_count>
151    [% IF c.is_about_attachment %]
152      <attachid>[% c.extra_data FILTER xml %]</attachid>
153    [% END %]
154    <who name="[% c.author.name FILTER xml %]">[% c.author.email FILTER email FILTER xml %]</who>
155    <bug_when>[% c.creation_ts FILTER time("%Y-%m-%d %T %z") FILTER xml %]</bug_when>
156    [% IF user.is_timetracker && (c.work_time - 0 != 0) %]
157      <work_time>[% PROCESS formattimeunit time_unit = c.work_time FILTER xml %]</work_time>
158    [% END %]
159    <thetext>[% c.body_full FILTER xml %]</thetext>
160  </long_desc>
161[% END %]
162