1
|
<?xml version="1.0"?>
|
2
|
<!--
|
3
|
* '$RCSfile$'
|
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: leinfelder $'
|
10
|
* '$Date: 2008-09-19 16:50:32 -0700 (Fri, 19 Sep 2008) $'
|
11
|
* '$Revision: 4361 $'
|
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
|
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
|
32
|
|
33
|
<xsl:output method="html"/>
|
34
|
<xsl:param name="sessid"/>
|
35
|
<xsl:param name="qformat">default</xsl:param>
|
36
|
<xsl:param name="enableediting">false</xsl:param>
|
37
|
<xsl:param name="contextURL"/>
|
38
|
<xsl:template match="/">
|
39
|
<script language="JavaScript">
|
40
|
<![CDATA[
|
41
|
submitform = function(action,docid,form_ref) {
|
42
|
form_ref.action.value=action;
|
43
|
form_ref.docid.value=docid;
|
44
|
form_ref.sessionid.value="]]><xsl:value-of select="$sessid" /><![CDATA[";
|
45
|
form_ref.qformat.value="first";
|
46
|
form_ref.submit();
|
47
|
}
|
48
|
setSelect = function(form_ref, checkBoxName, checked) {
|
49
|
var formElements = form_ref.elements;
|
50
|
for (var i=0; i<formElements.length; i++) {
|
51
|
var myElement = formElements[i];
|
52
|
if (myElement.name == checkBoxName) {
|
53
|
myElement.checked = checked;
|
54
|
}
|
55
|
}
|
56
|
}
|
57
|
]]>
|
58
|
</script>
|
59
|
<script type="text/javascript" language="Javascript">
|
60
|
<![CDATA[
|
61
|
downloadMergedResponseData = function(formId) {
|
62
|
|
63
|
if (!areItemsSelected('docid')) {
|
64
|
alert("Please select at least one dataset");
|
65
|
return false;
|
66
|
}
|
67
|
|
68
|
//transfer the assessmentItemId to this form
|
69
|
//document.getElementById("questionId").value = document.getElementById("assessmentItemId").value;
|
70
|
//alert("questionId: " + document.getElementById("questionId").value);
|
71
|
|
72
|
var submitFormObj = document.getElementById(formId);
|
73
|
submitFormObj.qformat.value = 'csv';
|
74
|
submitFormObj.action.value = 'dataquery';
|
75
|
|
76
|
multipleAssessmentSearch(submitFormObj);
|
77
|
|
78
|
submitFormObj.submit();
|
79
|
}
|
80
|
editCart = function(formId, operation) {
|
81
|
|
82
|
var metacatURL = "]]><xsl:value-of select="$contextURL" /><![CDATA[/metacat";
|
83
|
if (!areItemsSelected('docid')) {
|
84
|
alert("Please select at least one dataset");
|
85
|
return false;
|
86
|
}
|
87
|
|
88
|
var submitFormObj = document.getElementById(formId);
|
89
|
submitFormObj.qformat.value = 'first';
|
90
|
submitFormObj.action.value = 'editcart';
|
91
|
submitFormObj.operation.value = operation;
|
92
|
|
93
|
var myUpdate = new Ajax.Request(
|
94
|
metacatURL,
|
95
|
{ method: 'post',
|
96
|
parameters: Form.serialize(submitFormObj),
|
97
|
evalScripts: true,
|
98
|
onFailure: function(transport) {alert('failure making ajax call');}
|
99
|
});
|
100
|
|
101
|
}
|
102
|
areItemsSelected = function(checkBoxName) {
|
103
|
var checkBoxes = document.getElementsByName(checkBoxName);
|
104
|
|
105
|
for (var i=0; i< checkBoxes.length; i++) {
|
106
|
if (checkBoxes[i].checked == true) {
|
107
|
return true;
|
108
|
}
|
109
|
}
|
110
|
//alert("please select a checkbox: " + checkBoxName);
|
111
|
return false;
|
112
|
|
113
|
}
|
114
|
hideDiv = function(divId) {
|
115
|
Element.hide(divId);
|
116
|
}
|
117
|
]]>
|
118
|
</script>
|
119
|
|
120
|
<p class="emphasis"><xsl:number value="count(resultset/document)" /> found</p>
|
121
|
|
122
|
<!-- This tests to see if there are returned documents,
|
123
|
if there are not then don't show the query results -->
|
124
|
|
125
|
<xsl:if test="count(resultset/document) > 0">
|
126
|
|
127
|
<!-- for reading the assessment details -->
|
128
|
<form action="{$contextURL}/metacat" method="POST" id="readForm" name="readForm" >
|
129
|
<input type="hidden" name="qformat" value="first" />
|
130
|
<input type="hidden" name="sessionid">
|
131
|
<xsl:attribute name="value">
|
132
|
<xsl:value-of select="$sessid" />
|
133
|
</xsl:attribute>
|
134
|
</input>
|
135
|
<input type="hidden" name="action" value="read" />
|
136
|
<input type="hidden" name="docid" />
|
137
|
</form>
|
138
|
|
139
|
<!-- for managing the ajax actions -->
|
140
|
<form action="{$contextURL}/metacat" method="POST" id="assessmentForm" name="assessmentForm" >
|
141
|
<input type="hidden" name="qformat" value="first" />
|
142
|
<input type="hidden" name="sessionid">
|
143
|
<xsl:attribute name="value">
|
144
|
<xsl:value-of select="$sessid" />
|
145
|
</xsl:attribute>
|
146
|
</input>
|
147
|
<input type="hidden" name="action" value="read" />
|
148
|
<input type="hidden" name="dataquery" />
|
149
|
<input type="hidden" name="operation" />
|
150
|
<xsl:element name="input">
|
151
|
<xsl:attribute name="type">hidden</xsl:attribute>
|
152
|
<xsl:attribute name="id">questionId</xsl:attribute>
|
153
|
<xsl:attribute name="name">questionId</xsl:attribute>
|
154
|
<xsl:attribute name="value"></xsl:attribute>
|
155
|
</xsl:element>
|
156
|
|
157
|
<br/>
|
158
|
Download Selected as:
|
159
|
<a>
|
160
|
<xsl:attribute name="href">#</xsl:attribute>
|
161
|
<xsl:attribute name="onClick">javascript:downloadMergedResponseData('assessmentForm')</xsl:attribute>
|
162
|
<xsl:text>Datafile (.csv)</xsl:text>
|
163
|
</a>
|
164
|
<br/>
|
165
|
Edit Cart:
|
166
|
<a>
|
167
|
<xsl:attribute name="href">#</xsl:attribute>
|
168
|
<xsl:attribute name="onClick">javascript:editCart('assessmentForm', 'add')</xsl:attribute>
|
169
|
<xsl:text>Add Selected</xsl:text>
|
170
|
</a>
|
171
|
/
|
172
|
<a>
|
173
|
<xsl:attribute name="href">#</xsl:attribute>
|
174
|
<xsl:attribute name="onClick">javascript:editCart('assessmentForm', 'remove')</xsl:attribute>
|
175
|
<xsl:text>Remove Selected</xsl:text>
|
176
|
</a>
|
177
|
<br/>
|
178
|
|
179
|
<table width="95%" align="left" border="0" cellpadding="0"
|
180
|
cellspacing="0">
|
181
|
<tr>
|
182
|
<th style="text-align: left">
|
183
|
<input type="checkbox">
|
184
|
<xsl:attribute name="onclick">setSelect(document.assessmentForm, 'docid', this.checked)</xsl:attribute>
|
185
|
</input>
|
186
|
</th>
|
187
|
<th style="text-align: left">
|
188
|
Assessment Title
|
189
|
</th>
|
190
|
<th style="text-align: left">
|
191
|
Course Title
|
192
|
</th>
|
193
|
<th style="text-align: left">
|
194
|
Instructor[s]
|
195
|
</th>
|
196
|
<th style="text-align: left">
|
197
|
Organization[s]
|
198
|
</th>
|
199
|
<th style="text-align: left">
|
200
|
Keywords
|
201
|
</th>
|
202
|
</tr>
|
203
|
|
204
|
<xsl:for-each select="resultset/document">
|
205
|
<xsl:sort select="./param[@name='assessment/@id']" />
|
206
|
<xsl:variable name="divId">
|
207
|
<xsl:text>ajaxDiv</xsl:text><xsl:value-of select="./docid" />
|
208
|
</xsl:variable>
|
209
|
<tr valign="top" class="subpanel">
|
210
|
<xsl:attribute name="class">
|
211
|
<xsl:choose>
|
212
|
<xsl:when test="position() mod 2 = 1">rowodd</xsl:when>
|
213
|
<xsl:when test="position() mod 2 = 0">roweven</xsl:when>
|
214
|
</xsl:choose>
|
215
|
</xsl:attribute>
|
216
|
|
217
|
<td class="text_plain">
|
218
|
<input type="checkbox" name="docid">
|
219
|
<xsl:attribute name="value">
|
220
|
<xsl:value-of select="./docid" />
|
221
|
</xsl:attribute>
|
222
|
</input>
|
223
|
</td>
|
224
|
<td>
|
225
|
|
226
|
<a>
|
227
|
<xsl:attribute name="href">javascript:submitform('read','<xsl:value-of select="./docid" />',document.readForm)</xsl:attribute>
|
228
|
<xsl:text>» </xsl:text>
|
229
|
<xsl:value-of select="./param[@name='assessment/@title']" />
|
230
|
</a>
|
231
|
(<xsl:value-of select="./docid" />)
|
232
|
|
233
|
<br />
|
234
|
|
235
|
<!--include question ids here -->
|
236
|
<xsl:for-each select="./param[@name='assessmentItems/assessmentItem/assessmentItemId']" >
|
237
|
<input type="hidden">
|
238
|
<xsl:attribute name="name">
|
239
|
<xsl:value-of select="../docid" />
|
240
|
</xsl:attribute>
|
241
|
<xsl:attribute name="value">
|
242
|
<xsl:value-of select="." />
|
243
|
</xsl:attribute>
|
244
|
</input>
|
245
|
</xsl:for-each>
|
246
|
|
247
|
<br/>
|
248
|
|
249
|
<div>
|
250
|
<xsl:attribute name="id">
|
251
|
<xsl:value-of select="$divId" />
|
252
|
</xsl:attribute>
|
253
|
</div>
|
254
|
</td>
|
255
|
|
256
|
<td class="text_plain">
|
257
|
<xsl:for-each
|
258
|
select="./param[@name='lom/general/title/string']">
|
259
|
<xsl:value-of select="." />
|
260
|
<br />
|
261
|
</xsl:for-each>
|
262
|
</td>
|
263
|
<td class="text_plain">
|
264
|
<xsl:for-each
|
265
|
select="./param[@name='individualName/surName']">
|
266
|
<xsl:value-of select="." />
|
267
|
<br />
|
268
|
</xsl:for-each>
|
269
|
</td>
|
270
|
<td class="text_plain">
|
271
|
<xsl:for-each
|
272
|
select="./param[@name='organizationName']">
|
273
|
<xsl:value-of select="." />
|
274
|
<br />
|
275
|
</xsl:for-each>
|
276
|
</td>
|
277
|
|
278
|
<td class="text_plain">
|
279
|
<xsl:for-each
|
280
|
select="./param[@name='keyword']">
|
281
|
<xsl:value-of select="." />
|
282
|
<br />
|
283
|
</xsl:for-each>
|
284
|
<xsl:for-each
|
285
|
select="./param[@name='lom/general/keyword/string']">
|
286
|
<xsl:value-of select="." />
|
287
|
<br />
|
288
|
</xsl:for-each>
|
289
|
|
290
|
</td>
|
291
|
|
292
|
</tr>
|
293
|
<tr class="searchresultsdivider">
|
294
|
<td colspan="6">
|
295
|
<img
|
296
|
src="{$contextURL}/style/skins/default/images/transparent1x1.gif"
|
297
|
width="1" height="1" />
|
298
|
</td>
|
299
|
</tr>
|
300
|
|
301
|
</xsl:for-each>
|
302
|
|
303
|
</table>
|
304
|
|
305
|
</form>
|
306
|
|
307
|
</xsl:if>
|
308
|
</xsl:template>
|
309
|
|
310
|
</xsl:stylesheet>
|