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