Project

General

Profile

1 2950 berkley
<?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 3178 sledge
<xsl:stylesheet
32
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
33
    xmlns="http://www.w3.org/1999/xhtml"
34
    version="1.0">
35 2950 berkley
36 3178 sledge
  <xsl:output method="xml" encoding="utf-8"
37
              doctype-public="-//W3C//DTD XHTML 1.1//EN"
38
              doctype-system="http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"
39
              indent="yes" />
40
41 2950 berkley
  <xsl:param name="sessid"/>
42
  <xsl:param name="qformat">default</xsl:param>
43
  <xsl:param name="enableediting">false</xsl:param>
44 3178 sledge
45 2950 berkley
  <xsl:template match="/">
46 3178 sledge
    <html xml:lang="en-US">
47 2950 berkley
      <head>
48 3178 sledge
        <title>Components Search Results</title>
49
        <link rel="stylesheet" type="text/css"
50
            href="@style-skins-path@/{$qformat}/{$qformat}.css" />
51 2950 berkley
        <script language="Javascript" type="text/JavaScript"
52 3180 sledge
            src="@style-skins-path@/{$qformat}/{$qformat}.js">
53
          <xsl:text disable-output-escaping="yes">
54
          </xsl:text>
55
        </script>
56 2950 berkley
        <script language="Javascript" type="text/JavaScript"
57 3180 sledge
            src="@style-common-path@/branding.js">
58
          <xsl:text disable-output-escaping="yes">
59
          </xsl:text>
60
        </script>
61 3178 sledge
        <style type="text/css">
62 2950 berkley
63 3178 sledge
a
64
{
65
    color: inherit;
66
    font-weight: inherit;
67
    font-size: inherit;
68
    text-decoration: underline;
69
}
70
71
72
div.body
73
{
74
    margin-left: 2em;
75
    margin-right: 2em;
76
}
77
78
th.tablehead
79
{
80
    text-align: left;
81
}
82
83
th.tablehead,
84
td.text_plain
85
{
86 3236 sledge
    padding: 0.375em 0.75em 0;
87 3178 sledge
}
88
89
th.tablehead:first-child,
90
td.text_plain:first-child
91
{
92 3236 sledge
    padding: 0.375em 0.375em 0;
93 3178 sledge
}
94
95
td.text_plain
96
{
97
    vertical-align: top;
98
}
99
100
tr.entry td
101
{
102
    border-bottom: 1px solid #ddd;
103
}
104
105 3236 sledge
tr.entry + tr td
106 3178 sledge
{
107
    border-bottom: 1px solid #066;
108
    padding-top: 0.375em;
109
    padding-bottom: 0.375em;
110
}
111
112 3236 sledge
.dl
113 3178 sledge
{
114 3236 sledge
    background: #eeeeee url(@style-skins-path@/<xsl:value-of select="$qformat"/>/download2.png) 2px center no-repeat;
115 3178 sledge
    border: 1px solid black;
116
    font-weight: bold;
117
    text-decoration: none;
118
    padding: 0.063em 0.375em 0.063em 20px;
119 3236 sledge
    font-size: smaller;
120 3178 sledge
}
121
122
        </style>
123 2950 berkley
      </head>
124
125
      <body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
126 3178 sledge
        <script language="JavaScript">
127
insertTemplateOpening();
128
insertSearchBox();
129
        </script>
130 2950 berkley
131 3178 sledge
        <div class="body">
132 3257 berkley
          <xsl:if test="/resultset/pagesize = 0">
133
            <p class="emphasis">
134
              <xsl:number value="count(resultset/document)" /> components found
135
            </p>
136
          </xsl:if>
137
138
          <xsl:if test="/resultset/pagesize &gt; 0">
139
          <table cellspacing="0" cellpadding="0" style="width: 100%;">
140
          <tr>
141
          <td>
142
          <xsl:if test="/resultset/previouspage != -1">
143
            <div class="emphasis">
144
              <a style="font-size: smaller;">
145
                        <xsl:attribute name="href">
146
                          <xsl:text>metacat?action=query&amp;operator=INTERSECT&amp;enableediting=false</xsl:text>
147
148
                          <xsl:if test="count(/resultset/query/pathquery/querygroup/queryterm/value) &gt; 0">
149
                            <xsl:text>&amp;anyfield=</xsl:text>
150
                            <xsl:value-of select="/resultset/query/pathquery/querygroup/queryterm/value"/>
151
                          </xsl:if>
152
153
                          <xsl:if test="count(/resultset/query/pathquery/querygroup/queryterm/value) &lt;= 0">
154
                            <xsl:text>&amp;anyfield=%25</xsl:text>
155
                          </xsl:if>
156
157
                          <xsl:text>&amp;qformat=</xsl:text>
158
                          <xsl:value-of select="$qformat"/>
159
160
                          <xsl:text>&amp;sessionid=</xsl:text>
161
                          <xsl:value-of select="$sessid"/>
162
163
                          <xsl:for-each select="/resultset/query/pathquery/returndoctype">
