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

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

Supporting the changes to related_urls and removing browse as late binding.
(Those nasty A links should leave when the new moles2dif is run at badc/neodc)

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!={}" 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="Distribution(dlist)">
21        <table py:if="dlist!=[]" cellspacing="0" cellpadding="3" width=" 100%" border="0">
22        <tr><td class="linehead" colspan="4"><span class="headingO">Distribution</span></td></tr>
23        <tr><th> Format </th> <th> Size </th> <th> Media </th> <th> Fees </th> </tr>
24        <tr py:for="d in dlist">
25            <td>${d['Distribution_Format']}</td>
26            <td>${d['Distribution_Size']}</td>
27            <td>${d['Distribution_Media']}</td>
28            <td>${d['Fees']}</td>
29        </tr>
30        </table>
31    </div>
32   
33    <div py:def="Services()" id="ServiceList">
34        <table cellspacing="0" cellpadding="3" width=" 100%" border="0"><tbody>
35            <tr><td class="linehead" colspan="3"><span class="headingO">Links and Services</span></td></tr>
36            <tr py:for="s in c.doc.services">
37                <?python
38                t=s.contentType
39                if t=='': t='R'
40                try:
41                    icon={'NDG_A_SERVICE':g.icons_A,
42                        'NDG_B_SERVICE':g.icons_B,
43                        'DISCOVERY':g.icons_D,
44                        'R':g.icons_R}[t]
45                except:
46                    icon=g.icons_R
47                ?>
48            <td width="20%"><span py:replace="linkimage(s.url,icon,s.description)"/></td><td>${s.description}</td></tr>
49            <tr py:if="c.doc.ndgObject is not None">
50            <td width="20%"><span py:replace="linkimage(c.doc.ndgObject.xmlURL,g.icons_xml,'[XML]')"/></td>
51            <td>Downloadable XML version of this record
52            <span py:if="c.doc.ndgObject.gettable==1">
53            (Original <span py:replace="linkimage(c.doc.ndgObject.xmlURL+'&amp;outputSchema=original',g.icons_xml,'[XML]')"/>)
54            </span></td></tr>
55            <tr py:if="c.doc.ndgObject is not None">
56            <td width="20%"><span py:replace="linkimage(c.doc.ndgObject.printableURL,g.icons_prn,'[HTML]')"/></td>
57            <td>Viewable XML version of this record
58             <span py:if="c.doc.ndgObject.gettable==1">
59            (Original <span py:replace="linkimage(c.doc.ndgObject.printableURL+'&amp;outputSchema=original',g.icons_prn,'[HTML]')"/>)
60            </span></td></tr>
61            <tr py:if="c.doc.ndgObject.gettable==1"><td></td><td>(Original records are the raw material harvested from data providers)</td></tr>
62        </tbody></table>
63    </div> <!-- ServiceList -->
64   
65   
66    <div py:def="Spatial(bbox,h)">
67        <!-- Currently this only shows the first bounding box -->
68        <table py:if="bbox.nboxes==1"><tbody>
69            <tr py:if="h==1"><td colspan="2" class="cellhead">Spatial coverage</td></tr>
70            <tr><td colspan="2" align="center">${bbox.boxes[0][0]}</td></tr>
71            <tr><td align="center">${bbox.boxes[0][1]}</td><td align="center">${bbox.boxes[0][2]}</td></tr>
72            <tr><td colspan="2" align="center">${bbox.boxes[0][3]}</td></tr>
73        </tbody></table>
74        <span py:if="bbox.nboxes!=1"><p py:if="h==1" class="cellhead">Spatial Coverage</p>
75            <p py:if="bbox.nboxes>1"> $bbox.nboxes different areas.</p>
76            <p py:if="bbox.nboxes==0"> No spatial coverage information available.</p>
77        </span>
78    </div>
79   
80    <div py:def="Coverage(bbox,timcov)">
81        <table cellspacing="0" cellpadding="3" border="0" width="100%"><tbody>
82            <tr><td class="linehead" colspan="2"><span class="heading0"> Data Coverage</span> </td></tr>
83            <tr><td><div py:replace="Spatial(bbox,1)"/></td>
84                <td><table><tr><td colspan="2" class="cellhead"> Temporal coverage</td></tr>
85                           <span py:if="len(timcov)==1">
86                                <tr><td> Start Date: ${timcov[0][0]}</td><td>End Date: ${timcov[0][1]}</td></tr>
87                                <tr><td colspan="2"> Status:${timcov[0][2]}</td></tr>
88                           </span>
89                           <tr py:if="len(timcov)==0"><td colspan="2">No temporal information available.</td></tr>
90                           <tr py:if="len(timcov)>1"><td colspan="2">${len(timcov)} different periods of data available.</td></tr>
91                    </table>
92                </td></tr>
93        </tbody></table>
94    </div>
95   
96    <div py:def="ShortCoverage(e)">
97        <span py:if="len(e.timeCoverage)==1">From ${e.timeCoverage[0][0]} to ${e.timeCoverage[0][1]}
98        </span><span py:if="e.bbox.nboxes==1">
99         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
100        </span>
101    </div>
102   
103    <div py:def="People(ptype,listOf)">
104        <table py:if="listOf!=[]" cellspacing="0" cellpadding="3" border="0" width="100%"><tbody>
105            <tr><td class="linehead" colspan="2"><span class="heading0"> $ptype</span></td></tr>
106            <tr py:for="p in listOf"><td>${XML(p.core['role'])}</td><td>${XML(p.toHTML())}</td></tr>
107        </tbody></table>
108    </div>
109   
110    <div py:def="Centre(cen)">
111        <table cellspacing="0" cellpadding="3" border="0" width="100%"><tbody>
112            <tr><td class="linehead"><span class="heading0"> Data Centre</span></td></tr>
113            <tr><td>${XML(cen.toHTML())}</td></tr>
114        </tbody></table>
115    </div>
116   
117    <div py:def="Keywords(Name,listOf)">
118         <table cellspacing="0" cellpadding="3" border="0" width="100%"><tbody>
119            <tr><td class="linehead"><span class="heading0"> $Name</span></td></tr>
120            <tr py:for="item in listOf"><td>$item</td></tr>
121        </tbody></table>
122    </div>
123   
124    <!--- Create that little list of service icons on the result page -->
125    <span py:def="serviceIcons(sL)">
126        <span py:for="s in sL">
127            <?python
128            t=s.contentType
129            if t=='': t='R'
130            try:
131                icon={'NDG_A_SERVICE':g.icons_A,
132                    'NDG_B_SERVICE':g.icons_B,
133                    'DISCOVERY':g.icons_D,
134                    'R':g.icons_R}[t]
135            except:
136                icon=g.icons_R
137            ?>
138            <span py:replace="linkimage(s.url,icon,s.description)"/>
139        </span>
140    </span>
141   
142    <!--- Easy shortening of text for result pages, should use ajax to expand -->
143    <span py:def="abbreviate(text,L,url)">
144        <?python
145        if len(text)<L:
146            more=''
147        else:
148            if url:
149                more='&nbsp;<a href="%s">(more)</a>'%url
150            else: more='...'
151        ?>
152        ${text[0:L]}${XML(more)}
153    </span>
154   
155    <span py:def="result(i,d)">
156        <?python
157        if len(d.timeCoverage)==1:
158            tc=d.timeCoverage[0]
159            #tc=[(i or '') for i in tc]
160        elif len(d.timeCoverage)==0:
161            tc=['','','']
162        else:
163            tc=d.timeCoverage[0]
164            for m in d.timeCoverage:
165                if m[0]<tc[0]:tc[0]=m[0]
166                if m[1]>tc[1]:tc[1]=m[1]
167        ?>   
168        <tr class="${i%2 and 'rowhi' or 'rowlo'}">
169            <td>
170                <span py:if="d.briefCitation!=''">
171                    <span class="ndgem">Citation:</span> ${d.briefCitation}</span>
172                <span class="ndgem"> Title:</span>
173                    <span py:replace="abbreviate(d.name,70,0)"/>
174                <br/>
175                <span class="ndgem"> Abstract:</span>
176                    <span py:replace="abbreviate(d.abstract,200,d.binding.url)"/>
177                <br/>
178                <span class="ndgem"> Sourced from:</span>&nbsp;${XML(d.centre.url())}
179                &nbsp;<span class="ndgem">Links:</span>
180                <span py:replace="serviceIcons([d.binding])"/>
181                <span py:replace="serviceIcons(d.services)"/>
182                </td><td>${tc[0]}</td><td>${tc[1]}</td><td>
183                <div py:replace="Spatial(d.bbox,0)"/>
184            </td>
185        </tr>
186    </span>
187   
188</html>
Note: See TracBrowser for help on using the repository browser.