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 |
|
|
<xsl:template match="/">
|
38 |
|
|
<script language="JavaScript">
|
39 |
|
|
<![CDATA[
|
40 |
3542
|
leinfelder
|
submitform = function(action,docid,form_ref) {
|
41 |
3531
|
leinfelder
|
form_ref.action.value=action;
|
42 |
3542
|
leinfelder
|
form_ref.docid.value=docid;
|
43 |
3531
|
leinfelder
|
form_ref.sessionid.value="]]><xsl:value-of select="$sessid" /><![CDATA[";
|
44 |
|
|
//form_ref.qformat.value="]]><xsl:value-of select="$qformat" /><![CDATA[";
|
45 |
|
|
form_ref.submit();
|
46 |
|
|
}
|
47 |
3542
|
leinfelder
|
setSelect = function(form_ref, checkBoxName, checked) {
|
48 |
|
|
var formElements = form_ref.elements;
|
49 |
|
|
for (var i=0; i<formElements.length; i++) {
|
50 |
|
|
var myElement = formElements[i];
|
51 |
|
|
if (myElement.name == checkBoxName) {
|
52 |
|
|
myElement.checked = checked;
|
53 |
|
|
}
|
54 |
|
|
}
|
55 |
|
|
}
|
56 |
3531
|
leinfelder
|
]]>
|
57 |
|
|
</script>
|
58 |
3542
|
leinfelder
|
<script type="text/javascript" language="Javascript">
|
59 |
|
|
<![CDATA[
|
60 |
3551
|
leinfelder
|
//reusable function to get the URL since I know this could change....
|
61 |
|
|
getResponseDataURL = function() {
|
62 |
3542
|
leinfelder
|
var styleURL = "/knb/style/skins/first";
|
63 |
|
|
styleURL += "/assessmentQuery.jsp";
|
64 |
3551
|
leinfelder
|
return styleURL;
|
65 |
|
|
}
|
66 |
|
|
getResponseData = function(docid, divId) {
|
67 |
|
|
var styleURL = getResponseDataURL();
|
68 |
3542
|
leinfelder
|
|
69 |
|
|
//alert("calling ajax: " + styleURL);
|
70 |
|
|
//alert("docid: " + docid);
|
71 |
|
|
|
72 |
|
|
var myUpdate = new Ajax.Updater(
|
73 |
|
|
divId,
|
74 |
|
|
styleURL,
|
75 |
|
|
{ method: 'post',
|
76 |
|
|
parameters: { docids: docid},
|
77 |
|
|
//parameters: $('responseDataSearch').serialize(true),
|
78 |
|
|
evalScripts: true,
|
79 |
|
|
//onSuccess: function(transport) {alert('success: ' + transport.status);},
|
80 |
|
|
onFailure: function(transport) {alert('failure making ajax call');}
|
81 |
|
|
});
|
82 |
|
|
|
83 |
|
|
Element.show(divId);
|
84 |
|
|
//alert("done calling response ajax");
|
85 |
|
|
}
|
86 |
|
|
getMergedResponseData = function(formId,divId) {
|
87 |
3551
|
leinfelder
|
if (!areItemsSelected('docids')) {
|
88 |
|
|
alert("Please select at least one dataset to view");
|
89 |
|
|
return false;
|
90 |
|
|
}
|
91 |
|
|
var styleURL = getResponseDataURL();
|
92 |
3542
|
leinfelder
|
|
93 |
|
|
//alert("calling ajax: " + styleURL);
|
94 |
|
|
//alert("docid: " + docid);
|
95 |
|
|
|
96 |
|
|
var myUpdate = new Ajax.Updater(
|
97 |
|
|
divId,
|
98 |
|
|
styleURL,
|
99 |
|
|
{ method: 'post',
|
100 |
|
|
//parameters: { docid: docid},
|
101 |
|
|
parameters: $(formId).serialize(true),
|
102 |
|
|
evalScripts: true,
|
103 |
|
|
//onSuccess: function(transport) {alert('success: ' + transport.status);},
|
104 |
|
|
onFailure: function(transport) {alert('failure making ajax call');}
|
105 |
|
|
});
|
106 |
|
|
|
107 |
|
|
Element.show(divId);
|
108 |
|
|
//alert("done calling response ajax");
|
109 |
|
|
}
|
110 |
3551
|
leinfelder
|
downloadMergedResponseData = function(formId) {
|
111 |
|
|
|
112 |
|
|
if (!areItemsSelected('docids')) {
|
113 |
|
|
alert("Please select at least one dataset to download");
|
114 |
|
|
return false;
|
115 |
|
|
}
|
116 |
|
|
|
117 |
|
|
var styleURL = getResponseDataURL();
|
118 |
|
|
|
119 |
|
|
var submitFormObj = document.getElementById(formId);
|
120 |
|
|
submitFormObj.qformat.value = 'csv';
|
121 |
|
|
submitFormObj.action = styleURL;
|
122 |
|
|
|
123 |
|
|
//alert("downloading response data from: " + submitFormObj.action);
|
124 |
|
|
//alert("format=" + submitFormObj.qformat.value);
|
125 |
|
|
|
126 |
|
|
submitFormObj.submit();
|
127 |
|
|
}
|
128 |
|
|
areItemsSelected = function(checkBoxName) {
|
129 |
|
|
var checkBoxes = document.getElementsByName(checkBoxName);
|
130 |
|
|
|
131 |
|
|
for (var i=0; i< checkBoxes.length; i++) {
|
132 |
|
|
if (checkBoxes[i].checked == true) {
|
133 |
|
|
return true;
|
134 |
|
|
}
|
135 |
|
|
}
|
136 |
|
|
//alert("please select a checkbox: " + checkBoxName);
|
137 |
|
|
return false;
|
138 |
|
|
|
139 |
|
|
}
|
140 |
3542
|
leinfelder
|
hideDiv = function(divId) {
|
141 |
|
|
Element.hide(divId);
|
142 |
|
|
}
|
143 |
|
|
]]>
|
144 |
|
|
</script>
|
145 |
3531
|
leinfelder
|
|
146 |
|
|
<p class="emphasis"><xsl:number value="count(resultset/document)" /> found</p>
|
147 |
|
|
|
148 |
|
|
<!-- This tests to see if there are returned documents,
|
149 |
|
|
if there are not then don't show the query results -->
|
150 |
|
|
|
151 |
|
|
<xsl:if test="count(resultset/document) > 0">
|
152 |
|
|
|
153 |
3542
|
leinfelder
|
<form action="/knb/metacat" method="POST" id="assessmentForm" name="assessmentForm">
|
154 |
|
|
<input type="hidden" name="qformat" value="first" />
|
155 |
|
|
<input type="hidden" name="sessionid" />
|
156 |
|
|
<input type="hidden" name="action" value="read" />
|
157 |
|
|
<input type="hidden" name="docid" />
|
158 |
|
|
|
159 |
|
|
<br/>
|
160 |
|
|
Select:
|
161 |
|
|
<a>
|
162 |
|
|
<xsl:attribute name="href">javascript:setSelect(document.assessmentForm, 'docids', true)</xsl:attribute>
|
163 |
|
|
<xsl:text>All</xsl:text>
|
164 |
|
|
</a>
|
165 |
|
|
/
|
166 |
|
|
<a>
|
167 |
|
|
<xsl:attribute name="href">javascript:setSelect(document.assessmentForm, 'docids', false)</xsl:attribute>
|
168 |
|
|
<xsl:text>None</xsl:text>
|
169 |
|
|
</a>
|
170 |
|
|
<br/>
|
171 |
3551
|
leinfelder
|
View:
|
172 |
3542
|
leinfelder
|
<a>
|
173 |
3551
|
leinfelder
|
<xsl:attribute name="href">#</xsl:attribute>
|
174 |
|
|
<xsl:attribute name="onClick">javascript:getMergedResponseData('assessmentForm','mergedResponseData')</xsl:attribute>
|
175 |
|
|
<xsl:text>Selected</xsl:text>
|
176 |
3542
|
leinfelder
|
</a>
|
177 |
|
|
/
|
178 |
|
|
<a>
|
179 |
|
|
<xsl:attribute name="href">javascript:hideDiv('mergedResponseData')</xsl:attribute>
|
180 |
|
|
<xsl:text>Hide</xsl:text>
|
181 |
|
|
</a>
|
182 |
|
|
<br/>
|
183 |
3551
|
leinfelder
|
Download Selected as:
|
184 |
|
|
<a>
|
185 |
|
|
<xsl:attribute name="href">#</xsl:attribute>
|
186 |
|
|
<xsl:attribute name="onClick">javascript:downloadMergedResponseData('assessmentForm')</xsl:attribute>
|
187 |
|
|
<xsl:text>Datafile (.csv)</xsl:text>
|
188 |
|
|
</a>
|
189 |
|
|
/
|
190 |
|
|
<a>
|
191 |
|
|
<xsl:attribute name="href">#doNothing</xsl:attribute>
|
192 |
|
|
<xsl:text>Metadata Package (.zip)</xsl:text>
|
193 |
|
|
</a>
|
194 |
|
|
<br/>
|
195 |
3542
|
leinfelder
|
<div id="mergedResponseData"/>
|
196 |
|
|
<br/>
|
197 |
|
|
|
198 |
3531
|
leinfelder
|
<table width="95%" align="left" border="0" cellpadding="0"
|
199 |
|
|
cellspacing="0">
|
200 |
|
|
<tr>
|
201 |
|
|
<th style="text-align: left">
|
202 |
|
|
Assessment Title
|
203 |
|
|
</th>
|
204 |
|
|
<th style="text-align: left">
|
205 |
|
|
Course Title
|
206 |
|
|
</th>
|
207 |
|
|
<th style="text-align: left">
|
208 |
|
|
Instructor[s]
|
209 |
|
|
</th>
|
210 |
|
|
<th style="text-align: left">
|
211 |
|
|
Organization[s]
|
212 |
|
|
</th>
|
213 |
|
|
<th style="text-align: left">
|
214 |
|
|
Keywords
|
215 |
|
|
</th>
|
216 |
|
|
</tr>
|
217 |
|
|
|
218 |
|
|
<xsl:for-each select="resultset/document">
|
219 |
|
|
<xsl:sort select="./param[@name='assessment/@assessmentId']" />
|
220 |
3542
|
leinfelder
|
<xsl:variable name="divId">
|
221 |
|
|
<xsl:text>ajaxDiv</xsl:text><xsl:value-of select="./docid" />
|
222 |
|
|
</xsl:variable>
|
223 |
3531
|
leinfelder
|
<tr valign="top" class="subpanel">
|
224 |
|
|
<xsl:attribute name="class">
|
225 |
3542
|
leinfelder
|
<xsl:choose>
|
226 |
|
|
<xsl:when test="position() mod 2 = 1">rowodd</xsl:when>
|
227 |
|
|
<xsl:when test="position() mod 2 = 0">roweven</xsl:when>
|
228 |
|
|
</xsl:choose>
|
229 |
|
|
</xsl:attribute>
|
230 |
3531
|
leinfelder
|
|
231 |
|
|
<td class="text_plain">
|
232 |
3542
|
leinfelder
|
<a>
|
233 |
|
|
<xsl:attribute name="href">javascript:submitform('read','<xsl:value-of select="./docid" />',document.assessmentForm)</xsl:attribute>
|
234 |
|
|
<xsl:text>» </xsl:text>
|
235 |
|
|
<xsl:value-of select="./param[@name='assessment/@assessmentTitle']" />
|
236 |
|
|
<!-- <xsl:value-of select="./param[@name='assessment/@assessmentId']" />) -->
|
237 |
|
|
</a>
|
238 |
|
|
(<xsl:value-of select="./docid" />)
|
239 |
|
|
<br />
|
240 |
|
|
Response Data...
|
241 |
|
|
<input type="checkbox" name="docids">
|
242 |
|
|
<xsl:attribute name="value">
|
243 |
|
|
<xsl:value-of select="./docid" />
|
244 |
|
|
</xsl:attribute>
|
245 |
|
|
</input>
|
246 |
|
|
<br/>
|
247 |
|
|
<a>
|
248 |
|
|
<xsl:attribute name="href">javascript:getResponseData('<xsl:value-of select="./docid" />', '<xsl:value-of select="$divId" />')</xsl:attribute>
|
249 |
|
|
<xsl:text>View</xsl:text>
|
250 |
|
|
</a>
|
251 |
|
|
/
|
252 |
|
|
<a>
|
253 |
|
|
<xsl:attribute name="href">javascript:hideDiv('<xsl:value-of select="$divId" />')</xsl:attribute>
|
254 |
|
|
<xsl:text>Hide</xsl:text>
|
255 |
|
|
</a>
|
256 |
|
|
<!--
|
257 |
|
|
/
|
258 |
|
|
<a>
|
259 |
|
|
<xsl:attribute name="href">javascript:getMergedResponseData('assessmentForm','mergedResponseData')</xsl:attribute>
|
260 |
|
|
<xsl:text>Merge Selected</xsl:text>
|
261 |
|
|
</a>
|
262 |
|
|
-->
|
263 |
|
|
<div>
|
264 |
|
|
<xsl:attribute name="id">
|
265 |
|
|
<xsl:value-of select="$divId" />
|
266 |
|
|
</xsl:attribute>
|
267 |
|
|
</div>
|
268 |
3531
|
leinfelder
|
</td>
|
269 |
|
|
|
270 |
|
|
<td class="text_plain">
|
271 |
|
|
<xsl:for-each
|
272 |
|
|
select="./param[@name='lom/general/title/string']">
|
273 |
|
|
<xsl:value-of select="." />
|
274 |
|
|
<br />
|
275 |
|
|
</xsl:for-each>
|
276 |
|
|
</td>
|
277 |
|
|
<td class="text_plain">
|
278 |
|
|
<xsl:for-each
|
279 |
|
|
select="./param[@name='individualName/surName']">
|
280 |
|
|
<xsl:value-of select="." />
|
281 |
|
|
<br />
|
282 |
|
|
</xsl:for-each>
|
283 |
|
|
</td>
|
284 |
|
|
<td class="text_plain">
|
285 |
|
|
<xsl:for-each
|
286 |
|
|
select="./param[@name='organizationName']">
|
287 |
|
|
<xsl:value-of select="." />
|
288 |
|
|
<br />
|
289 |
|
|
</xsl:for-each>
|
290 |
|
|
</td>
|
291 |
|
|
|
292 |
|
|
<td class="text_plain">
|
293 |
|
|
<xsl:for-each
|
294 |
|
|
select="./param[@name='keyword']">
|
295 |
|
|
<xsl:value-of select="." />
|
296 |
|
|
<br />
|
297 |
|
|
</xsl:for-each>
|
298 |
|
|
<xsl:for-each
|
299 |
|
|
select="./param[@name='lom/general/keyword/string']">
|
300 |
|
|
<xsl:value-of select="." />
|
301 |
|
|
<br />
|
302 |
|
|
</xsl:for-each>
|
303 |
|
|
|
304 |
|
|
</td>
|
305 |
|
|
|
306 |
|
|
</tr>
|
307 |
|
|
<tr class="searchresultsdivider">
|
308 |
|
|
<td colspan="5">
|
309 |
|
|
<img
|
310 |
|
|
src="/knb/style/skins/default/images/transparent1x1.gif"
|
311 |
|
|
width="1" height="1" />
|
312 |
|
|
</td>
|
313 |
|
|
</tr>
|
314 |
|
|
|
315 |
|
|
</xsl:for-each>
|
316 |
3542
|
leinfelder
|
|
317 |
3531
|
leinfelder
|
</table>
|
318 |
3542
|
leinfelder
|
|
319 |
|
|
</form>
|
320 |
|
|
|
321 |
3531
|
leinfelder
|
|
322 |
|
|
</xsl:if>
|
323 |
|
|
</xsl:template>
|
324 |
|
|
|
325 |
|
|
</xsl:stylesheet>
|