Project

General

Profile

« Previous | Next » 

Revision 3442

Added by Matt Jones over 17 years ago

Added a refactored resultset stylesheet that allows skins to override the container format to not use iframes. The continaing skin can now import resulttable.xsl and call the result table template directly.

View differences:

lib/style/common/resultset-table.xsl
1
<?xml version="1.0"?>
2
<!--
3
	*  '$RCSfile$'
4
	*      Authors: Matt Jones, Chad Berkley
5
	*    Copyright: 2000-2007 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"
32
	version="1.0">
33
									
34
    <xsl:template name="resultstable">
35
			<body leftmargin="0" topmargin="0" marginwidth="0"
36
				marginheight="0">
37

  
38
				<p class="emphasis">
39
					<xsl:number value="count(resultset/document)" />
40
					data packages found
41
				</p>
42

  
43
				<!-- This tests to see if there are returned documents,
44
					if there are not then don't show the query results -->
45
				<xsl:if test="count(resultset/document) &gt; 0">
46

  
47
					<table width="95%" align="center" border="0"
48
						cellpadding="0" cellspacing="0">
49
						<tr>
50
							<th class="tablehead_lcorner" align="right"
51
								valign="top">
52
								<img
53
									src="@style-skins-path@/default/images/transparent1x1.gif"
54
									width="1" height="1" />
55
							</th>
56
							<th class="tablehead"
57
								style="text-align: left">
58
								Title
59
							</th>
60
							<th width="15%" class="tablehead"
61
								style="text-align: left">
62
								Contacts
63
							</th>
64
							<th width="15%" class="tablehead"
65
								style="text-align: left">
66
								Organization
67
							</th>
68
							<th width="15%" class="tablehead"
69
								style="text-align: left">
70
								Keywords
71
							</th>
72
							<xsl:if test="$enableediting = 'true'">
73
								<th width="10%" class="tablehead"
74
									style="text-align: middle">
75
									Actions
76
								</th>
77
							</xsl:if>
78
							<th class="tablehead_rcorner" align="right"
79
								valign="top">
80
								<img
81
									src="@style-skins-path@/default/images/transparent1x1.gif"
82
									width="1" height="1" />
83
							</th>
84
						</tr>
85

  
86
						<xsl:for-each select="resultset/document">
87
							<xsl:sort
88
								select="./param[@name='dataset/title']" />
89
							<tr valign="top" class="subpanel">
90
								<xsl:attribute name="class">
91
									<xsl:choose>
92
										<xsl:when
93
											test="position() mod 2 = 1">
94
											rowodd
95
										</xsl:when>
96
										<xsl:when
97
											test="position() mod 2 = 0">
98
											roweven
99
										</xsl:when>
100
									</xsl:choose>
101
								</xsl:attribute>
102

  
103
								<td width="10">&#160;</td>
104
								<td class="text_plain">
105
									<form action="@servlet-path@"
106
										method="POST">
107
										<xsl:attribute name="name"><xsl:value-of
108
												select="translate(./docid, '()-.', '____')" /></xsl:attribute>
109

  
110
										<input type="hidden"
111
											name="qformat" />
112
										<input type="hidden"
113
											name="sessionid" />
114
										<xsl:if
115
											test="$enableediting = 'true'">
116
											<input type="hidden"
117
												name="enableediting" value="{$enableediting}" />
118
										</xsl:if>
119
										<input type="hidden"
120
											name="action" value="read" />
121
										<input type="hidden"
122
											name="docid">
123
											<xsl:attribute
124
												name="value"><xsl:value-of
125
												select="./docid" /></xsl:attribute>
126
										</input>
127
										<xsl:for-each
128
											select="./relation">
129
											<input type="hidden"
130
												name="docid">
131
												<xsl:attribute
132
													name="value"><xsl:value-of
133
														select="./relationdoc" /></xsl:attribute>
134
											</input>
135
										</xsl:for-each>
136

  
137
										<a>
138
											<xsl:attribute
139
												name="href">javascript:submitform('read',document.<xsl:value-of
140
													select="translate(./docid, '()-.', '____')" />)</xsl:attribute>
141
											<xsl:text>
142
												&#187;&#160;
143
											</xsl:text>
144
											<xsl:choose>
145
												<xsl:when test="./param[@name='dataset/title']!=''"><xsl:value-of
146
														select="./param[@name='dataset/title']" />
147
												</xsl:when>
148
												<xsl:otherwise>
149
													<xsl:value-of
150
														select="./param[@name='citation/title']" />
151
													<xsl:value-of
152
														select="./param[@name='software/title']" />
153
													<xsl:value-of
