Project

General

Profile

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: 2008-08-22 15:59:06 -0700 (Fri, 22 Aug 2008) $'
11
* '$Revision: 4290 $'
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.submit();
47
          }
48
          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
          ]]>
58
        </script>
59
        <script type="text/javascript" language="Javascript">
60
			<![CDATA[
61
			downloadMergedResponseData = function(formId) {
62
			
63
				if (!areItemsSelected('docids')) {
64
					alert("Please select at least one dataset for download");
65
					return false;
66
				}
67
								
68
				//transfer the assessmentItemId to this form
69
				//document.getElementById("questionId").value = document.getElementById("assessmentItemId").value;
70
				//alert("questionId: " + document.getElementById("questionId").value);
71
				
72
				var submitFormObj = document.getElementById(formId);
73
				submitFormObj.qformat.value = 'csv';
74
				submitFormObj.action.value = 'dataquery';
75
				
76
				multipleAssessmentSearch(submitFormObj);
77
				
78
				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
			hideDiv = function(divId) {
93
				Element.hide(divId);
94
			}
95
		 ]]>	
96
		</script>
97
        
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
			<form action="{$contextURL}/metacat" method="POST" id="assessmentForm" name="assessmentForm" >
106
				<input type="hidden" name="qformat" value="first" />
107
				<input type="hidden" name="sessionid">
108
					<xsl:attribute name="value">
109
						<xsl:value-of select="$sessid" />						
110
					</xsl:attribute>
111
				</input>
112
				<input type="hidden" name="action" value="read" />
113
				<input type="hidden" name="dataquery" />
114
				<input type="hidden" name="docid" />
115
				<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
				
122
				<br/>
123
				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
				<div id="mergedResponseData"/>
131
				<br/>
132
				
133
			<table width="95%" align="left" border="0" cellpadding="0"
134
				cellspacing="0">
135
				<tr>
136
					<th style="text-align: left">
137
						<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
						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
					<xsl:sort select="./param[@name='assessment/@id']" />
160
					<xsl:variable name="divId">
161
						<xsl:text>ajaxDiv</xsl:text><xsl:value-of select="./docid" />
162
					</xsl:variable>
163
					<tr valign="top" class="subpanel">
164
						<xsl:attribute name="class">
165
			               <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

    
171
						<td class="text_plain">
172
							<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
							<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
								<xsl:value-of select="./param[@name='assessment/@title']" />
184
							</a>
185
							(<xsl:value-of select="./docid" />)
186
							
187
							<br />
188
							
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
							<br/>
202
							
203
							<div>
204
								<xsl:attribute name="id">
205
									<xsl:value-of select="$divId" />
206
								</xsl:attribute>
207
							</div>							
208
						</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
						<td colspan="6">
249
							<img
250
								src="{$contextURL}/style/skins/default/images/transparent1x1.gif"
251
								width="1" height="1" />
252
						</td>
253
					</tr>
254

    
255
				</xsl:for-each>
256
				
257
			</table>
258
			
259
			</form>
260

    
261
		</xsl:if>
262
	</xsl:template>
263

    
264
</xsl:stylesheet>
(2-2/11)