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
	<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
			getResponseData = function(docid, divId) {
61
				var styleURL = "/knb/style/skins/first";
62
				styleURL += "/assessmentQuery.jsp";
63
64
				//alert("calling ajax: " + styleURL);
65
				//alert("docid: " + docid);
66
67
				var myUpdate = new Ajax.Updater(
68
					divId,
69
					styleURL,
70
					{	method: 'post',
71
						parameters: { docids: docid},
72
						//parameters: $('responseDataSearch').serialize(true),
73
						evalScripts: true,
74
						//onSuccess: function(transport) {alert('success: ' + transport.status);},
75
						onFailure: function(transport) {alert('failure making ajax call');}
76
					 });
77
78
				Element.show(divId);
79
				//alert("done calling response ajax");
80
			}
81
			getMergedResponseData = function(formId,divId) {
82
				var styleURL = "/knb/style/skins/first";
83
				styleURL += "/assessmentQuery.jsp";
84
85
				//alert("calling ajax: " + styleURL);
86
				//alert("docid: " + docid);
87
88
				var myUpdate = new Ajax.Updater(
89
					divId,
90
					styleURL,
91
					{	method: 'post',
92
						//parameters: { docid: docid},
93
						parameters: $(formId).serialize(true),
94
						evalScripts: true,
95
						//onSuccess: function(transport) {alert('success: ' + transport.status);},
96
						onFailure: function(transport) {alert('failure making ajax call');}
97
					 });
98
99
				Element.show(divId);
100
				//alert("done calling response ajax");
101
			}
102
			hideDiv = function(divId) {
103
				Element.hide(divId);
104
			}
105
		 ]]>
106
		</script>
107 3531 leinfelder
108
		<p class="emphasis"><xsl:number value="count(resultset/document)" /> found</p>
109
110
		<!-- This tests to see if there are returned documents,
111
            if there are not then don't show the query results -->
112
113
		<xsl:if test="count(resultset/document) &gt; 0">
114
115 3542 leinfelder
			<form action="/knb/metacat" method="POST" id="assessmentForm" name="assessmentForm">
116
				<input type="hidden" name="qformat" value="first" />
117
				<input type="hidden" name="sessionid" />
118
				<input type="hidden" name="action" value="read" />
119
				<input type="hidden" name="docid" />
120
121
				<br/>
122
				Select:
123
				<a>
124
					<xsl:attribute name="href">javascript:setSelect(document.assessmentForm, 'docids', true)</xsl:attribute>
125
					<xsl:text>All</xsl:text>
126
				</a>
127
				/
128
				<a>
129
					<xsl:attribute name="href">javascript:setSelect(document.assessmentForm, 'docids', false)</xsl:attribute>
130
					<xsl:text>None</xsl:text>
131
				</a>
132
				<br/>
133
				Actions:
134
				<a>
135
					<xsl:attribute name="href">javascript:getMergedResponseData('assessmentForm','mergedResponseData')</xsl:attribute>
136
					<xsl:text>Merge Selected</xsl:text>
137
				</a>
138
				/
139
				<a>
140
					<xsl:attribute name="href">javascript:hideDiv('mergedResponseData')</xsl:attribute>
141
					<xsl:text>Hide</xsl:text>
142
				</a>
143
				<br/>
144
				<div id="mergedResponseData"/>
145
				<br/>
146
147 3531 leinfelder
			<table width="95%" align="left" border="0" cellpadding="0"
148
				cellspacing="0">
149
				<tr>
150
					<th style="text-align: left">
151
						Assessment Title
152
					</th>
153
					<th style="text-align: left">
154
						Course Title
155
					</th>
156
					<th	style="text-align: left">
157
						Instructor[s]
158
					</th>
159
					<th	style="text-align: left">
160
						Organization[s]
161
					</th>
162
					<th	style="text-align: left">
163
						Keywords
164
					</th>
165
				</tr>
166
167
				<xsl:for-each select="resultset/document">
168
					<xsl:sort select="./param[@name='assessment/@assessmentId']" />
