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-25 16:06:13 -0700 (Thu, 25 Sep 2008) $'
|
11
|
* '$Revision: 4390 $'
|
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.insertTemplate.value="1";
|
47
|
form_ref.submit();
|
48
|
}
|
49
|
setSelect = function(form_ref, checkBoxName, checked) {
|
50
|
var formElements = form_ref.elements;
|
51
|
for (var i=0; i<formElements.length; i++) {
|
52
|
var myElement = formElements[i];
|
53
|
if (myElement.name == checkBoxName) {
|
54
|
myElement.checked = checked;
|
55
|
}
|
56
|
}
|
57
|
}
|
58
|
]]>
|
59
|
</script>
|
60
|
<script type="text/javascript" language="Javascript">
|
61
|
<![CDATA[
|
62
|
downloadMergedResponseData = function(formId, fieldFormId) {
|
63
|
|
64
|
if (!areItemsSelected('docid')) {
|
65
|
alert("Please select at least one dataset");
|
66
|
return false;
|
67
|
}
|
68
|
|
69
|
//transfer the assessmentItemId to this form
|
70
|
//document.getElementById("questionId").value = document.getElementById("assessmentItemId").value;
|
71
|
//alert("questionId: " + document.getElementById("questionId").value);
|
72
|
|
73
|
var submitFormObj = document.getElementById(formId);
|
74
|
submitFormObj.qformat.value = 'csv';
|
75
|
submitFormObj.action.value = 'dataquery';
|
76
|
|
77
|
//the form that holds the metadata field mappings - but in the header!
|
78
|
var fieldFormObj =
|
79
|
window.document.getElementById("iframeheaderclass").contentDocument.getElementById(fieldFormId);
|
80
|
//alert("fieldFormObj: " + fieldFormObj);
|
81
|
|
82
|
multipleAssessmentSearch(submitFormObj, fieldFormObj);
|
83
|
|
84
|
submitFormObj.submit();
|
85
|
}
|
86
|
editCart = function(formId, operation) {
|
87
|
|
88
|
var metacatURL = "]]><xsl:value-of select="$contextURL" /><![CDATA[/metacat";
|
89
|
if (!areItemsSelected('docid')) {
|
90
|
alert("Please select at least one dataset");
|
91
|
return false;
|
92
|
}
|
93
|
|
94
|
var submitFormObj = document.getElementById(formId);
|
95
|
submitFormObj.qformat.value = 'first';
|
96
|
submitFormObj.action.value = 'editcart';
|
97
|
submitFormObj.operation.value = operation;
|
98
|
|
99
|
var myUpdate = new Ajax.Request(
|
100
|
metacatURL,
|
101
|
{ method: 'post',
|
102
|
parameters: Form.serialize(submitFormObj),
|
103
|
evalScripts: true,
|
104
|
onSuccess: function(transport) {
|
105
|
//alert('Cart changes saved: ' + operation);
|
106
|
//if we are in the cart, we should refresh the entire page
|
107
|
if (document.getElementById("ajaxCartResults")) {
|
108
|
window.location.reload();
|
109
|
}
|
110
|
else {
|
111
|
window.document.getElementById("iframeheaderclass").src=window.document.getElementById("iframeheaderclass").src;
|
112
|
}
|
113
|
},
|
114
|
onFailure: function(transport) {alert('failure making ajax call');}
|
115
|
});
|
116
|
|
117
|
}
|
118
|
read = function(formId, docid, divId) {
|
119
|
|
120
|
//alert("divId: " + divId);
|
121
|
|
122
|
var metacatURL = "]]><xsl:value-of select="$contextURL" /><![CDATA[/metacat";
|
123
|
|
124
|
var submitFormObj = document.getElementById(formId);
|
125
|
submitFormObj.qformat.value = 'first';
|
126
|
submitFormObj.action.value = 'read';
|
127
|
submitFormObj.docid.value = docid;
|
128
|
submitFormObj.insertTemplate.value = '0';
|
129
|
|
130
|
var myUpdate = new Ajax.Updater(
|
131
|
divId,
|
132
|
metacatURL,
|
133
|
{ method: 'post',
|
134
|
parameters: Form.serialize(submitFormObj),
|
135
|
evalScripts: true,
|
136
|
onSuccess: function(transport) {showDiv(divId); },
|
137
|
onFailure: function(transport) {alert('failure making ajax call');}
|
138
|
});
|
139
|
|
140
|
}
|
141
|
areItemsSelected = function(checkBoxName) {
|
142
|
var checkBoxes = document.getElementsByName(checkBoxName);
|
143
|
|
144
|
for (var i=0; i< checkBoxes.length; i++) {
|
145
|
if (checkBoxes[i].checked == true) {
|
146
|
return true;
|
147
|
}
|
148
|
}
|
149
|
//alert("please select a checkbox: " + checkBoxName);
|
150
|
return false;
|
151
|
|
152
|
}
|
153
|
hideDiv = function(divId) {
|
154
|
new Effect.Fade(divId);
|
155
|
//Element.hide(divId);
|
156
|
}
|
157
|
showDiv = function(divId) {
|
158
|
new Effect.Appear(divId)
|
159
|
//Element.show(divId);
|
160
|
}
|
161
|
]]>
|
162
|
</script>
|
163
|
|
164
|
<p class="emphasis">Assessments found: <xsl:number value="count(resultset/document)" /></p>
|
165
|
|
166
|
<!-- This tests to see if there are returned documents,
|
167
|
if there are not then don't show the query results -->
|
168
|
|
169
|
<xsl:if test="count(resultset/document) > 0">
|
170
|
<p>
|
171
|
Download Selected (.csv):
|
172
|
<a>
|
173
|
<xsl:attribute name="href">javascript:{}</xsl:attribute>
|
174
|
<xsl:attribute name="onclick">javascript:downloadMergedResponseData('assessmentForm', 'fieldForm')</xsl:attribute>
|
175
|
<img border="none">
|
176
|
<xsl:attribute name="src">
|
177
|
<xsl:value-of select="$contextURL" />
|
178
|
<xsl:text>/style/images/page_white_put.png</xsl:text>
|
179
|
</xsl:attribute>
|
180
|
</img>
|
181
|
</a>
|
182
|
</p>
|
183
|
<p>
|
184
|
Edit Selected:
|
185
|
<a>
|
186
|
<xsl:attribute name="href">javascript:{}</xsl:attribute>
|
187
|
<xsl:attribute name="onclick">javascript:editCart('assessmentForm', 'add')</xsl:attribute>
|
188
|
<xsl:text>+</xsl:text>
|
189
|
</a>
|
190
|
/
|
191
|
<a>
|
192
|
<xsl:attribute name="href">javascript:{}</xsl:attribute>
|
193
|
<xsl:attribute name="onclick">javascript:editCart('assessmentForm', 'remove')</xsl:attribute>
|
194
|
<!-- <xsl:text>Remove </xsl:text> -->
|
195
|
<img border="none">
|
196
|
<xsl:attribute name="src">
|
197
|
<xsl:value-of select="$contextURL" />
|
198
|
<xsl:text>/style/images/delete.gif</xsl:text>
|
199
|
</xsl:attribute>
|
200
|
</img>
|
201
|
</a>
|
202
|
</p>
|
203
|
|
204
|
<!-- for reading the assessment details -->
|
205
|
<form action="{$contextURL}/metacat" method="POST" id="readForm" name="readForm" >
|
206
|
<input type="hidden" name="qformat" value="first" />
|
207
|
<input type="hidden" name="sessionid">
|
208
|
<xsl:attribute name="value">
|
209
|
<xsl:value-of select="$sessid" />
|
210
|
</xsl:attribute>
|
211
|
</input>
|
212
|
<input type="hidden" name="action" value="read" />
|
213
|
<input type="hidden" name="docid" />
|
214
|
<input type="hidden" name="insertTemplate" value="1"/>
|
215
|
</form>
|
216
|
|
217
|
<!-- for managing the ajax actions -->
|
218
|
<form action="{$contextURL}/metacat" method="POST" id="assessmentForm" name="assessmentForm" >
|
219
|
<input type="hidden" name="qformat" value="first" />
|
220
|
<input type="hidden" name="sessionid">
|
221
|
<xsl:attribute name="value">
|
222
|
<xsl:value-of select="$sessid" />
|
223
|
</xsl:attribute>
|
224
|
</input>
|
225
|
<input type="hidden" name="action" value="read" />
|
226
|
<input type="hidden" name="dataquery" />
|
227
|
<input type="hidden" name="operation" />
|
228
|
<xsl:element name="input">
|
229
|
<xsl:attribute name="type">hidden</xsl:attribute>
|
230
|
<xsl:attribute name="id">questionId</xsl:attribute>
|
231
|
<xsl:attribute name="name">questionId</xsl:attribute>
|
232
|
<xsl:attribute name="value"></xsl:attribute>
|
233
|
</xsl:element>
|
234
|
|
235
|
<table width="95%" align="left" border="0" cellpadding="0"
|
236
|
cellspacing="0">
|
237
|
<tr>
|
238
|
<th style="text-align: left">
|
239
|
<input type="checkbox">
|
240
|
<xsl:attribute name="onclick">setSelect(document.assessmentForm, 'docid', this.checked)</xsl:attribute>
|
241
|
</input>
|
242
|
</th>
|
243
|
<th style="text-align: left">
|
244
|
Assessment Title
|
245
|
</th>
|
246
|
<th style="text-align: left">
|
247
|
Course Title
|
248
|
</th>
|
249
|
<th style="text-align: left">
|
250
|
Instructor[s]
|
251
|
</th>
|
252
|
<th style="text-align: left">
|
253
|
Organization[s]
|
254
|
</th>
|
255
|
<th style="text-align: left">
|
256
|
Keywords
|
257
|
</th>
|
258
|
</tr>
|
259
|
|
260
|
<xsl:for-each select="resultset/document">
|
261
|
<xsl:sort select="./param[@name='assessment/@id']" />
|
262
|
<xsl:variable name="divId">
|
263
|
<xsl:text>ajaxDiv</xsl:text><xsl:value-of select="./docid" />
|
264
|
</xsl:variable>
|
265
|
<tr valign="top" class="subpanel">
|
266
|
<xsl:attribute name="class">
|
267
|
<xsl:choose>
|
268
|
<xsl:when test="position() mod 2 = 1">rowodd</xsl:when>
|
269
|
<xsl:when test="position() mod 2 = 0">roweven</xsl:when>
|
270
|
</xsl:choose>
|
271
|
</xsl:attribute>
|
272
|
|
273
|
<td class="text_plain">
|
274
|
<input type="checkbox" name="docid">
|
275
|
<xsl:attribute name="value">
|
276
|
<xsl:value-of select="./docid" />
|
277
|
</xsl:attribute>
|
278
|
</input>
|
279
|
</td>
|
280
|
<td>
|
281
|
|
282
|
<a>
|
283
|
<xsl:attribute name="href">javascript:submitform('read','<xsl:value-of select="./docid" />',document.readForm)</xsl:attribute>
|
284
|
<xsl:text>» </xsl:text>
|
285
|
<xsl:value-of select="./param[@name='assessment/@title']" />
|
286
|
</a>
|
287
|
(<xsl:value-of select="./docid" />)
|
288
|
|
289
|
<br />
|
290
|
|
291
|
<!--include question ids here -->
|
292
|
<xsl:for-each select="./param[@name='assessmentItems/assessmentItem/assessmentItemId']" >
|
293
|
<input type="hidden">
|
294
|
<xsl:attribute name="name">
|
295
|
<xsl:value-of select="../docid" />
|
296
|
</xsl:attribute>
|
297
|
<xsl:attribute name="value">
|
298
|
<xsl:value-of select="." />
|
299
|
</xsl:attribute>
|
300
|
</input>
|
301
|
</xsl:for-each>
|
302
|
|
303
|
<br/>
|
304
|
|
305
|
</td>
|
306
|
|
307
|
<td class="text_plain">
|
308
|
<xsl:for-each
|
309
|
select="./param[@name='lom/general/title/string']">
|
310
|
<xsl:value-of select="." />
|
311
|
<br />
|
312
|
</xsl:for-each>
|
313
|
</td>
|
314
|
<td class="text_plain">
|
315
|
<xsl:for-each
|
316
|
select="./param[@name='individualName/surName']">
|
317
|
<xsl:value-of select="." />
|
318
|
<br />
|
319
|
</xsl:for-each>
|
320
|
</td>
|
321
|
<td class="text_plain">
|
322
|
<xsl:for-each
|
323
|
select="./param[@name='organizationName']">
|
324
|
<xsl:value-of select="." />
|
325
|
<br />
|
326
|
</xsl:for-each>
|
327
|
</td>
|
328
|
|
329
|
<td class="text_plain">
|
330
|
<xsl:for-each
|
331
|
select="./param[@name='keyword']">
|
332
|
<xsl:value-of select="." />
|
333
|
<br />
|
334
|
</xsl:for-each>
|
335
|
<xsl:for-each
|
336
|
select="./param[@name='lom/general/keyword/string']">
|
337
|
<xsl:value-of select="." />
|
338
|
<br />
|
339
|
</xsl:for-each>
|
340
|
|
341
|
</td>
|
342
|
|
343
|
</tr>
|
344
|
|
345
|
<tr>
|
346
|
<td width="30"> </td>
|
347
|
<td colspan="5">
|
348
|
Details
|
349
|
<a>
|
350
|
<xsl:attribute name="href">javascript:read('readForm', '<xsl:value-of select="./docid" />', '<xsl:value-of select="$divId" />')</xsl:attribute>
|
351
|
<img border="none">
|
352
|
<xsl:attribute name="src">
|
353
|
<xsl:value-of select="$contextURL" />
|
354
|
<xsl:text>/style/images/next.gif</xsl:text>
|
355
|
</xsl:attribute>
|
356
|
</img>
|
357
|
</a>
|
358
|
/
|
359
|
<a>
|
360
|
<xsl:attribute name="href">javascript:hideDiv('<xsl:value-of select="$divId" />')</xsl:attribute>
|
361
|
<img border="none">
|
362
|
<xsl:attribute name="src">
|
363
|
<xsl:value-of select="$contextURL" />
|
364
|
<xsl:text>/style/images/previous.gif</xsl:text>
|
365
|
</xsl:attribute>
|
366
|
</img>
|
367
|
</a>
|
368
|
|
369
|
</td>
|
370
|
</tr>
|
371
|
|
372
|
<tr>
|
373
|
<td> </td>
|
374
|
<td colspan="5">
|
375
|
<div style="display:none;">
|
376
|
<xsl:attribute name="id">
|
377
|
<xsl:value-of select="$divId" />
|
378
|
</xsl:attribute>
|
379
|
Assessment details...
|
380
|
</div>
|
381
|
</td>
|
382
|
</tr>
|
383
|
|
384
|
<tr class="searchresultsdivider">
|
385
|
<td colspan="6">
|
386
|
<img
|
387
|
src="{$contextURL}/style/skins/default/images/transparent1x1.gif"
|
388
|
width="1" height="1" />
|
389
|
</td>
|
390
|
</tr>
|
391
|
|
392
|
</xsl:for-each>
|
393
|
|
394
|
</table>
|
395
|
|
396
|
</form>
|
397
|
|
398
|
</xsl:if>
|
399
|
</xsl:template>
|
400
|
|
401
|
</xsl:stylesheet>
|