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: 2011-02-17 17:16:18 -0800 (Thu, 17 Feb 2011) $'
11
* '$Revision: 5985 $'
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-prefix"/>
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_id) {
53
          	var form_ref = document.getElementById(form_id);
54
              form_ref.action.value=action;
55
              form_ref.sessionid.value="]]><xsl:value-of select="$sessid" /><![CDATA[";
56
              form_ref.qformat.value="]]><xsl:value-of select="$qformat" /><![CDATA[";
57
              form_ref.submit();
58
          }
59
          function submitCGIform(form_id) {
60
          	var form_ref = document.getElementById(form_id);
61
              form_ref.sessionid.value="]]><xsl:value-of select="$sessid" /><![CDATA[";
62
              form_ref.cfg.value="]]><xsl:value-of select="$qformat" /><![CDATA[";
63
              form_ref.submit();
64
          }
65
          ]]>
66
        </script>
67
      </head>
68

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

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

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

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

    
108
             <td width="10">&#160;</td>
109
             <td class="text_plain">
110
	       
111
	     <xsl:choose>
112
             <xsl:when test="$enableediting = 'true'">
113
               <form action="{$cgi-prefix}/register-dataset.cgi" method="POST">
114
                 <xsl:attribute name="name">
115
                   <xsl:value-of select="translate(./docid, '()-.', '____')" />
116
                 </xsl:attribute>
117
                 <xsl:attribute name="id">
118
                   <xsl:value-of select="translate(./docid, '()-.', '____')" />
119
                 </xsl:attribute>
120
                 
121
                 <input type="hidden" name="cfg" />
122
                 <input type="hidden" name="sessionid" />
123
	 	 <input type="hidden" name="enableediting" value="{$enableediting}"/>
124
                 <input type="hidden" name="stage" value="read"/>
125
                 <input type="hidden" name="docid">
126
                   <xsl:attribute name="value">
127
                     <xsl:value-of select="./docid"/>
128
                   </xsl:attribute>
129
                 </input>
130
                 <a>
131
                   <xsl:attribute name="href">javascript:submitCGIform("<xsl:value-of select="translate(./docid, '()-.', '____')"/>")</xsl:attribute>
132
                   <xsl:text>&#187;&#160;</xsl:text>
133
                   <xsl:choose>
134
                     <xsl:when test="./param[@name='dataset/title']!=''">
135
                        <xsl:value-of select="./param[@name='dataset/title']"/>
136
                     </xsl:when>
137
                     <xsl:otherwise>
138
                       <xsl:value-of select="./param[@name='citation/title']"/>
139
                       <xsl:value-of select="./param[@name='software/title']"/>
140
                       <xsl:value-of select="./param[@name='protocol/title']"/>
141
                     </xsl:otherwise>
142
                   </xsl:choose>
143
                 </a><br />
144
                 <br/>
145
                 <p><pre>ID: <xsl:value-of select="./docid"/></pre></p>
146
               </form>
147
	      </xsl:when>
148
	      <xsl:otherwise>
149
		 <form action="{$contextURL}/metacat" method="POST">
150
                 <xsl:attribute name="name">
151
                   <xsl:value-of select="translate(./docid, '()-.', '____')" />
152
                 </xsl:attribute>
153
                 <xsl:attribute name="id">
154
                   <xsl:value-of select="translate(./docid, '()-.', '____')" />
155
                 </xsl:attribute>
156

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

    
196
             <td class="text_plain">
197
               <xsl:for-each select="./param[@name='originator/individualName/surName']" >
198
                 <xsl:value-of select="." />
199
                 <br/>
200
                </xsl:for-each>
201
               <xsl:for-each select="./param[@name='creator/individualName/surName']" >
202
                 <xsl:value-of select="." />
203
                 <br/>
204
               </xsl:for-each>
205

    
206
             </td>
207
             <td class="text_plain">
208
                 <xsl:value-of select="./param[@name='originator/organizationName']" />
209
                 <xsl:value-of select="./param[@name='creator/organizationName']" />
210

    
211
             </td>
212

    
213
             <td class="text_plain">
214
               <xsl:for-each
215
                select="./param[@name='keyword']">
216
                 <xsl:value-of select="." />
217
                 <br/>
218
               </xsl:for-each>
219

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

    
309
          </xsl:for-each>
310
          </table>
311

    
312
       </xsl:if>
313
      <script language="JavaScript">
314
        <![CDATA[
315
          insertTemplateClosing("]]><xsl:value-of select="$contextURL" /><![CDATA[");
316
        ]]>
317
      </script>
318
    </body>
319
    </html>
320
    </xsl:template>
321

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