Project

General

Profile

metacat / lib / style / common / resultset.xsl @ 2051

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: brooke $'
10
*     '$Date: 2004-03-17 10:52:41 -0800 (Wed, 17 Mar 2004) $'
11
* '$Revision: 2051 $'
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="sessid"/>
35
  <xsl:param name="qformat">default</xsl:param>
36
  <xsl:param name="enableediting">false</xsl:param>
37
  <xsl:template match="/">
38
   <html>
39
      <head>
40
        <link rel="stylesheet" type="text/css" 
41
              href="@style-skins-path@/{$qformat}/{$qformat}.css" />
42
        <script language="Javascript" type="text/JavaScript"
43
                src="@style-skins-path@/{$qformat}/{$qformat}.js" />
44
        <script language="Javascript" type="text/JavaScript"
45
                src="@style-common-path@/branding.js" />
46
        <script language="JavaScript">
47
          <![CDATA[
48
          function submitform(action,form_ref) {
49
              form_ref.action.value=action;
50
              form_ref.abstractpath.value="";
51
              form_ref.sessionid.value="]]><xsl:value-of select="$sessid" /><![CDATA[";
52
              form_ref.qformat.value="]]><xsl:value-of select="$qformat" /><![CDATA[";
53
              form_ref.submit();
54
          }
55

    
56
/*******************************************************************************
57
*** MB thinks these could be deleted? Matt to confirm
58
*******************************************************************************/
59

    
60
           function submitform1(action, abstractpath, form_ref) {
61
               form_ref.action.value=action;
62
               form_ref.abstractpath.value=abstractpath;
63
               form_ref.qformat.value="]]><xsl:value-of select="$qformat" /><![CDATA[";
64
               form_ref.submit();
65
           }
66
           function submitform2(action, qformat, form_ref) {
67
               form_ref.action.value=action;
68
               form_ref.qformat.value="]]><xsl:value-of select="$qformat" /><![CDATA[";
69
               form_ref.abstractpath.value="";
70
               form_ref.submit();
71
           }
72

    
73
/*******************************************************************************
74
*** end potential deletion
75
*******************************************************************************/
76

    
77
          ]]>
78
        </script>
79
      </head>
80

    
81
      <body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
82
      <script language="JavaScript">
83
          insertTemplateOpening();
84
          insertSearchBox();
85
      </script>
86
        <table width="100%" align="center" border="0" cellpadding="5" cellspacing="0">
87
           <tr>
88
             <td align="left"><br></br><p class="emphasis"><xsl:number value="count(resultset/document)" /> data packages found</p></td>
89
           </tr></table>
90
<!-- This tests to see if there are returned documents,
91
            if there are not then don't show the query results -->
92

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

    
95
         <table width="95%" align="center" border="0" cellpadding="0" cellspacing="0">
96
           <tr>
97
             <th class="tablehead_lcorner" align="right" valign="top"><img src="@style-skins-path@/default/images/transparent1x1.gif" width="1" height="1" /></th>
98
             <th class="tablehead">Title</th>
99
             <th width="15%" class="tablehead" style="text-align: left">Contacts</th>
100
             <th width="15%" class="tablehead" style="text-align: left">Organization</th>
101
             <th width="15%" class="tablehead" style="text-align: left">Keywords</th>
102
             <xsl:if test="$enableediting = 'true'">
103
               <th width="10%" class="tablehead" style="text-align: middle">Actions</th>
104
             </xsl:if>
105
             <th class="tablehead_rcorner" align="right" valign="top"><img src="@style-skins-path@/default/images/transparent1x1.gif" width="1" height="1" /></th>
106
           </tr>
107

    
108
         <xsl:for-each select="resultset/document">
109
           <xsl:sort select="./param[@name='dataset/title']"/>
110
           <tr valign="top" class="subpanel">
111
             <xsl:attribute name="class">
112
               <xsl:choose>
113
                 <xsl:when test="position() mod 2 = 1">rowodd</xsl:when>
114
                 <xsl:when test="position() mod 2 = 0">roweven</xsl:when>
115
               </xsl:choose>
116
             </xsl:attribute>
117

    
118
             <td width="10">&#160;</td>
119
             <td class="text_plain">
120
               <form action="@servlet-path@" method="POST">
121
                 <xsl:attribute name="name">
122
                   <xsl:value-of select="translate(./docid, '()-.', '')" />
123
                 </xsl:attribute>
124
                <!-- abstractpath tells the servlet where the abstract is in
125
                      the document.  The % sign is used because the path could
