source: TI05-delivery/ows_framework/trunk/ows_server/ows_server/templates/meta.kid @ 3093

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/TI05-delivery/ows_framework/trunk/ows_server/ows_server/templates/meta.kid@3093
Revision 3093, 7.9 KB checked in by lawrence, 12 years ago (diff)

Most of the coding for geospatial operators. Improvements
to results display for multiple bounding boxes.

Line 
1<!-- This is a bunch of named functions for using when displaying metadata -->
2<html xmlns="http://www.w3.org/1999/xhtml" xmlns:py="http://purl.org/kid/ns#">
3
4<!-- Parameter list class, used in StubB and DIF -->
5   
6    <div py:def="ParameterList(params)" class="ParameterList">
7        <table py:if="params is not None" cellspacing="0" cellpadding="3" border="0" width="100%"><tbody>
8            <tr><td class="linehead"><span class="heading0"> Parameters</span></td></tr>
9            <span py:for="item in params">
10                <tr><td class="rowhead">$item</td></tr>
11                <?python
12                #should make sure keyword with spaces are not split inappropriately
13                keywords='; '.join([k.replace(' ','&nbsp;') for k in params[item]])
14                ?>
15                <tr py:if="params[item]!=[]"><td>${XML(keywords)}</td></tr>
16            </span>
17        </tbody></table>
18    </div>
19   
20    <div py:def="Services()" id="ServiceList">
21        <table cellspacing="0" cellpadding="3" width=" 100%" border="0"><tbody>
22            <tr><td class="linehead" colspan="3"><span class="headingO">Links and Services</span></td></tr>
23            <!-- s=renderService(self.config)
24            <tr py:for="item in c.doc.services"><td>$s.get(item)<td><tr>
25            -->
26            <tr py:if="c.doc.ndgObject is not None">
27            <td width="20%"><span py:replace="linkimage(c.doc.ndgObject.xmlURL,g.icons_xml,'[XML]')"/></td>
28            <td>Downloadable XML version of this record
29            <span py:if="c.doc.ndgObject.gettable==1">
30            (Original <span py:replace="linkimage(c.doc.ndgObject.xmlURL+'&amp;outputSchema=original',g.icons_xml,'[XML]')"/>)
31            </span></td></tr>
32            <tr py:if="c.doc.ndgObject is not None">
33            <td width="20%"><span py:replace="linkimage(c.doc.ndgObject.printableURL,g.icons_prn,'[HTML]')"/></td>
34            <td>Viewable XML version of this record
35             <span py:if="c.doc.ndgObject.gettable==1">
36            (Original <span py:replace="linkimage(c.doc.ndgObject.printableURL+'&amp;outputSchema=original',g.icons_prn,'[HTML]')"/>)
37            </span></td></tr>
38            <span py:if="c.doc.ndgObject.gettable==1">
39                <tr><td></td><td>(Original records are the raw material harvested from data providers)</td></tr>
40                <tr><td><span py:replace="linkimage(c.doc.ndgObject.BURL,g.icons_B,'[NDG-BROWSE]')"/>
41                </td><td> NERC DataGrid Browse Metadata Record (should provide more information)</td></tr>
42            </span>
43        </tbody></table>
44    </div> <!-- ServiceList -->
45   
46   
47    <div py:def="Spatial(bbox,h)">
48        <!-- Currently this only shows the first bounding box -->
49        <table py:if="bbox.nboxes==1"><tbody>
50            <tr py:if="h==1"><td colspan="2" class="cellhead">Spatial coverage</td></tr>
51            <tr><td colspan="2" align="center">${bbox.boxes[0][0]}</td></tr>
52            <tr><td align="center">${bbox.boxes[0][1]}</td><td align="center">${bbox.boxes[0][2]}</td></tr>
53            <tr><td colspan="2" align="center">${bbox.boxes[0][3]}</td></tr>
54        </tbody></table>
55        <span py:if="bbox.nboxes!=1"><p py:if="h==1" class="cellhead">Spatial Coverage</p>
56            <p py:if="bbox.nboxes>1"> $bbox.nboxes different areas.</p>
57            <p py:if="bbox.nboxes==0"> No spatial coverage information available.</p>
58        </span>
59    </div>
60   
61    <div py:def="Coverage(bbox,timcov)">
62        <table cellspacing="0" cellpadding="3" border="0" width="100%"><tbody>
63            <tr><td class="linehead" colspan="2"><span class="heading0"> Data Coverage</span> </td></tr>
64            <tr><td><div py:replace="Spatial(bbox,1)"/></td>
65                <td><table><tr><td colspan="2" class="cellhead"> Temporal coverage</td></tr>
66                           <span py:if="len(timcov)==1">
67                                <tr><td> Start Date: ${timcov[0][0]}</td><td>End Date: ${timcov[0][1]}</td></tr>
68                                <tr><td colspan="2"> Status:${timcov[0][2]}</td></tr>
69                           </span>
70                           <tr py:if="len(timcov)==0"><td colspan="2">No temporal information available.</td></tr>
71                           <tr py:if="len(timcov)>1"><td colspan="2">${len(timcov)} different periods of data available.</td></tr>
72                    </table>
73                </td></tr>
74        </tbody></table>
75    </div>
76   
77    <div py:def="ShortCoverage(e)">
78        <span py:if="len(e.timeCoverage)==1">From ${e.timeCoverage[0][0]} to ${e.timeCoverage[0][1]}
79        </span><span py:if="e.bbox.nboxes==1">
80         for latitude ${e.bbox.boxes[0][3]} to ${e.bbox.boxes[0][0]}N and longitude ${e.bbox.boxes[0][1]} to ${e.bbox.boxes[0][2]}E
81        </span>
82    </div>
83   
84    <div py:def="People(ptype,listOf)">
85        <table py:if="listOf!=[]" cellspacing="0" cellpadding="3" border="0" width="100%"><tbody>
86            <tr><td class="linehead"><span class="heading0"> $ptype</span></td></tr>
87            <tr py:for="p in listOf"><td>${XML(p.core['role'])}</td><td>${XML(p.toHTML())}</td></tr>
88        </tbody></table>
89    </div>
90   
91    <div py:def="Centre(cen)">
92        <table cellspacing="0" cellpadding="3" border="0" width="100%"><tbody>
93            <tr><td class="linehead"><span class="heading0"> Data Centre</span></td></tr>
94            <tr><td>${XML(cen.toHTML())}</td></tr>
95        </tbody></table>
96    </div>
97   
98    <div py:def="Keywords(Name,listOf)">
99         <table cellspacing="0" cellpadding="3" border="0" width="100%"><tbody>
100            <tr><td class="linehead"><span class="heading0"> $Name</span></td></tr>
101            <tr py:for="item in listOf"><td>$item</td></tr>
102        </tbody></table>
103    </div>
104   
105    <!--- Create that little list of service icons on the result page -->
106    <span py:def="serviceIcons(sL)">
107        <span py:for="s in sL">
108            <?python
109            t=s.contentType
110            if t=='': t='R'
111            try:
112                icon={'NDG_A_SERVICE':g.icons_A,
113                    'NDG_B_SERVICE':g.icons_B,
114                    'DISCOVERY':g.icons_D,
115                    'R':g.icons_R}[t]
116            except:
117                icon=g.icons_R
118            ?>
119            <span py:replace="linkimage(s.url,icon,s.description)"/>
120        </span>
121    </span>
122   
123    <!--- Easy shortening of text for result pages, should use ajax to expand -->
124    <span py:def="abbreviate(text,L,url)">
125        <?python
126        if len(text)<L:
127            more=''
128        else:
129            if url:
130                more='&nbsp;<a href="%s">(more)</a>'%url
131            else: more='...'
132        ?>
133        ${text[0:L]}${XML(more)}
134    </span>
135   
136    <span py:def="result(i,d)">
137        <?python
138        if len(d.timeCoverage)==1:
139            tc=d.timeCoverage[0]
140            #tc=[(i or '') for i in tc]
141        elif len(d.timeCoverage)==0:
142            tc=['','','']
143        else:
144            tc=d.timeCoverage[0]
145            for m in d.timeCoverage:
146                if m[0]<tc[0]:tc[0]=m[0]
147                if m[1]>tc[1]:tc[1]=m[1]
148        ?>   
149        <tr class="${i%2 and 'rowhi' or 'rowlo'}">
150            <td>
151                <span py:if="d.briefCitation!=''">
152                    <span class="ndgem">Citation:</span> ${d.briefCitation}</span>
153                <span class="ndgem"> Title:</span>
154                    <span py:replace="abbreviate(d.name,70,0)"/>
155                <br/>
156                <span class="ndgem"> Abstract:</span>
157                    <span py:replace="abbreviate(d.abstract,200,d.binding.url)"/>
158                <br/>
159                <span class="ndgem"> Sourced from:</span>&nbsp;${XML(d.centre.url())}
160                &nbsp;<span class="ndgem">Links:</span>
161                <span py:replace="serviceIcons([d.binding])"/>
162                <span py:replace="serviceIcons(d.services)"/>
163                </td><td>${tc[0]}</td><td>${tc[1]}</td><td>
164                <div py:replace="Spatial(d.bbox,0)"/>
165            </td>
166        </tr>
167    </span>
168   
169</html>
Note: See TracBrowser for help on using the repository browser.