Project

General

Profile

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

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: sgarg $'
10
*     '$Date: 2004-02-05 19:05:10 -0800 (Thu, 05 Feb 2004) $'
11
* '$Revision: 2017 $'
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="@style-skins-path@/default/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="@style-skins-path@/default/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
                 <xsl:if test="$enableediting = 'true'">
121
	 	           <input type="hidden" name="enableediting" value="{$enableediting}"/>
122
                 </xsl:if>
123
                 <input type="hidden" name="action" value="read"/>
124
                 <input type="hidden" name="docid">
125
                   <xsl:attribute name="value">
126
                     <xsl:value-of select="./docid"/>
127
                   </xsl:attribute>
128
                 </input>
129
                 <xsl:for-each select="./relation">
130
                   <input type="hidden" name="docid">
131
                     <xsl:attribute name="value" >
132
                       <xsl:value-of select="./relationdoc" />
133
                     </xsl:attribute>
134
                   </input>
135
                 </xsl:for-each>
136

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

    
153
               </form>
154
             </td>
155

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

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

    
171
             </td>
172

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

    
180
             </td>
181
	   
182
             <xsl:if test="$enableediting = 'true'">
183
               <td class="text_plain">
184
	       <form action="@servlet-path@" method="POST">
185
	               <input type="hidden" name="action" value="read"/>
186
	 	       <input type="hidden" name="qformat" value="{$qformat}"/>
187
                       <input type="hidden" name="docid">
188
                       <xsl:attribute name="value">
189
                          <xsl:value-of select="./docid"/>
190
                       </xsl:attribute>
191
                       </input>
192
                       <center>
193
		       <input type="SUBMIT"  value=" View " name="View">
194
 	               </input>
195
	               </center>
196
	             </form>
197
                 <form action="@cgi-prefix@/register-dataset.cgi" 
198
                       method="POST">
199
	               <input type="hidden" name="stage" value="modify"/>	
200
	 	           <input type="hidden" name="cfg" value="{$qformat}"/>
201
                   <input type="hidden" name="docid">
202
                     <xsl:attribute name="value">
203
                       <xsl:value-of select="./docid"/>
204
                     </xsl:attribute>
205
                   </input>
206
                   <center>
207
		             <input type="SUBMIT"  value=" Edit " name="Edit">
208
 	                 </input>
209
	               </center>
210
	             </form>
211
                 <form action="@cgi-prefix@/register-dataset.cgi" 
212
                       method="POST">
213
	               <input type="hidden" name="stage" value="delete"/>	
214
	 	           <input type="hidden" name="cfg" value="{$qformat}"/>
215
                   <input type="hidden" name="docid">
216
                     <xsl:attribute name="value">
217
                       <xsl:value-of select="./docid"/>
218
                     </xsl:attribute>
219
                   </input>
220
                   <center>
221
		             <input type="SUBMIT"  value="Delete" name="Delete">
222
 	                 </input>
223
	               </center>
224
	             </form>
225
	           </td>	  
226
             </xsl:if>
227
             <td width="10">&#160;</td>
228
             </tr>
229
             <tr class="searchresultsdivider"><td colspan="6">
230
             <img src="@style-skins-path@/default/images/transparent1x1.gif" width="1" height="1" /></td></tr>
231

    
232
          </xsl:for-each>
233
          </table>
234

    
235
       </xsl:if>
236
      <script language="JavaScript">
237
          insertTemplateClosing();
238
      </script>
239
    </body>
240
    </html>
241
    </xsl:template>
242

    
243
</xsl:stylesheet>