Debian Codegraph @

gavo/resources/web/xsl/tap-job-to-html.xsl

raw
1 <?xml version="1.0" encoding="UTF-8"?>
2
3 <!-- A stylesheet to convert a UWS job-summary into HTML.
4
5 TODO: See if there's a way to unify this with dlasync-job-to-html.xsl and
6 useruws-job-to-html.xsl.
7
8 This stylesheet is made available under CC-0 by the GAVO project,
9 http://www.g-vo.org.
10 See http://creativecommons.org/publicdomain/zero/1.0/ for details.
11 -->
12
13 <xsl:stylesheet
14 xmlns:uws="http://www.ivoa.net/xml/UWS/v1.0"
15 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
16 xmlns="http://www.w3.org/1999/xhtml"
17 version="1.0">
18
19
20 <xsl:output method="xml"
21 doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
22 doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"/>
23
24 <!-- Don't spill the content of unknown elements. -->
25 <xsl:template match="text()"/>
26
27 <xsl:template match="uws:parameter">
28 <li class="param">
29 <label>
30 <xsl:attribute name="for"><xsl:value-of select="@id"/></xsl:attribute>
31 <xsl:value-of select="@id"/>
32 </label>
33 <xsl:text> </xsl:text>
34 <input type="text">
35 <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
36 <xsl:attribute name="name"><xsl:value-of select="@id"/></xsl:attribute>
37 <xsl:attribute name="value">
38 <xsl:value-of select="text()"/>
39 </xsl:attribute>
40 </input>
41 </li>
42 </xsl:template>
43
44 <xsl:template match="uws:parameter[@id='query']">
45 <li class="param">
46 <label for="query">QUERY</label><br/>
47 <textarea name="QUERY" style="width:100%" rows="7">
48 <xsl:value-of select="//uws:parameter[@id='query']"/>
49 </textarea>
50 </li>
51 </xsl:template>
52
53 <xsl:template match="uws:parameter[@id='format']"/>
54
55 <xsl:template match="uws:parameter[@id='responseformat']">
56 <li class="param">
57 <label for="query">Response format </label>
58 <select name="FORMAT">
59 <option value="votable/b2">VOTable</option>
60 <option value="text/xml">Text VOTable</option>
61 <option value="application/fits">FITS binary</option>
62 <option value="text/csv">CSV</option>
63 <option value="application/json">JSON</option>
64 </select>
65 <xsl:text> Current: </xsl:text>
66 <xsl:value-of select="."/>
67 </li>
68 </xsl:template>
69
70 <xsl:template match="uws:parameters">
71 <form method="POST">
72 <xsl:attribute name="action">
73 <xsl:value-of select="/*/uws:jobId"/>/parameters</xsl:attribute>
74 <ul class="params"><xsl:apply-templates/></ul>
75 <input type="submit" value="Set Parameters"/>
76 </form>
77 </xsl:template>
78
79
80 <xsl:template name="instrux">
81 <xsl:param name="phase"/>
82 <xsl:choose>
83 <xsl:when test="$phase='PENDING'">
84 <p class="instrux">Use the parameter form to configure
85 your query (in particular, type in the ADQL query and choose some
86 maxrec suitable for your query), then use the
87 "Execute query" button below
88 to start the job.</p>
89 </xsl:when>
90 <xsl:when test="$phase='QUEUED'">
91 <p class="instrux">Your job is waiting for other jobs to
92 complete. Please be patient and hit reload now and then.
93 You can no longer change parameters except the destruction time.</p>
94 </xsl:when>
95 <xsl:when test="$phase='EXECUTING'">
96 <p class="instrux">Your job is executing.
97 You can no longer change parameters except the destruction time.</p>
98 </xsl:when>
99 </xsl:choose>
100 </xsl:template>
101
102
103 <xsl:template match="/">
104 <html>
105 <head>
106 <title>UWS job <xsl:value-of select="/*/uws:jobId"/></title>
107 <style type="text/css">
108 p.instrux {
109 padding-left: 1ex;
110 padding-right: 1ex;
111 border-left: 3pt solid grey;
112 border-right: 3pt solid grey;
113 max-width: 30em;
114 margin-left: 3em;
115 margin-top: 2ex;
116 margin-bottom: 2ex;
117 }
118
119 form {
120 margin-top: 2ex;
121 margin-bottom: 2ex;
122 background-color: #ccc;
123 padding: 1ex;
124 }
125 </style>
126 </head>
127 <body>
128 <h1>UWS job <xsl:value-of select="/*/uws:jobId"/></h1>
129 <xsl:apply-templates/>
130 </body>
131 </html>
132 </xsl:template>
133
134 <xsl:template match="uws:job">
135 <xsl:variable name="jobId"><xsl:value-of select="uws:jobId"/></xsl:variable>
136 <xsl:variable name="phase"><xsl:value-of select="uws:phase"/></xsl:variable>
137
138 <xsl:call-template name="instrux">
139 <xsl:with-param name="phase" select="$phase"/>
140 </xsl:call-template>
141
142 <dl>
143 <dt><xsl:text>Phase:</xsl:text></dt>
144 <dd><xsl:value-of select="uws:phase"/></dd>
145
146 <dt><xsl:text>Start time</xsl:text></dt>
147 <dd><xsl:value-of select="uws:startTime"/></dd>
148
149 <dt><xsl:text>End time:</xsl:text></dt>
150 <dd><xsl:value-of select="uws:endTime"/></dd>
151
152 <dt><xsl:text>Maximum duration:</xsl:text></dt>
153 <dd><xsl:value-of select="uws:executionDuration"/></dd>
154
155 <dt><xsl:text>Destruction time:</xsl:text></dt>
156 <dd><xsl:value-of select="uws:destruction"/></dd>
157
158 <dt>Parameters</dt>
159 <dd><xsl:apply-templates/></dd>
160
161 <xsl:if test="$phase='COMPLETED'">
162 <dt><xsl:text>Query results:</xsl:text></dt>
163 <dd><a>
164 <xsl:attribute name="href">
165 <xsl:value-of select="$jobId"/>/results/result</xsl:attribute>
166 Result</a></dd>
167 </xsl:if>
168
169 <xsl:if test="$phase='ERROR'">
170 <dt><xsl:text>Error message:</xsl:text></dt>
171 <dd><xsl:value-of select="uws:errorSummary/uws:message"/></dd>
172 </xsl:if>
173
174 </dl>
175 <xsl:if test="$phase='PENDING'">
176 <p>
177 <form method="post">
178 <xsl:attribute name="action">
179 <xsl:value-of select="$jobId"/>/executionduration</xsl:attribute>
180 Set maximum runtime to <input type="text" name="EXECUTIONDURATION"
181 size="5">
182 <xsl:attribute name="value"><xsl:value-of select="uws:executionDuration"/></xsl:attribute>
183 </input> seconds. <input type="submit" value="Go"/></form> </p>
184
185 <form method="post">
186 <xsl:attribute name="action">
187 <xsl:value-of select="$jobId"/>/phase</xsl:attribute>
188 <input type="hidden" name="PHASE" value="RUN"/>
189 <input type="submit" value="Execute query"/>
190 </form>
191
192 <p>If you edit the query, you must hit
193 "Set query". Otherwise, "Execute query" will not pick up
194 your changes.</p>
195
196 </xsl:if>
197 <xsl:if test="$phase='EXECUTING' or $phase='QUEUED'">
198 <p>Use your browser's reload to update the phase information.</p>
199 <form method="post">
200 <xsl:attribute name="action">
201 <xsl:value-of select="$jobId"/>/phase</xsl:attribute>
202 <input type="hidden" name="PHASE" value="ABORT"/>
203 <input type="submit" value="Abort query"/>
204 </form></xsl:if>
205 <p>
206 <form method="post">
207 <xsl:attribute name="action">
208 <xsl:value-of select="$jobId"/></xsl:attribute>
209 <input type="hidden" name="ACTION" value="DELETE"/>
210 <input type="submit" value="Delete job"/></form></p>
211 <p>
212 <form method="post">
213 <xsl:attribute name="action">
214 <xsl:value-of select="$jobId"/>/destruction</xsl:attribute>
215 <input type="submit" value="Change destruction time to"/>
216 <input type="text" name="DESTRUCTION">
217 <xsl:attribute name="value"><xsl:value-of select="uws:destruction"/></xsl:attribute>
218 <xsl:attribute name="size">23</xsl:attribute>
219 </input> </form> </p>
220 <p>
221 <a href=".">List of known jobs</a></p>
222 </xsl:template>
223 </xsl:stylesheet>
224 <!-- vi:et:sw=2:sta
225 -->