Project

General

Profile

Statistics
| Branch: | Tag: | Revision:

cdmlib / cdmlib-remote-webapp / src / main / webapp / vibrant-taxon.xsl @ c93aed86

History | View | Annotate | Download (19 KB)

1
<?xml version="1.0" encoding="UTF-8"?>
2
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
3

    
4
    <xsl:param name="query"/>
5
    <!-- pass this in as a parameter? -->
6

    
7
    <xsl:variable name="url_webservice">../taxon/findTaxaAndNames</xsl:variable>
8
    <xsl:variable name="url_start">"../taxon/</xsl:variable>
9
    <xsl:variable name="url_end">/extensions.json"</xsl:variable>
10

    
11

    
12
    <xsl:template match="/DefaultPagerImpl">
13
        <HTML>
14

    
15
            <HEAD>
16
                <script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"/>
17
                <link type="text/css" rel="stylesheet" media="all" href="../vibrant.css"/>
18
            </HEAD>
19
            <BODY>
20
                <script type="text/javascript" language="javascript">
21
                    
22
                    (function($){
23
	                    $.getQuery = function( query ) {
24
                  		query = query.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
25
                  		var expr = "[\\?&amp;]"+query+"=([^&amp;#]*)";
26
                  		var regex = new RegExp( expr );
27
                  		var results = regex.exec( window.location.href );
28
                  		if( results !== null ) {
29
                  			return results[1];
30
                  			return decodeURIComponent(results[1].replace(/\+/g, " "));
31
                  		} else {
32
                  			return false;
33
        		        }
34
	           };
35
               })(jQuery);
36

    
37
                    $(document).ready(function() {
38
            
39
                    $('.source-url').each(function(index) {
40
                        
41
                        var fullurl = '../taxon/' + $(this).attr('ref') + '/extensions.json';
42
                        //$(this).html(fullurl);
43
                        var source_url = location.href;
44
                        
45
                        //alert($(this).html); 
46
                        // this is td class="source-url" ref="c51e9c56-3761-4e3b-aef6-db446fa8748c"
47
                                                        //console.log(this);
48
                                                        
49
                        $.ajax({
50
                            url: fullurl,
51
                            dataType: "jsonp",
52
                            async: false, // only for debugging, let's you see more error messages
53
                            cache: false, // browser will not cache
54

    
55
                                                      
56
                            success: function(data) {
57
                                                          
58
                                var dataRecords = data.records;
59
                                //alert($(this).html(data.pageSize)); 
60
                                //the data is the default pager object for the extensions
61
                                //console.log(data);
62
                        
63
                                $.each(data.records, function(i,record){
64
                                
65
                                var value = record.value;
66
                                var ch = 'http';
67
                                if ( value.indexOf(ch) === 0 ) {
68
            
69
                                    source_url = value;
70
                                    }
71
                                });
72
                                },
73
                            error: function(XMLHttpRequest, statusText, errorThrown){$("#content").html("ERROR: " + statusText + " - " + errorThrown);}                                                     
74
                        });
75
            
76
            //alert(source_url); 
77
                        //add a href to the source URL to the html table cell element
78
                        //$(this).html('&lt;a href="' + source_url + '"&gt;' + source_url + '&lt;/a&gt;');            
79
                        $(this).html('&lt;a href="' + source_url + '"&gt;View summary in source database&lt;/a&gt;');                       
80
                        });
81
                      
82
                     });
83
            
84
                    function open(url)
85
                    {window.open(url);}
86
  
87
            </script>
88

    
89

    
90
                <a href="../vibrant_names.html" title="Home">
91
                    <img src="../acquia_prosper_logo.png" alt="Home"/>
92
                </a>
93
                <br/>
94
                <table cellpadding="1" width="100%">
95
                    <tr>
96
                        <td width="5%"/>
97
                        <td valign="top">
98

    
99
                            <h2>ViBRANT Common Data Model names search</h2>
100
                            <br/>
101
                            <BR/>
102
                            <H4>Source(s) using this name: </H4>
103
                            <br/>
104

    
105

    
106
                            <xsl:for-each select="records/e">
107
                                <table width="35%" border="1" cellspacing="4" cellpadding="0"
108
                                    bordercolor="#66C266" style="border-collapse: collapse">
109

    
110
                                    <xsl:variable name="taxonclass">
111
                                        <xsl:value-of select="class"/>
112
                                    </xsl:variable>
113
                                    <xsl:choose>
114
                                        <xsl:when test="$taxonclass = 'SearchResult'">
115
                                            <tr>
116
                                                <TABLE border="0">
