/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/monspec.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>setups/katrin/services/adei.fcgi?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>setups/katrin/services/adei.fcgi?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="parameters">
233
 
    <xsl:if test="fluke">
234
 
        <tr>
235
 
            <td><b>Voltage:</b></td>
236
 
            <td><xsl:value-of select="fluke" /> V</td>
237
 
        </tr>
238
 
    </xsl:if>
239
 
</xsl:template>
240
 
 
241
 
<xsl:template match="run">
242
 
    <table>
243
 
        <tr>
244
 
            <td>
245
 
                <h2>Run <xsl:value-of select="identifier" /></h2>
246
 
            </td>
247
 
            <td>
248
 
                <a href="javascript:katrin.SetCustomProperties('kdb_run=')">
249
 
                    Back to run overview
250
 
                </a>
251
 
            </td>
252
 
        </tr>
253
 
        <tr>
254
 
            <td colspan="2" style="padding: 0 10px">
255
 
                <xsl:apply-templates select="streams" />
256
 
            </td>
257
 
        </tr>
258
 
        <xsl:apply-templates select="errors" />
259
 
        <tr>
260
 
            <td rowspan="1" style="width:600px; padding: 0 10px 0 0">
261
 
                <xsl:apply-templates select="plots/transmission" />
262
 
                <table style="font-size:small">
263
 
                    <tr>
264
 
                        <td><b>Start:</b></td>
265
 
                        <td><xsl:value-of select="start" /></td>
266
 
                    </tr>
267
 
                    <tr>
268
 
                        <td><b>Duration:</b></td>
269
 
                        <td><xsl:value-of select="duration" /></td>
270
 
                    </tr>
271
 
                    <tr>
272
 
                        <td><b>Configuration:</b></td>
273
 
                        <td><xsl:value-of select="configuration" /></td>
274
 
                    </tr>
275
 
                    <tr>
276
 
                        <td><b>ORCA version:</b></td>
277
 
                        <td><xsl:value-of select="orca_version" /></td>
278
 
                    </tr>
279
 
                    <xsl:apply-templates select="parameters" />
280
 
                </table>
281
 
            </td>
282
 
            <td>
283
 
                <xsl:apply-templates select="plots/countrate" />
284
 
                <xsl:apply-templates select="plots/parameter" />
285
 
                <xsl:apply-templates select="downloads" />
286
 
            </td>
287
 
        </tr>
288
 
        <tr>
289
 
            <td>
290
 
                <xsl:apply-templates select="plots" />
291
 
            </td>
292
 
            <td style="vertical-align:bottom">
293
 
                <div>
294
 
                    <xsl:if test="../subruns">
295
 
                        <a href="javascript:katrin.SetCustomProperties('kdb_subruns=0')">
296
 
                            Hide subruns
297
 
                        </a>
298
 
                    </xsl:if>
299
 
                    <xsl:if test="not(../subruns)">
300
 
                        <a href="javascript:katrin.SetCustomProperties('kdb_subruns=1')">
301
 
                            Show subruns
302
 
                        </a>
303
 
                    </xsl:if>
304
 
                </div>
305
 
            </td>
306
 
        </tr>
307
 
    </table>
308
 
</xsl:template>
309
 
 
310
 
<xsl:template match="subrun">
311
 
    <div style="margin: 20px 0">
312
 
        <h4>Subrun <xsl:value-of select="identifier" /></h4>
313
 
        <table style="font-size:small">
314
 
            <tr>
315
 
                <td><b>Start:</b></td>
316
 
                <td><xsl:value-of select="start" /></td>
317
 
            </tr>
318
 
            <tr>
319
 
                <td><b>End:</b></td>
320
 
                <td><xsl:value-of select="end" /></td>
321
 
            </tr>
322
 
            <xsl:apply-templates select="parameters" />
323
 
        </table>
324
 
        <xsl:apply-templates select="plots" />
325
 
    </div>
326
 
</xsl:template>
327
 
 
328
 
<xsl:template match="subruns">
329
 
    <div>
330
 
        <xsl:apply-templates select="subrun" />
331
 
    </div>
332
 
</xsl:template>
333
 
 
334
 
<xsl:template match="/result">
335
 
    <div style="margin: 10px">
336
 
        <xsl:choose>
337
 
            <xsl:when test="Error">
338
 
                <h2>Error</h2>
339
 
                <xsl:value-of select="Error" />
340
 
            </xsl:when>
341
 
            <xsl:otherwise>
342
 
                <xsl:apply-templates select="run" />
343
 
                <xsl:apply-templates select="subruns" />
344
 
            </xsl:otherwise>
345
 
        </xsl:choose>
346
 
    </div>
347
 
</xsl:template>
348
 
</xsl:stylesheet>