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 |
|
|
evalScripts: true,
|
98 |
|
|
onFailure: function(transport) {alert('failure making ajax call');}
|
99 |
|
|
});
|
100 |
|
|
|
101 |
|
|
}
|
102 |
3551
|
leinfelder
|
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 |
3542
|
leinfelder
|
hideDiv = function(divId) {
|
115 |
|
|
Element.hide(divId);
|
116 |
|
|
}
|
117 |
|
|
]]>
|
118 |
|
|
</script>
|
119 |
3531
|
leinfelder
|
|
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 |
4365
|
leinfelder
|
|
127 |
|
|
Download Selected as:
|
128 |
|
|
<a>
|
129 |
|
|
<xsl:attribute name="href">#</xsl:attribute>
|
130 |
|
|
<xsl:attribute name="onClick">javascript:downloadMergedResponseData('assessmentForm')</xsl:attribute>
|
131 |
|
|
<xsl:text>Datafile (.csv)</xsl:text>
|
132 |
|
|
</a>
|
133 |
|
|
<br/>
|
134 |
|
|
Edit Cart:
|
135 |
|
|
<a>
|
136 |
|
|
<xsl:attribute name="href">#</xsl:attribute>
|
137 |
|
|
<xsl:attribute name="onClick">javascript:editCart('assessmentForm', 'add')</xsl:attribute>
|
138 |
|
|
<xsl:text>Add Selected</xsl:text>
|
139 |
|
|
</a>
|
140 |
|
|
/
|
141 |
|
|
<a>
|
142 |
|
|
<xsl:attribute name="href">#</xsl:attribute>
|
143 |
|
|
<xsl:attribute name="onClick">javascript:editCart('assessmentForm', 'remove')</xsl:attribute>
|
144 |
|
|
<xsl:text>Remove Selected</xsl:text>
|
145 |
|
|
</a>
|
146 |
|
|
|
147 |
|
|
<br/>
|
148 |
|
|
|
149 |
4361
|
leinfelder
|
<!-- for reading the assessment details -->
|
150 |
|
|
<form action="{$contextURL}/metacat" method="POST" id="readForm" name="readForm" >
|
151 |
|
|
<input type="hidden" name="qformat" value="first" />
|
152 |
|
|
<input type="hidden" name="sessionid">
|
153 |
|
|
<xsl:attribute name="value">
|
154 |
|
|
<xsl:value-of select="$sessid" />
|
155 |
|
|
</xsl:attribute>
|
156 |
|
|
</input>
|
157 |
|
|
<input type="hidden" name="action" value="read" />
|
158 |
|
|
<input type="hidden" name="docid" />
|
159 |
|
|
</form>
|
160 |
|
|
|
161 |
|
|
<!-- for managing the ajax actions -->
|
162 |
4289
|
leinfelder
|
<form action="{$contextURL}/metacat" method="POST" id="assessmentForm" name="assessmentForm" >
|
163 |
3542
|
leinfelder
|
<input type="hidden" name="qformat" value="first" />
|
164 |
4289
|
leinfelder
|
<input type="hidden" name="sessionid">
|
165 |
|
|
<xsl:attribute name="value">
|
166 |
|
|
<xsl:value-of select="$sessid" />
|
167 |
|
|
</xsl:attribute>
|
168 |
|
|
</input>
|
169 |
3542
|
leinfelder
|
<input type="hidden" name="action" value="read" />
|
170 |
4289
|
leinfelder
|
<input type="hidden" name="dataquery" />
|
171 |
4361
|
leinfelder
|
<input type="hidden" name="operation" />
|
172 |
3669
|
leinfelder
|
<xsl:element name="input">
|
173 |
|
|
<xsl:attribute name="type">hidden</xsl:attribute>
|
174 |
|
|
<xsl:attribute name="id">questionId</xsl:attribute>
|
175 |
|
|
<xsl:attribute name="name">questionId</xsl:attribute>
|
176 |
|
|
<xsl:attribute name="value"></xsl:attribute>
|
177 |
|
|
</xsl:element>
|
178 |
3542
|
leinfelder
|
|
179 |
3531
|
leinfelder
|
<table width="95%" align="left" border="0" cellpadding="0"
|
180 |
|
|
cellspacing="0">
|
181 |
|
|
<tr>
|
182 |
|
|
<th style="text-align: left">
|
183 |
4289
|
leinfelder
|
<input type="checkbox">
|
184 |
4361
|
leinfelder
|
<xsl:attribute name="onclick">setSelect(document.assessmentForm, 'docid', this.checked)</xsl:attribute>
|
185 |
4289
|
leinfelder
|
</input>
|
186 |
|
|
</th>
|
187 |
|
|
<th style="text-align: left">
|
188 |
3531
|
leinfelder
|
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 |
3918
|
leinfelder
|
<xsl:sort select="./param[@name='assessment/@id']" />
|
206 |
3542
|
leinfelder
|
<xsl:variable name="divId">
|
207 |
|
|
<xsl:text>ajaxDiv</xsl:text><xsl:value-of select="./docid" />
|
208 |
|
|
</xsl:variable>
|
209 |
3531
|
leinfelder
|
<tr valign="top" class="subpanel">
|
210 |
|
|
<xsl:attribute name="class">
|
211 |
3542
|
leinfelder
|
<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 |
3531
|
leinfelder
|
|
217 |
|
|
<td class="text_plain">
|
218 |
4361
|
leinfelder
|
<input type="checkbox" name="docid">
|
219 |
4289
|
leinfelder
|
<xsl:attribute name="value">
|
220 |
|
|
<xsl:value-of select="./docid" />
|
221 |
|
|
</xsl:attribute>
|
222 |
|
|
</input>
|
223 |
|
|
</td>
|
224 |
|
|
<td>
|
225 |
|
|
|
226 |
3542
|
leinfelder
|
<a>
|
227 |
4361
|
leinfelder
|
<xsl:attribute name="href">javascript:submitform('read','<xsl:value-of select="./docid" />',document.readForm)</xsl:attribute>
|
228 |
3542
|
leinfelder
|
<xsl:text>» </xsl:text>
|
229 |
3918
|
leinfelder
|
<xsl:value-of select="./param[@name='assessment/@title']" />
|
230 |
3542
|
leinfelder
|
</a>
|
231 |
|
|
(<xsl:value-of select="./docid" />)
|
232 |
4289
|
leinfelder
|
|
233 |
3542
|
leinfelder
|
<br />
|
234 |
4289
|
leinfelder
|
|
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 |
3542
|
leinfelder
|
<br/>
|
248 |
4289
|
leinfelder
|
|
249 |
3542
|
leinfelder
|
<div>
|
250 |
|
|
<xsl:attribute name="id">
|
251 |
|
|
<xsl:value-of select="$divId" />
|
252 |
|
|
</xsl:attribute>
|
253 |
|
|
</div>
|
254 |
3531
|
leinfelder
|
</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 |
4289
|
leinfelder
|
<td colspan="6">
|
295 |
3531
|
leinfelder
|
<img
|
296 |
4289
|
leinfelder
|
src="{$contextURL}/style/skins/default/images/transparent1x1.gif"
|
297 |
3531
|
leinfelder
|
width="1" height="1" />
|
298 |
|
|
</td>
|
299 |
|
|
</tr>
|
300 |
|
|
|
301 |
|
|
</xsl:for-each>
|
302 |
3542
|
leinfelder
|
|
303 |
3531
|
leinfelder
|
</table>
|
304 |
3542
|
leinfelder
|
|
305 |
|
|
</form>
|
306 |
3531
|
leinfelder
|
|
307 |
|
|
</xsl:if>
|
308 |
|
|
</xsl:template>
|
309 |
|
|
|
310 |
|
|
</xsl:stylesheet>
|