Project

General

Profile

metacat / lib / style / common / resultset-table.xsl @ 7926

1
<?xml version="1.0"?>
2
<!--
3
	*  '$RCSfile$'
4
	*      Authors: Matt Jones, Chad Berkley
5
	*    Copyright: 2000-2007 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-18 12:09:10 -0800 (Fri, 18 Feb 2011) $'
11
	* '$Revision: 5991 $'
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"
32
                version="1.0">
33
    <xsl:template name="resultstable">
34
        <body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
35
            
36
            <p class="emphasis">
37
                <xsl:number value="count(resultset/document)" />
38
                data packages found
39
            </p>
40
            
41
            <!-- This tests to see if there are returned documents,
42
					if there are not then don't show the query results -->
43
            <xsl:if test="count(resultset/document) &gt; 0">
44
                
45
                <table class="resultstable" width="95%" align="center" border="0" cellpadding="0" cellspacing="0">
46
                    <tr>
47
                        <th class="tablehead_lcorner" align="right" valign="top">
48
                            <img src="{$contextURL}/style/skins/default/images/transparent1x1.gif" width="1" height="1" />
49
                        </th>
50
                        <th class="tablehead" style="text-align: left">
51
                            Title
52
                        </th>
53
                        <th width="15%" class="tablehead" style="text-align: left">
54
                            Contacts
55
                        </th>
56
                        <th width="15%" class="tablehead" style="text-align: left">
57
                            Organization
58
                        </th>
59
                        <th width="15%" class="tablehead" style="text-align: left">
60
                            Keywords
61
                        </th>
62
                        <xsl:if test="$enableediting = 'true'">
63
                            <th width="10%" class="tablehead" style="text-align: middle">
64
                                Actions
65
                            </th>
66
                        </xsl:if>
67
                        <th class="tablehead_rcorner" align="right" valign="top">
68
                            <img src="{$contextURL}/style/skins/default/images/transparent1x1.gif" width="1" height="1" />
69
                        </th>
70
                    </tr>
71
                    
72
                    <xsl:for-each select="resultset/document">
73
                        <xsl:sort select="./param[@name='dataset/title']" />
74
                        <tr valign="top" class="subpanel">
75
                            <xsl:attribute name="class">
76
                                <xsl:choose>
77
                                    <xsl:when test="position() mod 2 = 1">rowodd</xsl:when>
78
                                    <xsl:when test="position() mod 2 = 0">roweven</xsl:when>
79
                                </xsl:choose>
80
                            </xsl:attribute>
81
                            
82
                            <td width="10">&#160;</td>
83
                            <td class="text_plain">
84
                                <form action="{$contextURL}/metacat" method="POST">
85
                                    <xsl:attribute name="name"><xsl:value-of
86
                                        select="translate(./docid, '()-.', '____')" /></xsl:attribute>
87
                                    
88
                                    <input type="hidden" name="qformat" />
89
                                    <input type="hidden" name="sessionid" />
90
                                    <xsl:if
91
                                        test="$enableediting = 'true'">
92
                                        <input type="hidden" name="enableediting" value="{$enableediting}" />
93
                                    </xsl:if>
94
                                    <input type="hidden" name="action" value="read" />
95
                                    <input type="hidden" name="docid">
96
                                        <xsl:attribute
97
                                            name="value"><xsl:value-of
98
                                            select="./docid" /></xsl:attribute>
99
                                    </input>
100
                                    <xsl:for-each
101
                                        select="./relation">
102
                                        <input type="hidden" name="docid">
103
                                            <xsl:attribute
104
                                                name="value"><xsl:value-of
105
                                                select="./relationdoc" /></xsl:attribute>
106
                                        </input>
107
                                    </xsl:for-each>
108
                                    
109
                                    <a>
110
                                        <xsl:attribute
111
                                            name="href">javascript:submitform('read',document.<xsl:value-of
112
                                            select="translate(./docid, '()-.', '____')" />)</xsl:attribute>
113
                                        <xsl:text>
114
                                            &#187;&#160;
115
                                        </xsl:text>
116
                                        <xsl:choose>
117
                                            <xsl:when test="./param[@name='dataset/title']!=''">
118
                                            	<xsl:value-of select="./param[@name='dataset/title']" />
119
                                            	<xsl:if test="count(./param[@name='dataset/title/value']) != 0">
120
                                            		<br/>
121
	                                            	<xsl:for-each select="./param[@name='dataset/title/value']" >
122
														<xsl:value-of select="." />
123
														<br/>
124
	                                            	</xsl:for-each>
125
	                                            </xsl:if>
126
                                            </xsl:when>