117

    
118
                                                  <TR>
119
                                                  <td> </td>
120
                                                  <td/>
121
                                                  <TD>
122
                                                  <xsl:variable name="score">
123
                                                  <xsl:value-of select="score"/>
124
                                                  </xsl:variable>
125
                                                  <div class="bars">
126
                                                  <div class="bar bar-1" style="width:100%">
127

    
128
                                                  <div class="bar bar-2"
129
                                                  style="width:{$score * 100}%">
130
                                                  <!--div class="value"><xsl:value-of select="score"/></div-->
131
                                                  <div class="value">
132
                                                  <xsl:value-of
133
                                                  select="substring(substring-after($score,'.'), 1,2)"
134
                                                  />%
135
                                                  <!--xsl:value-of select="concat('0.', substring(substring-after($score,'.'), 1,2))"-->
136
                                                  </div>
137
                                                  </div>
138
                                                  </div>
139
                                                  </div>
140

    
141
                                                  </TD>
142
                                                  </TR>
143
                                                  <TR>
144
                                                  <td/>
145
                                                  <td/>
146
                                                  </TR>
147
                                                  <TR>
148

    
149
                                                  <TD>
150
                                                  <strong>Name:</strong>
151
                                                  </TD>
152
                                                  <TD>
153
                                                  <xsl:apply-templates select="entity/titleCache"/>
154

    
155

    
156
                                                  </TD>
157
                                                  </TR>
158
                                                  <TR>
159
                                                  <TD>
160
                                                  <strong>Status: </strong>
161
                                                  </TD>
162
                                                  <TD>
163
                                                  <xsl:choose>
164
                                                  <xsl:when test="$taxonclass = 'Taxon'">
165
                                                  <font color="green">
166
                                                  <strong>
167
                                                  <xsl:apply-templates select="entity/class"/>
168
                                                  </strong>
169
                                                  </font>
170
                                                  </xsl:when>
171
                                                  <xsl:otherwise>
172
                                                  <font color="purple">
173
                                                  <strong>
174
                                                  <xsl:apply-templates select="entity/class"/>
175
                                                  </strong>
176
                                                  </font>
177
                                                  </xsl:otherwise>
178
                                                  </xsl:choose>
179
                                                  </TD>
180
                                                  </TR>
181
                                                  <TR>
182
                                                  <TD>
183
                                                  <strong>Source: </strong>
184
                                                  </TD>
185
                                                  <TD>
186
                                                  <xsl:apply-templates
187
                                                  select="entity/sec/titleCache"/>
188
                                                  </TD>
189
                                                  </TR>
190

    
191
                                                  <!--TR>
192
                                                <TD>
193
                                                  <strong>UUID: </strong>
194
                                                </TD>
195
                                                <TD>
196
                                                  <xsl:apply-templates select="uuid"/>
197
                                                </TD>
198
                                            </TR-->
199
                                                  <TR>
200
                                                  <TD><!--strong>Description: </strong-->
201
                                                  </TD>
202
                                                  <TD>
203
                                                      
204
                                                  <!--xsl:value-of select="fieldHighlightMap/text.ALL/e"/-->
205
                                                      
206
                                                      <xsl:call-template name="add-bold">
207
                                                          <xsl:with-param name="str" select="fieldHighlightMap/text.ALL/e"/>
208
                                                      </xsl:call-template>
209
                                                  <!--xsl:apply-templates select="fieldHighlightMap/text.ALL/e" ></xsl:apply-templates-->
210
                                                  </TD>
211
                                                  </TR>
212
                                                  <TR>
213
                                                  <TD> </TD>
214
                                                  <xsl:variable name="uuid">
215
                                                  <xsl:value-of select="entity/uuid"/>
216
                                                  </xsl:variable>
217

    
218
                                                  <TD class="source-url" ref="{$uuid}">
219

    
220
                                                  <a>
221
                                                  <xsl:attribute name="href">
222
                                                  <div id="content"> </div>
223
                                                  </xsl:attribute>
224
                                                  <div id="content"> </div>
225
                                                  </a>
226
                                                  </TD>
227
                                                  </TR>
228
                                                </TABLE>
229
                                            </tr>
230
                                        </xsl:when>
231
                                        <xsl:otherwise>
232
                                            <tr>
233
                                                <TABLE border="0">
234

    
235
                                                  <TR>
236
                                                  <TD>
237
                                                  <strong>Name:</strong>
238
                                                  </TD>
239
                                                  <TD>
240
                                                  <xsl:apply-templates select="titleCache"/>
241
                                                  </TD>
242
                                                  </TR>