164
                            <xsl:text>&amp;returndoctype=</xsl:text>
165
                            <xsl:value-of select="."/>
166
                          </xsl:for-each>
167
168
                          <xsl:for-each select="/resultset/query/pathquery/returnfield">
169
                            <xsl:text>&amp;returnfield=</xsl:text>
170
                            <xsl:value-of select="."/>
171
                          </xsl:for-each>
172
173
                          <xsl:text>&amp;pagestart=</xsl:text>
174
                          <xsl:value-of select="/resultset/previouspage"/>
175
176
                          <xsl:text>&amp;pagesize=</xsl:text>
177
                          <xsl:value-of select="/resultset/pagesize"/>
178
                        </xsl:attribute>
179
180
                        <xsl:text>Previous Page</xsl:text>
181
                      </a>
182
            </div>
183
          </xsl:if>
184
          </td>
185 2950 berkley
186 3257 berkley
          <td>
187
          <div class="emphasis">
188
            <a style="font-size: smaller;">
189
                      <xsl:attribute name="href">
190
                        <xsl:text>metacat?action=query&amp;operator=INTERSECT&amp;enableediting=false</xsl:text>
191
192
                        <xsl:if test="count(/resultset/query/pathquery/querygroup/queryterm/value) &gt; 0">
193
                          <xsl:text>&amp;anyfield=</xsl:text>
194
                          <xsl:value-of select="/resultset/query/pathquery/querygroup/queryterm/value"/>
195
                        </xsl:if>
196
197
                        <xsl:if test="count(/resultset/query/pathquery/querygroup/queryterm/value) &lt;= 0">
198
                          <xsl:text>&amp;anyfield=%25</xsl:text>
199
                        </xsl:if>
200
201
                        <xsl:text>&amp;qformat=</xsl:text>
202
                        <xsl:value-of select="$qformat"/>
203
204
                        <xsl:text>&amp;sessionid=</xsl:text>
205
                        <xsl:value-of select="$sessid"/>
206
207
                        <xsl:for-each select="/resultset/query/pathquery/returndoctype">
208
                          <xsl:text>&amp;returndoctype=</xsl:text>
209
                          <xsl:value-of select="."/>
210
                        </xsl:for-each>
211
212
                        <xsl:for-each select="/resultset/query/pathquery/returnfield">
213
                          <xsl:text>&amp;returnfield=</xsl:text>
214
                          <xsl:value-of select="."/>
215
                        </xsl:for-each>
216
217
                        <xsl:text>&amp;pagestart=</xsl:text>
218
                        <xsl:value-of select="/resultset/nextpage"/>
219
220
                        <xsl:text>&amp;pagesize=</xsl:text>
221
                        <xsl:value-of select="/resultset/pagesize"/>
222
                      </xsl:attribute>
223
224
                      <xsl:text>Next Page</xsl:text>
225
                    </a>
226
          </div>
227
          </td>
228
          </tr>
229
          </table>
230
          </xsl:if>
231
232 3178 sledge
          <!-- This tests to see if there are returned documents,
233
              if there are not then don't show the query results -->
234 2950 berkley
235 3178 sledge
          <xsl:if test="count(resultset/document) &gt; 0">
236
            <table cellspacing="0" cellpadding="0" style="width: 100%;">
237
              <tr>
238
                <th class="tablehead" style="width: 1px;"></th>
239
                <th class="tablehead" style="width: 1px;">Component</th>
240
                <th class="tablehead" style="width: 15em;">Author</th>
241
                <th class="tablehead">Version</th>
242 3236 sledge
                <th class="tablehead"></th>
243 3178 sledge
              </tr>
244 2950 berkley
245 3178 sledge
              <xsl:for-each select="resultset/document">
246
                <xsl:sort select="./param[@name='/entity/@name']"/>
247 3236 sledge
                <xsl:variable name="sq">'</xsl:variable>
248 3178 sledge
                <tr class="entry">
249 2950 berkley
250 3178 sledge
                  <td class="text_plain">
251
                    <xsl:value-of select="position()"/>.
252
                  </td>
253 2950 berkley
254 3178 sledge
                  <td class="text_plain" style="white-space: nowrap;">
255
                    <xsl:if test="./param[@name='entity/@name']!=''">
256 3236 sledge
                      <b style="font-size: larger;">
257 2950 berkley
                        <xsl:value-of select="./param[@name='entity/@name']"/>
258 3178 sledge
                      </b>
259
                    </xsl:if>
260
                  </td>
261 2950 berkley
262 3236 sledge
                  <td class="text_plain">
263
                    <xsl:value-of select="./param[@name=concat('entity/property[@name=', $sq, 'documentation', $sq, ']/property[@name=', $sq, 'author', $sq, ']/configure')]"/>
264 3178 sledge
                  </td>
265 2950 berkley
266 3178 sledge
                  <td class="text_plain">
