1
|
<?xml version="1.0"?>
|
2
|
<!--
|
3
|
* '$RCSfile: resultset.xsl,v $'
|
4
|
* Authors: Matt Jones, Chad Berkley
|
5
|
* Copyright: 2000 Regents of the University of California and the
|
6
|
* National Center for Ecological Analysis and Synthesis
|
7
|
* For Details: http://www.nceas.ucsb.edu/
|
8
|
*
|
9
|
* '$Author: cjones $'
|
10
|
* '$Date: 2004/10/05 23:50:46 $'
|
11
|
* '$Revision: 1.1 $'
|
12
|
*
|
13
|
* This program is free software; you can redistribute it and/or modify
|
14
|
* it under the terms of the GNU General Public License as published by
|
15
|
* the Free Software Foundation; either version 2 of the License, or
|
16
|
* (at your option) any later version.
|
17
|
*
|
18
|
* This program is distributed in the hope that it will be useful,
|
19
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
20
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
21
|
* GNU General Public License for more details.
|
22
|
*
|
23
|
* You should have received a copy of the GNU General Public License
|
24
|
* along with this program; if not, write to the Free Software
|
25
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
26
|
*
|
27
|
* This is an XSLT (http://www.w3.org/TR/xslt) stylesheet designed to
|
28
|
* convert an XML file showing the resultset of a query
|
29
|
* into an HTML format suitable for rendering with modern web browsers.
|
30
|
-->
|
31
|
<!-- 2006-05-01 mob: link to data entity is now a form, submits to a cgi requesting some user info, then on to data.
|
32
|
required another javascript (original one contains metacat params) and a template to generate the form.
|
33
|
-->
|
34
|
|
35
|
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
|
36
|
<!-- import the header, footer, and sidebars for customized styling -->
|
37
|
<xsl:import href="./pageheader.xsl"/>
|
38
|
<xsl:import href="./pagefooter.xsl"/>
|
39
|
<xsl:import href="./page_leftsidebar.xsl"/>
|
40
|
<xsl:import href="./page_rightsidebar.xsl"/>
|
41
|
<xsl:import href="./loginbox.xsl"/>
|
42
|
<xsl:import href="./searchbox.xsl"/>
|
43
|
|
44
|
<xsl:param name="cgi-prefix"/>
|
45
|
<xsl:param name="sessid"/>
|
46
|
<xsl:param name="enableediting">false</xsl:param>
|
47
|
<xsl:param name="contextURL"/>
|
48
|
<!-- This parameter gets overidden by the chosen default qformat -->
|
49
|
<xsl:param name="qformat">default</xsl:param>
|
50
|
<xsl:param name="servletURL"/>
|
51
|
|
52
|
<!-- send the resultset back to the browser styled in HTML -->
|
53
|
<xsl:output method="html" encoding="iso-8859-1" indent="yes" standalone="yes"
|
54
|
doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
|
55
|
doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" />
|
56
|
|
57
|
<!-- this param set to require a user to accept a datause agreement
|
58
|
<xsl:param name="visit_datauseagreement">true</xsl:param> -->
|
59
|
|
60
|
<!-- The main template matches the XML document root -->
|
61
|
<xsl:template match="/">
|
62
|
<html>
|
63
|
<head>
|
64
|
<link rel="stylesheet" type="text/css"
|
65
|
href="{$contextURL}/style/skins/sbclter/sbclter.css" />
|
66
|
<script language="Javascript" type="text/JavaScript"
|
67
|
src="{$contextURL}/style/skins/sbclter/sbclter.js" />
|
68
|
<script language="Javascript" type="text/JavaScript"
|
69
|
src="{$contextURL}/style/common/branding.js" />
|
70
|
<script language="JavaScript">
|
71
|
<![CDATA[
|
72
|
function submitform(action,form_ref) {
|
73
|
form_ref.action.value=action;
|
74
|
form_ref.sessionid.value="]]><xsl:value-of select="$sessid" /><![CDATA[";
|
75
|
form_ref.qformat.value="sbclter";
|
76
|
form_ref.submit();
|
77
|
}
|
78
|
]]>
|
79
|
</script>
|
80
|
<script language="JavaScript">
|
81
|
<![CDATA[
|
82
|
function view_entity(form_ref) {
|
83
|
form_ref.sessionid.value="]]><xsl:value-of select="$sessid" /><![CDATA[";
|
84
|
form_ref.qformat.value="sbclter";
|
85
|
form_ref.submit();
|
86
|
}
|
87
|
]]>
|
88
|
</script>
|
89
|
|
90
|
|
91
|
</head>
|
92
|
|
93
|
<body>
|
94
|
<!-- begin the header area -->
|
95
|
<xsl:call-template name="pageheader" />
|
96
|
<!-- end the header area -->
|
97
|
|
98
|
<!-- begin the left sidebar area -->
|
99
|
<xsl:call-template name="page_leftsidebar" />
|
100
|
<!-- end the left sidebar area -->
|
101
|
|
102
|
<!-- begin the content area -->
|
103
|
<div id="content">
|
104
|
|
105
|
<!-- begin login form area -->
|
106
|
<xsl:call-template name="loginbox" />
|
107
|
<!-- end login form area -->
|
108
|
|
109
|
<!-- begin search form area -->
|
110
|
<xsl:call-template name="searchbox" />
|
111
|
<!-- end search form area -->
|
112
|
|
113
|
|
114
|
<!-- begin results section (XSLT generated) -->
|
115
|
<div id="data-catalog-area">
|
116
|
|
117
|
<!-- State how many package hits were returned -->
|
118
|
<xsl:choose>
|
119
|
<xsl:when test="count(resultset/document)=1">
|
120
|
<p>
|
121
|
<xsl:number value="count(resultset/document)" /> data package found:
|
122
|
</p>
|
123
|
</xsl:when>
|
124
|
<xsl:otherwise>
|
125
|
<p>
|
126
|
<xsl:number value="count(resultset/document)" /> data packages found:
|
127
|
</p>
|
128
|
</xsl:otherwise>
|
129
|
</xsl:choose>
|
130
|
|
131
|
<!-- This tests to see if there are returned documents,
|
132
|
if there are not then don't show the query results -->
|
133
|
<xsl:if test="count(resultset/document) > 0">
|
134
|
|
135
|
<!-- create the results table, and style each of the returnfield that
|
136
|
were specified in the original query -->
|
137
|
<table class="group group_border">
|
138
|
<tr>
|
139
|
<!--<th>Type</th> -->
|
140
|
<th class="wide_column">Title (follow link for metadata)</th>
|
141
|
<th>Principal Investigators</th>
|
142
|
<!-- <th>Organization</th> -->
|
143
|
<th>Download Data Tables (no metadata)</th>
|
144
|
<xsl:if test="$enableediting = 'true'">
|
145
|
<th>Actions</th>
|
146
|
</xsl:if>
|
147
|
</tr>
|
148
|
|
149
|
<xsl:for-each select="resultset/document">
|
150
|
<xsl:sort select="./param[@name='eml/dataset/title']"/>
|
151
|
<tr>
|
152
|
|
153
|
<!-- style the keyword table-cell for data type-->
|
154
|
<!-- removed: too many keywords
|
155
|
<td>
|
156
|
<xsl:attribute name="class">
|
157
|
<xsl:choose>
|
158
|
<xsl:when test="position() mod 2 = 1">rowodd</xsl:when>
|
159
|
<xsl:when test="position() mod 2 = 0">roweven</xsl:when>
|
160
|
</xsl:choose>
|
161
|
</xsl:attribute>
|
162
|
<xsl:for-each select="./param[@name='keyword']">
|
163
|
<xsl:value-of select="." />
|
164
|
<br />
|
165
|
</xsl:for-each>
|
166
|
</td>
|
167
|
-->
|
168
|
|
169
|
|
170
|
<!-- style the Title table-cell for data type-->
|
171
|
<td>
|
172
|
<xsl:attribute name="class">
|
173
|
<xsl:choose>
|
174
|
<xsl:when test="position() mod 2 = 1">rowodd</xsl:when>
|
175
|
<xsl:when test="position() mod 2 = 0">roweven</xsl:when>
|
176
|
</xsl:choose>
|
177
|
</xsl:attribute>
|
178
|
|
179
|
<!--
|
180
|
Build a submit form to view the data package details, using hidden fields to POST the query values.
|
181
|
-->
|
182
|
<form action="{$servletURL}" method="POST">
|
183
|
<xsl:attribute name="name">
|
184
|
<xsl:value-of select="translate(./docid, '()-.', '')" />
|
185
|
</xsl:attribute>
|
186
|
<input type="hidden" name="qformat" />
|
187
|
<input type="hidden" name="sessionid" />
|
188
|
<xsl:if test="$enableediting = 'true'">
|
189
|
<input type="hidden" name="enableediting" value="{$enableediting}"/>
|
190
|
</xsl:if>
|
191
|
<input type="hidden" name="action" value="read"/>
|
192
|
<input type="hidden" name="docid">
|
193
|
<xsl:attribute name="value">
|
194
|
<xsl:value-of select="./docid"/>
|
195
|
</xsl:attribute>
|
196
|
</input>
|
197
|
<xsl:for-each select="./relation">
|
198
|
<input type="hidden" name="docid">
|
199
|
<xsl:attribute name="value" >
|
200
|
<xsl:value-of select="./relationdoc" />
|
201
|
</xsl:attribute>
|
202
|
</input>
|
203
|
</xsl:for-each>
|
204
|
|
205
|
<!-- Create the link on the title column -->
|
206
|
<a>
|
207
|
<xsl:attribute name="href">javascript:submitform('read',document.<xsl:value-of select="translate(./docid, '()-.', '')"/>)</xsl:attribute>
|
208
|
<xsl:choose>
|
209
|
<xsl:when test="./param[@name='eml/dataset/title']!=''">
|
210
|
<xsl:value-of select="./param[@name='eml/dataset/title']"/>
|
211
|
</xsl:when>
|
212
|
<xsl:otherwise>
|
213
|
<xsl:value-of select="./param[@name='eml/citation/title']"/>
|
214
|
<xsl:value-of select="./param[@name='eml/software/title']"/>
|
215
|
<xsl:value-of select="./param[@name='eml/protocol/title']"/>
|
216
|
</xsl:otherwise>
|
217
|
</xsl:choose>
|
218
|
</a>
|
219
|
|
220
|
<!-- Include the docid in the title output -->
|
221
|
<xsl:text>(</xsl:text>
|
222
|
<xsl:value-of select="./docid"/>
|
223
|
<xsl:text>)</xsl:text>
|
224
|
</form>
|
225
|
</td>
|
226
|
|
227
|
|
228
|
<!-- style the table-cell for PIs -->
|
229
|
<td>
|
230
|
<xsl:attribute name="class">
|
231
|
<xsl:choose>
|
232
|
<xsl:when test="position() mod 2 = 1">rowodd</xsl:when>
|
233
|
<xsl:when test="position() mod 2 = 0">roweven</xsl:when>
|
234
|
</xsl:choose>
|
235
|
</xsl:attribute>
|
236
|
|
237
|
<xsl:for-each select="./param[@name='eml/dataset/creator/individualName/surName']" >
|
238
|
<xsl:value-of select="." />
|
239
|
<br />
|
240
|
</xsl:for-each>
|
241
|
</td>
|
242
|
|
243
|
<!-- style the table-cell for the data tables-->
|
244
|
<!--
|
245
|
create links to each of this package's data entities.
|
246
|
needed to edit the url first, then pass it to the form template with param.
|
247
|
mob replaced this section 2006-05-01 -->
|
248
|
<td>
|
249
|
<xsl:attribute name="class">
|
250
|
<xsl:choose>
|
251
|
<xsl:when test="position() mod 2 = 1">rowodd</xsl:when>
|
252
|
<xsl:when test="position() mod 2 = 0">roweven</xsl:when>
|
253
|
</xsl:choose>
|
254
|
</xsl:attribute>
|
255
|
<!-- Check the url, edit string if it uses ecogrid protocol. -->
|
256
|
<xsl:for-each select="./param[@name='eml/dataset/dataTable/entityName']">
|
257
|
<xsl:variable name="entity_name" select="."/>
|
258
|
<xsl:variable name="URL"
|
259
|
select="following-sibling::param[@name='eml/dataset/dataTable/physical/distribution/online/url']" />
|
260
|
<xsl:choose>
|
261
|
<!--
|
262
|
if the content of url is to external data table -->
|
263
|
<xsl:when test="starts-with($URL,'http')">
|
264
|
<xsl:variable name="URL1" select="$URL"/>
|
265
|
<xsl:call-template name="data_use_agreement_form">
|
266
|
<xsl:with-param name="entity_name" select="$entity_name"/>
|
267
|
<xsl:with-param name="URL1" select="$URL1"/>
|
268
|
</xsl:call-template>
|
269
|
</xsl:when>
|
270
|
<!--
|
271
|
if URL uses ecogrid protocol, strip off table name, then create metacat query -->
|
272
|
<xsl:when test="starts-with($URL,'ecogrid')">
|
273
|
<xsl:variable name="URLsubstr" select="substring-after($URL, 'ecogrid://')"/>
|
274
|
<xsl:variable name="docID" select="substring-after($URLsubstr, '/')"/>
|
275
|
<xsl:variable name="URL1">
|
276
|
<xsl:text>{$servletURL}?action=read&qformat=sbclter</xsl:text><xsl:text>&docid=</xsl:text><xsl:value-of select="$docID"/>
|
277
|
|
278
|
<!-- <xsl:text>http://sbcdata.lternet.edu/catalog/metacat?action=read&qformat=</xsl:text>
|
279
|
<xsl:value-of select="$qformat"/>
|
280
|
<xsl:text>&docid=</xsl:text>
|
281
|
<xsl:value-of select="$docID"/> -->
|
282
|
</xsl:variable>
|
283
|
<xsl:call-template name="data_use_agreement_form">
|
284
|
<xsl:with-param name="entity_name" select="$entity_name"/>
|
285
|
<xsl:with-param name="URL1" select="$URL1"/>
|
286
|
</xsl:call-template>
|
287
|
</xsl:when>
|
288
|
<xsl:otherwise>
|
289
|
<!--
|
290
|
else, assume the url content is the just name of a metacat table -->
|
291
|
<xsl:variable name="URL1">
|
292
|
<xsl:text>{$servletURL}?action=read&qformat=sbclter</xsl:text>
|
293
|
<xsl:text>&docid=</xsl:text>
|
294
|
<xsl:value-of select="$URL"/>
|
295
|
</xsl:variable>
|
296
|
<xsl:call-template name="data_use_agreement_form">
|
297
|
<xsl:with-param name="entity_name" select="$entity_name"/>
|
298
|
<xsl:with-param name="URL1" select="$URL1"/>
|
299
|
</xsl:call-template>
|
300
|
</xsl:otherwise>
|
301
|
</xsl:choose>
|
302
|
</xsl:for-each>
|
303
|
</td>
|
304
|
|
305
|
|
306
|
|
307
|
|
308
|
<!--
|
309
|
|
310
|
if editing is turned on, add some buttons -->
|
311
|
<xsl:if test="$enableediting = 'true'">
|
312
|
<td>
|
313
|
<xsl:attribute name="class">
|
314
|
<xsl:choose>
|
315
|
<xsl:when test="position() mod 2 = 1">rowodd</xsl:when>
|
316
|
<xsl:when test="position() mod 2 = 0">roweven</xsl:when>
|
317
|
</xsl:choose>
|
318
|
</xsl:attribute>
|
319
|
|
320
|
<form action="{$servletURL}" method="POST">
|
321
|
<input type="hidden" name="action" value="read"/>
|
322
|
<input type="hidden" name="qformat" value="sbclter"/>
|
323
|
<input type="hidden" name="sessionid" value="{$sessid}"/>
|
324
|
<input type="hidden" name="docid">
|
325
|
<xsl:attribute name="value">
|
326
|
<xsl:value-of select="./docid"/>
|
327
|
</xsl:attribute>
|
328
|
</input>
|
329
|
<center>
|
330
|
<input type="SUBMIT" value=" View " name="View">
|
331
|
</input>
|
332
|
</center>
|
333
|
</form>
|
334
|
<form action="{$cgi-prefix}/register-dataset.cgi"
|
335
|
method="POST">
|
336
|
<input type="hidden" name="stage" value="modify"/>
|
337
|
<input type="hidden" name="cfg" value="sbclter"/>
|
338
|
<input type="hidden" name="sessionid" value="{$sessid}"/>
|
339
|
<input type="hidden" name="docid">
|
340
|
<xsl:attribute name="value">
|
341
|
<xsl:value-of select="./docid"/>
|
342
|
</xsl:attribute>
|
343
|
</input>
|
344
|
<input type="SUBMIT" value=" Edit " name="Edit">
|
345
|
</input>
|
346
|
</form>
|
347
|
<form action="{$cgi-prefix}/register-dataset.cgi"
|
348
|
method="POST">
|
349
|
<input type="hidden" name="stage" value="delete"/>
|
350
|
<input type="hidden" name="cfg" value="sbclter"/>
|
351
|
<input type="hidden" name="sessionid" value="{$sessid}"/>
|
352
|
<input type="hidden" name="docid">
|
353
|
<xsl:attribute name="value">
|
354
|
<xsl:value-of select="./docid"/>
|
355
|
</xsl:attribute>
|
356
|
</input>
|
357
|
<input type="submit" value="Delete" name="Delete">
|
358
|
</input>
|
359
|
</form>
|
360
|
</td>
|
361
|
</xsl:if>
|
362
|
</tr>
|
363
|
</xsl:for-each>
|
364
|
</table>
|
365
|
</xsl:if>
|
366
|
|
367
|
</div> <!-- end data-catalog-area -->
|
368
|
</div>
|
369
|
<!-- end content area -->
|
370
|
|
371
|
<!-- begin the right sidebar area -->
|
372
|
<xsl:call-template name="page_rightsidebar" />
|
373
|
<!-- end the right sidebar area -->
|
374
|
|
375
|
<!-- begin the footer area -->
|
376
|
<xsl:call-template name="pagefooter" />
|
377
|
<!-- end the footer area -->
|
378
|
|
379
|
</body>
|
380
|
</html>
|
381
|
</xsl:template>
|
382
|
<!--
|
383
|
|
384
|
|
385
|
template to display data use agreement form.
|
386
|
mob, 2006-05-01 -->
|
387
|
<xsl:template name="data_use_agreement_form">
|
388
|
<xsl:param name="entity_name"/>
|
389
|
<xsl:param name="URL1"/>
|
390
|
<!-- create form to pass url and entity's name to cgi with data agreement page. form name must be unique/dynamic -->
|
391
|
<form action="{$cgi-prefix}/data-use-agreement.cgi" method="POST">
|
392
|
<!-- <form action="http://sbcdata.lternet.edu/cgi-bin/data-use-agreement.cgi" method="POST"> -->
|
393
|
<xsl:attribute name="name">
|
394
|
<xsl:value-of select="translate($entity_name,',:()-. ' ,'')" />
|
395
|
</xsl:attribute>
|
396
|
<input type="hidden" name="qformat" />
|
397
|
<input type="hidden" name="sessionid" />
|
398
|
<xsl:if test="$enableediting = 'true'">
|
399
|
<input type="hidden" name="enableediting" value="{$enableediting}"/>
|
400
|
</xsl:if>
|
401
|
<input type="hidden" name="url">
|
402
|
<xsl:attribute name="value">
|
403
|
<xsl:value-of select="$URL1"/>
|
404
|
</xsl:attribute>
|
405
|
</input>
|
406
|
<input type="hidden" name="entityName">
|
407
|
<xsl:attribute name="value">
|
408
|
<xsl:value-of select="$entity_name"/>
|
409
|
</xsl:attribute>
|
410
|
</input>
|
411
|
<a>
|
412
|
<xsl:attribute name="href">javascript:view_entity(document.<xsl:value-of select="translate($entity_name,',:()-. ' ,'')" />)</xsl:attribute>
|
413
|
<xsl:value-of select="$entity_name"/> <!-- the entity name forms the anchor text -->
|
414
|
</a>
|
415
|
<br/>
|
416
|
</form>
|
417
|
</xsl:template>
|
418
|
</xsl:stylesheet>
|