Project

General

Profile

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$'
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
  <!-- import the header, footer, and sidebars for customized styling -->
34
  <xsl:import href="@systemidserver@@style-skins-path@/@default-style@/templates/xsl/pageheader.xsl"/>
35
  <xsl:import href="@systemidserver@@style-skins-path@/@default-style@/templates/xsl/pagefooter.xsl"/>
36
  <xsl:import href="@systemidserver@@style-skins-path@/@default-style@/templates/xsl/page_leftsidebar.xsl"/>
37
  <xsl:import href="@systemidserver@@style-skins-path@/@default-style@/templates/xsl/page_rightsidebar.xsl"/>
38
  <xsl:import href="@systemidserver@@style-skins-path@/@default-style@/templates/xsl/loginbox.xsl"/>
39
  <xsl:import href="@systemidserver@@style-skins-path@/@default-style@/templates/xsl/searchbox.xsl"/>
40

    
41
  <!-- send the resultset back to the browser styled in HTML -->
42
  <xsl:output method="html" encoding="iso-8859-1" indent="yes" standalone="yes"
43
    doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
44
    doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" />
45

    
46
  <xsl:param name="sessid"/>
47
  <xsl:param name="enableediting">false</xsl:param>
48
  <!-- This parameter gets overidden by the chosen default qformat -->
49
  <xsl:param name="qformat">default</xsl:param>
50

    
51
  <!-- The main template matches the XML document root -->
52
  <xsl:template match="/">
53
   <html>
54
      <head>
55
        <link rel="stylesheet" type="text/css" 
56
              href="@style-skins-path@/{$qformat}/{$qformat}.css" />
57
        <script language="Javascript" type="text/JavaScript"
58
          src="@style-skins-path@/{$qformat}/{$qformat}.js" />
59
        <script language="Javascript" type="text/JavaScript"
60
          src="@style-common-path@/branding.js" />
61
        <script language="JavaScript">
62
          <![CDATA[
63
          function submitform(action,form_ref) {
64
              form_ref.action.value=action;
65
              form_ref.sessionid.value="]]><xsl:value-of select="$sessid" /><![CDATA[";
66
              form_ref.qformat.value="]]><xsl:value-of select="$qformat" /><![CDATA[";
67
              form_ref.submit();
68
          }
69
          ]]>
70
        </script>
71
      </head>
72

    
73
      <body>
74
        <!-- begin the header area -->
75
        <xsl:call-template name="pageheader" />
76
        <!-- end the header area -->
77
   
78
        <!-- begin the left sidebar area -->
79
        <xsl:call-template name="page_leftsidebar" />
80
        <!-- end the left sidebar area -->
81
   
82
        <!-- begin the content area -->
83
        <div id="content">
84

    
85
          <!-- begin login form area -->
86
          <xsl:call-template name="loginbox" />
87
          <!-- end login form area -->
88

    
89
          <!-- begin search form area -->
90
          <xsl:call-template name="searchbox" />
91
          <!-- end search form area -->
92

    
93
          <!-- begin results section (XSLT generated) -->
94

    
95
          <!-- State how many package hits were returned -->
96
          <xsl:choose>
97
            <xsl:when test="count(resultset/document)=1">
98
              <p>
99
              <xsl:number value="count(resultset/document)" /> data package found:
100
              </p>
101
            </xsl:when>
102
            <xsl:otherwise>
103
              <p>
104
              <xsl:number value="count(resultset/document)" /> data packages found:
105
              </p>
106
            </xsl:otherwise>
107
          </xsl:choose>
108
          
109
          <!-- This tests to see if there are returned documents,
110
          if there are not then don't show the query results -->
111
          <xsl:if test="count(resultset/document) &gt; 0">
112

    
113
            <!-- create the results table, and style each of the returnfield that
114
            were specified in the original query -->
115
            <table class="group group_border">
116
              <tr>
117
                <th class="wide_column">Title</th>
118
                <th>Contacts</th>
119
                <th>Organization</th>
120
                <th>Associated Data</th>
121
                <xsl:if test="$enableediting = 'true'">
122
                  <th>Actions</th>
123
                </xsl:if>
124
              </tr>
125
          
126
            <xsl:for-each select="resultset/document">
127
              <xsl:sort select="./param[@name='dataset/title']"/>
128
              <tr>
129
                <td>
130
                <xsl:attribute name="class">
131
                  <xsl:choose>
132
                    <xsl:when test="position() mod 2 = 1">rowodd</xsl:when>
