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: berkley $'
10
*     '$Date: 2007-05-08 11:41:26 -0700 (Tue, 08 May 2007) $'
11
* '$Revision: 3262 $'
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
32
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
33
    xmlns="http://www.w3.org/1999/xhtml"
34
    version="1.0">
35

    
36
  <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
  <xsl:param name="sessid"/>
42
  <xsl:param name="qformat">default</xsl:param>
43
  <xsl:param name="enableediting">false</xsl:param>
44

    
45
  <xsl:template match="/">
46
    <html xml:lang="en-US">
47
      <head>
48
        <title>Components Search Results</title>
49
        <link rel="stylesheet" type="text/css"
50
            href="@style-skins-path@/{$qformat}/{$qformat}.css" />
51
        <script language="Javascript" type="text/JavaScript"
52
            src="@style-skins-path@/{$qformat}/{$qformat}.js">
53
          <xsl:text disable-output-escaping="yes">
54
          </xsl:text>
55
        </script>
56
        <script language="Javascript" type="text/JavaScript"
57
            src="@style-common-path@/branding.js">
58
          <xsl:text disable-output-escaping="yes">
59
          </xsl:text>
60
        </script>
61
        <style type="text/css">
62

    
63
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
    padding: 0.375em 0.75em 0;
87
}
88

    
89
th.tablehead:first-child,
90
td.text_plain:first-child
91
{
92
    padding: 0.375em 0.375em 0;
93
}
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
tr.entry + tr td
106
{
107
    border-bottom: 1px solid #066;
108
    padding-top: 0.375em;
109
    padding-bottom: 0.375em;
110
}
111

    
112
.dl
113
{
114
    background: #eeeeee url(@style-skins-path@/<xsl:value-of select="$qformat"/>/download2.png) 2px center no-repeat;
115
    border: 1px solid black;
116
    font-weight: bold;
117
    text-decoration: none;
118
    padding: 0.063em 0.375em 0.063em 20px;
119
    font-size: smaller;
120
}
121

    
122
        </style>
123
      </head>
124

    
125
      <body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
126
        <script language="JavaScript">
127
insertTemplateOpening();
128
insertSearchBox();
129
        </script>
130

    
131
        <div class="body">
132
          <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
          <!-- paging code here -->
139
          <xsl:if test="/resultset/pagesize &gt; 0">
140
          <table cellspacing="0" cellpadding="0" style="width: 50%;">
141
          <tr>
142
          <td>
143
          <xsl:choose>
144
            <xsl:when test="/resultset/previouspage != -1">
145
              <div class="emphasis">
146
                <a style="font-size: smaller;">
147
                          <xsl:attribute name="href">
148
                            <xsl:text>metacat?action=query&amp;operator=INTERSECT&amp;enableediting=false</xsl:text>
149
                            
150
                            <xsl:if test="count(/resultset/query/pathquery/querygroup/queryterm/value) &gt; 0">
151
                              <xsl:text>&amp;anyfield=</xsl:text>
152
                              <xsl:value-of select="/resultset/query/pathquery/querygroup/queryterm/value"/>
153
                            </xsl:if>
154
                            
155
                            <xsl:if test="count(/resultset/query/pathquery/querygroup/queryterm/value) &lt;= 0">
156
                              <xsl:text>&amp;anyfield=%25</xsl:text>
157
                            </xsl:if>
158
                            
159
                            <xsl:text>&amp;qformat=</xsl:text>
160
                            <xsl:value-of select="$qformat"/>
161
                            
162
                            <xsl:text>&amp;sessionid=</xsl:text>
163
                            <xsl:value-of select="$sessid"/>
164
                            
165
                            <xsl:for-each select="/resultset/query/pathquery/returndoctype">
166
                              <xsl:text>&amp;returndoctype=</xsl:text>
167
                              <xsl:value-of select="."/>
168
                            </xsl:for-each>
169
                            
170
                            <xsl:for-each select="/resultset/query/pathquery/returnfield">
171
                              <xsl:text>&amp;returnfield=</xsl:text>
172
                              <xsl:value-of select="."/>
173
                            </xsl:for-each>
174
                            
175
                            <xsl:text>&amp;pagestart=</xsl:text>
176
                            <xsl:value-of select="/resultset/previouspage"/>
177
                            
178
                            <xsl:text>&amp;pagesize=</xsl:text>
179
                            <xsl:value-of select="/resultset/pagesize"/>
180
                          </xsl:attribute>
181
    
182
                          <xsl:text>Previous Page</xsl:text>
183
                        </a>
184
              </div>
185
            </xsl:when>
186
            <xsl:otherwise>
187
              <div class="emphasis-grey">
188
                Previous Page
189
              </div>
190
            </xsl:otherwise>
191
          </xsl:choose>
192
          </td>
193

    
194
          <td>
195
          <xsl:choose>
196
            <xsl:when test="/resultset/lastpage = 'false'">
197
              <div class="emphasis">
198
                <a style="font-size: smaller;">
199
                          <xsl:attribute name="href">
200
                            <xsl:text>metacat?action=query&amp;operator=INTERSECT&amp;enableediting=false</xsl:text>
201
                            
202
                            <xsl:if test="count(/resultset/query/pathquery/querygroup/queryterm/value) &gt; 0">
203
                              <xsl:text>&amp;anyfield=</xsl:text>
204
                              <xsl:value-of select="/resultset/query/pathquery/querygroup/queryterm/value"/>
205
                            </xsl:if>
206
                            
207
                            <xsl:if test="count(/resultset/query/pathquery/querygroup/queryterm/value) &lt;= 0">
208
                              <xsl:text>&amp;anyfield=%25</xsl:text>
209
                            </xsl:if>
210
                            
211
                            <xsl:text>&amp;qformat=</xsl:text>
