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: daigle $'
10
*     '$Date: 2008-04-02 16:28:31 -0700 (Wed, 02 Apr 2008) $'
11
* '$Revision: 3780 $'
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="cgi-url" select='string("")'/>
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="isModerator">false</xsl:param>
39
  <xsl:param name="message"></xsl:param>
40
  <xsl:template match="/">
41
   <html>
42
      <head>
43
        <link rel="stylesheet" type="text/css" 
44
              href="{$contextURL}/style/skins/{$qformat}/{$qformat}.css" />
45
        <script language="Javascript" type="text/JavaScript"
46
                src="{$contextURL}/style/skins/{$qformat}/{$qformat}.js" />
47
        <script language="Javascript" type="text/JavaScript"
48
                src="{$contextURL}/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
          function submitCGIform(form_ref) {
58
              form_ref.sessionid.value="]]><xsl:value-of select="$sessid" /><![CDATA[";
59
              form_ref.cfg.value="]]><xsl:value-of select="$qformat" /><![CDATA[";
60
              form_ref.submit();
61
          }
62
          ]]>
63
        </script>
64
      </head>
65

    
66
      <body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
67
      <script language="JavaScript">
68
          <![CDATA[
69
          insertTemplateOpening("{$contextURL}");
70
          insertSearchBox("{$contextURL}");
71
          ]]>
72
      </script>
73
        <table width="100%" align="center" border="0" cellpadding="2" cellspacing="0">
74
           <tr>
75
             <td align="left"><br></br><p class="emphasis"><xsl:value-of select="$message"/><br></br><xsl:number value="count(resultset/document)" /> data set(s) found <xsl:if test="$enableediting ='true' and $isModerator = 'true'">for moderation</xsl:if></p></td>
76
           </tr></table>
77
<!-- This tests to see if there are returned documents,
78
            if there are not then don't show the query results -->
79

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

    
82
         <table width="99%" align="center" border="0" cellpadding="0" cellspacing="0">
83
           <tr>
84
             <th class="tablehead_lcorner" align="right" valign="top"><img src="{$contextURL}/style/skins/default/images/transparent1x1.gif" width="1" height="1" /></th>
85
             <th class="tablehead" style="text-align: left">Title</th>
86
             <th width="15%" class="tablehead" style="text-align: left">Contacts</th>
87
             <th width="15%" class="tablehead" style="text-align: left">Organization</th>
88
             <th width="15%" class="tablehead" style="text-align: left">Keywords</th>
89
             <xsl:if test="$enableediting = 'true'">
90
               <th width="10%" class="tablehead" style="text-align: middle">Actions</th>
91
             </xsl:if>
92
             <th class="tablehead_rcorner" align="right" valign="top"><img src="{$contextURL}/style/skins/default/images/transparent1x1.gif" width="1" height="1" /></th>
93
           </tr>
94

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

    
105
             <td width="10">&#160;</td>
106
             <td class="text_plain">
107
	       
108
	     <xsl:choose>
109
             <xsl:when test="$enableediting = 'true'">
110
               <form action="{$cgi-url}/register-dataset.cgi" method="POST">
111
                 <xsl:attribute name="name">
112
                   <xsl:value-of select="translate(./docid, '()-.', '____')" />
113
                 </xsl:attribute>
114

    
115
                 <input type="hidden" name="cfg" />
116
                 <input type="hidden" name="sessionid" />
117
	 	 <input type="hidden" name="enableediting" value="{$enableediting}"/>
118
                 <input type="hidden" name="stage" value="read"/>
119
                 <input type="hidden" name="docid">
120
                   <xsl:attribute name="value">
121
                     <xsl:value-of select="./docid"/>
122
                   </xsl:attribute>
123
                 </input>
124
                 <a>
125
                   <xsl:attribute name="href">javascript:submitCGIform(document.<xsl:value-of select="translate(./docid, '()-.', '____')"/>)</xsl:attribute>
126
                   <xsl:text>&#187;&#160;</xsl:text>
127
                   <xsl:choose>
