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 3805 leinfelder
  <xsl:param name="contextURL"/>
45 3178 sledge
46 2950 berkley
  <xsl:template match="/">
47 3178 sledge
    <html xml:lang="en-US">
48 2950 berkley
      <head>
49 3178 sledge
        <title>Components Search Results</title>
50
        <link rel="stylesheet" type="text/css"
51 3780 daigle
            href="{$contextURL}/style/skins/{$qformat}/{$qformat}.css" />
52 2950 berkley
        <script language="Javascript" type="text/JavaScript"
53 3780 daigle
            src="{$contextURL}/style/skins/{$qformat}/{$qformat}.js">
54 3180 sledge
          <xsl:text disable-output-escaping="yes">
55
          </xsl:text>
56
        </script>
57 2950 berkley
        <script language="Javascript" type="text/JavaScript"
58 3780 daigle
            src="{$contextURL}/style/common/branding.js">
59 3180 sledge
          <xsl:text disable-output-escaping="yes">
60
          </xsl:text>
61
        </script>
62 3178 sledge
        <style type="text/css">
63 2950 berkley
64 3178 sledge
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 3236 sledge
    padding: 0.375em 0.75em 0;
88 3178 sledge
}
89
90
th.tablehead:first-child,
91
td.text_plain:first-child
92
{
93 3236 sledge
    padding: 0.375em 0.375em 0;
94 3178 sledge
}
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 3236 sledge
tr.entry + tr td
107 3178 sledge
{
108
    border-bottom: 1px solid #066;
109
    padding-top: 0.375em;
110
    padding-bottom: 0.375em;
111
}
112
113 3236 sledge
.dl
114 3178 sledge
{
115 3780 daigle
    background: #eeeeee url({$contextURL}/style/skins/<xsl:value-of select="$qformat"/>/download2.png) 2px center no-repeat;
116 3178 sledge
    border: 1px solid black;
117
    font-weight: bold;
118
    text-decoration: none;
119
    padding: 0.063em 0.375em 0.063em 20px;
120 3236 sledge
    font-size: smaller;
121 3178 sledge
}
122
123
        </style>
124 2950 berkley
      </head>
125
126
      <body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
127 3178 sledge
        <script language="JavaScript">
128 3806 leinfelder
          <![CDATA[
129
          insertTemplateOpening("]]><xsl:value-of select="$contextURL" /><![CDATA[");
130
          insertSearchBox("]]><xsl:value-of select="$contextURL" /><![CDATA[");
131
         ]]>
132 3178 sledge
        </script>
133 2950 berkley
134 3178 sledge
        <div class="body">
135 3257 berkley
          <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 3262 berkley
          <!-- paging code here -->
142 3257 berkley
          <xsl:if test="/resultset/pagesize &gt; 0">
143 3262 berkley
          <table cellspacing="0" cellpadding="0" style="width: 50%;">
144 3257 berkley
          <tr>
145
          <td>
146 3262 berkley
          <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 3257 berkley
          </td>
196 2950 berkley
197 3257 berkley
          <td>
198 3262 berkley
          <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 3257 berkley
          </td>
248
          </tr>
249
          </table>
250
          </xsl:if>
251 3262 berkley
          <!-- end paging code -->
252 3257 berkley
253 3178 sledge
          <!-- This tests to see if there are returned documents,
254
              if there are not then don't show the query results -->
255 2950 berkley
256 3178 sledge
          <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 3236 sledge
                <th class="tablehead"></th>
264 3178 sledge
              </tr>
265 2950 berkley
266 3178 sledge
              <xsl:for-each select="resultset/document">
267
                <xsl:sort select="./param[@name='/entity/@name']"/>
268 3236 sledge
                <xsl:variable name="sq">'</xsl:variable>
269 3178 sledge
                <tr class="entry">
270 2950 berkley
271 3178 sledge
                  <td class="text_plain">
272
                    <xsl:value-of select="position()"/>.
273
                  </td>
274 2950 berkley
275 3178 sledge
                  <td class="text_plain" style="white-space: nowrap;">
276
                    <xsl:if test="./param[@name='entity/@name']!=''">
277 3236 sledge
                      <b style="font-size: larger;">
278 2950 berkley
                        <xsl:value-of select="./param[@name='entity/@name']"/>
279 3178 sledge
                      </b>
280
                    </xsl:if>
281
                  </td>
282 2950 berkley
283 3236 sledge
                  <td class="text_plain">
284 3286 berkley
                    <xsl:value-of select="./param[@name=concat('entity/property[@name=', $sq, 'KeplerDocumentation', $sq, ']/property[@name=', $sq, 'author', $sq, ']/configure')]"/>
285 3178 sledge
                  </td>
286 2950 berkley
287 3178 sledge
                  <td class="text_plain">
288 3286 berkley
                    <xsl:value-of select="./param[@name=concat('entity/property[@name=', $sq, 'KeplerDocumentation', $sq, ']/property[@name=', $sq, 'version', $sq, ']/configure')]"/>
289 3178 sledge
                  </td>
290 2950 berkley
291 3236 sledge
                  <td class="text_plain">
292
                    <a class="dl">
293
                      <xsl:attribute name="href">
294 3780 daigle
                        <xsl:text>http://{$httpServer}/authority/data?lsid=</xsl:text>
295 3236 sledge
                        <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 3178 sledge
                </tr>
302
303
                <tr>
304
                  <td class="text_plain"></td>
305
                  <td class="text_plain" colspan="6">
306 3286 berkley
                    <xsl:variable name="docClip" select="substring(./param[@name=concat('entity/property[@name=', $sq, 'KeplerDocumentation', $sq, ']/property[@name=', $sq, 'userLevelDocumentation', $sq, ']/configure')], 0, 200)"/>
307 3236 sledge
                    <xsl:value-of select="$docClip"/>
308
                    <xsl:text> </xsl:text>
309 3286 berkley
                    <!-- <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 3236 sledge
                    <xsl:text>... [</xsl:text>
319 3178 sledge
320 3236 sledge
                    <a style="font-size: smaller;">
321 3178 sledge
                      <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 3180 sledge
                      <xsl:text>View Documentation</xsl:text>
336 3178 sledge
                    </a>
337
338 3236 sledge
                    <xsl:text>]</xsl:text>
339 3178 sledge
                  </td>
340
                </tr>
341
              </xsl:for-each>
342
            </table>
343
          </xsl:if>
344
        </div>
345
        <script language="JavaScript">
346 3806 leinfelder
          <![CDATA[
347
          insertTemplateClosing("]]><xsl:value-of select="$contextURL" /><![CDATA[");
348
         ]]>
349 3178 sledge
        </script>
350
      </body>
351 2950 berkley
    </html>
352 3178 sledge
  </xsl:template>
353
</xsl:stylesheet>