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