127
                                            <xsl:otherwise>
128
                                                <xsl:value-of select="./param[@name='citation/title']" />
129
                                                <xsl:value-of select="./param[@name='software/title']" />
130
                                                <xsl:value-of select="./param[@name='protocol/title']" />
131
                                                <xsl:value-of select="./param[@name='idinfo/citation/citeinfo/title']" />
132
                                            </xsl:otherwise>
133
                                        </xsl:choose>
134
                                    </a>
135
                                    <br />
136
                                    <br />
137
                                    <p>
138
                                        <pre>ID: <xsl:value-of select="./docid" /></pre>
139
                                    </p>
140
                                    
141
                                </form>
142
                            </td>
143
                            
144
                            <td class="text_plain">
145
                                <xsl:for-each
146
                                    select="./param[@name='originator/individualName/surName']">
147
                                    <xsl:value-of select="." />
148
                                    <br />
149
                                </xsl:for-each>
150
                                <xsl:for-each
151
                                    select="./param[@name='creator/individualName/surName']">
152
                                    <xsl:value-of select="." />
153
                                    <br />
154
                                </xsl:for-each>
155
                                <xsl:for-each
156
                                    select="./param[@name='idinfo/citation/citeinfo/origin']">
157
                                    <xsl:value-of select="." />
158
                                    <br />
159
                                </xsl:for-each>
160
                                
161
                            </td>
162
                            <td class="text_plain">
163
                                <xsl:value-of
164
                                    select="./param[@name='originator/organizationName']" />
165
                                <xsl:value-of
166
                                    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
                                <xsl:for-each
177
                                    select="./param[@name='keyword/value']">
178
                                    <xsl:value-of select="." />
179
                                    <br />
180
                                </xsl:for-each>
181
                                <xsl:for-each
182
                                    select="./param[@name='idinfo/keywords/theme/themekey']">
183
                                    <xsl:value-of select="." />
184
                                    <br />
185
                                </xsl:for-each>
186
                                
187
                            </td>
188
                            
189
                            <xsl:if test="$enableediting = 'true'">
190
                                <td class="text_plain">
191
                                    <form action="{$contextURL}/metacat" method="POST">
192
                                        <input type="hidden" name="action" value="read" />
193
                                        <input type="hidden" name="qformat" value="{$qformat}" />
194
                                        <input type="hidden" name="sessionid" value="{$sessid}" />
195
                                        <input type="hidden" name="docid">
196
                                            <xsl:attribute name="value">
197
                                                <xsl:value-of select="./docid" />
198
                                            </xsl:attribute>
199
                                        </input>
200
                                        <center>
201
                                            <input type="SUBMIT" value=" View " name="View">
202
                                            </input>
203
                                        </center>
204
                                    </form>
205
                                    <form action="{$cgi-prefix}/register-dataset.cgi" method="POST">
206
                                        <input type="hidden" name="stage" value="modify" />
207
                                        <input type="hidden" name="cfg" value="{$qformat}" />
208
                                        <input type="hidden" name="sessionid" value="{$sessid}" />
209
                                        <input type="hidden" name="docid">
210
                                            <xsl:attribute name="value">
211
                                                <xsl:value-of select="./docid" />
212
                                            </xsl:attribute>
213
                                        </input>
214
                                        <center>
215
                                            <input type="SUBMIT" value=" Edit " name="Edit">
216
                                            </input>
217
                                        </center>
218
                                    </form>
219
                                    <form action="{$cgi-prefix}/register-dataset.cgi" method="POST">
220
                                        <input type="hidden" name="stage" value="delete" />
221
                                        <input type="hidden" name="cfg" value="{$qformat}" />
222
                                        <input type="hidden" name="sessionid" value="{$sessid}" />
223
                                        <input type="hidden" name="docid">
224
                                            <xsl:attribute name="value">
225
                                                <xsl:value-of select="./docid" />
226
                                            </xsl:attribute>
227
                                        </input>
228
                                        <center>
229
                                            <input type="SUBMIT" value="Delete" name="Delete">
230
                                            </input>
231
                                        </center>
232
                                    </form>
233
                                </td>
234
                            </xsl:if>
235
                            <td width="10">&#160;</td>
236
                        </tr>
237
                        <tr>
238
                            <td width="10" class="searchresultslead"></td>
239
                            <td colspan="5" class="searchresultsdivider">&#160;</td>
240
                        </tr>
241
                        
242
                    </xsl:for-each>
243
                </table>
244
                
245
            </xsl:if>
246
        </body>
247
    </xsl:template>
248
    
249
</xsl:stylesheet>