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:43:05 -0700 (Wed, 23 Apr 2008) $'
11
* '$Revision: 3806 $'
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
          <![CDATA[
129
          insertTemplateOpening("]]><xsl:value-of select="$contextURL" /><![CDATA[");
130
          insertSearchBox("]]><xsl:value-of select="$contextURL" /><![CDATA[");
131
         ]]>
132
        </script>
133

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

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

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

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

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

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

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

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

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

    
298
                      <xsl:text>Download</xsl:text>
299
                    </a>
300
                  </td>
301
                </tr>
302

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

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

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

    
335
                      <xsl:text>View Documentation</xsl:text>
336
                    </a>
337

    
338
                    <xsl:text>]</xsl:text>
339
                  </td>
340
                </tr>
341
              </xsl:for-each>
342
            </table>
343
          </xsl:if>
344
        </div>
345
        <script language="JavaScript">
346
          <![CDATA[
347
          insertTemplateClosing("]]><xsl:value-of select="$contextURL" /><![CDATA[");
348
         ]]>
349
        </script>
350
      </body>
351
    </html>
352
  </xsl:template>
353
</xsl:stylesheet>
354

    
(10-10/11)