133
                    <xsl:when test="position() mod 2 = 0">roweven</xsl:when>
134
                  </xsl:choose>
135
                </xsl:attribute>
136
          
137
                  <!--
138
                  Build a submit form to view the data package details, using hidden
139
                  fields to POST the query values.
140
                  --> 
141
                  <form action="@servlet-path@" method="POST">
142
              <xsl:attribute name="name">
143
                <xsl:value-of select="translate(./docid, '()-.', '')" />
144
              </xsl:attribute>
145
                    <input type="hidden" name="qformat" />
146
                    <input type="hidden" name="sessionid" />
147
              <xsl:if test="$enableediting = 'true'">
148
                <input type="hidden" name="enableediting" value="{$enableediting}"/>
149
              </xsl:if>
150
                    <input type="hidden" name="action" value="read"/>
151
                    <input type="hidden" name="docid">
152
                <xsl:attribute name="value">
153
                  <xsl:value-of select="./docid"/>
154
                </xsl:attribute>
155
                    </input>
156
              <xsl:for-each select="./relation">
157
                <input type="hidden" name="docid">
158
                  <xsl:attribute name="value" >
159
                    <xsl:value-of select="./relationdoc" />
160
                  </xsl:attribute>
161
                </input>
162
              </xsl:for-each>
163

    
164
              <!-- Create the link on the title column -->
165
              <a>
166
                <xsl:attribute name="href">javascript:submitform('read',document.<xsl:value-of select="translate(./docid, '()-.', '')"/>)</xsl:attribute>
167
                <xsl:choose>
168
                  <xsl:when test="./param[@name='dataset/title']!=''">
169
               <xsl:value-of select="./param[@name='dataset/title']"/>
170
                  </xsl:when>
171
                  <xsl:otherwise>
172
                    <xsl:value-of select="./param[@name='citation/title']"/>
173
                    <xsl:value-of select="./param[@name='software/title']"/>
174
                    <xsl:value-of select="./param[@name='protocol/title']"/>
175
                  </xsl:otherwise>
176
                </xsl:choose>
177
              </a>
178

    
179
              <!-- Include the docid in the title output -->
180
              <xsl:text>(</xsl:text>
181
                <xsl:value-of select="./docid"/>
182
              <xsl:text>)</xsl:text>
183
                  </form>
184
                </td>
185
          
186
              <!-- style the contacts returned -->
187
                <td>
188
                <xsl:attribute name="class">
189
                  <xsl:choose>
190
                    <xsl:when test="position() mod 2 = 1">rowodd</xsl:when>
191
                    <xsl:when test="position() mod 2 = 0">roweven</xsl:when>
192
                  </xsl:choose>
193
                </xsl:attribute>
194
          
195
                  <xsl:for-each select="./param[@name='originator/individualName/surName']" >
196
              <xsl:value-of select="." />
197
                  <br />
198
             </xsl:for-each>
199
                  <xsl:for-each select="./param[@name='creator/individualName/surName']" >
200
              <xsl:value-of select="." />
201
                  <br />
202
                  </xsl:for-each>
203
                </td>
204

    
205
              <!-- style the contacts returned -->
206
                <td>
207
                <xsl:attribute name="class">
208
                  <xsl:choose>
209
                    <xsl:when test="position() mod 2 = 1">rowodd</xsl:when>
210
                    <xsl:when test="position() mod 2 = 0">roweven</xsl:when>
211
                  </xsl:choose>
212
                </xsl:attribute>
213
          
214
              <xsl:value-of select="./param[@name='originator/organizationName']" />
215
              <xsl:value-of select="./param[@name='creator/organizationName']" />
216
                </td>
217
          
218
              <!-- style the keywords returned -->
219
              <!--
220
                <td>
221
                <xsl:attribute name="class">
222
                  <xsl:choose>
223
                    <xsl:when test="position() mod 2 = 1">rowodd</xsl:when>
224
                    <xsl:when test="position() mod 2 = 0">roweven</xsl:when>
225
                  </xsl:choose>
226
                </xsl:attribute>
227
          
228
                  <xsl:for-each select="./param[@name='keyword']">
229
                  <xsl:value-of select="." />
230
                  <br />
231
                  </xsl:for-each>
232
                </td>
233
              -->
234

    
235
              <!-- create links to each of the associated raw data entities -->
236
                <td>
237
                <xsl:attribute name="class">
238
                  <xsl:choose>
239
                    <xsl:when test="position() mod 2 = 1">rowodd</xsl:when>
