/dev/trunk

To get this branch, use:
bzr branch http://darksoft.org/webbzr/dev/trunk

« back to all changes in this revision

Viewing changes to setups/katrin/xslt/default.xsl

  • Committer: Suren A. Chilingaryan
  • Date: 2014-01-25 16:38:03 UTC
  • Revision ID: csa@dside.dyndns.org-20140125163803-mhmpyk4dpzz7qabw
Detach setups

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
<?xml version="1.0" encoding="utf-8"?>
2
 
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
3
 
<xsl:output encoding="utf-8"/>
4
 
 
5
 
<xsl:variable name="service">
6
 
    services/katrin.php?target=file&amp;
7
 
</xsl:variable>
8
 
 
9
 
<xsl:template name="image">
10
 
    <xsl:param name="width" />
11
 
    <xsl:param name="height" />
12
 
 
13
 
    <xsl:variable name="link">
14
 
        <xsl:text>services/katrin.php?target=file&amp;</xsl:text>
15
 
        <xsl:if test="@run">
16
 
            <xsl:text>kdb_run=</xsl:text>
17
 
            <xsl:value-of select="@run" />
18
 
            <xsl:text>&amp;</xsl:text>
19
 
        </xsl:if>
20
 
        <xsl:text>kdb_name=</xsl:text>
21
 
        <xsl:value-of select="@name" />
22
 
    </xsl:variable>
23
 
 
24
 
    <xsl:element name="a">
25
 
        <xsl:attribute name="href">
26
 
            <xsl:value-of select="$link" />
27
 
            <xsl:text>.png</xsl:text>
28
 
        </xsl:attribute>
29
 
        <xsl:attribute name="target">_blank</xsl:attribute>
30
 
        <xsl:element name="img">
31
 
            <xsl:attribute name="src">
32
 
                <xsl:value-of select="$link" />
33
 
                <xsl:text>_pv.png</xsl:text>
34
 
            </xsl:attribute>
35
 
            <xsl:attribute name="border">0</xsl:attribute>
36
 
            <xsl:attribute name="alt">
37
 
                <xsl:value-of select="." />
38
 
            </xsl:attribute>
39
 
            <xsl:attribute name="width">
40
 
                <xsl:value-of select="$width" />
41
 
            </xsl:attribute>
42
 
            <xsl:attribute name="height">
43
 
                <xsl:value-of select="$height" />
44
 
            </xsl:attribute>
45
 
        </xsl:element>
46
 
    </xsl:element>
47
 
 
48
 
</xsl:template>
49
 
 
50
 
<xsl:template match="image" mode="small">
51
 
    <xsl:call-template name="image">
52
 
        <xsl:with-param name="width" select="'150'" />
53
 
        <xsl:with-param name="height" select="'100'" />
54
 
    </xsl:call-template>
55
 
</xsl:template>
56
 
 
57
 
<xsl:template match="image" mode="normal">
58
 
    <xsl:call-template name="image">
59
 
        <xsl:with-param name="width" select="'300'" />
60
 
        <xsl:with-param name="height" select="'200'" />
61
 
    </xsl:call-template>
62
 
</xsl:template>
63
 
 
64
 
<xsl:template match="image" mode="large">
65
 
    <xsl:call-template name="image">
66
 
        <xsl:with-param name="width" select="'600'" />
67
 
        <xsl:with-param name="height" select="'400'" />
68
 
    </xsl:call-template>
69
 
</xsl:template>
70
 
 
71
 
<xsl:template match="image" mode="table">
72
 
    <td>
73
 
        <xsl:apply-templates select="." mode="small" />
74
 
    </td>
75
 
</xsl:template>
76
 
 
77
 
<xsl:template match="image" mode="title">
78
 
    <th><xsl:value-of select="." /></th>
79
 
</xsl:template>
80
 
 
81
 
<xsl:template match="file">
82
 
    <p style="margin: 0">
83
 
        <xsl:element name="a">
84
 
            <xsl:attribute name="href">
85
 
                <xsl:text>services/katrin.php?target=file</xsl:text>
86
 
                <xsl:text>&amp;kdb_download=yes</xsl:text>
87
 
                <xsl:if test="@run">
88
 
                    <xsl:text>&amp;kdb_run=</xsl:text>
89
 
                    <xsl:value-of select="@run" />
90
 
                </xsl:if>
91
 
                <xsl:if test="@name">
92
 
                    <xsl:text>&amp;kdb_name=</xsl:text>
93
 
                    <xsl:value-of select="@name" />
94
 
                </xsl:if>
95
 
            </xsl:attribute>
96
 
            <xsl:value-of select="." />
97
 
        </xsl:element>
98
 
        <xsl:if test="@filesize">
99
 
            <span style="font-size: small">
100
 
                <xsl:text> (</xsl:text>
101
 
                <xsl:value-of select="@filesize" />
102
 
                <xsl:text>)</xsl:text>