212
                            <xsl:value-of select="$qformat"/>
213
                            
214
                            <xsl:text>&amp;sessionid=</xsl:text>
215
                            <xsl:value-of select="$sessid"/>
216
                            
217
                            <xsl:for-each select="/resultset/query/pathquery/returndoctype">
218
                              <xsl:text>&amp;returndoctype=</xsl:text>
219
                              <xsl:value-of select="."/>
220
                            </xsl:for-each>
221
                            
222
                            <xsl:for-each select="/resultset/query/pathquery/returnfield">
223
                              <xsl:text>&amp;returnfield=</xsl:text>
224
                              <xsl:value-of select="."/>
225
                            </xsl:for-each>
226
                            
227
                            <xsl:text>&amp;pagestart=</xsl:text>
228
                            <xsl:value-of select="/resultset/nextpage"/>
229
                            
230
                            <xsl:text>&amp;pagesize=</xsl:text>
231
                            <xsl:value-of select="/resultset/pagesize"/>
232
                          </xsl:attribute>
233
    
234
                          <xsl:text>Next Page</xsl:text>
235
                        </a>
236
              </div>
237
            </xsl:when>
238
            <xsl:otherwise>
239
              <div class="emphasis-grey">
240
                Next Page
241
              </div>
242
            </xsl:otherwise>
243
          </xsl:choose>
244
          </td>
245
          </tr>
246
          </table>
247
          </xsl:if>
248
          <!-- end paging code -->
249
          
250
          <!-- This tests to see if there are returned documents,
251
              if there are not then don't show the query results -->
252

    
253
          <xsl:if test="count(resultset/document) &gt; 0">
254
            <table cellspacing="0" cellpadding="0" style="width: 100%;">
255
              <tr>
256
                <th class="tablehead" style="width: 1px;"></th>
257
                <th class="tablehead" style="width: 1px;">Component</th>
258
                <th class="tablehead" style="width: 15em;">Author</th>
259
                <th class="tablehead">Version</th>
260
                <th class="tablehead"></th>
261
              </tr>
262

    
263
              <xsl:for-each select="resultset/document">
264
                <xsl:sort select="./param[@name='/entity/@name']"/>
265
                <xsl:variable name="sq">'</xsl:variable>
266
                <tr class="entry">
267

    
268
                  <td class="text_plain">
269
                    <xsl:value-of select="position()"/>.
270
                  </td>
271

    
272
                  <td class="text_plain" style="white-space: nowrap;">
273
                    <xsl:if test="./param[@name='entity/@name']!=''">
274
                      <b style="font-size: larger;">
275
                        <xsl:value-of select="./param[@name='entity/@name']"/>
276
                      </b>
277
                    </xsl:if>
278
                  </td>
279

    
280
                  <td class="text_plain">
281
                    <xsl:value-of select="./param[@name=concat('entity/property[@name=', $sq, 'documentation', $sq, ']/property[@name=', $sq, 'author', $sq, ']/configure')]"/>
282
                  </td>
283

    
284
                  <td class="text_plain">
285
                    <xsl:value-of select="./param[@name=concat('entity/property[@name=', $sq, 'documentation', $sq, ']/property[@name=', $sq, 'version', $sq, ']/configure')]"/>
286
                  </td>
287

    
288
                  <td class="text_plain">
289
                    <a class="dl">
290
                      <xsl:attribute name="href">
291
                        <xsl:text>http://@server@/authority/data?lsid=</xsl:text>
292
                        <xsl:value-of select="./param[@name=concat('entity/property[@name=', $sq, 'karId', $sq, ']/@value')]"/>
293
                      </xsl:attribute>
294

    
295
                      <xsl:text>Download</xsl:text>
296
                    </a>
297
                  </td>
298
                </tr>
299

    
300
                <tr>
301
                  <td class="text_plain"></td>
302
                  <td class="text_plain" colspan="6">
303
                    <xsl:variable name="docClip" select="substring(./param[@name=concat('entity/property[@name=', $sq, 'documentation', $sq, ']/property[@name=', $sq, 'description', $sq, ']/configure')], 0, 200)"/>
304
                    <xsl:value-of select="$docClip"/>
305
                    <xsl:text> </xsl:text>
306
                    <xsl:value-of select="substring(./param[@name=concat('entity/property[@name=', $sq, 'documentation', $sq, ']/property[@name=', $sq, 'userLevelDocumentation', $sq, ']/configure')], 0, 200 - $docClip)"/>
307
                    <xsl:text>... [</xsl:text>
308

    
309
                    <a style="font-size: smaller;">
310
                      <xsl:attribute name="href">
311
                        <xsl:text>metacat?qformat=</xsl:text>
312
                        <xsl:value-of select="$qformat"/>
313
                        <xsl:text>&amp;sessionid=</xsl:text>
314
                        <xsl:value-of select="$sessid"/>
315
                        <xsl:text>&amp;action=read&amp;docid=</xsl:text>
316
                        <xsl:value-of select="./docid"/>
317

    
318
                        <xsl:if test="$enableediting = 'true'">
319
                          <xsl:text>&amp;enableediting=</xsl:text>
320
                          <xsl:value-of select="$enableediting"/>
321
                        </xsl:if>
322
                      </xsl:attribute>
323

    
324
                      <xsl:text>View Documentation</xsl:text>
325
                    </a>
326

    
327
                    <xsl:text>]</xsl:text>
328
                  </td>
329
                </tr>
330
              </xsl:for-each>
331
            </table>
332
          </xsl:if>
333
        </div>
334
        <script language="JavaScript">
335
insertTemplateClosing();
336
        </script>
337
      </body>
338
    </html>
339
  </xsl:template>
340
</xsl:stylesheet>
341

    
(10-10/11)