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-06-17 13:16:32 -0700 (Tue, 17 Jun 2008) $'
11
* '$Revision: 4006 $'
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="contextURL"/>
37
  <xsl:param name="qformat">default</xsl:param>
38
  <xsl:param name="enableediting">false</xsl:param>
39
  <xsl:param name="isModerator">false</xsl:param>
40
  <xsl:param name="message"></xsl:param>
41
  <xsl:template match="/">
42
   <html>
43
      <head>
44
        <link rel="stylesheet" type="text/css" 
45
              href="{$contextURL}/style/skins/{$qformat}/{$qformat}.css" />
46
        <script language="Javascript" type="text/JavaScript"
47
                src="{$contextURL}/style/skins/{$qformat}/{$qformat}.js" />
48
        <script language="Javascript" type="text/JavaScript"
49
                src="{$contextURL}/style/common/branding.js" />
50
        <script language="JavaScript">
51
          <![CDATA[
52
          function submitform(action,form_ref) {
53
              form_ref.action.value=action;
54
              form_ref.sessionid.value="]]><xsl:value-of select="$sessid" /><![CDATA[";
55
              form_ref.qformat.value="]]><xsl:value-of select="$qformat" /><![CDATA[";
56
              form_ref.submit();
57
          }
58
          function submitCGIform(form_ref) {
59
              form_ref.sessionid.value="]]><xsl:value-of select="$sessid" /><![CDATA[";
60
              form_ref.cfg.value="]]><xsl:value-of select="$qformat" /><![CDATA[";
61
              form_ref.submit();
62
          }
63
          ]]>
64
        </script>
65
      </head>
66

    
67
      <body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
68
        <script language="JavaScript">
69
          <![CDATA[
70
          insertTemplateOpening("]]><xsl:value-of select="$contextURL" /><![CDATA[");
71
          insertSearchBox("]]><xsl:value-of select="$contextURL" /><![CDATA[");
72
         ]]>
73
        </script>
74
        <table width="100%" align="center" border="0" cellpadding="2" cellspacing="0">
75
           <tr>
76
             <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>
77
           </tr></table>
78
<!-- This tests to see if there are returned documents,
79
            if there are not then don't show the query results -->
80

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

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

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

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

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

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

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

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

    
203
             </td>
204

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

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

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

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

    
312
</xsl:stylesheet>
(6-6/17)