154
														select="./param[@name='protocol/title']" />
155
													<xsl:value-of
156
														select="./param[@name='idinfo/citation/citeinfo/title']" />
157
												</xsl:otherwise>
158
											</xsl:choose>
159
										</a>
160
										<br />
161
										<br />
162
										<p>
163
											<pre>ID: <xsl:value-of
164
													select="./docid" /></pre>
165
										</p>
166

  
167
									</form>
168
								</td>
169

  
170
								<td class="text_plain">
171
									<xsl:for-each
172
										select="./param[@name='originator/individualName/surName']">
173
										<xsl:value-of select="." />
174
										<br />
175
									</xsl:for-each>
176
									<xsl:for-each
177
										select="./param[@name='creator/individualName/surName']">
178
										<xsl:value-of select="." />
179
										<br />
180
									</xsl:for-each>
181
									<xsl:for-each
182
										select="./param[@name='idinfo/citation/citeinfo/origin']">
183
										<xsl:value-of select="." />
184
										<br />
185
									</xsl:for-each>
186

  
187
								</td>
188
								<td class="text_plain">
189
									<xsl:value-of
190
										select="./param[@name='originator/organizationName']" />
191
									<xsl:value-of
192
										select="./param[@name='creator/organizationName']" />
193

  
194
								</td>
195

  
196
								<td class="text_plain">
197
									<xsl:for-each
198
										select="./param[@name='keyword']">
199
										<xsl:value-of select="." />
200
										<br />
201
									</xsl:for-each>
202
									<xsl:for-each
203
										select="./param[@name='idinfo/keywords/theme/themekey']">
204
										<xsl:value-of select="." />
205
										<br />
206
									</xsl:for-each>
207

  
208
								</td>
209

  
210
								<xsl:if test="$enableediting = 'true'">
211
									<td class="text_plain">
212
										<form action="@servlet-path@"
213
											method="POST">
214
											<input type="hidden"
215
												name="action" value="read" />
216
											<input type="hidden"
217
												name="qformat" value="{$qformat}" />
218
											<input type="hidden"
219
												name="sessionid" value="{$sessid}" />
220
											<input type="hidden"
221
												name="docid">
222
												<xsl:attribute
223
													name="value">
224
													<xsl:value-of
225
														select="./docid" />
226
												</xsl:attribute>
227
											</input>
228
											<center>
229
												<input type="SUBMIT"
230
													value=" View " name="View">
231
												</input>
232
											</center>
233
										</form>
234
										<form
235
											action="@cgi-prefix@/register-dataset.cgi" method="POST">
236
											<input type="hidden"
237
												name="stage" value="modify" />
238
											<input type="hidden"
239
												name="cfg" value="{$qformat}" />
240
											<input type="hidden"
241
												name="sessionid" value="{$sessid}" />
242
											<input type="hidden"
243
												name="docid">
244
												<xsl:attribute
245
													name="value">
246
													<xsl:value-of
247
														select="./docid" />
248
												</xsl:attribute>
249
											</input>
250
											<center>
251
												<input type="SUBMIT"
252
													value=" Edit " name="Edit">
253
												</input>
254
											</center>
255
										</form>
256
										<form
257
											action="@cgi-prefix@/register-dataset.cgi" method="POST">
258
											<input type="hidden"
259
												name="stage" value="delete" />
260
											<input type="hidden"
261
												name="cfg" value="{$qformat}" />
262
											<input type="hidden"
263
												name="sessionid" value="{$sessid}" />
264
											<input type="hidden"
265
												name="docid">
266
												<xsl:attribute
267
													name="value">
268
													<xsl:value-of
269
														select="./docid" />
270
												</xsl:attribute>
271
											</input>
272
											<center>
273
												<input type="SUBMIT"
274
													value="Delete" name="Delete">
275
												</input>
276
											</center>
277
										</form>
278
									</td>
279
								</xsl:if>
280
								<td width="10">&#160;</td>
281
							</tr>
282
							<tr class="searchresultsdivider">
283
								<td colspan="6">
284
									<img
285
										src="@style-skins-path@/default/images/transparent1x1.gif"
286
										width="1" height="1" />
287
								</td>
288
							</tr>
289

  
290
						</xsl:for-each>
291
					</table>
292

  
293
				</xsl:if>
294
			</body>
295
    </xsl:template>
296

  
297
</xsl:stylesheet>
0 298

  
lib/style/common/resultset.xsl
29 29
* into an HTML format suitable for rendering with modern web browsers.
30 30
-->
31 31
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
32

  
32
  <xsl:import href="@systemidserver@@style-common-path@/resultset-table.xsl"/>