267 3236 sledge
                    <xsl:value-of select="./param[@name=concat('entity/property[@name=', $sq, 'documentation', $sq, ']/property[@name=', $sq, 'version', $sq, ']/configure')]"/>
268 3178 sledge
                  </td>
269 2950 berkley
270 3236 sledge
                  <td class="text_plain">
271
                    <a class="dl">
272
                      <xsl:attribute name="href">
273
                        <xsl:text>http://@server@/authority/data?lsid=</xsl:text>
274
                        <xsl:value-of select="./param[@name=concat('entity/property[@name=', $sq, 'karId', $sq, ']/@value')]"/>
275
                      </xsl:attribute>
276
277
                      <xsl:text>Download</xsl:text>
278
                    </a>
279
                  </td>
280
281
                  <!--xsl:if test="$enableediting = 'true'">
282 3178 sledge
                    <td class="text_plain">
283
                      <form action="@servlet-path@" method="get">
284
                        <input type="hidden" name="action" value="read"/>
285
                        <input type="hidden" name="qformat" value="{$qformat}"/>
286
                        <input type="hidden" name="sessionid"  value="{$sessid}"/>
287 2950 berkley
288 3178 sledge
                        <input type="hidden" name="docid">
289
                          <xsl:attribute name="value">
290
                            <xsl:value-of select="./docid"/>
291
                          </xsl:attribute>
292
                        </input>
293
294
                        <center>
295
                          <input type="SUBMIT"  value=" View " name="View"></input>
296
                        </center>
297
                      </form>
298
299
                      <form action="@cgi-prefix@/register-dataset.cgi" method="get">
300
                        <input type="hidden" name="stage" value="modify"/>
301
                        <input type="hidden" name="cfg" value="{$qformat}"/>
302
                        <input type="hidden" name="sessionid"  value="{$sessid}"/>
303
304
                        <input type="hidden" name="docid">
305
                          <xsl:attribute name="value">
306
                            <xsl:value-of select="./docid"/>
307
                          </xsl:attribute>
308
                        </input>
309
310
                        <center>
311
                          <input type="SUBMIT"  value=" Edit " name="Edit"></input>
312
                        </center>
313
                      </form>
314
315
                      <form action="@cgi-prefix@/register-dataset.cgi" method="get">
316
                        <input type="hidden" name="stage" value="delete"/>
317
                        <input type="hidden" name="cfg" value="{$qformat}"/>
318
                        <input type="hidden" name="sessionid"  value="{$sessid}"/>
319
320
                        <input type="hidden" name="docid">
321
                          <xsl:attribute name="value">
322
                            <xsl:value-of select="./docid"/>
323
                          </xsl:attribute>
324
                        </input>
325
326
                        <center>
327
                          <input type="SUBMIT"  value="Delete" name="Delete"></input>
328
                        </center>
329
                      </form>
330
                    </td>
331 3180 sledge
                  </xsl:if-->
332 3178 sledge
                </tr>
333
334
                <tr>
335
                  <td class="text_plain"></td>
336
                  <td class="text_plain" colspan="6">
337 3236 sledge
                    <xsl:variable name="docClip" select="substring(./param[@name=concat('entity/property[@name=', $sq, 'documentation', $sq, ']/property[@name=', $sq, 'description', $sq, ']/configure')], 0, 200)"/>
338
                    <xsl:value-of select="$docClip"/>
339
                    <xsl:text> </xsl:text>
340
                    <xsl:value-of select="substring(./param[@name=concat('entity/property[@name=', $sq, 'documentation', $sq, ']/property[@name=', $sq, 'userLevelDocumentation', $sq, ']/configure')], 0, 200 - $docClip)"/>
341
                    <xsl:text>... [</xsl:text>
342 3178 sledge
343 3236 sledge
                    <a style="font-size: smaller;">
344 3178 sledge
                      <xsl:attribute name="href">
345
                        <xsl:text>metacat?qformat=</xsl:text>
346
                        <xsl:value-of select="$qformat"/>
347
                        <xsl:text>&amp;sessionid=</xsl:text>
348
                        <xsl:value-of select="$sessid"/>
349
                        <xsl:text>&amp;action=read&amp;docid=</xsl:text>
350
                        <xsl:value-of select="./docid"/>
351
352
                        <xsl:if test="$enableediting = 'true'">
353
                          <xsl:text>&amp;enableediting=</xsl:text>
354
                          <xsl:value-of select="$enableediting"/>
355
                        </xsl:if>
356
                      </xsl:attribute>
357
358 3180 sledge
                      <xsl:text>View Documentation</xsl:text>
359 3178 sledge
                    </a>
360
361 3236 sledge
                    <xsl:text>]</xsl:text>
362 3178 sledge
                  </td>
363
                </tr>
364
              </xsl:for-each>
365
            </table>
366
          </xsl:if>
367
        </div>
368
        <script language="JavaScript">
369
insertTemplateClosing();
370
        </script>
371
      </body>
372 2950 berkley
    </html>
373 3178 sledge
  </xsl:template>
374
</xsl:stylesheet>