128
                     <xsl:when test="./param[@name='dataset/title']!=''">
129
                        <xsl:value-of select="./param[@name='dataset/title']"/>
130
                     </xsl:when>
131
                     <xsl:otherwise>
132
                       <xsl:value-of select="./param[@name='citation/title']"/>
133
                       <xsl:value-of select="./param[@name='software/title']"/>
134
                       <xsl:value-of select="./param[@name='protocol/title']"/>
135
                     </xsl:otherwise>
136
                   </xsl:choose>
137
                 </a><br />
138
                 <br/>
139
                 <p><pre>ID: <xsl:value-of select="./docid"/></pre></p>
140
               </form>
141
	      </xsl:when>
142
	      <xsl:otherwise>
143
		 <form action="{$servletURL}" method="POST">
144
                 <xsl:attribute name="name">
145
                   <xsl:value-of select="translate(./docid, '()-.', '____')" />
146
                 </xsl:attribute>
147

    
148
                 <input type="hidden" name="qformat" />
149
                 <input type="hidden" name="sessionid" />
150
                 <xsl:if test="$enableediting = 'true'">
151
                           <input type="hidden" name="enableediting" value="{$enableediting}"/>
152
                 </xsl:if>
153
                 <input type="hidden" name="action" value="read"/>
154
                 <input type="hidden" name="docid">
155
                   <xsl:attribute name="value">
156
                     <xsl:value-of select="./docid"/>
157
                   </xsl:attribute>
158
                 </input>
159
                 <xsl:for-each select="./relation">
160
                   <input type="hidden" name="docid">
161
                     <xsl:attribute name="value" >
162
                       <xsl:value-of select="./relationdoc" />
163
                     </xsl:attribute>
164
                   </input>
165
                 </xsl:for-each>
166
                 <a>
167
                   <xsl:attribute name="href">javascript:submitform('read',document.<xsl:value-of select="translate(./docid, '()-.', '____')"/>)</xsl:attribute>
168
                   <xsl:text>&#187;&#160;</xsl:text>
169
                   <xsl:choose>
170
                     <xsl:when test="./param[@name='dataset/title']!=''">
171
                        <xsl:value-of select="./param[@name='dataset/title']"/>
172
                     </xsl:when>
173
                     <xsl:otherwise>
174
                       <xsl:value-of select="./param[@name='citation/title']"/>
175
                       <xsl:value-of select="./param[@name='software/title']"/>
176
                       <xsl:value-of select="./param[@name='protocol/title']"/>
177
                     </xsl:otherwise>
178
                   </xsl:choose>
179
                 </a><br />
180
                 <br/>
181
                 <p><pre>ID: <xsl:value-of select="./docid"/></pre></p>
182
               </form>
183
	      </xsl:otherwise>
184
	      </xsl:choose>
185
             </td>
186

    
187
             <td class="text_plain">
188
               <xsl:for-each select="./param[@name='originator/individualName/surName']" >
189
                 <xsl:value-of select="." />
190
                 <br/>
191
                </xsl:for-each>
192
               <xsl:for-each select="./param[@name='creator/individualName/surName']" >
193
                 <xsl:value-of select="." />
194
                 <br/>
195
               </xsl:for-each>
196

    
197
             </td>
198
             <td class="text_plain">
199
                 <xsl:value-of select="./param[@name='originator/organizationName']" />
200
                 <xsl:value-of select="./param[@name='creator/organizationName']" />
201

    
202
             </td>
203

    
204
             <td class="text_plain">
205
               <xsl:for-each
206
                select="./param[@name='keyword']">
207
                 <xsl:value-of select="." />
208
                 <br/>
209
               </xsl:for-each>
210

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

    
300
          </xsl:for-each>
301
          </table>
302

    
303
       </xsl:if>
304
      <script language="JavaScript">
305
          insertTemplateClosing("{$contextURL}");
306
      </script>
307
    </body>
308
    </html>
309
    </xsl:template>
310

    
311
</xsl:stylesheet>
(6-6/15)