1 |
3531
|
leinfelder
|
<?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$'
|
10 |
|
|
* '$Date$'
|
11 |
|
|
* '$Revision$'
|
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 |
4289
|
leinfelder
|
<xsl:param name="contextURL"/>
|
38 |
3531
|
leinfelder
|
<xsl:template match="/">
|
39 |
|
|
<script language="JavaScript">
|
40 |
|
|
<![CDATA[
|
41 |
3542
|
leinfelder
|
submitform = function(action,docid,form_ref) {
|
42 |
3531
|
leinfelder
|
form_ref.action.value=action;
|
43 |
3542
|
leinfelder
|
form_ref.docid.value=docid;
|
44 |
3531
|
leinfelder
|
form_ref.sessionid.value="]]><xsl:value-of select="$sessid" /><![CDATA[";
|
45 |
4290
|
leinfelder
|
form_ref.qformat.value="first";
|
46 |
3531
|
leinfelder
|
form_ref.submit();
|
47 |
|
|
}
|
48 |
3542
|
leinfelder
|
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 |
3531
|
leinfelder
|
]]>
|
58 |
|
|
</script>
|
59 |
3542
|
leinfelder
|
<script type="text/javascript" language="Javascript">
|
60 |
|
|
<![CDATA[
|
61 |
3551
|
leinfelder
|
downloadMergedResponseData = function(formId) {
|
62 |
|
|
|
63 |
4361
|
leinfelder
|
if (!areItemsSelected('docid')) {
|
64 |
|
|
alert("Please select at least one dataset");
|
65 |
3551
|
leinfelder
|
return false;
|
66 |
|
|
}
|
67 |
4289
|
leinfelder
|
|
68 |
3669
|
leinfelder
|
//transfer the assessmentItemId to this form
|
69 |
4290
|
leinfelder
|
//document.getElementById("questionId").value = document.getElementById("assessmentItemId").value;
|
70 |
3669
|
leinfelder
|
//alert("questionId: " + document.getElementById("questionId").value);
|
71 |
|
|
|
72 |
3551
|
leinfelder
|
var submitFormObj = document.getElementById(formId);
|
73 |
|
|
submitFormObj.qformat.value = 'csv';
|
74 |
4289
|
leinfelder
|
submitFormObj.action.value = 'dataquery';
|
75 |
3551
|
leinfelder
|
|
76 |
4289
|
leinfelder
|
multipleAssessmentSearch(submitFormObj);
|
77 |
|
|
|
78 |
3551
|
leinfelder
|
submitFormObj.submit();
|
79 |
|
|
}
|
80 |
4361
|
leinfelder
|
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 |
4379
|
leinfelder
|
evalScripts: true,
|
98 |
|
|
onSuccess: function(transport) {alert('Cart changes saved: ' + operation); window.document.getElementById("iframeheaderclass").src=window.document.getElementById("iframeheaderclass").src;},
|
99 |
4361
|
leinfelder
|
onFailure: function(transport) {alert('failure making ajax call');}
|
100 |
|
|
});
|
101 |
|
|
|
102 |
|
|
}
|
103 |
4379
|
leinfelder
|
read = function(formId, docid, divId) {
|
104 |
|
|
|
105 |
|
|
//alert("divId: " + divId);
|
106 |
|
|
|
107 |
|
|
var metacatURL = "]]><xsl:value-of select="$contextURL" /><![CDATA[/metacat";
|
108 |
|
|
|
109 |
|
|
var submitFormObj = document.getElementById(formId);
|
110 |
|
|
submitFormObj.qformat.value = 'first';
|
111 |
|
|
submitFormObj.action.value = 'read';
|
112 |
|
|
submitFormObj.docid.value = docid;
|
113 |
|
|
submitFormObj.insertTemplate.value = '0';
|
114 |
|
|
|
115 |
|
|
var myUpdate = new Ajax.Updater(
|
116 |
|
|
divId,
|
117 |
|
|
metacatURL,
|
118 |
|
|
{ method: 'post',
|
119 |
|
|
parameters: Form.serialize(submitFormObj),
|
120 |
|
|
evalScripts: true,
|
121 |
|
|
onSuccess: function(transport) {showDiv(divId); },
|
122 |
|
|
onFailure: function(transport) {alert('failure making ajax call');}
|
123 |
|
|
});
|
124 |
|
|
|
125 |
|
|
}
|
126 |
3551
|
leinfelder
|
areItemsSelected = function(checkBoxName) {
|
127 |
|
|
var checkBoxes = document.getElementsByName(checkBoxName);
|
128 |
|
|
|
129 |
|
|
for (var i=0; i< checkBoxes.length; i++) {
|
130 |
|
|
if (checkBoxes[i].checked == true) {
|
131 |
|
|
return true;
|
132 |
|
|
}
|
133 |
|
|
}
|
134 |
|
|
//alert("please select a checkbox: " + checkBoxName);
|
135 |
|
|
return false;
|
136 |
|
|
|
137 |
|
|
}
|
138 |
3542
|
leinfelder
|
hideDiv = function(divId) {
|
139 |
|
|
Element.hide(divId);
|
140 |
|
|
}
|
141 |
4379
|
leinfelder
|
showDiv = function(divId) {
|
142 |
|
|
Element.show(divId);
|
143 |
|
|
}
|
144 |
3542
|
leinfelder
|
]]>
|
145 |
|
|
</script>
|
146 |
3531
|
leinfelder
|
|
147 |
|
|
<p class="emphasis"><xsl:number value="count(resultset/document)" /> found</p>
|
148 |
|
|
|
149 |
|
|
<!-- This tests to see if there are returned documents,
|
150 |
|
|
if there are not then don't show the query results -->
|
151 |
|
|
|
152 |
|
|
<xsl:if test="count(resultset/document) > 0">
|
153 |
4365
|
leinfelder
|
|
154 |
|
|
Download Selected as:
|
155 |
|
|
<a>
|
156 |
|
|
<xsl:attribute name="href">#</xsl:attribute>
|
157 |
|
|
<xsl:attribute name="onClick">javascript:downloadMergedResponseData('assessmentForm')</xsl:attribute>
|
158 |
|
|
<xsl:text>Datafile (.csv)</xsl:text>
|
159 |
|
|
</a>
|
160 |
|
|
<br/>
|
161 |
|
|
Edit Cart:
|
162 |
|
|
<a>
|
163 |
|
|
<xsl:attribute name="href">#</xsl:attribute>
|
164 |
|
|
<xsl:attribute name="onClick">javascript:editCart('assessmentForm', 'add')</xsl:attribute>
|
165 |
|
|
<xsl:text>Add Selected</xsl:text>
|
166 |
|
|
</a>
|
167 |
|
|
/
|
168 |
|
|
<a>
|
169 |
|
|
<xsl:attribute name="href">#</xsl:attribute>
|
170 |
|
|
<xsl:attribute name="onClick">javascript:editCart('assessmentForm', 'remove')</xsl:attribute>
|
171 |
|
|
<xsl:text>Remove Selected</xsl:text>
|
172 |
|
|
</a>
|
173 |
|
|
|
174 |
|
|
<br/>
|
175 |
|
|
|
176 |
4361
|
leinfelder
|
<!-- for reading the assessment details -->
|
177 |
|
|
<form action="{$contextURL}/metacat" method="POST" id="readForm" name="readForm" >
|
178 |
|
|
<input type="hidden" name="qformat" value="first" />
|
179 |
|
|
<input type="hidden" name="sessionid">
|
180 |
|
|
<xsl:attribute name="value">
|
181 |
|
|
<xsl:value-of select="$sessid" />
|
182 |
|
|
</xsl:attribute>
|
183 |
|
|
</input>
|
184 |
|
|
<input type="hidden" name="action" value="read" />
|
185 |
|
|
<input type="hidden" name="docid" />
|
186 |
4379
|
leinfelder
|
<input type="hidden" name="insertTemplate" value="1"/>
|
187 |
4361
|
leinfelder
|
</form>
|
188 |
|
|
|
189 |
|
|
<!-- for managing the ajax actions -->
|
190 |
4289
|
leinfelder
|
<form action="{$contextURL}/metacat" method="POST" id="assessmentForm" name="assessmentForm" >
|
191 |
3542
|
leinfelder
|
<input type="hidden" name="qformat" value="first" />
|
192 |
4289
|
leinfelder
|
<input type="hidden" name="sessionid">
|
193 |
|
|
<xsl:attribute name="value">
|
194 |
|
|
<xsl:value-of select="$sessid" />
|
195 |
|
|
</xsl:attribute>
|
196 |
|
|
</input>
|
197 |
3542
|
leinfelder
|
<input type="hidden" name="action" value="read" />
|
198 |
4289
|
leinfelder
|
<input type="hidden" name="dataquery" />
|
199 |
4361
|
leinfelder
|
<input type="hidden" name="operation" />
|
200 |
3669
|
leinfelder
|
<xsl:element name="input">
|
201 |
|
|
<xsl:attribute name="type">hidden</xsl:attribute>
|
202 |
|
|
<xsl:attribute name="id">questionId</xsl:attribute>
|
203 |
|
|
<xsl:attribute name="name">questionId</xsl:attribute>
|
204 |
|
|
<xsl:attribute name="value"></xsl:attribute>
|
205 |
|
|
</xsl:element>
|
206 |
3542
|
leinfelder
|
|
207 |
3531
|
leinfelder
|
<table width="95%" align="left" border="0" cellpadding="0"
|
208 |
|
|
cellspacing="0">
|
209 |
|
|
<tr>
|
210 |
|
|
<th style="text-align: left">
|
211 |
4289
|
leinfelder
|
<input type="checkbox">
|
212 |
4361
|
leinfelder
|
<xsl:attribute name="onclick">setSelect(document.assessmentForm, 'docid', this.checked)</xsl:attribute>
|
213 |
4289
|
leinfelder
|
</input>
|
214 |
|
|
</th>
|
215 |
|
|
<th style="text-align: left">
|
216 |
3531
|
leinfelder
|
Assessment Title
|
217 |
|
|
</th>
|
218 |
|
|
<th style="text-align: left">
|
219 |
|
|
Course Title
|
220 |
|
|
</th>
|
221 |
|
|
<th style="text-align: left">
|
222 |
|
|
Instructor[s]
|
223 |
|
|
</th>
|
224 |
|
|
<th style="text-align: left">
|
225 |
|
|
Organization[s]
|
226 |
|
|
</th>
|
227 |
|
|
<th style="text-align: left">
|
228 |
|
|
Keywords
|
229 |
|
|
</th>
|
230 |
|
|
</tr>
|
231 |
|
|
|
232 |
|
|
<xsl:for-each select="resultset/document">
|
233 |
3918
|
leinfelder
|
<xsl:sort select="./param[@name='assessment/@id']" />
|
234 |
3542
|
leinfelder
|
<xsl:variable name="divId">
|
235 |
|
|
<xsl:text>ajaxDiv</xsl:text><xsl:value-of select="./docid" />
|
236 |
|
|
</xsl:variable>
|
237 |
3531
|
leinfelder
|
<tr valign="top" class="subpanel">
|
238 |
|
|
<xsl:attribute name="class">
|
239 |
3542
|
leinfelder
|
<xsl:choose>
|
240 |
|
|
<xsl:when test="position() mod 2 = 1">rowodd</xsl:when>
|
241 |
|
|
<xsl:when test="position() mod 2 = 0">roweven</xsl:when>
|
242 |
|
|
</xsl:choose>
|
243 |
|
|
</xsl:attribute>
|
244 |
3531
|
leinfelder
|
|
245 |
|
|
<td class="text_plain">
|
246 |
4361
|
leinfelder
|
<input type="checkbox" name="docid">
|
247 |
4289
|
leinfelder
|
<xsl:attribute name="value">
|
248 |
|
|
<xsl:value-of select="./docid" />
|
249 |
|
|
</xsl:attribute>
|
250 |
|
|
</input>
|
251 |
|
|
</td>
|
252 |
|
|
<td>
|
253 |
|
|
|
254 |
3542
|
leinfelder
|
<a>
|
255 |
4361
|
leinfelder
|
<xsl:attribute name="href">javascript:submitform('read','<xsl:value-of select="./docid" />',document.readForm)</xsl:attribute>
|
256 |
3542
|
leinfelder
|
<xsl:text>» </xsl:text>
|
257 |
3918
|
leinfelder
|
<xsl:value-of select="./param[@name='assessment/@title']" />
|
258 |
3542
|
leinfelder
|
</a>
|
259 |
|
|
(<xsl:value-of select="./docid" />)
|
260 |
4289
|
leinfelder
|
|
261 |
3542
|
leinfelder
|
<br />
|
262 |
4289
|
leinfelder
|
|
263 |
|
|
<!--include question ids here -->
|
264 |
|
|
<xsl:for-each select="./param[@name='assessmentItems/assessmentItem/assessmentItemId']" >
|
265 |
|
|
<input type="hidden">
|
266 |
|
|
<xsl:attribute name="name">
|
267 |
|
|
<xsl:value-of select="../docid" />
|
268 |
|
|
</xsl:attribute>
|
269 |
|
|
<xsl:attribute name="value">
|
270 |
|
|
<xsl:value-of select="." />
|
271 |
|
|
</xsl:attribute>
|
272 |
|
|
</input>
|
273 |
|
|
</xsl:for-each>
|
274 |
|
|
|
275 |
3542
|
leinfelder
|
<br/>
|
276 |
4379
|
leinfelder
|
|
277 |
3531
|
leinfelder
|
</td>
|
278 |
|
|
|
279 |
|
|
<td class="text_plain">
|
280 |
|
|
<xsl:for-each
|
281 |
|
|
select="./param[@name='lom/general/title/string']">
|
282 |
|
|
<xsl:value-of select="." />
|
283 |
|
|
<br />
|
284 |
|
|
</xsl:for-each>
|
285 |
|
|
</td>
|
286 |
|
|
<td class="text_plain">
|
287 |
|
|
<xsl:for-each
|
288 |
|
|
select="./param[@name='individualName/surName']">
|
289 |
|
|
<xsl:value-of select="." />
|
290 |
|
|
<br />
|
291 |
|
|
</xsl:for-each>
|
292 |
|
|
</td>
|
293 |
|
|
<td class="text_plain">
|
294 |
|
|
<xsl:for-each
|
295 |
|
|
select="./param[@name='organizationName']">
|
296 |
|
|
<xsl:value-of select="." />
|
297 |
|
|
<br />
|
298 |
|
|
</xsl:for-each>
|
299 |
|
|
</td>
|
300 |
|
|
|
301 |
|
|
<td class="text_plain">
|
302 |
|
|
<xsl:for-each
|
303 |
|
|
select="./param[@name='keyword']">
|
304 |
|
|
<xsl:value-of select="." />
|
305 |
|
|
<br />
|
306 |
|
|
</xsl:for-each>
|
307 |
|
|
<xsl:for-each
|
308 |
|
|
select="./param[@name='lom/general/keyword/string']">
|
309 |
|
|
<xsl:value-of select="." />
|
310 |
|
|
<br />
|
311 |
|
|
</xsl:for-each>
|
312 |
|
|
|
313 |
|
|
</td>
|
314 |
|
|
|
315 |
|
|
</tr>
|
316 |
4379
|
leinfelder
|
|
317 |
|
|
<tr>
|
318 |
|
|
<td colspan="6">
|
319 |
|
|
<a>
|
320 |
|
|
<xsl:attribute name="href">#</xsl:attribute>
|
321 |
|
|
<xsl:attribute name="onClick">javascript:read('readForm', '<xsl:value-of select="./docid" />', '<xsl:value-of select="$divId" />')</xsl:attribute>
|
322 |
|
|
<xsl:text>View</xsl:text>
|
323 |
|
|
</a>
|
324 |
|
|
/
|
325 |
|
|
<a>
|
326 |
|
|
<xsl:attribute name="href">#</xsl:attribute>
|
327 |
|
|
<xsl:attribute name="onClick">javascript:hideDiv('<xsl:value-of select="$divId" />')</xsl:attribute>
|
328 |
|
|
<xsl:text>Hide</xsl:text>
|
329 |
|
|
</a>
|
330 |
|
|
|
331 |
|
|
<div>
|
332 |
|
|
<xsl:attribute name="id">
|
333 |
|
|
<xsl:value-of select="$divId" />
|
334 |
|
|
</xsl:attribute>
|
335 |
|
|
Assessment details...
|
336 |
|
|
</div>
|
337 |
|
|
</td>
|
338 |
|
|
</tr>
|
339 |
|
|
|
340 |
3531
|
leinfelder
|
<tr class="searchresultsdivider">
|
341 |
4289
|
leinfelder
|
<td colspan="6">
|
342 |
3531
|
leinfelder
|
<img
|
343 |
4289
|
leinfelder
|
src="{$contextURL}/style/skins/default/images/transparent1x1.gif"
|
344 |
3531
|
leinfelder
|
width="1" height="1" />
|
345 |
|
|
</td>
|
346 |
|
|
</tr>
|
347 |
|
|
|
348 |
|
|
</xsl:for-each>
|
349 |
3542
|
leinfelder
|
|
350 |
3531
|
leinfelder
|
</table>
|
351 |
3542
|
leinfelder
|
|
352 |
|
|
</form>
|
353 |
3531
|
leinfelder
|
|
354 |
|
|
</xsl:if>
|
355 |
|
|
</xsl:template>
|
356 |
|
|
|
357 |
|
|
</xsl:stylesheet>
|