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: 2007-10-31 18:57:22 -0700 (Wed, 31 Oct 2007) $'
11
	* '$Revision: 3550 $'
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"
32
	version="1.0">
33

    
34
	<xsl:output method="html" />
35
	<xsl:param name="sessid" />
36
	<xsl:param name="qformat">default</xsl:param>
37
	<xsl:param name="enableediting">false</xsl:param>
38
	<xsl:template match="/">
39
		<html>
40
			<head>
41
				<title>Search Results</title>
42
				<link rel="stylesheet" type="text/css"
43
					href="/knb/style/skins/{$qformat}/{$qformat}.css" />
44
				<script language="Javascript" type="text/JavaScript"
45
					src="/knb/style/skins/{$qformat}/{$qformat}.js" />
46
				<script language="Javascript" type="text/JavaScript"
47
					src="/knb/style/common/branding.js" />
48
				<script language="JavaScript">
49
					<![CDATA[
50
					function submitform(action,form_ref) {
51
						form_ref.action.value=action;
52
						form_ref.sessionid.value="]]><xsl:value-of select="$sessid" /><![CDATA[";
53
						form_ref.qformat.value="]]><xsl:value-of select="$qformat" /><![CDATA[";
54
						form_ref.submit();
55
					}
56
					]]>
57
				</script>
58
			</head>
59

    
60
			<body leftmargin="0" topmargin="0" marginwidth="0"
61
				marginheight="0">
62
				<script language="JavaScript">
63
					insertTemplateOpening(); insertSearchBox();
64
				</script>
65

    
66
				<table style="width:100%;" align="center" border="0"
67
					cellpadding="5" cellspacing="0">
68
					<tr>
69
						<td align="left">
70
							<br />
71
							<p class="emphasis">
72
								<xsl:number
73
									value="count(resultset/document)" />
74
								total records found
75
							</p>
76
						</td>
77
					</tr>
78
				</table>
79

    
80
				<table align="center" border="0"
81
					cellpadding="0" cellspacing="0" style="width:98%;">
82
					<tr valign="top">
83
						<!-- ASSESSMENTS HERE  -->
84
						<xsl:if test="count(resultset/document[docname='edml']) &gt; 0">
85
							<td>
86
								<xsl:call-template name="assessmentResults"/>
87
							</td>	
88
						</xsl:if>
89
						
90
						<!-- QUESTIONS HERE  -->
91
						<xsl:if test="count(resultset/document[docname!='edml']) &gt; 0">
92
							<td>
93
								<xsl:call-template name="questionResults"/>
94
							</td>	
95
						</xsl:if>
96
					</tr>	
97
				</table>
98
				
99
				<script language="JavaScript">
100
					insertTemplateClosing();
101
				</script>
102
			</body>
103
		</html>
104
	</xsl:template>
105
	
106
	<xsl:template name="assessmentResults">
107
		<table style="width:95%;" align="center" border="0"
108
			cellpadding="0" cellspacing="0">
109
			<tr>
110
				<th class="tablehead" colspan="5">
111
					Assessments
112
				</th>
113
			</tr>	
114
			<tr>
115
				<th	style="text-align: left">
116
					Assessment
117
				</th>
118
				<th	style="text-align: left">
119
					Course
120
				</th>
121
				<th	style="text-align: left">
122
					Instructor[s]
123
				</th>
124
				<th	style="text-align: left">
125
					Organization[s]
126
				</th>
127
				<th	style="text-align: left">
128
					Keywords
129
				</th>
130
			</tr>
131
	
132
			<xsl:for-each
133
				select="resultset/document[docname='edml']">
134
				<xsl:sort
135
					select="./param[@name='dataset/title']" />
136
				<tr valign="top" class="subpanel">
137
					<xsl:attribute name="class">
138
	              			<xsl:choose>
139
						    <xsl:when test="position() mod 2 = 1">rowodd</xsl:when>
140
						    <xsl:when test="position() mod 2 = 0">roweven</xsl:when>
141
						</xsl:choose>
142
					</xsl:attribute>
143
	
144
					<td class="text_plain">
145
						<form action="/knb/metacat"
146
							method="POST">
147
							<xsl:attribute name="name">
148
								<xsl:value-of select="translate(./docid, '()-.', '____')" />
149
							</xsl:attribute>
150
	
151
							<input type="hidden"
152
								name="qformat" />
153
							<input type="hidden"
154
								name="sessionid" />
155
							<input type="hidden"
156
								name="action" value="read" />
157
							<input type="hidden"
158
								name="docid">
159
								<xsl:attribute name="value">
160
									<xsl:value-of select="./docid" />
161
								</xsl:attribute>
162
							</input>
163
							<xsl:for-each
164
								select="./relation">
165
								<input type="hidden"
166
									name="docid">
167
									<xsl:attribute name="value">
168
										<xsl:value-of select="./relationdoc" />
169
									</xsl:attribute>
170
								</input>
171
							</xsl:for-each>
172
	
173
							<a>
174
								<xsl:attribute name="href">javascript:submitform('read',document.<xsl:value-of	select="translate(./docid, '()-.', '____')" />)</xsl:attribute>
175
								<xsl:text>&#187;&#160;</xsl:text>
176
								<xsl:value-of select="./param[@name='assessment/@assessmentTitle']"/>
177
							</a>
178
							<br />
179
							<br />
180
							<p>
181
								<pre>ID: <xsl:value-of select="./docid" /></pre>
182
							</p>
183
	
184
						</form>
185
					</td>
186
	
187
					<td class="text_plain">
188
						<xsl:value-of
189
							select="./param[@name='lom/general/title/string']" />
190
						<xsl:value-of