33
  
33 34
  <xsl:output method="html"/>
34 35
  <xsl:param name="sessid"/>
35 36
  <xsl:param name="qformat">default</xsl:param>
......
61 62
          insertTemplateOpening();
62 63
          insertSearchBox();
63 64
      </script>
64
        <table width="100%" align="center" border="0" cellpadding="5" cellspacing="0">
65
           <tr>
66
             <td align="left"><br></br><p class="emphasis"><xsl:number value="count(resultset/document)" /> data packages found</p></td>
67
           </tr></table>
68
<!-- This tests to see if there are returned documents,
69
            if there are not then don't show the query results -->
70

  
71
      <xsl:if test="count(resultset/document) &gt; 0">
72

  
73
         <table width="95%" align="center" border="0" cellpadding="0" cellspacing="0">
74
           <tr>
75
             <th class="tablehead_lcorner" align="right" valign="top"><img src="@style-skins-path@/default/images/transparent1x1.gif" width="1" height="1" /></th>
76
             <th class="tablehead" style="text-align: left">Title</th>
77
             <th width="15%" class="tablehead" style="text-align: left">Contacts</th>
78
             <th width="15%" class="tablehead" style="text-align: left">Organization</th>
79
             <th width="15%" class="tablehead" style="text-align: left">Keywords</th>
80
             <xsl:if test="$enableediting = 'true'">
81
               <th width="10%" class="tablehead" style="text-align: middle">Actions</th>
82
             </xsl:if>
83
             <th class="tablehead_rcorner" align="right" valign="top"><img src="@style-skins-path@/default/images/transparent1x1.gif" width="1" height="1" /></th>
84
           </tr>
85

  
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>
95

  
96
             <td width="10">&#160;</td>
97
             <td class="text_plain">
98
               <form action="@servlet-path@" method="POST">
99
                 <xsl:attribute name="name">
100
                   <xsl:value-of select="translate(./docid, '()-.', '____')" />
101
                 </xsl:attribute>
102

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

  
122
                 <a>
123
                   <xsl:attribute name="href">javascript:submitform('read',document.<xsl:value-of select="translate(./docid, '()-.', '____')"/>)</xsl:attribute>
124
                   <xsl:text>&#187;&#160;</xsl:text>
125
                   <xsl:choose>
126
                     <xsl:when test="./param[@name='dataset/title']!=''">
127
                        <xsl:value-of select="./param[@name='dataset/title']"/>
128
                     </xsl:when>
129
                     <xsl:otherwise>
130
                       <xsl:value-of select="./param[@name='citation/title']"/>
131
                       <xsl:value-of select="./param[@name='software/title']"/>
132
                       <xsl:value-of select="./param[@name='protocol/title']"/>
133
                       <xsl:value-of select="./param[@name='idinfo/citation/citeinfo/title']"/>
134
                     </xsl:otherwise>
135
                   </xsl:choose>
136
                 </a><br />
137
                 <br/>
138
                 <p><pre>ID: <xsl:value-of select="./docid"/></pre></p>
139

  
140
               </form>
141
             </td>
142

  
143
             <td class="text_plain">
144
               <xsl:for-each select="./param[@name='originator/individualName/surName']" >
145
                 <xsl:value-of select="." />
146
                 <br/>
147
                </xsl:for-each>
148
               <xsl:for-each select="./param[@name='creator/individualName/surName']" >
149
                 <xsl:value-of select="." />
150
                 <br/>
151
               </xsl:for-each>
152
               <xsl:for-each select="./param[@name='idinfo/citation/citeinfo/origin']" >
153
                 <xsl:value-of select="." />
154
                 <br/>
155
               </xsl:for-each>
156

  
157
             </td>
158
             <td class="text_plain">
159
                 <xsl:value-of select="./param[@name='originator/organizationName']" />
160
                 <xsl:value-of select="./param[@name='creator/organizationName']" />
161

  
162
             </td>
163

  
164
             <td class="text_plain">
165
               <xsl:for-each
166
                select="./param[@name='keyword']">
167
                 <xsl:value-of select="." />
168
                 <br/>
169
               </xsl:for-each>
170
               <xsl:for-each
171
                select="./param[@name='idinfo/keywords/theme/themekey']">
172
                 <xsl:value-of select="." />
173
                 <br/>
174
               </xsl:for-each>
175

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

  
231
          </xsl:for-each>
232
          </table>
233

  
234
       </xsl:if>
65
      <xsl:call-template name="resultstable"/>
235 66
      <script language="JavaScript">
236 67
          insertTemplateClosing();
237 68
      </script>

Also available in: Unified diff