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="cgi-url" select='string("")'/>
47
  <xsl:param name="sessid"/>
48
  <xsl:param name="enableediting">false</xsl:param>
49
  <!-- This parameter gets overidden by the chosen default qformat -->
50
  <xsl:param name="qformat">default</xsl:param>
51

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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