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: tao $'
10
*     '$Date: 2010-08-13 13:50:41 -0700 (Fri, 13 Aug 2010) $'
11
* '$Revision: 5501 $'
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
 <xsl:import href="../../common/util.xsl"/>
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
  <xsl:param name="httpServer"/>
46
  
47

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

    
66
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
    padding: 0.375em 0.75em 0;
90
}
91

    
92
th.tablehead:first-child,
93
td.text_plain:first-child
94
{
95
    padding: 0.375em 0.375em 0;
96
}
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
tr.entry + tr td
109
{
110
    border-bottom: 1px solid #066;
111
    padding-top: 0.375em;
112
    padding-bottom: 0.375em;
113
}
114

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

    
125
        </style>
126
      </head>
127

    
128
      <body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
129
        <script language="JavaScript">
130
          <![CDATA[
131
          insertTemplateOpening("]]><xsl:value-of select="$contextURL" /><![CDATA[");
132
          insertSearchBox("]]><xsl:value-of select="$contextURL" /><![CDATA[");
133
         ]]>
134
        </script>
135

    
136
        <div class="body">
137
          <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
          <!-- paging code here -->
144
          <xsl:if test="/resultset/pagesize &gt; 0">
145
          <table cellspacing="0" cellpadding="0" style="width: 50%;">
146
          <tr>
147
          <td>
148
          <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
          </td>
198

    
199
          <td>
200
          <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
          </td>
250
          </tr>
251
          </table>
252
          </xsl:if>
253
          <!-- end paging code -->
254
          
255
          <!-- This tests to see if there are returned documents,
256
              if there are not then don't show the query results -->
257

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

    
269
              <xsl:for-each select="resultset/document">
270
                <xsl:sort select="./param[@name='karEntry/karEntryXML/entity/@name']"/>
271
                <xsl:variable name="sq">'</xsl:variable>
272
                <tr class="entry">
273

    
274
                  <td class="text_plain">
275
                    <xsl:value-of select="position()"/>.
276
                  </td>
277

    
278
				<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
                  </td>
290
					
291
                  <td class="text_plain">
292
					  <xsl:for-each select="./param[@name='karEntry/karEntryXML/entity/@name']">
293
						  
294
						  <xsl:value-of select="./"/>
295
					      <xsl:if test="position() != last()">
296
                              <xsl:value-of select="', '"/>
297
                          </xsl:if>
298
					  </xsl:for-each>
299
                  </td>
300

    
301
                  <td class="text_plain">
302
                    <xsl:for-each select="./param[@name=concat('karEntry/karEntryXML/entity/property[@name=', $sq, 'author', $sq, ']/configure')]">
303
					      <xsl:value-of select="./"/>
304
                          <xsl:if test="position() != last()">
305
                              <xsl:value-of select="', '"/>
306
                          </xsl:if>
307
					</xsl:for-each>
308
                  </td>
309

    
310
                  <td class="text_plain">
311
                    <xsl:for-each select="./param[@name=concat('karEntry/karEntryXML/entity/property[@name=', $sq, 'KeplerDocumentation', $sq, ']/property[@name=', $sq, 'version', $sq, ']/configure')]">
312
						  <xsl:value-of select="./"/>
313
                          <xsl:if test="position() != last()">
314
                              <xsl:value-of select="', '"/>
315
                          </xsl:if>
316
					</xsl:for-each>
317
                  </td>
318

    
319
                  <td class="text_plain">
320
                    <a class="dl">
321
					 <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
                      <xsl:attribute name="href">
327
                        <!--<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
                      </xsl:attribute>
333

    
334
                      <xsl:text>Download</xsl:text>
335
                    </a>
336
                  </td>
337
                </tr>
338

    
339
                <tr>
340
                  <td class="text_plain"></td>
341
                  <td class="text_plain" colspan="5">
342
                    <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
                    <xsl:value-of select="$docClip"/>
344
                    <xsl:text> </xsl:text>
345
                    <!-- <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
                    <xsl:text>... [</xsl:text>
355

    
356
                    <a style="font-size: smaller;">
357
                      <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
                      <xsl:text>View Documentation</xsl:text>
372
                    </a>
373

    
374
                    <xsl:text>]</xsl:text>
375
                  </td>
376
                </tr>
377
              </xsl:for-each>
378
            </table>
379
          </xsl:if>
380
        </div>
381
        <script language="JavaScript">
382
          <![CDATA[
383
          insertTemplateClosing("]]><xsl:value-of select="$contextURL" /><![CDATA[");
384
         ]]>
385
        </script>
386
      </body>
387
    </html>
388
  </xsl:template>
389
</xsl:stylesheet>
390

    
(14-14/15)