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: leinfelder $'
10
*     '$Date: 2008-04-23 15:10:43 -0700 (Wed, 23 Apr 2008) $'
11
* '$Revision: 3805 $'
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
  <xsl:param name="contextURL"/>
45

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

    
64
a
65
{
66
    color: inherit;
67
    font-weight: inherit;
68
    font-size: inherit; 
69
    text-decoration: underline;
70
}
71

    
72

    
73
div.body
74
{
75
    margin-left: 2em;
76
    margin-right: 2em;
77
}
78

    
79
th.tablehead
80
{
81
    text-align: left;
82
}
83

    
84
th.tablehead,
85
td.text_plain
86
{
87
    padding: 0.375em 0.75em 0;
88
}
89

    
90
th.tablehead:first-child,
91
td.text_plain:first-child
92
{
93
    padding: 0.375em 0.375em 0;
94
}
95

    
96
td.text_plain
97
{
98
    vertical-align: top;
99
}
100

    
101
tr.entry td
102
{
103
    border-bottom: 1px solid #ddd;
104
}
105

    
106
tr.entry + tr td
107
{
108
    border-bottom: 1px solid #066;
109
    padding-top: 0.375em;
110
    padding-bottom: 0.375em;
111
}
112

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

    
123
        </style>
124
      </head>
125

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

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

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

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

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

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

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

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

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

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

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

    
301
                <tr>
302
                  <td class="text_plain"></td>
303
                  <td class="text_plain" colspan="6">
304
                    <xsl:variable name="docClip" select="substring(./param[@name=concat('entity/property[@name=', $sq, 'KeplerDocumentation', $sq, ']/property[@name=', $sq, 'userLevelDocumentation', $sq, ']/configure')], 0, 200)"/>
305
                    <xsl:value-of select="$docClip"/>
306
                    <xsl:text> </xsl:text>
307
                    <!-- <xsl:if test="count(/entity/property[@name='KeplerDocumentation']/property[@name='userLevelDocumentation']/configure) &gt; 0">
308
                      <p><xsl:value-of select="/entity/property[@name='KeplerDocumentation']/property[@name='userLevelDocumentation']/configure"/></p>
309
                    </xsl:if> -->
310
                    <!-- <xsl:value-of select="substring(./param[@name=concat('entity/property[@name=', $sq, 'KeplerDocumentation', $sq, ']/property[@name=', $sq, 'userLevelDocumentation', $sq, ']/configure')], 0, 200 - $docClip)"/> -->
311
                    <!--<xsl:for-each select="./param[@name=concat('entity/property[@name=', $sq, 'KeplerDocumentation', $sq, ']/property[@name=', $sq, 'userLevelDocumentation', $sq, ']/configure/p')]">
312
                      <p>
313
                        <xsl:value-of select="."/>
314
                      </p>
315
                    </xsl:for-each>-->
316
                    <xsl:text>... [</xsl:text>
317

    
318
                    <a style="font-size: smaller;">
319
                      <xsl:attribute name="href">
320
                        <xsl:text>metacat?qformat=</xsl:text>
321
                        <xsl:value-of select="$qformat"/>
322
                        <xsl:text>&amp;sessionid=</xsl:text>
323
                        <xsl:value-of select="$sessid"/>
324
                        <xsl:text>&amp;action=read&amp;docid=</xsl:text>
325
                        <xsl:value-of select="./docid"/>
326

    
327
                        <xsl:if test="$enableediting = 'true'">
328
                          <xsl:text>&amp;enableediting=</xsl:text>
329
                          <xsl:value-of select="$enableediting"/>
330
                        </xsl:if>
331
                      </xsl:attribute>
332

    
333
                      <xsl:text>View Documentation</xsl:text>
334
                    </a>
335

    
336
                    <xsl:text>]</xsl:text>
337
                  </td>
338
                </tr>
339
              </xsl:for-each>
340
            </table>
341
          </xsl:if>
342
        </div>
343
        <script language="JavaScript">
344
insertTemplateClosing("{$contextURL}");
345
        </script>
346
      </body>
347
    </html>
348
  </xsl:template>
349
</xsl:stylesheet>
350

    
(10-10/11)