Mercurial > pub > buggler
annotate bug-list.xsl @ 12:52b34ea50eff default tip
sync: work time projection doesn't seem to be working anyway
author | cin |
---|---|
date | Sun, 13 Sep 2015 19:37:16 +0300 |
parents | 4eb9fdf4efa9 |
children |
rev | line source |
---|---|
0 | 1 <?xml version="1.0" encoding="UTF-8"?> |
2 <xsl:stylesheet version="1.0" | |
4 | 3 xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:exsl="http://exslt.org/common" |
11 | 4 xmlns:date="http://exslt.org/dates-and-times" |
5 extension-element-prefixes="exsl date"> | |
4 | 6 <xsl:output method="text" indent="yes" /> |
7 | |
5 | 8 <!-- PARAMETERS --> |
9 | |
10 <!-- chargeset - название аккаунта, на который вести расходы --> | |
11 <xsl:param name="chargeset" /> | |
12 | |
13 <!-- root_task_id - id корневой задачи, в которую будут организованы все | |
14 задачи --> | |
15 <xsl:param name="root_task_id" /> | |
16 | |
17 <!-- root_task - описание корневой задачи --> | |
18 <xsl:param name="root_task" /> | |
19 | |
20 <!-- GLOBAL VARIABLES --> | |
4 | 21 <xsl:variable name="resources" |
22 select="document('resources.xml')/resources/resource" /> | |
23 | |
3 | 24 <xsl:variable name="bugs" select="/bugzilla/bug" /> |
4 | 25 |
10
14a966369278
working version of exporting bugs from bugzilla in tj3 format (without bookings)
cin
parents:
6
diff
changeset
|
26 <xsl:key name="bugid" match="/bugzilla/bug" use="string(id)" /> |
4 | 27 |
10
14a966369278
working version of exporting bugs from bugzilla in tj3 format (without bookings)
cin
parents:
6
diff
changeset
|
28 <xsl:variable name="roots" select="$bugs[not(blocks[key('bugid',.)])]" /> |
1 | 29 |
30 <!-- BUILD BUG TREE --> | |
31 <xsl:variable name="tree"> | |
32 <xsl:apply-templates mode="tree" select="$roots" /> | |
33 </xsl:variable> | |
34 | |
35 <xsl:template match="bug" mode="tree"> | |
36 <xsl:element name="bug"> | |
10
14a966369278
working version of exporting bugs from bugzilla in tj3 format (without bookings)
cin
parents:
6
diff
changeset
|
37 <xsl:attribute name="id"><xsl:value-of select="id" /></xsl:attribute> |
3 | 38 <xsl:if test="component = 'product' or not(number(estimated_time))"> |
5 | 39 <xsl:attribute name="group"><xsl:value-of select="boolean(1)" /></xsl:attribute> |
1 | 40 </xsl:if> |
10
14a966369278
working version of exporting bugs from bugzilla in tj3 format (without bookings)
cin
parents:
6
diff
changeset
|
41 <xsl:for-each select="depends_on"> |
1 | 42 <xsl:apply-templates mode="tree" select="key('bugid', .)" /> |
43 </xsl:for-each> | |
44 </xsl:element> | |
45 </xsl:template> | |
46 | |
47 <!-- CALCULATE RELATIONS --> | |
48 <xsl:variable name="relations"> | |
3 | 49 <xsl:apply-templates select="$bugs" mode="relations" /> |
1 | 50 </xsl:variable> |
51 | |
52 <xsl:template match="bug" mode="relations"> | |
10
14a966369278
working version of exporting bugs from bugzilla in tj3 format (without bookings)
cin
parents:
6
diff
changeset
|
53 <xsl:variable name="bugid" select="string(id)" /> |
1 | 54 <bug id="{$bugid}"> |
6 | 55 <!-- calculate all palaces where the same node appears --> |
1 | 56 <xsl:apply-templates select="exsl:node-set($tree)//bug[@id = $bugid]" |
57 mode="traverse-relations"> | |
58 </xsl:apply-templates> | |
59 </bug> | |
60 </xsl:template> | |
61 | |
62 <xsl:template match="bug" mode="traverse-relations"> | |
63 <xsl:variable name="bugid" select="@id" /> | |
3 | 64 <xsl:variable name="path" select="ancestor::bug" /> |
65 <xsl:variable name="level" select="count($path)" /> | |
6 | 66 <!-- for the specified path calculate the distances to the preceding container --> |
5 | 67 <xsl:for-each select="$path[@group]"> |
3 | 68 <xsl:variable name="pos" select="position()" /> |
4 | 69 <xsl:variable name="rank" select="$level - $pos" /> |
3 | 70 <rel container="{@id}" rank="{$rank}" level="{$level}"> |
6 | 71 <!-- record the full path --> |
72 <xsl:for-each select="$path[@group]"> | |
73 <parent id="{@id}" bugid="{$bugid}" /> | |
3 | 74 </xsl:for-each> |
75 </rel> | |
1 | 76 </xsl:for-each> |
77 </xsl:template> | |
78 | |
79 <!-- CALCULATE STRUCTURE --> | |
80 | |
3 | 81 <xsl:variable name="parents"> |
1 | 82 <xsl:apply-templates select="exsl:node-set($relations)" |
3 | 83 mode="parents" /> |
84 </xsl:variable> | |
85 | |
86 <xsl:template match="bug" mode="parents"> | |
87 <xsl:variable name="parent" | |
88 select="rel[ not(../rel/@rank < @rank) ][1]" /> | |
89 <bug id="{@id}" parent="{$parent/@container}" rank="{$parent/@rank}" | |
6 | 90 level="{$parent/@level}"> |
91 <xsl:copy-of select="$parent/node()" /> | |
92 </bug> | |
3 | 93 </xsl:template> |
94 | |
95 <xsl:variable name="structure"> | |
5 | 96 <xsl:choose> |
97 <xsl:when test="$root_task"> | |
98 <bug id="_root" desc="{$root_task}" group="true"> | |
6 | 99 <xsl:apply-templates select="$roots" mode="structure" /> |
5 | 100 </bug> |
101 </xsl:when> | |
102 <xsl:otherwise> | |
6 | 103 <xsl:apply-templates select="$roots" mode="structure" /> |
5 | 104 </xsl:otherwise> |
105 </xsl:choose> | |
1 | 106 </xsl:variable> |
107 | |
6 | 108 <!-- applied in context of the bugzilla document --> |
1 | 109 <xsl:template match="bug" mode="structure"> |
10
14a966369278
working version of exporting bugs from bugzilla in tj3 format (without bookings)
cin
parents:
6
diff
changeset
|
110 <xsl:variable name="id" select="string(id)" /> |
3 | 111 <xsl:variable name="self" select="." /> |
5 | 112 <xsl:variable name="children" |
113 select="exsl:node-set($parents)/bug[@parent = $id]" /> | |
114 <xsl:element name="bug"> | |
115 <xsl:attribute name="id"><xsl:value-of select="$id" /></xsl:attribute> | |
10
14a966369278
working version of exporting bugs from bugzilla in tj3 format (without bookings)
cin
parents:
6
diff
changeset
|
116 <xsl:attribute name="desc"><xsl:value-of select="summary" /></xsl:attribute> |
11 | 117 <xsl:attribute name="estimated"><xsl:value-of |
118 select="number((time/estimated | estimated_time)[1])" /></xsl:attribute> | |
12
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
119 <xsl:attribute name="complete"><xsl:value-of select="status = 'RESOLVED' or status = 'VERIFIED'"/></xsl:attribute> |
5 | 120 |
121 <xsl:if test="$children"> | |
122 <xsl:attribute name="group"><xsl:value-of select="boolean($children)" /></xsl:attribute> | |
123 | |
124 <xsl:for-each select="$children"> | |
125 <xsl:variable name="child" select="@id" /> | |
10
14a966369278
working version of exporting bugs from bugzilla in tj3 format (without bookings)
cin
parents:
6
diff
changeset
|
126 <xsl:apply-templates select="$bugs[id = $child]" |
5 | 127 mode="structure" /> |
128 </xsl:for-each> | |
129 | |
130 </xsl:if> | |
131 | |
132 <!-- filter out dependencies --> | |
6 | 133 <!-- exclude children, and missing bugs --> |
3 | 134 <xsl:variable name="dependencies" |
10
14a966369278
working version of exporting bugs from bugzilla in tj3 format (without bookings)
cin
parents:
6
diff
changeset
|
135 select="depends_on[not(text() = exsl:node-set($parents)/bug/parent[@id=$id]/@bugid)][key('bugid', .)]" /> |
5 | 136 <xsl:for-each select="$dependencies"> |
137 <dependency id="{.}" /> | |
138 </xsl:for-each> | |
139 </xsl:element> | |
1 | 140 </xsl:template> |
141 | |
4 | 142 <!-- output --> |
0 | 143 <xsl:template match="/"> |
12
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
144 <xsl:apply-templates select="exsl:node-set($structure)/node()"> |
4 | 145 <xsl:with-param name="indent" select="0" /> |
6 | 146 <xsl:with-param name="chargeset" select="$chargeset" /> |
4 | 147 </xsl:apply-templates> |
12
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
148 <!-- |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
149 <xsl:apply-templates select="bugzilla/timesheet"> |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
150 <xsl:with-param name="indent" select="0" /> |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
151 </xsl:apply-templates> |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
152 --> |
0 | 153 </xsl:template> |
154 | |
11 | 155 <!-- task --> |
0 | 156 <xsl:template match="bug"> |
157 <xsl:param name="indent" select="0" /> | |
5 | 158 <xsl:param name="chargeset" /> |
159 | |
11 | 160 <!-- format the task header --> |
0 | 161 <xsl:call-template name="start-task"> |
162 <xsl:with-param name="indent" select="$indent" /> | |
5 | 163 <xsl:with-param name="id"> |
164 <xsl:call-template name="bug-local-name"> | |
165 <xsl:with-param name="id" select="@id" /> | |
166 </xsl:call-template> | |
167 </xsl:with-param> | |
168 <xsl:with-param name="desc" select="@desc" /> | |
0 | 169 </xsl:call-template> |
6 | 170 |
11 | 171 <!-- specify chargeset if present --> |
5 | 172 <xsl:if test="$chargeset"> |
173 <xsl:call-template name="println"> | |
6 | 174 <xsl:with-param name="indent" select="$indent + 1" /> |
175 <xsl:with-param name="text" | |
176 select="concat('chargeset ', $chargeset)" /> | |
5 | 177 </xsl:call-template> |
178 </xsl:if> | |
179 | |
11 | 180 <!-- print task contents --> |
181 <xsl:apply-templates select="." mode="task-content"> | |
182 <xsl:with-param name="indent" select="$indent + 1" /> | |
183 </xsl:apply-templates> | |
0 | 184 |
11 | 185 <!-- prints subtasks and dependencies --> |
4 | 186 <xsl:apply-templates> |
187 <xsl:with-param name="indent" select="$indent + 1" /> | |
5 | 188 <xsl:with-param name="referer" select="." /> |
4 | 189 </xsl:apply-templates> |
0 | 190 |
191 <xsl:call-template name="end-task"> | |
192 <xsl:with-param name="indent" select="$indent" /> | |
193 </xsl:call-template> | |
194 </xsl:template> | |
195 | |
11 | 196 <!-- dependency --> |
5 | 197 <xsl:template match="dependency"> |
11 | 198 <xsl:param name="indent" select="0" /> |
5 | 199 <xsl:param name="referer" /> |
11 | 200 |
5 | 201 <xsl:call-template name="println"> |
202 <xsl:with-param name="indent" select="$indent" /> | |
203 <xsl:with-param name="text"> | |
204 <xsl:text>depends </xsl:text> | |
205 <xsl:call-template name="bug-reference"> | |
206 <xsl:with-param name="id" select="@id" /> | |
207 <xsl:with-param name="referer" select="$referer" /> | |
208 </xsl:call-template> | |
209 </xsl:with-param> | |
210 </xsl:call-template> | |
211 </xsl:template> | |
212 | |
11 | 213 <!-- an organizational task with spent/estimated time will contain a generated |
214 task which will contain the information about resource allocation and bookings --> | |
215 <xsl:template match="bug[@group][@estimated > 0]" mode="task-content" | |
216 priority="3"> | |
217 <xsl:param name="indent" select="0" /> | |
218 <xsl:variable name="id" select="@id" /> | |
5 | 219 |
11 | 220 <!-- DEBUG --> |
221 <xsl:call-template name="comment"> | |
222 <xsl:with-param name="indent" select="$indent" /> | |
223 <xsl:with-param name="comment" select="'group'" /> | |
224 </xsl:call-template> | |
5 | 225 |
11 | 226 <!-- print group details --> |
227 <xsl:apply-templates select="$bugs[id = $id]/node()" | |
228 mode="group-task"> | |
229 <xsl:with-param name="indent" select="$indent" /> | |
230 </xsl:apply-templates> | |
5 | 231 |
11 | 232 <xsl:variable name="metabug"> |
233 <bug id="{@id}" estimated="{@estimated}" desc="{@desc}" /> | |
234 </xsl:variable> | |
235 | |
236 <!-- write an administrative bug for this group-task --> | |
237 <xsl:apply-templates select="exsl:node-set($metabug)/bug[1]"> | |
238 <xsl:with-param name="indent" select="$indent" /> | |
239 </xsl:apply-templates> | |
240 </xsl:template> | |
241 | |
242 <!-- an organizational task without resource allocations --> | |
243 <xsl:template match="bug[@group]" mode="task-content"> | |
244 <xsl:param name="indent" select="0" /> | |
245 <xsl:variable name="id" select="@id" /> | |
246 <xsl:apply-templates select="$bugs[id = $id]/node()" | |
247 mode="group-task"> | |
248 <xsl:with-param name="indent" select="$indent" /> | |
249 </xsl:apply-templates> | |
4 | 250 </xsl:template> |
251 | |
11 | 252 <!-- a work task --> |
253 <xsl:template match="bug[@estimated > 0]" mode="task-content"> | |
254 <xsl:param name="indent" select="0" /> | |
255 <xsl:variable name="id" select="@id" /> | |
256 | |
257 <!-- DEBUG --> | |
258 <xsl:call-template name="comment"> | |
259 <xsl:with-param name="indent" select="$indent" /> | |
260 <xsl:with-param name="comment" select="'work'" /> | |
261 </xsl:call-template> | |
262 | |
263 <xsl:apply-templates select="$bugs[id = $id]/node()" | |
264 mode="work-task"> | |
265 <xsl:with-param name="indent" select="$indent" /> | |
266 </xsl:apply-templates> | |
4 | 267 </xsl:template> |
12
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
268 |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
269 <xsl:template match="bug[@estimated > 0 and @complete]" mode="task-content"> |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
270 <xsl:param name="indent" select="0" /> |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
271 <xsl:variable name="id" select="@id" /> |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
272 |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
273 <!-- DEBUG --> |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
274 <xsl:call-template name="comment"> |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
275 <xsl:with-param name="indent" select="$indent" /> |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
276 <xsl:with-param name="comment" select="'work'" /> |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
277 </xsl:call-template> |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
278 |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
279 <xsl:apply-templates select="$bugs[id = $id]/node()" |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
280 mode="done-work-task"> |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
281 <xsl:with-param name="indent" select="$indent" /> |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
282 </xsl:apply-templates> |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
283 </xsl:template> |
4 | 284 |
11 | 285 <!-- a milestone task --> |
286 <xsl:template match="bug" mode="task-content"> | |
287 <xsl:param name="indent" select="0" /> | |
288 <xsl:variable name="id" select="@id" /> | |
289 | |
290 <!-- DEBUG --> | |
291 <xsl:call-template name="comment"> | |
292 <xsl:with-param name="indent" select="$indent" /> | |
293 <xsl:with-param name="comment" select="'milestone'" /> | |
294 </xsl:call-template> | |
295 | |
296 <xsl:apply-templates select="$bugs[id = $id]/node()" | |
297 mode="milestone-task"> | |
298 <xsl:with-param name="indent" select="$indent" /> | |
299 </xsl:apply-templates> | |
300 </xsl:template> | |
301 | |
302 <!-- each type of task processed in the corresponding mode MODES: * group-task | |
303 * work-task * milestone-task --> | |
304 | |
305 <!-- group-task --> | |
306 <xsl:template match="assigned_to" mode="group-task"> | |
5 | 307 <xsl:param name="indent" /> |
308 <xsl:variable name="email" select="string(.)" /> | |
309 <xsl:variable name="resource" select="$resources[@email = $email]/@id" /> | |
310 <xsl:if test="$resource"> | |
311 <xsl:call-template name="println"> | |
312 <xsl:with-param name="indent" select="$indent" /> | |
313 <xsl:with-param name="text" | |
314 select="concat('responsible ', $resource)" /> | |
315 </xsl:call-template> | |
316 </xsl:if> | |
317 </xsl:template> | |
11 | 318 |
319 <xsl:template match="*" mode="group-task"> | |
320 <xsl:param name="indent" select="0" /> | |
321 <xsl:apply-templates mode="group-task"> | |
322 <xsl:with-param name="indent" select="$indent" /> | |
323 </xsl:apply-templates> | |
324 </xsl:template> | |
325 | |
326 <xsl:template match="text()" mode="group-task"> | |
327 </xsl:template> | |
328 | |
329 | |
330 <!-- work-task --> | |
331 <xsl:template match="assigned_to" mode="work-task"> | |
332 <xsl:param name="indent" /> | |
333 <xsl:variable name="email" select="string(.)" /> | |
334 <xsl:variable name="resource" select="$resources[@email = $email]/@id" /> | |
335 <xsl:if test="$resource"> | |
336 <xsl:call-template name="println"> | |
337 <xsl:with-param name="indent" select="$indent" /> | |
338 <xsl:with-param name="text" select="concat('allocate ', $resource)" /> | |
339 </xsl:call-template> | |
340 </xsl:if> | |
341 </xsl:template> | |
342 | |
343 <!-- if we have a timereports --> | |
344 <xsl:template match="time/estimated[. > 0]" mode="work-task"> | |
345 <xsl:param name="indent" /> | |
346 <xsl:call-template name="println"> | |
347 <xsl:with-param name="indent" select="$indent" /> | |
348 <xsl:with-param name="text" select="concat('effort ', .,'h')" /> | |
349 </xsl:call-template> | |
350 </xsl:template> | |
351 | |
352 <!-- if we have an estimated_time --> | |
353 <xsl:template match="estimated_time[../time/estimated = 0]" | |
354 mode="work-task"> | |
355 <xsl:param name="indent" /> | |
356 <xsl:call-template name="comment"> | |
357 <xsl:with-param name="indent" select="$indent" /> | |
358 <xsl:with-param name="comment" select="'original estimated'" /> | |
359 </xsl:call-template> | |
360 <xsl:call-template name="println"> | |
361 <xsl:with-param name="indent" select="$indent" /> | |
362 <xsl:with-param name="text" select="concat('effort ', .,'h')" /> | |
363 </xsl:call-template> | |
364 </xsl:template> | |
365 | |
366 <xsl:template match="*" mode="work-task"> | |
367 <xsl:param name="indent" select="0" /> | |
368 <xsl:apply-templates mode="work-task"> | |
369 <xsl:with-param name="indent" select="$indent" /> | |
370 </xsl:apply-templates> | |
371 </xsl:template> | |
372 | |
373 <xsl:template match="text()" mode="work-task"> | |
374 </xsl:template> | |
12
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
375 |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
376 <!-- done-work-task --> |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
377 |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
378 <xsl:template match="assigned_to" mode="done-work-task"> |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
379 <xsl:param name="indent" /> |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
380 <xsl:variable name="email" select="string(.)" /> |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
381 <xsl:variable name="resource" select="$resources[@email = $email]/@id" /> |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
382 <xsl:if test="$resource"> |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
383 <xsl:call-template name="println"> |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
384 <xsl:with-param name="indent" select="$indent" /> |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
385 <xsl:with-param name="text" select="concat('allocate ', $resource)" /> |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
386 </xsl:call-template> |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
387 </xsl:if> |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
388 </xsl:template> |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
389 |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
390 <!-- if we have a timereports --> |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
391 <xsl:template match="time/estimated[. > 0]" mode="done-work-task"> |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
392 <xsl:param name="indent" /> |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
393 <xsl:call-template name="println"> |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
394 <xsl:with-param name="indent" select="$indent" /> |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
395 <xsl:with-param name="text" select="concat('effort ', .,'h')" /> |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
396 </xsl:call-template> |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
397 </xsl:template> |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
398 |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
399 <xsl:template match="last_change_time" mode="done-work-task"> |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
400 <xsl:param name="indent" /> |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
401 <xsl:call-template name="println"> |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
402 <xsl:with-param name="indent" select="$indent" /> |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
403 <xsl:with-param name="text" select="concat('end ', .)" /> |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
404 </xsl:call-template> |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
405 </xsl:template> |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
406 |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
407 <xsl:template match="*" mode="done-work-task"> |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
408 <xsl:param name="indent" select="0" /> |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
409 <xsl:apply-templates mode="work-task"> |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
410 <xsl:with-param name="indent" select="$indent" /> |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
411 </xsl:apply-templates> |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
412 </xsl:template> |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
413 |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
414 <xsl:template match="text()" mode="done-work-task"> |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
415 </xsl:template> |
11 | 416 |
417 <!-- milestone-task --> | |
418 <xsl:template match="assigned_to" mode="milestone-task"> | |
419 <xsl:param name="indent" /> | |
420 <xsl:variable name="email" select="string(.)" /> | |
421 <xsl:variable name="resource" select="$resources[@email = $email]/@id" /> | |
422 <xsl:if test="$resource"> | |
423 <xsl:call-template name="println"> | |
424 <xsl:with-param name="indent" select="$indent" /> | |
425 <xsl:with-param name="text" | |
426 select="concat('responsible ', $resource)" /> | |
427 </xsl:call-template> | |
428 </xsl:if> | |
429 </xsl:template> | |
430 | |
431 <xsl:template match="*" mode="milestone-task"> | |
432 <xsl:param name="indent" select="0" /> | |
433 <xsl:apply-templates mode="milestone-task"> | |
434 <xsl:with-param name="indent" select="$indent" /> | |
435 </xsl:apply-templates> | |
436 </xsl:template> | |
437 | |
438 <xsl:template match="text()" mode="milestone-task"> | |
4 | 439 </xsl:template> |
440 | |
12
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
441 <!-- TIMESHEETS --> |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
442 |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
443 <xsl:template match="timesheet"> |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
444 <xsl:param name="indent" select="0" /> |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
445 <xsl:variable name="email" select="string(@resource)" /> |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
446 <xsl:variable name="resource" select="$resources[@email = $email]/@id" /> |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
447 |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
448 <xsl:call-template name="println"> |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
449 <xsl:with-param name="indent" select="$indent" /> |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
450 <xsl:with-param name="text" |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
451 select="concat('timesheet ', $resource, ' ', @start, ' - ', @end, ' {')" /> |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
452 </xsl:call-template> |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
453 |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
454 <xsl:apply-templates mode="timesheet"> |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
455 <xsl:with-param name="indent" select="$indent + 1" /> |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
456 </xsl:apply-templates> |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
457 |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
458 <xsl:call-template name="println"> |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
459 <xsl:with-param name="indent" select="$indent" /> |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
460 <xsl:with-param name="text" select="'}'" /> |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
461 </xsl:call-template> |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
462 </xsl:template> |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
463 |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
464 <xsl:template match="bug" mode="timesheet"> |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
465 <xsl:param name="indent" select="0" /> |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
466 <xsl:variable name="id" select="@id" /> |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
467 |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
468 <xsl:call-template name="begin-line"> |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
469 <xsl:with-param name="indent" select="$indent" /> |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
470 </xsl:call-template> |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
471 <xsl:text>task </xsl:text> |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
472 <xsl:for-each |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
473 select="exsl:node-set( $parents)/bug[@id = $id]/parent/@id | @id"> |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
474 <xsl:call-template name="bug-local-name"> |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
475 <xsl:with-param name="id" select="." /> |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
476 </xsl:call-template> |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
477 <xsl:if test="position() != last()"> |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
478 <xsl:text>.</xsl:text> |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
479 </xsl:if> |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
480 </xsl:for-each> |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
481 <xsl:text> {</xsl:text> |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
482 <xsl:call-template name="end-line" /> |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
483 |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
484 <xsl:apply-templates mode="timesheet"> |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
485 <xsl:with-param name="indent" select="$indent + 1" /> |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
486 </xsl:apply-templates> |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
487 |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
488 <xsl:call-template name="println"> |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
489 <xsl:with-param name="indent" select="$indent" /> |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
490 <xsl:with-param name="text" select="'}'" /> |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
491 </xsl:call-template> |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
492 |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
493 </xsl:template> |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
494 |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
495 <xsl:template match="work" mode="timesheet"> |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
496 <xsl:param name="indent" select="0" /> |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
497 |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
498 <xsl:call-template name="println"> |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
499 <xsl:with-param name="indent" select="$indent" /> |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
500 <xsl:with-param name="text" select="concat('work ', ., 'h')" /> |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
501 </xsl:call-template> |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
502 </xsl:template> |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
503 |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
504 <xsl:template match="remaining" mode="timesheet"> |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
505 <xsl:param name="indent" select="0" /> |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
506 |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
507 <xsl:call-template name="println"> |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
508 <xsl:with-param name="indent" select="$indent" /> |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
509 <xsl:with-param name="text" select="concat('remaining ', ., 'h')" /> |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
510 </xsl:call-template> |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
511 </xsl:template> |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
512 |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
513 <xsl:template match="*" mode="timesheet"> |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
514 <xsl:param name="indent" select="0" /> |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
515 <xsl:apply-templates mode="milestone-task"> |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
516 <xsl:with-param name="indent" select="$indent" /> |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
517 </xsl:apply-templates> |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
518 </xsl:template> |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
519 |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
520 <xsl:template match="text()" mode="timesheet"> |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
521 </xsl:template> |
52b34ea50eff
sync: work time projection doesn't seem to be working anyway
cin
parents:
11
diff
changeset
|
522 |
5 | 523 <!-- PRIMITIVES --> |
4 | 524 |
525 <xsl:template name="bug-local-name"> | |
526 <xsl:param name="id" /> | |
527 <xsl:value-of select="concat('bug',$id)" /> | |
528 </xsl:template> | |
529 | |
530 | |
531 <xsl:template name="bug-reference"> | |
532 <xsl:param name="id" /> | |
533 <xsl:param name="referer" /> | |
534 | |
535 <xsl:variable name="refererPathFragment"> | |
536 <bug id="#root" /> | |
537 <xsl:for-each select="$referer/ancestor-or-self::bug"> | |
538 <bug id="{@id}" /> | |
539 </xsl:for-each> | |
540 </xsl:variable> | |
541 <xsl:variable name="targetPathFragment"> | |
542 <bug id="#root" /> | |
543 <xsl:for-each | |
5 | 544 select="exsl:node-set($structure)//bug[@id = $id]/ancestor-or-self::bug"> |
4 | 545 <bug id="{@id}" /> |
546 </xsl:for-each> | |
547 </xsl:variable> | |
548 <xsl:variable name="path" | |
549 select="exsl:node-set($refererPathFragment)/bug" /> | |
550 <xsl:variable name="targetPath" | |
551 select="exsl:node-set($targetPathFragment)/bug" /> | |
552 | |
553 <!-- find closest shared container id --> | |
554 <xsl:variable name="join" | |
555 select="($path[@id = $targetPath/@id])[position() = last() ]/@id" /> | |
556 | |
557 <!-- how many levels we need to up --> | |
558 <xsl:variable name="depth" | |
559 select="count($path[@id = $join]/following-sibling::node())" /> | |
560 | |
561 <!-- DEBUG --> | |
562 <!-- <xsl:value-of select="concat('id=', $id, ',referer=', $referer/@id)" | |
563 /> <xsl:text>, path=</xsl:text> <xsl:for-each select="$targetPath"> <xsl:value-of | |
564 select="concat(name(),@id)" /> <xsl:if test="position() != last()"> <xsl:text>-</xsl:text> | |
565 </xsl:if> </xsl:for-each> --> | |
566 <!-- DEBUG --> | |
567 <!-- <xsl:value-of select="concat(', join=', $join,', depth=', $depth,' | |
568 ')" /> --> | |
569 | |
570 <!-- PRINT REFERENCE --> | |
571 <xsl:call-template name="repeat"> | |
572 <xsl:with-param name="value" select="'!'" /> | |
573 <xsl:with-param name="count" select="$depth" /> | |
574 </xsl:call-template> | |
575 <xsl:for-each select="$targetPath[@id = $join]/following-sibling::node()"> | |
576 <xsl:call-template name="bug-local-name"> | |
577 <xsl:with-param name="id" select="@id" /> | |
578 </xsl:call-template> | |
579 <xsl:if test="position() != last()"> | |
580 <xsl:text>.</xsl:text> | |
581 </xsl:if> | |
582 </xsl:for-each> | |
583 | |
0 | 584 </xsl:template> |
585 | |
586 <xsl:template name="start-task"> | |
587 <xsl:param name="indent" /> | |
4 | 588 <xsl:param name="id" /> |
589 <xsl:param name="desc" /> | |
0 | 590 <xsl:call-template name="begin-line"> |
591 <xsl:with-param name="indent" select="$indent" /> | |
592 </xsl:call-template> | |
593 <xsl:text>task </xsl:text> | |
5 | 594 <xsl:value-of select="$id" /> |
4 | 595 <xsl:value-of select="concat(' "',$desc,'" {')" /> |
0 | 596 <xsl:call-template name="end-line" /> |
597 </xsl:template> | |
598 | |
599 <xsl:template name="end-task"> | |
600 <xsl:param name="indent" /> | |
601 <xsl:call-template name="begin-line"> | |
602 <xsl:with-param name="indent" select="$indent" /> | |
603 </xsl:call-template> | |
604 <xsl:text>}</xsl:text> | |
605 <xsl:call-template name="end-line" /> | |
606 </xsl:template> | |
607 | |
608 <xsl:template name="begin-line"> | |
609 <xsl:param name="indent" /> | |
610 <xsl:if test="number($indent) > 0"> | |
611 <xsl:text> </xsl:text> | |
612 <xsl:call-template name="begin-line"> | |
613 <xsl:with-param name="indent" select="$indent - 1" /> | |
614 </xsl:call-template> | |
615 </xsl:if> | |
616 </xsl:template> | |
5 | 617 |
0 | 618 <xsl:template name="end-line"> |
619 <xsl:text>
</xsl:text> | |
620 </xsl:template> | |
4 | 621 |
622 <xsl:template name="repeat"> | |
623 <xsl:param name="value" /> | |
624 <xsl:param name="count" select="0" /> | |
625 | |
626 <xsl:if test="number($count)"> | |
6 | 627 <xsl:value-of select="$value" /> |
4 | 628 <xsl:call-template name="repeat"> |
629 <xsl:with-param name="value" select="$value" /> | |
630 <xsl:with-param name="count" select="$count - 1" /> | |
631 </xsl:call-template> | |
632 </xsl:if> | |
633 </xsl:template> | |
5 | 634 |
635 <xsl:template name="comment"> | |
636 <xsl:param name="indent" /> | |
637 <xsl:param name="comment" /> | |
638 <xsl:call-template name="println"> | |
639 <xsl:with-param name="indent" select="$indent" /> | |
640 <xsl:with-param name="text"> | |
641 <xsl:text># </xsl:text> | |
642 <xsl:value-of select="$comment" /> | |
643 </xsl:with-param> | |
644 </xsl:call-template> | |
645 </xsl:template> | |
646 | |
647 <xsl:template name="println"> | |
648 <xsl:param name="indent" /> | |
649 <xsl:param name="text" /> | |
650 <xsl:call-template name="begin-line"> | |
651 <xsl:with-param name="indent" select="$indent" /> | |
652 </xsl:call-template> | |
653 <xsl:value-of select="$text" /> | |
654 <xsl:call-template name="end-line" /> | |
655 </xsl:template> | |
0 | 656 </xsl:stylesheet> |