Project

General

Profile

1 2656 sgarg
<?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$'
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" version="1.0">
32
33
  <xsl:output method="html"/>
34 4613 walbridge
  <xsl:param name="cgi-prefix"/>
35 2656 sgarg
  <xsl:param name="sessid"/>
36 4006 leinfelder
  <xsl:param name="contextURL"/>
37 2656 sgarg
  <xsl:param name="qformat">default</xsl:param>
38
  <xsl:param name="enableediting">false</xsl:param>
39 2788 sgarg
  <xsl:param name="isModerator">false</xsl:param>
40 2802 sgarg
  <xsl:param name="message"></xsl:param>
41 2656 sgarg
  <xsl:template match="/">
42
   <html>
43
      <head>
44
        <link rel="stylesheet" type="text/css"
45 3780 daigle
              href="{$contextURL}/style/skins/{$qformat}/{$qformat}.css" />
46 2656 sgarg
        <script language="Javascript" type="text/JavaScript"
47 3780 daigle
                src="{$contextURL}/style/skins/{$qformat}/{$qformat}.js" />
48 2656 sgarg
        <script language="Javascript" type="text/JavaScript"
49 3780 daigle
                src="{$contextURL}/style/common/branding.js" />
50 2656 sgarg
        <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 2852 sgarg
          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 2656 sgarg
          ]]>
64
        </script>
65
      </head>
66
67
      <body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
68 4006 leinfelder
        <script language="JavaScript">
69 2686 sgarg
          <![CDATA[
70 4006 leinfelder
          insertTemplateOpening("]]><xsl:value-of select="$contextURL" /><![CDATA[");
71
          insertSearchBox("]]><xsl:value-of select="$contextURL" /><![CDATA[");
72
         ]]>
73
        </script>
74 2802 sgarg
        <table width="100%" align="center" border="0" cellpadding="2" cellspacing="0">
75 2656 sgarg
           <tr>
76 2831 sgarg
             <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 2656 sgarg
           </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 2802 sgarg
         <table width="99%" align="center" border="0" cellpadding="0" cellspacing="0">
84 2656 sgarg
           <tr>
85 3780 daigle
             <th class="tablehead_lcorner" align="right" valign="top"><img src="{$contextURL}/style/skins/default/images/transparent1x1.gif" width="1" height="1" /></th>
86 2656 sgarg
             <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 3780 daigle
             <th class="tablehead_rcorner" align="right" valign="top"><img src="{$contextURL}/style/skins/default/images/transparent1x1.gif" width="1" height="1" /></th>
94 2656 sgarg
           </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 2852 sgarg
109
	     <xsl:choose>
110
             <xsl:when test="$enableediting = 'true'">
111 4613 walbridge
               <form action="{$cgi-prefix}/register-dataset.cgi" method="POST">
112 2656 sgarg
                 <xsl:attribute name="name">
113
                   <xsl:value-of select="translate(./docid, '()-.', '____')" />
114
                 </xsl:attribute>
115
116 2852 sgarg
                 <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 4006 leinfelder
		 <form action="{$contextURL}/metacat" method="POST">
145 2852 sgarg
                 <xsl:attribute name="name">
146
                   <xsl:value-of select="translate(./docid, '()-.', '____')" />
147
                 </xsl:attribute>
148
149 2656 sgarg
                 <input type="hidden" name="qformat" />
150
                 <input type="hidden" name="sessionid" />
151
                 <xsl:if test="$enableediting = 'true'">
152 2852 sgarg
                           <input type="hidden" name="enableediting" value="{$enableediting}"/>
153 2656 sgarg
                 </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 2852 sgarg
	      </xsl:otherwise>
185
	      </xsl:choose>
186 2656 sgarg
             </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 2788 sgarg
               <xsl:choose>
216
                     <xsl:when test="$isModerator = 'true'">
217
               		<td class="text_plain">
218 4613 walbridge
	       		<form action="{$cgi-prefix}/register-dataset.cgi" method="POST">
219 2788 sgarg
	               	<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 4613 walbridge
	       	     <form action="{$cgi-prefix}/register-dataset.cgi" method="POST">
233 2788 sgarg
	               <input type="hidden" name="stage" value="mod_decline"/>
234 2756 sgarg
	 	       <input type="hidden" name="cfg" value="{$qformat}"/>
235
		       <input type="hidden" name="sessionid"  value="{$sessid}"/>
236 2788 sgarg
                   	<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 4613 walbridge
                    <form action="{$cgi-prefix}/register-dataset.cgi" method="POST">
247 2788 sgarg
	               <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 4613 walbridge
			<form action="{$cgi-prefix}/register-dataset.cgi" method="POST">
265 2852 sgarg
                       		<input type="hidden" name="stage" value="read"/>
266
                        	<input type="hidden" name="cfg" value="{$qformat}"/>
267 2788 sgarg
                                <input type="hidden" name="sessionid"  value="{$sessid}"/>
268 2852 sgarg
                       		<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 4613 walbridge
                 	<form action="{$cgi-prefix}/register-dataset.cgi"
278 2852 sgarg
                       		method="POST">
279 2788 sgarg
                       <input type="hidden" name="stage" value="modify"/>
280
                            <input type="hidden" name="cfg" value="{$qformat}"/>
281
                                        <input type="hidden" name="sessionid"  value="{$sessid}"/>
282 2656 sgarg
                   <input type="hidden" name="docid">
283
                     <xsl:attribute name="value">
284
                       <xsl:value-of select="./docid"/>
285
                     </xsl:attribute>
286
                   </input>
287
                   <center>
288 2788 sgarg
                             <input type="SUBMIT"  value=" Edit " name="Edit">
289
                         </input>
290
                       </center>
291
                     </form>
292
		     </td>
293
		  </xsl:otherwise>
294
             </xsl:choose>
295 2656 sgarg
             </xsl:if>
296
             <td width="10">&#160;</td>
297
             </tr>
298
             <tr class="searchresultsdivider"><td colspan="6">
299 3780 daigle
             <img src="{$contextURL}/style/skins/default/images/transparent1x1.gif" width="1" height="1" /></td></tr>
300 2656 sgarg
301
          </xsl:for-each>
302
          </table>
303
304
       </xsl:if>
305
      <script language="JavaScript">
306 4755 walbridge
        <![CDATA[
307
          insertTemplateClosing("]]><xsl:value-of select="$contextURL" /><![CDATA[");
308
        ]]>
309 2656 sgarg
      </script>
310
    </body>
311
    </html>
312
    </xsl:template>
313
314
</xsl:stylesheet>