-
Notifications
You must be signed in to change notification settings - Fork 77
/
matrix.jelly
107 lines (97 loc) · 4.14 KB
/
matrix.jelly
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
<!--
The MIT License
Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi, Yahoo! Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-->
<!--
Generate configuration matrix and invoke body with 'p' as the instance of T
(of Layouter<T>)
Used by Matrix* classes
-->
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form" xmlns:i="jelly:fmt" xmlns:p="/lib/hudson/project">
<st:documentation>
Generate configuration matrix and invoke body with 'p' as the instance of T
(of Layouter<T>)
<st:attribute name="autoRefresh">
If specified, the content of the matrix will be automatically updated via AJAX.
(This happens by requesting URL "./ajaxMatrix", so the caller needs "ajaxMatrix.jelly"
to serve this request.)
</st:attribute>
</st:documentation>
<j:set var="o" value="${it.layouter}"/>
<div id='matrix'>
<j:choose>
<!-- Optimized case when there's only one dimension to the axis (or zero dimension) -->
<j:when test="${empty(o.x) and empty(o.y)}">
<h2>${%Configurations}</h2>
<j:forEach var="p" items="${o.rows[0][0]}">
<d:invokeBody />
<st:nbsp />
</j:forEach>
</j:when>
<j:otherwise>
<table id="configuration-matrix">
<!-- X-axis -->
<j:forEach var="x" items="${o.x}" varStatus="loop">
<tr class="matrix-row">
<!-- space for Y-axis -->
<j:if test="${!empty(o.y)}">
<th id="matrix-title" colspan="${size(o.y)}">${%Configuration Matrix}</th>
</j:if>
<j:forEach begin="1" end="${o.repeatX(loop.index)}">
<j:forEach var="v" items="${x.values}">
<th class="matrix-header" colspan="${o.width(loop.index)}">
<span tooltip="${h.xmlEscape(x.name)}">${v}</span>
</th>
</j:forEach>
</j:forEach>
</tr>
</j:forEach>
<!-- Y-axis -->
<j:forEach var="r" items="${o.rows}">
<tr>
<j:forEach var="y" items="${o.y}" varStatus="loop">
<j:if test="${r.drawYHeader(loop.index)!=null}">
<td class="matrix-leftcolumn" rowspan="${o.height(loop.index)}">
<span tooltip="${h.xmlEscape(y.name)}">${r.drawYHeader(loop.index)}</span>
</td>
</j:if>
</j:forEach>
<j:forEach var="c" items="${r}">
<td class="matrix-cell">
<j:choose>
<j:forEach var="p" items="${c}">
<div>
<d:invokeBody />
</div>
</j:forEach>
</j:choose>
</td>
</j:forEach>
</tr>
</j:forEach>
</table>
</j:otherwise>
</j:choose>
<j:if test="${ajax==null and attrs.autoRefresh and !h.isAutoRefresh(request)}">
<script defer="defer">
refreshPart('matrix',"./ajaxMatrix");
</script>
</j:if>
</div>
</j:jelly>