169 3542 leinfelder
					<xsl:variable name="divId">
170
						<xsl:text>ajaxDiv</xsl:text><xsl:value-of select="./docid" />
171
					</xsl:variable>
172 3531 leinfelder
					<tr valign="top" class="subpanel">
173
						<xsl:attribute name="class">
174 3542 leinfelder
			               <xsl:choose>
175
			                 <xsl:when test="position() mod 2 = 1">rowodd</xsl:when>
176
			                 <xsl:when test="position() mod 2 = 0">roweven</xsl:when>
177
			               </xsl:choose>
178
			             </xsl:attribute>
179 3531 leinfelder
180
						<td class="text_plain">
181 3542 leinfelder
							<a>
182
								<xsl:attribute name="href">javascript:submitform('read','<xsl:value-of select="./docid" />',document.assessmentForm)</xsl:attribute>
183
								<xsl:text>&#187;&#160;</xsl:text>
184
								<xsl:value-of select="./param[@name='assessment/@assessmentTitle']" />
185
								<!-- <xsl:value-of select="./param[@name='assessment/@assessmentId']" />) -->
186
							</a>
187
							(<xsl:value-of select="./docid" />)
188
							<br />
189
							Response Data...
190
							<input type="checkbox" name="docids">
191
								<xsl:attribute name="value">
192
									<xsl:value-of select="./docid" />
193
								</xsl:attribute>
194
							</input>
195
							<br/>
196
							<a>
197
								<xsl:attribute name="href">javascript:getResponseData('<xsl:value-of select="./docid" />', '<xsl:value-of select="$divId" />')</xsl:attribute>
198
								<xsl:text>View</xsl:text>
199
							</a>
200
							/
201
							<a>
202
								<xsl:attribute name="href">javascript:hideDiv('<xsl:value-of select="$divId" />')</xsl:attribute>
203
								<xsl:text>Hide</xsl:text>
204
							</a>
205
							<!--
206
							/
207
							<a>
208
								<xsl:attribute name="href">javascript:getMergedResponseData('assessmentForm','mergedResponseData')</xsl:attribute>
209
								<xsl:text>Merge Selected</xsl:text>
210
							</a>
211
							 -->
212
							<div>
213
								<xsl:attribute name="id">
214
									<xsl:value-of select="$divId" />
215
								</xsl:attribute>
216
							</div>
217 3531 leinfelder
						</td>
218
219
						<td class="text_plain">
220
							<xsl:for-each
221
								select="./param[@name='lom/general/title/string']">
222
								<xsl:value-of select="." />
223
								<br />
224
							</xsl:for-each>
225
						</td>
226
						<td class="text_plain">
227
							<xsl:for-each
228
								select="./param[@name='individualName/surName']">
229
								<xsl:value-of select="." />
230
								<br />
231
							</xsl:for-each>
232
						</td>
233
						<td class="text_plain">
234
							<xsl:for-each
235
								select="./param[@name='organizationName']">
236
								<xsl:value-of select="." />
237
								<br />
238
							</xsl:for-each>
239
						</td>
240
241
						<td class="text_plain">
242
							<xsl:for-each
243
								select="./param[@name='keyword']">
244
								<xsl:value-of select="." />
245
								<br />
246
							</xsl:for-each>
247
							<xsl:for-each
248
								select="./param[@name='lom/general/keyword/string']">
249
								<xsl:value-of select="." />
250
								<br />
251
							</xsl:for-each>
252
253
						</td>
254
255
					</tr>
256
					<tr class="searchresultsdivider">
257
						<td colspan="5">
258
							<img
259
								src="/knb/style/skins/default/images/transparent1x1.gif"
260
								width="1" height="1" />
261
						</td>
262
					</tr>
263
264
				</xsl:for-each>
265 3542 leinfelder
266 3531 leinfelder
			</table>
267 3542 leinfelder
268
			</form>
269
270 3531 leinfelder
271
		</xsl:if>
272
	</xsl:template>
273
274
</xsl:stylesheet>