Project

General

Profile

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
				if (!areItemsSelected('docids')) {
64 4289 leinfelder
					alert("Please select at least one dataset for download");
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
			areItemsSelected = function(checkBoxName) {
81
				var checkBoxes = document.getElementsByName(checkBoxName);
82
83
				for (var i=0; i< checkBoxes.length; i++) {
84
					if (checkBoxes[i].checked == true) {
85
						return true;
86
					}
87
				}
88
				//alert("please select a checkbox: " + checkBoxName);
89
				return false;
90
91
			}
92 3542 leinfelder
			hideDiv = function(divId) {
93
				Element.hide(divId);
94
			}
95
		 ]]>
96
		</script>
97 3531 leinfelder
98
		<p class="emphasis"><xsl:number value="count(resultset/document)" /> found</p>
99
100
		<!-- This tests to see if there are returned documents,
101
            if there are not then don't show the query results -->
102
103
		<xsl:if test="count(resultset/document) &gt; 0">
104
105 4289 leinfelder
			<form action="{$contextURL}/metacat" method="POST" id="assessmentForm" name="assessmentForm" >
106 3542 leinfelder
				<input type="hidden" name="qformat" value="first" />
107 4289 leinfelder
				<input type="hidden" name="sessionid">
108
					<xsl:attribute name="value">
109
						<xsl:value-of select="$sessid" />
110
					</xsl:attribute>
111
				</input>
112 3542 leinfelder
				<input type="hidden" name="action" value="read" />
113 4289 leinfelder
				<input type="hidden" name="dataquery" />
114 3542 leinfelder
				<input type="hidden" name="docid" />
115 3669 leinfelder
				<xsl:element name="input">
116
					<xsl:attribute name="type">hidden</xsl:attribute>
117
					<xsl:attribute name="id">questionId</xsl:attribute>
118
					<xsl:attribute name="name">questionId</xsl:attribute>
119
					<xsl:attribute name="value"></xsl:attribute>
120
				</xsl:element>
121 3542 leinfelder
122
				<br/>
123 3551 leinfelder
				Download Selected as:
124
				<a>
125
					<xsl:attribute name="href">#</xsl:attribute>
126
					<xsl:attribute name="onClick">javascript:downloadMergedResponseData('assessmentForm')</xsl:attribute>
127
					<xsl:text>Datafile (.csv)</xsl:text>
128
				</a>
129
				<br/>
130 3542 leinfelder
				<div id="mergedResponseData"/>
131
				<br/>
132
133 3531 leinfelder
			<table width="95%" align="left" border="0" cellpadding="0"
134
				cellspacing="0">
135
				<tr>
136
					<th style="text-align: left">
137 4289 leinfelder
						<input type="checkbox">
138
							<xsl:attribute name="onclick">setSelect(document.assessmentForm, 'docids', this.checked)</xsl:attribute>
139
						</input>
140
					</th>
141
					<th style="text-align: left">
142 3531 leinfelder
						Assessment Title
143
					</th>
144
					<th style="text-align: left">
145
						Course Title
146
					</th>
147
					<th	style="text-align: left">
148
						Instructor[s]
149
					</th>
150
					<th	style="text-align: left">
151
						Organization[s]
152
					</th>
153
					<th	style="text-align: left">
154
						Keywords
155
					</th>
156
				</tr>
157
158
				<xsl:for-each select="resultset/document">
159 3918 leinfelder
					<xsl:sort select="./param[@name='assessment/@id']" />
160 3542 leinfelder
					<xsl:variable name="divId">
161
						<xsl:text>ajaxDiv</xsl:text><xsl:value-of select="./docid" />
162
					</xsl:variable>
163 3531 leinfelder
					<tr valign="top" class="subpanel">
164
						<xsl:attribute name="class">
165 3542 leinfelder
			               <xsl:choose>
166
			                 <xsl:when test="position() mod 2 = 1">rowodd</xsl:when>
167
			                 <xsl:when test="position() mod 2 = 0">roweven</xsl:when>
168
			               </xsl:choose>
169
			             </xsl:attribute>
170 3531 leinfelder
171
						<td class="text_plain">
172 4289 leinfelder
							<input type="checkbox" name="docids">
173
								<xsl:attribute name="value">
174
									<xsl:value-of select="./docid" />
175
								</xsl:attribute>
176
							</input>
177
						</td>
178
						<td>
179
180 3542 leinfelder
							<a>
181
								<xsl:attribute name="href">javascript:submitform('read','<xsl:value-of select="./docid" />',document.assessmentForm)</xsl:attribute>
182
								<xsl:text>&#187;&#160;</xsl:text>
183 3918 leinfelder
								<xsl:value-of select="./param[@name='assessment/@title']" />
184 3542 leinfelder
							</a>
185
							(<xsl:value-of select="./docid" />)
186 4289 leinfelder
187 3542 leinfelder
							<br />
188 4289 leinfelder
189
							<!--include question ids here -->
190
							<xsl:for-each select="./param[@name='assessmentItems/assessmentItem/assessmentItemId']" >
191
								<input type="hidden">
192
									<xsl:attribute name="name">
193
										<xsl:value-of select="../docid" />
194
									</xsl:attribute>
195
									<xsl:attribute name="value">
196
										<xsl:value-of select="." />
197
									</xsl:attribute>
198
								</input>
199
							</xsl:for-each>
200
201 3542 leinfelder
							<br/>
202 4289 leinfelder
203 3542 leinfelder
							<div>
204
								<xsl:attribute name="id">
205
									<xsl:value-of select="$divId" />
206
								</xsl:attribute>
207
							</div>
208 3531 leinfelder
						</td>
209
210
						<td class="text_plain">
211
							<xsl:for-each
212
								select="./param[@name='lom/general/title/string']">
213
								<xsl:value-of select="." />
214
								<br />
215
							</xsl:for-each>
216
						</td>
217
						<td class="text_plain">
218
							<xsl:for-each
219
								select="./param[@name='individualName/surName']">
220
								<xsl:value-of select="." />
221
								<br />
222
							</xsl:for-each>
223
						</td>
224
						<td class="text_plain">
225
							<xsl:for-each
226
								select="./param[@name='organizationName']">
227
								<xsl:value-of select="." />
228
								<br />
229
							</xsl:for-each>
230
						</td>
231
232
						<td class="text_plain">
233
							<xsl:for-each
234
								select="./param[@name='keyword']">
235
								<xsl:value-of select="." />
236
								<br />
237
							</xsl:for-each>
238
							<xsl:for-each
239
								select="./param[@name='lom/general/keyword/string']">
240
								<xsl:value-of select="." />
241
								<br />
242
							</xsl:for-each>
243
244
						</td>
245
246
					</tr>
247
					<tr class="searchresultsdivider">
248 4289 leinfelder
						<td colspan="6">
249 3531 leinfelder
							<img
250 4289 leinfelder
								src="{$contextURL}/style/skins/default/images/transparent1x1.gif"
251 3531 leinfelder
								width="1" height="1" />
252
						</td>
253
					</tr>
254
255
				</xsl:for-each>
256 3542 leinfelder
257 3531 leinfelder
			</table>
258 3542 leinfelder
259
			</form>
260 3531 leinfelder
261
		</xsl:if>
262
	</xsl:template>
263
264
</xsl:stylesheet>