191
							select="./param[@name='lom/general/description/string']" />
192
					</td>
193
					<td class="text_plain">
194
						<xsl:for-each
195
							select="./param[@name='individualName/surName']">
196
							<xsl:value-of select="." />
197
							<br />
198
						</xsl:for-each>
199
					</td>
200
					<td class="text_plain">
201
						<xsl:for-each
202
							select="./param[@name='organizationName']">
203
							<xsl:value-of select="." />
204
							<br />
205
						</xsl:for-each>
206
					</td>
207
	
208
					<td class="text_plain">
209
						<xsl:for-each
210
							select="./param[@name='keyword']">
211
							<xsl:value-of select="." />
212
							<br />
213
						</xsl:for-each>
214
						<xsl:for-each
215
							select="./param[@name='lom/general/keyword/string']">
216
							<xsl:value-of select="." />
217
							<br />
218
						</xsl:for-each>
219
	
220
					</td>
221
	
222
				</tr>
223
				<tr class="searchresultsdivider">
224
					<td colspan="5">
225
						<img
226
							src="/knb/style/skins/default/images/transparent1x1.gif"
227
							width="1" height="1" />
228
					</td>
229
				</tr>
230
	
231
			</xsl:for-each>
232
		</table>
233
	</xsl:template>
234
	
235
	<xsl:template name="questionResults">
236
		<table style="width:95%;" align="left" border="0" cellpadding="0"
237
			cellspacing="0">
238
			
239
			<tr>
240
				<th class="tablehead" colspan="3">
241
					Questions
242
				</th>
243
			</tr>	
244
			<tr>
245
				<th	style="text-align: left">
246
					Identifier
247
				</th>
248
				<th	style="text-align: left">
249
					Content
250
				</th>
251
				<th	style="text-align: left">
252
					Metadata/Keywords
253
				</th>
254
			</tr>
255

    
256
			<xsl:for-each select="resultset/document[docname!='edml']">
257
				<xsl:sort select="./param[@name='item/@title']" />
258
				<tr valign="top">
259
					<xsl:attribute name="class">
260
						<xsl:choose>
261
							<xsl:when test="position() mod 2 = 1">rowodd</xsl:when>
262
							<xsl:when test="position() mod 2 = 0">roweven</xsl:when>
263
						</xsl:choose>
264
					</xsl:attribute>
265

    
266
					<td class="text_plain">
267
						<a>
268
							<xsl:attribute name="href">javascript:submitform('read',document.<xsl:value-of select="translate(./docid, '()-.', '____')" />)</xsl:attribute>
269
							<xsl:text>&#187;&#160;</xsl:text>
270
							<xsl:value-of select="./param[@name='item/@title']" />
271
							<!-- <xsl:value-of select="./param[@name='item/@ident']" />-->
272
						</a>
273
						(<xsl:value-of select="./docid" />)
274
						<form action="/knb/metacat" method="POST">
275
							<xsl:attribute name="name">
276
								<xsl:value-of select="translate(./docid, '()-.', '____')" />
277
							</xsl:attribute>
278

    
279
							<input type="hidden" name="qformat" value="first"/>
280
							<input type="hidden" name="sessionid" />
281
							<xsl:if	test="$enableediting = 'true'">
282
								<input type="hidden"
283
									name="enableediting" value="{$enableediting}" />
284
							</xsl:if>
285
							<input type="hidden" name="action" value="read" />
286
							<input type="hidden" name="docid">
287
								<xsl:attribute name="value">
288
									<xsl:value-of select="./docid" />
289
								</xsl:attribute>
290
							</input>
291
							<xsl:for-each select="./relation">
292
								<input type="hidden" name="docid">
293
									<xsl:attribute name="value">
294
										<xsl:value-of select="./relationdoc" />
295
									</xsl:attribute>
296
								</input>
297
							</xsl:for-each>
298
						</form>	
299
					</td>
300
					
301
					<td class="text_plain">
302
						<xsl:value-of select="./param[@name='presentation/flow/material/mattext']"/>
303
						
304
						<ul>
305
						<xsl:for-each
306
							select="./param[@name='response_label/flow_mat/material/mattext']">
307
							<li>
308
								<xsl:value-of select="." />
309
							</li>	
310
						</xsl:for-each>
311
						</ul>
312
					</td>
313
					
314
					<td>
315
						<table>
316
							<tr>
317
								<td class="text_plain" colspan="2">
318
									Metadata:
319
								</td>
320
							</tr>
321
							<tr>
322
								<td class="text_plain">
323
									<xsl:for-each
324
										select="./param[@name='fieldlabel']">
325
										<xsl:value-of select="." />
326
										<br />
327
									</xsl:for-each>
328
								</td>
329
								
330
								<td class="text_plain">
331
									<xsl:for-each
332
										select="./param[@name='fieldentry']">
333
										<xsl:value-of select="." />
334
										<br />
335
									</xsl:for-each>
336
								</td>
337
							</tr>
338
						</table>
339
					</td>
340

    
341
				</tr>
342
				<!-- 
343
				<tr>
344
					<td class="text_plain">
345
						<xsl:for-each
346
							select="./param[@name='objectives/material/mattext']">
347
							<xsl:value-of select="." />
348
							<br />
349
						</xsl:for-each>
350
					</td>
351
				</tr>
352
				-->
353
				<tr class="searchresultsdivider">
354
					<td colspan="3">
355
						<img
356
							src="/knb/style/skins/default/images/transparent1x1.gif"
357
							width="1" height="1" />
358
					</td>
359
				</tr>
360

    
361
			</xsl:for-each>
362
		</table>
363
	
364
	</xsl:template>
365

    
366
</xsl:stylesheet>
(4-4/10)