103
 
            </span>
104
 
        </xsl:if>
105
 
    </p>
106
 
</xsl:template>
107
 
 
108
 
<!-- ADEI links and images -->
109
 
<xsl:template name="adeiurl">
110
 
    <xsl:text>db_server=</xsl:text>
111
 
    <xsl:value-of select="@server" />
112
 
    <xsl:text>&amp;db_name=</xsl:text>
113
 
    <xsl:value-of select="@database" />
114
 
    <xsl:text>&amp;db_group=</xsl:text>
115
 
    <xsl:value-of select="@group" />
116
 
    <xsl:if test="@mask">
117
 
        <xsl:text>&amp;db_mask=</xsl:text>
118
 
        <xsl:value-of select="@mask" />
119
 
    </xsl:if>
120
 
    <xsl:if test="@window">
121
 
        <xsl:text>&amp;window=</xsl:text>
122
 
        <xsl:value-of select="@window" />
123
 
    </xsl:if>
124
 
</xsl:template>
125
 
 
126
 
<xsl:template match="adei">
127
 
    <xsl:element name="a">
128
 
        <xsl:attribute name="href">
129
 
            <xsl:text>javascript:adei.config.Load('</xsl:text>
130
 
            <xsl:call-template name="adeiurl" />
131
 
            <xsl:text>&amp;module=graph&amp;setup=katrin, true)</xsl:text>
132
 
        </xsl:attribute>
133
 
        <xsl:value-of select="." />
134
 
    </xsl:element>
135
 
</xsl:template>
136
 
 
137
 
<xsl:template match="plots">
138
 
    <table style="margin:10px 0">
139
 
        <tr>
140
 
            <xsl:apply-templates select="image" mode="title" />
141
 
        </tr>
142
 
        <tr>
143
 
            <xsl:apply-templates select="image" mode="table" />
144
 
        </tr>
145
 
    </table>
146
 
</xsl:template>
147
 
 
148
 
<xsl:template match="streams">
149
 
    <xsl:for-each select="type">
150
 
        <xsl:variable name="title">
151
 
            <xsl:choose>
152
 
                <xsl:when test="@name=uw">UW</xsl:when>
153
 
                <xsl:when test="@name='ipe3_energy'">IPE3 Energy</xsl:when>
154
 
                <xsl:when test="@name='ipe3_waveform'">IPE3 Waveform</xsl:when>
155
 
                <xsl:when test="@name='ipe3_histogram'">IPE3 Histogram</xsl:when>
156
 
                <xsl:when test="@name='ipe4_energy'">IPE4 Energy</xsl:when>
157
 
                <xsl:when test="@name='ipe4_waveform'">IPE4 Waveform</xsl:when>
158
 
                <xsl:when test="@name='ipe4_histogram'">IPE4 Histogram</xsl:when>
159
 
            </xsl:choose>
160
 
        </xsl:variable>
161
 
        <xsl:element name="img">
162
 
            <xsl:attribute name="src">
163
 
                <xsl:text>setups/katrin/images/</xsl:text>
164
 
                <xsl:value-of select="@name" />
165
 
                <xsl:text>.png</xsl:text>
166
 
            </xsl:attribute>
167
 
            <xsl:attribute name="height">16</xsl:attribute>
168
 
            <xsl:attribute name="alt">
169
 
                <xsl:value-of select="$title" />
170
 
            </xsl:attribute>
171
 
            <xsl:attribute name="title">
172
 
                <xsl:value-of select="$title" />
173
 
            </xsl:attribute>
174
 
            <xsl:attribute name="style">
175
 
                <xsl:text>margin: 0 5px; vertical-align: middle</xsl:text>
176
 
            </xsl:attribute>
177
 
        </xsl:element>
178
 
    </xsl:for-each>
179
 
</xsl:template>
180
 
 
181
 
<xsl:template match="downloads">
182
 
    <h4>Downloads</h4>
183
 
    <xsl:apply-templates select="file" />
184
 
</xsl:template>
185
 
 
186
 
<xsl:template match="transmission">
187
 
    <div>
188
 
        <h4>
189
 
            <xsl:text>Transmission (</xsl:text>
190
 
            <xsl:value-of select="@parameter" />
191
 
            <xsl:text>):</xsl:text>
192
 
        </h4>
193
 
        <xsl:apply-templates select="image" mode="large" />
194
 
    </div>
195
 
</xsl:template>
196
 
 
197
 
<xsl:template match="parameter">
198
 
    <div>
199
 
        <h4>
200
 
            <xsl:text>Control parameter (</xsl:text>
201
 
            <xsl:value-of select="@parameter" />
202
 
            <xsl:text>):</xsl:text>
203
 
        </h4>
204
 
        <xsl:apply-templates select="image" mode="normal" />
205
 
    </div>
206
 
</xsl:template>
207
 
 
208
 