240
                    <xsl:when test="position() mod 2 = 0">roweven</xsl:when>
241
                  </xsl:choose>
242
                </xsl:attribute>
243
                  <!-- take each entity name and link it to the physical object url-->
244
                  <xsl:for-each select="./param[@name='dataTable/entityName']">
245
                  <a>
246
                  <xsl:variable name="URL"
247
                    select="following-sibling::param[@name='dataTable/physical/distribution/online/url']" />
248
                    <!-- strip out the ecogrid:// syntax if it's there -->
249
                    <xsl:choose>
250
                      <xsl:when test="starts-with($URL,'ecogrid')">
251
                        <xsl:variable name="URL1" select="substring-after($URL, 'ecogrid://')"/>
252
                        <xsl:variable name="docID" select="substring-after($URL1, '/')"/>
253
                        <xsl:attribute name="href">
254
                          <!-- this needs to be on one line ... -->
255
                          <xsl:text>@systemidserver@@servlet-path@?action=read&amp;qformat=</xsl:text><xsl:value-of select="$qformat"/><xsl:text>&amp;docid=</xsl:text><xsl:value-of select="$docID"/>
256
                        </xsl:attribute>
257
                      </xsl:when>
258
                      <xsl:otherwise>
259
                        <xsl:attribute name="href"><xsl:value-of select="$URL"/></xsl:attribute>
260
                      </xsl:otherwise>
261
                    </xsl:choose>
262
                  <!-- show the entityName value as the link -->
263
                  <xsl:value-of select="." />
264
                  </a>
265
                  <br />
266
                  </xsl:for-each>
267
                </td>
268
              
269
                <xsl:if test="$enableediting = 'true'">
270
                <td>
271
                <xsl:attribute name="class">
272
                  <xsl:choose>
273
                    <xsl:when test="position() mod 2 = 1">rowodd</xsl:when>
274
                    <xsl:when test="position() mod 2 = 0">roweven</xsl:when>
275
                  </xsl:choose>
276
                </xsl:attribute>
277
          
278
                  <form action="@servlet-path@" method="POST">
279
                    <input type="hidden" name="action" value="read"/>
280
               <input type="hidden" name="qformat" value="{$qformat}"/>
281
                 <input type="hidden" name="sessionid"  value="{$sessid}"/>
282
                    <input type="hidden" name="docid">
283
                    <xsl:attribute name="value">
284
                 <xsl:value-of select="./docid"/>
285
                    </xsl:attribute>
286
                    </input>
287
                    <center>
288
                    <input type="SUBMIT"  value=" View " name="View">
289
               </input>
290
                    </center>
291
                  </form>
292
              <form action="@cgi-prefix@/register-dataset.cgi" 
293
                    method="POST">
294
                    <input type="hidden" name="stage" value="modify"/>  
295
                   <input type="hidden" name="cfg" value="{$qformat}"/>
296
                   <input type="hidden" name="sessionid"  value="{$sessid}"/>
297
                <input type="hidden" name="docid">
298
                  <xsl:attribute name="value">
299
                    <xsl:value-of select="./docid"/>
300
                  </xsl:attribute>
301
                </input>
302
                    <input type="SUBMIT"  value=" Edit " name="Edit">
303
                 </input>
304
                  </form>
305
              <form action="@cgi-prefix@/register-dataset.cgi" 
306
                    method="POST">
307
                    <input type="hidden" name="stage" value="delete"/>  
308
                   <input type="hidden" name="cfg" value="{$qformat}"/>
309
                   <input type="hidden" name="sessionid"  value="{$sessid}"/>
310
                <input type="hidden" name="docid">
311
                  <xsl:attribute name="value">
312
                    <xsl:value-of select="./docid"/>
313
                  </xsl:attribute>
314
                </input>
315
                    <input type="submit"  value="Delete" name="Delete">
316
                 </input>
317
                  </form>
318
                </td>    
319
                </xsl:if>
320
                </tr>
321
             </xsl:for-each>
322
             </table>
323
           </xsl:if>
324

    
325
        </div>
326
        <!-- end content area -->
327

    
328
        <!-- begin the right sidebar area -->
329
        <xsl:call-template name="page_rightsidebar" />
330
        <!-- end the right sidebar area -->
331

    
332
        <!-- begin the footer area -->
333
        <xsl:call-template name="pagefooter" />
334
        <!-- end the footer area -->
335

    
336
      </body>
337
    </html>
338
  </xsl:template>
339

    
340
</xsl:stylesheet>
(6-6/7)