126
                      be resource/literature or resource/dataset. -->
127
                 <!-- specified down IN javascript:submitform1('read',abstractpath,docid) -->
128
                 <input type="hidden" name="abstractpath" />
129
                 <!-- specified down IN javascript:submitform2('read','zip',docid) -->
130

    
131
                 <input type="hidden" name="qformat" />
132
                 <input type="hidden" name="sessionid" />
133
                 <xsl:if test="$enableediting = 'true'">
134
	 	           <input type="hidden" name="enableediting" value="{$enableediting}"/>
135
                 </xsl:if>
136
                 <input type="hidden" name="action" value="read"/>
137
                 <input type="hidden" name="docid">
138
                   <xsl:attribute name="value">
139
                     <xsl:value-of select="./docid"/>
140
                   </xsl:attribute>
141
                 </input>
142
                 <xsl:for-each select="./relation">
143
                   <input type="hidden" name="docid">
144
                     <xsl:attribute name="value" >
145
                       <xsl:value-of select="./relationdoc" />
146
                     </xsl:attribute>
147
                   </input>
148
                 </xsl:for-each>
149

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

    
167
               </form>
168
             </td>
169

    
170
             <td class="text_plain">
171
               <xsl:for-each select="./param[@name='originator/individualName/surName']" >
172
                 <xsl:value-of select="." />
173
                 <br/>
174
                </xsl:for-each>
175
               <xsl:for-each select="./param[@name='creator/individualName/surName']" >
176
                 <xsl:value-of select="." />
177
                 <br/>
178
               </xsl:for-each>
179

    
180
             </td>
181
             <td class="text_plain">
182
                 <xsl:value-of select="./param[@name='originator/organizationName']" />
183
                 <xsl:value-of select="./param[@name='creator/organizationName']" />
184

    
185
             </td>
186

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

    
194
             </td>
195
	   
196
             <xsl:if test="$enableediting = 'true'">
197
               <td class="text_plain">
198
	       <form action="@servlet-path@" method="POST">
199
	               <input type="hidden" name="action" value="read"/>
200
	 	       <input type="hidden" name="qformat" value="{$qformat}"/>
201
				<input type="hidden" name="sessionid"  value="{$sessid}"/>
202
                       <input type="hidden" name="docid">
203
                       <xsl:attribute name="value">
204
                          <xsl:value-of select="./docid"/>
205
                       </xsl:attribute>
206
                       </input>
207
                       <center>
208
		       <input type="SUBMIT"  value=" View " name="View">
209
 	               </input>
210
	               </center>
211
	             </form>
212
                 <form action="@cgi-prefix@/register-dataset.cgi" 
213
                       method="POST">
214
	               <input type="hidden" name="stage" value="modify"/>	
215
	 	           <input type="hidden" name="cfg" value="{$qformat}"/>
216
					<input type="hidden" name="sessionid"  value="{$sessid}"/>
217
                   <input type="hidden" name="docid">
218
                     <xsl:attribute name="value">
219
                       <xsl:value-of select="./docid"/>
220
                     </xsl:attribute>
221
                   </input>
222
                   <center>
223
		             <input type="SUBMIT"  value=" Edit " name="Edit">
224
 	                 </input>
225
	               </center>
226
	             </form>
227
                 <form action="@cgi-prefix@/register-dataset.cgi" 
228
                       method="POST">
229
	               <input type="hidden" name="stage" value="delete"/>	
230
	 	           <input type="hidden" name="cfg" value="{$qformat}"/>
231
					<input type="hidden" name="sessionid"  value="{$sessid}"/>
232
                   <input type="hidden" name="docid">
233
                     <xsl:attribute name="value">
234
                       <xsl:value-of select="./docid"/>
235
                     </xsl:attribute>
236
                   </input>
237
                   <center>
238
		             <input type="SUBMIT"  value="Delete" name="Delete">
239
 	                 </input>
240
	               </center>
241
	             </form>
242
	           </td>	  
243
             </xsl:if>
244
             <td width="10">&#160;</td>
245
             </tr>
246
             <tr class="searchresultsdivider"><td colspan="6">
247
             <img src="@style-skins-path@/default/images/transparent1x1.gif" width="1" height="1" /></td></tr>
248

    
249
          </xsl:for-each>
250
          </table>
251

    
252
       </xsl:if>
253
      <script language="JavaScript">
254
          insertTemplateClosing();
255
      </script>
256
    </body>
257
    </html>
258
    </xsl:template>
259

    
260
</xsl:stylesheet>