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-20 11:02:29 -0700 (Wed, 20 Aug 2008) $'
11
	* '$Revision: 4271 $'
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:param name="contextURL"/>
39
	<xsl:template match="/">
40
		<html>
41
			<head>
42
				<title>Search Results</title>
43
				<link rel="stylesheet" type="text/css"
44
					href="/knb/style/skins/{$qformat}/{$qformat}.css" />
45
				<script language="Javascript" type="text/JavaScript"
46
					src="/knb/style/skins/{$qformat}/{$qformat}.js" />
47
				<script language="Javascript" type="text/JavaScript"
48
					src="/knb/style/common/branding.js" />
49
				<script language="JavaScript">
50
					<![CDATA[
51
					function submitform(action,form_ref) {
52
						form_ref.action.value=action;
53
						form_ref.sessionid.value="]]><xsl:value-of select="$sessid" /><![CDATA[";
54
						form_ref.qformat.value="]]><xsl:value-of select="$qformat" /><![CDATA[";
55
						form_ref.submit();
56
					}
57
					]]>
58
				</script>
59
			</head>
60

    
61
			<body leftmargin="0" topmargin="0" marginwidth="0"
62
				marginheight="0">
63
				<script language="JavaScript">
64
					insertTemplateOpening('<xsl:value-of select="$contextURL" />'); insertSearchBox('<xsl:value-of select="$contextURL" />');
65
				</script>
66

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

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

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

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

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

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

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

    
367
</xsl:stylesheet>
(5-5/13)