Project

General

Profile

« Previous | Next » 

Revision 3550

include both assessments and questions in the results of a search (driven by option in search form)

View differences:

first-resultset.xsl
1 1
<?xml version="1.0"?>
2 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.
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 30
-->
31
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
31
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
32
	version="1.0">
32 33

  
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
   <html>
39
      <head>
40
      	<title>Search Results</title>
41
        <link rel="stylesheet" type="text/css" 
42
              href="/knb/style/skins/{$qformat}/{$qformat}.css" />
43
        <script language="Javascript" type="text/JavaScript"
44
                src="/knb/style/skins/{$qformat}/{$qformat}.js" />
45
        <script language="Javascript" type="text/JavaScript"
46
                src="/knb/style/common/branding.js" />
47
        <script language="JavaScript">
48
          <![CDATA[
49
          function submitform(action,form_ref) {
50
              form_ref.action.value=action;
51
              form_ref.sessionid.value="]]><xsl:value-of select="$sessid" /><![CDATA[";
52
              form_ref.qformat.value="]]><xsl:value-of select="$qformat" /><![CDATA[";
53
              form_ref.submit();
54
          }
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>
55 59

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

  
60
      <body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
61
      <script language="JavaScript">
62
          insertTemplateOpening();
63
          insertSearchBox();
64
      </script>
65
        <table width="100%" align="center" border="0" cellpadding="5" cellspacing="0">
66
           <tr>
67
             <td align="left"><br></br><p class="emphasis"><xsl:number value="count(resultset/document)" /> records found</p></td>
68
           </tr></table>
69
<!-- This tests to see if there are returned documents,
70
            if there are not then don't show the query results -->
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>
71 79

  
72
      <xsl:if test="count(resultset/document) &gt; 0">
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>
73 255

  
74
         <table width="95%" align="center" border="0" cellpadding="0" cellspacing="0">
75
           <tr>
76
             <th class="tablehead" style="text-align: left">Course Title</th>
77
             <th class="tablehead" style="text-align: left">Assessment Title</th>
78
             <th width="15%" class="tablehead" style="text-align: left">Instructor[s]</th>
79
             <th width="15%" class="tablehead" style="text-align: left">Organization[s]</th>
80
             <th width="15%" class="tablehead" style="text-align: left">Keywords</th>
81
             <xsl:if test="$enableediting = 'true'">
82
               <th width="10%" class="tablehead" style="text-align: middle">Actions</th>
83
             </xsl:if>
84
           </tr>
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>
85 265

  
86
         <xsl:for-each select="resultset/document">
87
           <xsl:sort select="./param[@name='dataset/title']"/>
88
           <tr valign="top" class="subpanel">
89
             <xsl:attribute name="class">
90
               <xsl:choose>
91
                 <xsl:when test="position() mod 2 = 1">rowodd</xsl:when>
92
                 <xsl:when test="position() mod 2 = 0">roweven</xsl:when>
93
               </xsl:choose>
94
             </xsl:attribute>
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>
95 278

  
96
             <td class="text_plain">
97
               <form action="/knb/metacat" method="POST">
98
                 <xsl:attribute name="name">
99
                   <xsl:value-of select="translate(./docid, '()-.', '____')" />
100
                 </xsl:attribute>
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>
101 340

  
102
                 <input type="hidden" name="qformat" />
103
                 <input type="hidden" name="sessionid" />
104
                 <xsl:if test="$enableediting = 'true'">
105
	 	           <input type="hidden" name="enableediting" value="{$enableediting}"/>
106
                 </xsl:if>
107
                 <input type="hidden" name="action" value="read"/>
108
                 <input type="hidden" name="docid">
109
                   <xsl:attribute name="value">
110
                     <xsl:value-of select="./docid"/>
111
                   </xsl:attribute>
112
                 </input>
113
                 <xsl:for-each select="./relation">
114
                   <input type="hidden" name="docid">
115
                     <xsl:attribute name="value" >
116
                       <xsl:value-of select="./relationdoc" />
117
                     </xsl:attribute>
118
                   </input>
119
                 </xsl:for-each>
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>
120 360

  
121
                 <a>
122
                   <xsl:attribute name="href">javascript:submitform('read',document.<xsl:value-of select="translate(./docid, '()-.', '____')"/>)</xsl:attribute>
123
                   <xsl:text>&#187;&#160;</xsl:text>
124
                   <xsl:choose>
125
                     <xsl:when test="./param[@name='dataset/title']!=''">
126
                        <xsl:value-of select="./param[@name='dataset/title']"/>
127
                     </xsl:when>
128
                     <xsl:otherwise>			
129
                       <xsl:value-of select="./param[@name='lom/general/title/string']"/>
130
                       <xsl:value-of select="./param[@name='lom/general/description/string']"/>
131
                     </xsl:otherwise>
132
                   </xsl:choose>
133
                 </a><br />
134
                 <br/>
135
                 <p><pre>ID: <xsl:value-of select="./docid"/></pre></p>
361
			</xsl:for-each>
362
		</table>
363
	
364
	</xsl:template>
136 365

  
137
               </form>
138
             </td>
139

  
140
	     <td class="text_plain">
141
               <xsl:for-each select="./param[@name='assessment/@assessmentTitle']" >
142
                 <xsl:value-of select="." />
143
                 <br/>
144
                </xsl:for-each>
145
             </td>
146
             <td class="text_plain">
147
               <xsl:for-each select="./param[@name='individualName/surName']" >
148
                 <xsl:value-of select="." />
149
                 <br/>
150
                </xsl:for-each>
151
             </td>
152
             <td class="text_plain">
153
             	<xsl:for-each select="./param[@name='organizationName']" >
154
					<xsl:value-of select="." />
155
					<br/>
156
				</xsl:for-each>	
157
             </td>
158

  
159
             <td class="text_plain">
160
               <xsl:for-each
161
                select="./param[@name='keyword']">
162
                 <xsl:value-of select="." />
163
                 <br/>
164
               </xsl:for-each>
165
               <xsl:for-each
166
                select="./param[@name='lom/general/keyword/string']">
167
                 <xsl:value-of select="." />
168
                 <br/>
169
               </xsl:for-each>
170

  
171
             </td>
172
	   
173
             <xsl:if test="$enableediting = 'true'">
174
               <td class="text_plain">
175
	       <form action="/knb/metacat" method="POST">
176
	               <input type="hidden" name="action" value="read"/>
177
	 	       <input type="hidden" name="qformat" value="{$qformat}"/>
178
				<input type="hidden" name="sessionid"  value="{$sessid}"/>
179
                       <input type="hidden" name="docid">
180
                       <xsl:attribute name="value">
181
                          <xsl:value-of select="./docid"/>
182
                       </xsl:attribute>
183
                       </input>
184
                       <center>
185
		       <input type="SUBMIT"  value=" View " name="View">
186
 	               </input>
187
	               </center>
188
	             </form>
189
                 <form action="@cgi-prefix@/cgi-bin/register-dataset.cgi" 
190
                       method="POST">
191
	               <input type="hidden" name="stage" value="modify"/>	
192
	 	           <input type="hidden" name="cfg" value="{$qformat}"/>
193
					<input type="hidden" name="sessionid"  value="{$sessid}"/>
194
                   <input type="hidden" name="docid">
195
                     <xsl:attribute name="value">
196
                       <xsl:value-of select="./docid"/>
197
                     </xsl:attribute>
198
                   </input>
199
                   <center>
200
		             <input type="SUBMIT"  value=" Edit " name="Edit">
201
 	                 </input>
202
	               </center>
203
	             </form>
204
                 <form action="@cgi-prefix@/cgi-bin/register-dataset.cgi" 
205
                       method="POST">
206
	               <input type="hidden" name="stage" value="delete"/>	
207
	 	           <input type="hidden" name="cfg" value="{$qformat}"/>
208
					<input type="hidden" name="sessionid"  value="{$sessid}"/>
209
                   <input type="hidden" name="docid">
210
                     <xsl:attribute name="value">
211
                       <xsl:value-of select="./docid"/>
212
                     </xsl:attribute>
213
                   </input>
214
                   <center>
215
		             <input type="SUBMIT"  value="Delete" name="Delete">
216
 	                 </input>
217
	               </center>
218
	             </form>
219
	           </td>	  
220
             </xsl:if>
221
             </tr>
222
             <tr class="searchresultsdivider">
223
             	<td colspan="5"><img src="/knb/style/skins/default/images/transparent1x1.gif" width="1" height="1" /></td>
224
             </tr>
225

  
226
          </xsl:for-each>
227
          </table>
228

  
229
       </xsl:if>
230
      <script language="JavaScript">
231
          insertTemplateClosing();
232
      </script>
233
    </body>
234
    </html>
235
    </xsl:template>
236

  
237 366
</xsl:stylesheet>

Also available in: Unified diff