Project

General

Profile

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

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: 2003-11-25 15:18:37 -0800 (Tue, 25 Nov 2003) $'
11
* '$Revision: 1940 $'
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="qformat">default</xsl:param>
35
  <xsl:param name="enableediting">false</xsl:param>
36
  <xsl:template match="/">
37
   <html>
38
      <head>
39
        <link rel="stylesheet" type="text/css" 
40
              href="@style-skins-path@/{$qformat}/{$qformat}.css" />
41
        <script language="Javascript" type="text/JavaScript"
42
                src="@style-skins-path@/{$qformat}/{$qformat}.js" />
43
        <script language="Javascript" type="text/JavaScript"
44
                src="@style-common-path@/branding.js" />
45
        <script language="JavaScript">
46
          <![CDATA[
47
          function submitform(action,form_ref) {
48
              form_ref.action.value=action;
49
              form_ref.abstractpath.value="";
50
              form_ref.qformat.value="]]><xsl:value-of select="$qformat" /><![CDATA[";
51
              form_ref.submit();
52
          }
53
          function submitform1(action, abstractpath, form_ref) {
54
              form_ref.action.value=action;
55
              form_ref.abstractpath.value=abstractpath;
56
              form_ref.qformat.value="]]><xsl:value-of select="$qformat" /><![CDATA[";
57
              form_ref.submit();
58
          }
59
          function submitform2(action, qformat, form_ref) {
60
              form_ref.action.value=action;
61
              form_ref.qformat.value="]]><xsl:value-of select="$qformat" /><![CDATA[";
62
              form_ref.abstractpath.value="";
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
          insertTemplateOpening();
72
          insertSearchBox();
73
      </script>
74
        <table width="100%" align="center" border="0" cellpadding="5" cellspacing="0">
75
           <tr>
76
             <td align="left"><br></br><p class="emphasis"><xsl:number value="count(resultset/document)" /> data packages found</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="95%" align="center" border="0" cellpadding="0" cellspacing="0">
84
           <tr>
85
             <th class="tablehead_lcorner" align="right" valign="top"><img src="images/transparent1x1.gif" width="1" height="1" /></th>
86
             <th class="tablehead">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="images/transparent1x1.gif" width="1" height="1" /></th>
94
           </tr>
95

    
96
         <xsl:for-each select="resultset/document">
97
           <xsl:sort select="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
               <form action="@servlet-path@" method="POST">
109
                 <xsl:attribute name="name">
110
                   <xsl:value-of select="translate(./docid,'.','')"/>
111
                 </xsl:attribute>
112
                <!-- abstractpath tells the servlet where the abstract is in
113
                      the document.  The % sign is used because the path could
114
                      be resource/literature or resource/dataset. -->
115
                 <!-- specified down IN javascript:submitform1('read',abstractpath,docid) -->
116
                 <input type="hidden" name="abstractpath" />
117
                 <!-- specified down IN javascript:submitform2('read','zip',docid) -->
118

    
119
                <input type="hidden" name="qformat" />
120
                 <input type="hidden" name="action" value="read"/>
121
                 <input type="hidden" name="docid">
122
                   <xsl:attribute name="value">
123
                     <xsl:value-of select="./docid"/>
124
                   </xsl:attribute>
125
                 </input>
126
                 <xsl:for-each select="./relation">
127
                   <input type="hidden" name="docid">
128
                     <xsl:attribute name="value" >
129
                       <xsl:value-of select="./relationdoc" />
130
                     </xsl:attribute>
131
                   </input>
132
                 </xsl:for-each>
133

    
134
                 <a>
135
                   <xsl:attribute name="href">javascript:submitform('read',document.<xsl:value-of select="translate(./docid, '.', '')"/>)</xsl:attribute>
136
                   <xsl:choose>
137
                     <xsl:when test="./param[@name='dataset/title']!=''">
138
                        <xsl:value-of select="./param[@name='dataset/title']"/>
139
                     </xsl:when>
140
                     <xsl:otherwise>
141
                       <xsl:value-of select="./param[@name='citation/title']"/>
142
                       <xsl:value-of select="./param[@name='software/title']"/>
143
                       <xsl:value-of select="./param[@name='protocol/title']"/>
144
                     </xsl:otherwise>
145
                   </xsl:choose>
146
                 </a><br />
147
                 <br/>
148
                 <p><pre>Document ID: <xsl:value-of select="./docid"/></pre></p>
149

    
150
               </form>
151
             </td>
152

    
153
             <td class="text_plain">
154
               <xsl:for-each select="./param[@name='originator/individualName/surName']" >
155
                 <xsl:value-of select="." />
156
                 <br/>
157
                </xsl:for-each>
158
               <xsl:for-each select="./param[@name='creator/individualName/surName']" >
159
                 <xsl:value-of select="." />
160
                 <br/>
161
               </xsl:for-each>
162

    
163
             </td>
164
             <td class="text_plain">
165
                 <xsl:value-of select="./param[@name='originator/organizationName']" />
166
                 <xsl:value-of select="./param[@name='creator/organizationName']" />
167

    
168
             </td>
169

    
170
             <td class="text_plain">
171
               <xsl:for-each
172
                select="./param[@name='keyword']">
173
                 <xsl:value-of select="." />
174
                 <br/>
175
               </xsl:for-each>
176

    
177
             </td>
178
	   
179
             <xsl:if test="$enableediting = 'true'">
180
               <td class="text_plain">
181
                 <form action="@cgi-prefix@/register-dataset.cgi" 
182
                       method="POST">
183
	               <input type="hidden" name="stage" value="modify"/>	
184
	 	           <input type="hidden" name="cfg" value="{$qformat}"/>
185
                   <input type="hidden" name="docid">
186
                     <xsl:attribute name="value">
187
                       <xsl:value-of select="./docid"/>
188
                     </xsl:attribute>
189
                   </input>
190
                   <center>
191
		             <input type="SUBMIT"  value=" Edit " name="Edit">
192
 	                 </input>
193
	               </center>
194
	             </form>
195
                 <form action="@cgi-prefix@/register-dataset.cgi" 
196
                       method="POST">
197
	               <input type="hidden" name="stage" value="delete"/>	
198
	 	           <input type="hidden" name="cfg" value="{$qformat}"/>
199
                   <input type="hidden" name="docid">
200
                     <xsl:attribute name="value">
201
                       <xsl:value-of select="./docid"/>
202
                     </xsl:attribute>
203
                   </input>
204
                   <center>
205
		             <input type="SUBMIT"  value="Delete" name="Delete">
206
 	                 </input>
207
	               </center>
208
	             </form>
209
	           </td>	  
210
             </xsl:if>
211
             <td width="10">&#160;</td>
212
             </tr>
213
             <tr class="searchresultsdivider"><td colspan="6">
214
             <img src="images/transparent1x1.gif" width="1" height="1" /></td></tr>
215

    
216
          </xsl:for-each>
217
          </table>
218

    
219
       </xsl:if>
220
      <script language="JavaScript">
221
          insertTemplateClosing();
222
      </script>
223
    </body>
224
    </html>
225
    </xsl:template>
226

    
227
</xsl:stylesheet>