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: 2009-03-30 16:01:04 -0700 (Mon, 30 Mar 2009) $'
|
11
|
* '$Revision: 4880 $'
|
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
|
var submitFormObj = document.getElementById(formId);
|
65
|
submitFormObj.qformat.value = 'csv';
|
66
|
submitFormObj.action.value = 'dataquery';
|
67
|
|
68
|
//the form that holds the metadata field mappings - but in the header!
|
69
|
var fieldFormObj =
|
70
|
getIframeDocument("iframeheaderclass").getElementById(fieldFormId);
|
71
|
//alert("fieldFormObj: " + fieldFormObj);
|
72
|
|
73
|
multipleAssessmentSearch(submitFormObj, fieldFormObj);
|
74
|
|
75
|
submitFormObj.submit();
|
76
|
}
|
77
|
editCart = function(formId, operation, docid) {
|
78
|
|
79
|
var metacatURL = "]]><xsl:value-of select="$contextURL" /><![CDATA[/metacat";
|
80
|
//if (!areItemsSelected('docid') && docid) {
|
81
|
// alert("Please select at least one dataset");
|
82
|
// return false;
|
83
|
//}
|
84
|
|
85
|
var submitFormObj = document.getElementById(formId);
|
86
|
submitFormObj.qformat.value = 'first';
|
87
|
submitFormObj.action.value = 'editcart';
|
88
|
submitFormObj.operation.value = operation;
|
89
|
if (docid) {
|
90
|
submitFormObj.docid.value = docid;
|
91
|
}
|
92
|
|
93
|
var myUpdate = new Ajax.Request(
|
94
|
metacatURL,
|
95
|
{ method: 'post',
|
96
|
parameters: Form.serialize(submitFormObj),
|
97
|
evalScripts: true,
|
98
|
onSuccess: function(transport) {
|
99
|
//alert('Cart changes saved: ' + operation);
|
100
|
//if we are in the cart, we should refresh the entire page
|
101
|
if (document.getElementById("ajaxCartResults")) {
|
102
|
window.location.reload();
|
103
|
}
|
104
|
else {
|
105
|
window.document.getElementById("iframeheaderclass").src=window.document.getElementById("iframeheaderclass").src;
|
106
|
//now check the cart contents and update those icons (but wait a second)
|
107
|
setTimeout("setAllCartIcons()", 1000);
|
108
|
}
|
109
|
},
|
110
|
onFailure: function(transport) {alert('failure making ajax call');}
|
111
|
});
|
112
|
|
113
|
}
|
114
|
read = function(formId, docid, divId) {
|
115
|
|
116
|
//alert("divId: " + divId);
|
117
|
|
118
|
var metacatURL = "]]><xsl:value-of select="$contextURL" /><![CDATA[/metacat";
|
119
|
|
120
|
var submitFormObj = document.getElementById(formId);
|
121
|
submitFormObj.qformat.value = 'first';
|
122
|
submitFormObj.action.value = 'read';
|
123
|
submitFormObj.docid.value = docid;
|
124
|
submitFormObj.insertTemplate.value = '0';
|
125
|
|
126
|
var myUpdate = new Ajax.Updater(
|
127
|
divId,
|
128
|
metacatURL,
|
129
|
{ method: 'post',
|
130
|
parameters: Form.serialize(submitFormObj),
|
131
|
evalScripts: true,
|
132
|
onSuccess: function(transport) {showDiv(divId); },
|
133
|
onFailure: function(transport) {alert('failure making ajax call');}
|
134
|
});
|
135
|
|
136
|
}
|
137
|
areItemsSelected = function(checkBoxName) {
|
138
|
var checkBoxes = document.getElementsByName(checkBoxName);
|
139
|
|
140
|
for (var i=0; i< checkBoxes.length; i++) {
|
141
|
if (checkBoxes[i].checked == true) {
|
142
|
return true;
|
143
|
}
|
144
|
}
|
145
|
//alert("please select a checkbox: " + checkBoxName);
|
146
|
return false;
|
147
|
|
148
|
}
|
149
|
setControlVisibility = function() {
|
150
|
if (document.getElementById("ajaxCartResults")) {
|
151
|
new Effect.Appear("download");
|
152
|
new Effect.Appear("transposeDiv");
|
153
|
}
|
154
|
}
|
155
|
isInCart = function(docid) {
|
156
|
|
157
|
//look up the cart in the header
|
158
|
var doc = getIframeDocument("iframeheaderclass");
|
159
|
var objs = doc.getElementsByName("@packageId");
|
160
|
|
161
|
if (objs.length == 0) {
|
162
|
return false;
|
163
|
}
|
164
|
for (var i=0; i< objs.length; i++) {
|
165
|
if (docid == objs[i].value) {
|
166
|
return true;
|
167
|
}
|
168
|
}
|
169
|
return false;
|
170
|
}
|
171
|
hideDiv = function(divId) {
|
172
|
new Effect.Puff(divId);
|
173
|
//Element.hide(divId);
|
174
|
}
|
175
|
showDiv = function(divId) {
|
176
|
new Effect.Appear(divId)
|
177
|
//Element.show(divId);
|
178
|
}
|
179
|
setAllCartIcons = function() {
|
180
|
var docids = document.getElementsByName('docid');
|
181
|
for (var i=0; i< docids.length; i++) {
|
182
|
var docid = docids[i].value;
|
183
|
if (docid != "") {
|
184
|
setCartIcon(docid);
|
185
|
}
|
186
|
}
|
187
|
}
|
188
|
setCartIcon = function(docid) {
|
189
|
//show or hide the div
|
190
|
//alert("setting icon for: " + docid);
|
191
|
if (isInCart(docid)) {
|
192
|
hideDiv("ajaxDiv" + docid + "add");
|
193
|
showDiv("ajaxDiv" + docid + "remove");
|
194
|
}
|
195
|
else {
|
196
|
hideDiv("ajaxDiv" + docid + "remove");
|
197
|
showDiv("ajaxDiv" + docid + "add");
|
198
|
}
|
199
|
}
|
200
|
|
201
|
]]>
|
202
|
</script>
|
203
|
|
204
|
<p class="emphasis">Assessments found: <xsl:number value="count(resultset/document)" /></p>
|
205
|
|
206
|
<!-- This tests to see if there are returned documents,
|
207
|
if there are not then don't show the query results -->
|
208
|
|
209
|
<xsl:if test="count(resultset/document) > 0">
|
210
|
<script type="text/javascript" language="Javascript">
|
211
|
<![CDATA[
|
212
|
//call on load
|
213
|
setControlVisibility();
|
214
|
]]>
|
215
|
</script>
|
216
|
<div id="download" style="display:none;">
|
217
|
<p>
|
218
|
<a>
|
219
|
<xsl:attribute name="href">javascript:{}</xsl:attribute>
|
220
|
<xsl:attribute name="onclick">javascript:downloadMergedResponseData('assessmentForm', 'fieldForm')</xsl:attribute>
|
221
|
<img border="none">
|
222
|
<xsl:attribute name="src">
|
223
|
<xsl:value-of select="$contextURL" />
|
224
|
<xsl:text>/style/images/page_white_put.png</xsl:text>
|
225
|
</xsl:attribute>
|
226
|
</img>
|
227
|
<xsl:text> Download (.csv)</xsl:text>
|
228
|
</a>
|
229
|
</p>
|
230
|
</div>
|
231
|
|
232
|
<!-- for reading the assessment details -->
|
233
|
<form action="{$contextURL}/metacat" method="POST" id="readForm" name="readForm" >
|
234
|
<input type="hidden" name="qformat" value="first" />
|
235
|
<input type="hidden" name="sessionid">
|
236
|
<xsl:attribute name="value">
|
237
|
<xsl:value-of select="$sessid" />
|
238
|
</xsl:attribute>
|
239
|
</input>
|
240
|
<input type="hidden" name="action" value="read" />
|
241
|
<input type="hidden" name="docid" />
|
242
|
<input type="hidden" name="insertTemplate" value="1"/>
|
243
|
</form>
|
244
|
|
245
|
<!-- for editing cart -->
|
246
|
<form action="{$contextURL}/metacat" method="POST" id="cartForm" name="cartForm" >
|
247
|
<input type="hidden" name="qformat" value="first" />
|
248
|
<input type="hidden" name="sessionid">
|
249
|
<xsl:attribute name="value">
|
250
|
<xsl:value-of select="$sessid" />
|
251
|
</xsl:attribute>
|
252
|
</input>
|
253
|
<input type="hidden" name="action" value="editcart" />
|
254
|
<input type="hidden" name="operation" />
|
255
|
<input type="hidden" name="docid" />
|
256
|
|
257
|
</form>
|
258
|
|
259
|
<!-- for downloading data -->
|
260
|
<form action="{$contextURL}/style/skins/first/download.jsp" method="POST" id="assessmentForm" name="assessmentForm" >
|
261
|
<input type="hidden" name="qformat" value="first" />
|
262
|
<input type="hidden" name="sessionid">
|
263
|
<xsl:attribute name="value">
|
264
|
<xsl:value-of select="$sessid" />
|
265
|
</xsl:attribute>
|
266
|
</input>
|
267
|
<input type="hidden" name="action" value="read" />
|
268
|
<input type="hidden" name="dataquery" />
|
269
|
<div id="transposeDiv" style="display:none;">
|
270
|
<input type="checkbox" name="transpose" value="true" />Transpose Data
|
271
|
</div>
|
272
|
<input type="hidden" name="observation" value="3" />
|
273
|
<input type="hidden" name="pivot" value="2" />
|
274
|
<input type="hidden" name="operation" />
|
275
|
|
276
|
<xsl:element name="input">
|
277
|
<xsl:attribute name="type">hidden</xsl:attribute>
|
278
|
<xsl:attribute name="id">questionId</xsl:attribute>
|
279
|
<xsl:attribute name="name">questionId</xsl:attribute>
|
280
|
<xsl:attribute name="value"></xsl:attribute>
|
281
|
</xsl:element>
|
282
|
|
283
|
<table width="95%" align="left" border="0" cellpadding="0"
|
284
|
cellspacing="0">
|
285
|
<tr>
|
286
|
|
287
|
<th style="text-align: left" colspan="2">
|
288
|
Assessment
|
289
|
</th>
|
290
|
<th style="text-align: left">
|
291
|
Course Title
|
292
|
</th>
|
293
|
<th style="text-align: left">
|
294
|
Instructor[s]
|
295
|
</th>
|
296
|
<th style="text-align: left">
|
297
|
Organization[s]
|
298
|
</th>
|
299
|
<th style="text-align: left">
|
300
|
Keywords
|
301
|
</th>
|
302
|
</tr>
|
303
|
|
304
|
<xsl:for-each select="resultset/document">
|
305
|
<xsl:sort select="./param[@name='assessment/@id']" />
|
306
|
<xsl:variable name="divId">
|
307
|
<xsl:text>ajaxDiv</xsl:text><xsl:value-of select="./docid" />
|
308
|
</xsl:variable>
|
309
|
<tr valign="top" class="subpanel">
|
310
|
<xsl:attribute name="class">
|
311
|
<xsl:choose>
|
312
|
<xsl:when test="position() mod 2 = 1">rowodd</xsl:when>
|
313
|
<xsl:when test="position() mod 2 = 0">roweven</xsl:when>
|
314
|
</xsl:choose>
|
315
|
</xsl:attribute>
|
316
|
|
317
|
<td class="text_plain" nowrap="nowrap">
|
318
|
|
319
|
<xsl:if test="count(./param[@name='dataset/dataTable/entityName']) = 0" >
|
320
|
No Data
|
321
|
</xsl:if>
|
322
|
<xsl:if test="count(./param[@name='dataset/dataTable/entityName']) >= 1" >
|
323
|
|
324
|
<script type="text/javascript" language="Javascript">
|
325
|
<![CDATA[
|
326
|
//what are our options?
|
327
|
if (isInCart("]]><xsl:value-of select="./docid" /><![CDATA[")) {
|
328
|
showDiv("]]><xsl:value-of select="$divId" /><![CDATA[remove");
|
329
|
hideDiv("]]><xsl:value-of select="$divId" /><![CDATA[add");
|
330
|
}
|
331
|
else {
|
332
|
showDiv("]]><xsl:value-of select="$divId" /><![CDATA[add");
|
333
|
hideDiv("]]><xsl:value-of select="$divId" /><![CDATA[remove");
|
334
|
}
|
335
|
]]>
|
336
|
</script>
|
337
|
<div style="display:none;">
|
338
|
<xsl:attribute name="id">
|
339
|
<xsl:value-of select="$divId" />
|
340
|
<xsl:text>add</xsl:text>
|
341
|
</xsl:attribute>
|
342
|
<a>
|
343
|
<xsl:attribute name="href">javascript:{}</xsl:attribute>
|
344
|
<xsl:attribute name="onclick"><![CDATA[javascript:editCart('cartForm', 'add',"]]><xsl:value-of select="./docid" /><![CDATA[")]]></xsl:attribute>
|
345
|
<img border="none">
|
346
|
<xsl:attribute name="src">
|
347
|
<xsl:value-of select="$contextURL" />
|
348
|
<xsl:text>/style/skins/first/images/cart_plus_sm.png</xsl:text>
|
349
|
</xsl:attribute>
|
350
|
</img>
|
351
|
</a>
|
352
|
</div>
|
353
|
<div style="display:none;">
|
354
|
<xsl:attribute name="id">
|
355
|
<xsl:value-of select="$divId" />
|
356
|
<xsl:text>remove</xsl:text>
|
357
|
</xsl:attribute>
|
358
|
<a>
|
359
|
<xsl:attribute name="href">javascript:{}</xsl:attribute>
|
360
|
<xsl:attribute name="onclick"><![CDATA[javascript:editCart('cartForm', 'remove',"]]><xsl:value-of select="./docid" /><![CDATA[")]]></xsl:attribute>
|
361
|
<!-- <xsl:text>Remove </xsl:text> -->
|
362
|
<img border="none">
|
363
|
<xsl:attribute name="src">
|
364
|
<xsl:value-of select="$contextURL" />
|
365
|
<xsl:text>/style/skins/first/images/cart_minus_sm.png</xsl:text>
|
366
|
</xsl:attribute>
|
367
|
</img>
|
368
|
</a>
|
369
|
</div>
|
370
|
|
371
|
<input type="hidden" name="docid">
|
372
|
<xsl:attribute name="value">
|
373
|
<xsl:value-of select="./docid" />
|
374
|
</xsl:attribute>
|
375
|
</input>
|
376
|
|
377
|
</xsl:if>
|
378
|
<xsl:if test="count(./param[@name='dataset/dataTable/entityName']) >= 2" >
|
379
|
<!-- demographic data is present -->
|
380
|
<img border="none">
|
381
|
<xsl:attribute name="src">
|
382
|
<xsl:value-of select="$contextURL" />
|
383
|
<xsl:text>/style/skins/first/images/user.gif</xsl:text>
|
384
|
</xsl:attribute>
|
385
|
</img>
|
386
|
</xsl:if>
|
387
|
|
388
|
</td>
|
389
|
<td>
|
390
|
|
391
|
<a>
|
392
|
<xsl:attribute name="href">javascript:submitform('read','<xsl:value-of select="./docid" />',document.readForm)</xsl:attribute>
|
393
|
<xsl:text>» </xsl:text>
|
394
|
<xsl:value-of select="./param[@name='assessment/title']" />
|
395
|
</a>
|
396
|
(<xsl:value-of select="./docid" />)
|
397
|
|
398
|
<br />
|
399
|
|
400
|
<!--include question ids here -->
|
401
|
<xsl:for-each select="./param[@name='assessmentItems/assessmentItem/assessmentItemId']" >
|
402
|
<input type="hidden">
|
403
|
<xsl:attribute name="name">
|
404
|
<xsl:value-of select="../docid" />
|
405
|
</xsl:attribute>
|
406
|
<xsl:attribute name="value">
|
407
|
<xsl:value-of select="." />
|
408
|
</xsl:attribute>
|
409
|
</input>
|
410
|
</xsl:for-each>
|
411
|
|
412
|
<!-- demographic data - present or not? -->
|
413
|
<input type="hidden">
|
414
|
<xsl:attribute name="name">
|
415
|
<xsl:value-of select="./docid" />
|
416
|
<xsl:text>demographicData</xsl:text>
|
417
|
</xsl:attribute>
|
418
|
<xsl:attribute name="value">
|
419
|
<xsl:choose>
|
420
|
<xsl:when test="count(./param[@name='dataset/dataTable/entityName']) >= 2" >
|
421
|
<xsl:text>true</xsl:text>
|
422
|
</xsl:when>
|
423
|
<xsl:otherwise>
|
424
|
<xsl:text></xsl:text>
|
425
|
</xsl:otherwise>
|
426
|
</xsl:choose>
|
427
|
</xsl:attribute>
|
428
|
</input>
|
429
|
|
430
|
<br/>
|
431
|
|
432
|
</td>
|
433
|
|
434
|
<td class="text_plain">
|
435
|
<xsl:for-each
|
436
|
select="./param[@name='lom/general/title/string']">
|
437
|
<xsl:value-of select="." />
|
438
|
<br />
|
439
|
</xsl:for-each>
|
440
|
</td>
|
441
|
<td class="text_plain">
|
442
|
<xsl:for-each
|
443
|
select="./param[@name='individualName/surName']">
|
444
|
<xsl:value-of select="." />
|
445
|
<br />
|
446
|
</xsl:for-each>
|
447
|
</td>
|
448
|
<td class="text_plain">
|
449
|
<xsl:for-each
|
450
|
select="./param[@name='organizationName']">
|
451
|
<xsl:value-of select="." />
|
452
|
<br />
|
453
|
</xsl:for-each>
|
454
|
</td>
|
455
|
|
456
|
<td class="text_plain">
|
457
|
<xsl:for-each
|
458
|
select="./param[@name='keyword']">
|
459
|
<xsl:value-of select="." />
|
460
|
<br />
|
461
|
</xsl:for-each>
|
462
|
<xsl:for-each
|
463
|
select="./param[@name='lom/general/keyword/string']">
|
464
|
<xsl:value-of select="." />
|
465
|
<br />
|
466
|
</xsl:for-each>
|
467
|
|
468
|
</td>
|
469
|
|
470
|
</tr>
|
471
|
|
472
|
<tr>
|
473
|
<td colspan="6">
|
474
|
Details
|
475
|
<a>
|
476
|
<xsl:attribute name="href">javascript:read('readForm', '<xsl:value-of select="./docid" />', '<xsl:value-of select="$divId" />')</xsl:attribute>
|
477
|
<img border="none">
|
478
|
<xsl:attribute name="src">
|
479
|
<xsl:value-of select="$contextURL" />
|
480
|
<xsl:text>/style/images/next.gif</xsl:text>
|
481
|
</xsl:attribute>
|
482
|
</img>
|
483
|
</a>
|
484
|
/
|
485
|
<a>
|
486
|
<xsl:attribute name="href">javascript:hideDiv('<xsl:value-of select="$divId" />')</xsl:attribute>
|
487
|
<img border="none">
|
488
|
<xsl:attribute name="src">
|
489
|
<xsl:value-of select="$contextURL" />
|
490
|
<xsl:text>/style/images/previous.gif</xsl:text>
|
491
|
</xsl:attribute>
|
492
|
</img>
|
493
|
</a>
|
494
|
|
495
|
</td>
|
496
|
</tr>
|
497
|
|
498
|
<tr>
|
499
|
<td colspan="6">
|
500
|
<div style="display:none;">
|
501
|
<xsl:attribute name="id">
|
502
|
<xsl:value-of select="$divId" />
|
503
|
</xsl:attribute>
|
504
|
Assessment details...
|
505
|
</div>
|
506
|
</td>
|
507
|
</tr>
|
508
|
|
509
|
<tr class="searchresultsdivider">
|
510
|
<td colspan="6">
|
511
|
<img
|
512
|
src="{$contextURL}/style/skins/default/images/transparent1x1.gif"
|
513
|
width="1" height="1" />
|
514
|
</td>
|
515
|
</tr>
|
516
|
|
517
|
</xsl:for-each>
|
518
|
|
519
|
</table>
|
520
|
|
521
|
</form>
|
522
|
|
523
|
</xsl:if>
|
524
|
</xsl:template>
|
525
|
|
526
|
</xsl:stylesheet>
|