<xsl:template match="countrate">
209
 
    <div>
210
 
        <h4>Eventrate:</h4>
211
 
        <xsl:apply-templates select="image" mode="normal" />
212
 
    </div>
213
 
</xsl:template>
214
 
 
215
 
<xsl:template match="errors">
216
 
    <tr>
217
 
        <td colspan="2">
218
 
            <p class="errors">
219
 
                <xsl:for-each select="error">
220
 
                    <span class="service">
221
 
                        <xsl:value-of select="@service" />
222
 
                    </span>
223
 
                    <xsl:text>: </xsl:text>
224
 
                    <xsl:value-of select="." />
225
 
                    <br />
226
 
                </xsl:for-each>
227
 
            </p>
228
 
        </td>
229
 
    </tr>
230
 
</xsl:template>
231
 
 
232
 
<xsl:template match="run">
233
 
    <table>
234
 
        <tr>
235
 
            <td>
236
 
                <h2>Run <xsl:value-of select="identifier" /></h2>
237
 
            </td>
238
 
            <td>
239
 
                <a href="javascript:katrin.SetCustomProperties('kdb_run=')">
240
 
                    Back to run overview
241
 
                </a>
242
 
            </td>
243
 
        </tr>
244
 
        <tr>
245
 
            <td colspan="2" style="padding: 0 10px">
246
 
                <xsl:apply-templates select="streams" />
247
 
            </td>
248
 
        </tr>
249
 
        <xsl:apply-templates select="errors" />
250
 
        <tr>
251
 
            <td rowspan="2" style="width:600px; padding: 0 10px 0 0">
252
 
                <xsl:apply-templates select="plots/transmission" />
253
 
                <table style="font-size:small">
254
 
                    <tr>
255
 
                        <td><b>Start:</b></td>
256
 
                        <td><xsl:value-of select="start" /></td>
257
 
                    </tr>
258
 
                    <tr>
259
 
                        <td><b>Duration:</b></td>
260
 
                        <td><xsl:value-of select="duration" /></td>
261
 
                    </tr>
262
 
                    <tr>
263
 
                        <td><b>Configuration:</b></td>
264
 
                        <td><xsl:value-of select="configuration" /></td>
265
 
                    </tr>
266
 
                    <tr>
267
 
                        <td><b>ORCA version:</b></td>
268
 
                        <td><xsl:value-of select="orca_version" /></td>
269
 
                    </tr>
270
 
                </table>
271
 
            </td>
272
 
            <td>
273
 
                <xsl:apply-templates select="plots/countrate" />
274
 
                <xsl:apply-templates select="plots/parameter" />
275
 
                <xsl:apply-templates select="downloads" />
276
 
            </td>
277
 
        </tr>
278
 
        <tr>
279
 
            <td style="vertical-align:bottom">
280
 
                <div>
281
 
                    <xsl:if test="../subruns">
282
 
                        <a href="javascript:katrin.SetCustomProperties('kdb_subruns=0')">
283
 
                            Hide subruns
284
 
                        </a>
285
 
                    </xsl:if>
286
 
                    <xsl:if test="not(../subruns)">
287
 
                        <a href="javascript:katrin.SetCustomProperties('kdb_subruns=1')">
288
 
                            Show subruns
289
 
                        </a>
290
 
                    </xsl:if>
291
 
                </div>
292
 
            </td>
293
 
        </tr>
294
 
    </table>
295
 
</xsl:template>
296
 
 
297
 
<xsl:template match="subrun">
298
 
    <div style="margin: 20px 0">
299
 
        <h4>Subrun <xsl:value-of select="identifier" /></h4>
300
 
        <table style="font-size:small">
301
 
            <tr>
302
 
                <td><b>Start:</b></td>
303
 
                <td><xsl:value-of select="start" /></td>
304
 
            </tr>
305
 
            <tr>
306
 
                <td><b>End:</b></td>
307
 
                <td><xsl:value-of select="end" /></td>
308
 
            </tr>
309
 
        </table>
310
 
        <xsl:apply-templates select="plots" />
311
 
    </div>
312
 
</xsl:template>
313
 
 
314
 
<xsl:template match="subruns">
315
 
    <div>
316
 
        <xsl:apply-templates select="subrun" />
317
 
    </div>
318
 
</xsl:template>
319
 
 
320
 
<xsl:template match="/result">
321
 
    <div style="margin: 10px">
322
 
        <xsl:choose>
323
 
            <xsl:when test="Error">
324
 
                <h2>Error</h2>
325
 
                <xsl:value-of select="Error" />
326
 
            </xsl:when>
327
 
            <xsl:otherwise>
328
 
                <xsl:apply-templates select="run" />
329
 
                <xsl:apply-templates select="subruns" />
330
 
            </xsl:otherwise>
331
 
        </xsl:choose>
332
 
    </div>
333
 
</xsl:template>
334
 
</xsl:stylesheet>