243
                                                  <TR>
244
                                                  <TD>
245
                                                  <strong>Status: </strong>
246
                                                  </TD>
247
                                                  <TD>
248
                                                  <xsl:choose>
249
                                                  <xsl:when test="$taxonclass = 'Taxon'">
250
                                                  <font color="green">
251
                                                  <strong>
252
                                                  <xsl:apply-templates select="class"/>
253
                                                  </strong>
254
                                                  </font>
255
                                                  </xsl:when>
256
                                                  <xsl:otherwise>
257
                                                  <font color="purple">
258
                                                  <strong>
259
                                                  <xsl:apply-templates select="class"/>
260
                                                  </strong>
261
                                                  </font>
262
                                                  </xsl:otherwise>
263
                                                  </xsl:choose>
264
                                                  </TD>
265
                                                  </TR>
266
                                                  <TR>
267
                                                  <TD>
268
                                                  <strong>Source: </strong>
269
                                                  </TD>
270
                                                  <TD>
271
                                                  <xsl:apply-templates select="sec/titleCache"/>
272
                                                  </TD>
273
                                                  </TR>
274

    
275
                                                  <!--TR>
276
                                                <TD>
277
                                                  <strong>UUID: </strong>
278
                                                </TD>
279
                                                <TD>
280
                                                  <xsl:apply-templates select="uuid"/>
281
                                                </TD>
282
                                            </TR-->
283
                                                  <TR>
284
                                                  <TD> </TD>
285
                                                  <xsl:variable name="uuid">
286
                                                  <xsl:value-of select="uuid"/>
287
                                                  </xsl:variable>
288

    
289
                                                  <TD class="source-url" ref="{$uuid}">
290

    
291
                                                  <a>
292
                                                  <xsl:attribute name="href">
293
                                                  <div id="content"> </div>
294
                                                  </xsl:attribute>
295
                                                  <div id="content"> </div>
296
                                                  </a>
297
                                                  </TD>
298
                                                  </TR>
299
                                                </TABLE>
300
                                            </tr>
301
                                        </xsl:otherwise>
302
                                    </xsl:choose>
303
                                </table>
304
                                <br/>
305
                            </xsl:for-each>
306
                            <TABLE>
307
                                <TR>
308
                                    <TD>
309
                                        <FORM>
310
                                            <INPUT type="button" value="Back To Results"
311
                                                onClick="history.back()"/>
312
                                        </FORM>
313
                                    </TD>
314
                                    <TD>
315
                                        <!--FORM>
316
                                            <INPUT type="button" value="New Search" onClick="javascript:open('../vibrant_names.html');"></INPUT>
317
                                            <button><a href="../vibrant_names.html" title="Home"></a></button>
318
                                        </FORM -->
319
                                        <FORM METHOD="LINK" ACTION="../vibrant_names.html">
320
                                            <INPUT TYPE="submit" VALUE="New Search"/>
321
                                        </FORM>
322
                                    </TD>
323
                                </TR>
324
                            </TABLE>
325
                        </td>
326
                    </tr>
327
                </table>
328

    
329
            </BODY>
330
        </HTML>
331
    </xsl:template>
332

    
333
    <xsl:template name="add-bold">
334
        <xsl:param name="str"/>
335
        <xsl:choose>
336
            <xsl:when test="contains($str,&quot;&lt;B&gt;&quot;)">
337
                <xsl:variable name="before-first-b" select="substring-before($str,&quot;&lt;B&gt;&quot;)"/>
338
                <xsl:variable name="inside-first-b"
339
                    select="substring-before(substring-after
340
                    ($str,'&lt;B&gt;'),'&lt;/B&gt;')"/>
341
                <xsl:variable name="after-first-b" select="substring-after($str,&quot;&lt;/B&gt;&quot;)"/>
342
                <xsl:value-of select="$before-first-b"/>
343

    
344
                <!--Highlight the search term in bold and red font-->
345
                <font color="red"><b><xsl:value-of select="$inside-first-b"/></b></font>
346
                <xsl:call-template name="add-bold">
347
                    <xsl:with-param name="str" select="$after-first-b"/>
348
                </xsl:call-template>
349
            </xsl:when>
350
            <xsl:otherwise>
351
                <xsl:value-of select="$str"/>
352
            </xsl:otherwise>
353
        </xsl:choose>
354
    </xsl:template>
355

    
356
    <!--xsl:template match=".">
357
        <xsl:value-of select="text()"/>
358
    </xsl:template-->
359

    
360
</xsl:stylesheet>
Add picture from clipboard (Maximum size: 40 MB)