1 | <!-- This is a bunch of named functions for using when displaying metadata --> |
---|
2 | <?python |
---|
3 | |
---|
4 | from milk_server.lib.Utilities import urlListEncode |
---|
5 | |
---|
6 | ?> |
---|
7 | |
---|
8 | <html xmlns="http://www.w3.org/1999/xhtml" xmlns:py="http://purl.org/kid/ns#"> |
---|
9 | |
---|
10 | <!-- Parameter list class, used in StubB and DIF --> |
---|
11 | |
---|
12 | <div py:def="ParameterList(params)" class="ParameterList"> |
---|
13 | <table py:if="params!={}" cellspacing="0" cellpadding="3" border="0" width="100%"><tbody> |
---|
14 | <tr><td class="linehead"><span class="heading0"> Parameters</span></td></tr> |
---|
15 | <span py:for="item in params"> |
---|
16 | <tr><td class="rowhead">$item</td></tr> |
---|
17 | <?python |
---|
18 | #should make sure keyword with spaces are not split inappropriately |
---|
19 | keywords='; '.join([k.replace(' ',' ') for k in params[item]]) |
---|
20 | ?> |
---|
21 | <tr py:if="params[item]!=[]"><td>${XML(keywords)}</td></tr> |
---|
22 | </span> |
---|
23 | </tbody></table> |
---|
24 | </div> |
---|
25 | |
---|
26 | <div py:def="Distribution(dlist)"> |
---|
27 | <table py:if="dlist!=[]" cellspacing="0" cellpadding="3" width=" 100%" border="0"> |
---|
28 | <tr><td class="linehead" colspan="4"><span class="headingO">Distribution</span></td></tr> |
---|
29 | <tr><th> Format </th> <th> Size </th> <th> Media </th> <th> Fees </th> </tr> |
---|
30 | <tr py:for="d in dlist"> |
---|
31 | <td>${d['Distribution_Format']}</td> |
---|
32 | <td>${d['Distribution_Size']}</td> |
---|
33 | <td>${d['Distribution_Media']}</td> |
---|
34 | <td>${d['Fees']}</td> |
---|
35 | </tr> |
---|
36 | </table> |
---|
37 | </div> |
---|
38 | |
---|
39 | <div py:def="Services()" id="ServiceList"> |
---|
40 | <table cellspacing="0" cellpadding="3" width=" 100%" border="0"><tbody> |
---|
41 | <tr><td class="linehead" colspan="3"><span class="headingO">Links and Services</span></td></tr> |
---|
42 | <tr py:for="s in c.doc.services"> |
---|
43 | <?python |
---|
44 | t=s.contentType |
---|
45 | |
---|
46 | isWMC = False |
---|
47 | |
---|
48 | |
---|
49 | if 'WEB MAP CONTEXT' in t: |
---|
50 | isWMC = True |
---|
51 | if t=='': |
---|
52 | t='R' |
---|
53 | if 'GET DATA' in t: |
---|
54 | t='GET DATA' |
---|
55 | try: |
---|
56 | icon={'NDG_BROWSE':g.icons_NDGBrwse,'GET DATA':g.icons_A, |
---|
57 | 'VIEW EXTENDED METADATA':g.icons_B, |
---|
58 | 'DISCOVERY':g.icons_D, |
---|
59 | 'R':g.icons_R}[t] |
---|
60 | except: |
---|
61 | icon=g.icons_R |
---|
62 | ?> |
---|
63 | <td width="20%" py:if="isWMC"> |
---|
64 | <span py:replace="linkimage(g.server + '/viewItems?ENDPOINT=' + s.url,icon,s.description)" py:strip="True"/> |
---|
65 | </td> |
---|
66 | <td width="20%" py:if="not isWMC"> |
---|
67 | <span py:replace="linkimage(s.url,icon,s.description)" py:strip="True"/> |
---|
68 | </td> |
---|
69 | <td>${s.description}</td> |
---|
70 | </tr> |
---|
71 | <tr py:if="c.doc.ndgObject is not None"> |
---|
72 | <td width="20%"><span py:replace="linkimage(c.doc.ndgObject.xmlURL,g.icons_xml,'[XML]')"/></td> |
---|
73 | <td>Downloadable XML version of this record |
---|
74 | <span py:if="c.doc.ndgObject.gettable==1"> |
---|
75 | (Original <span py:replace="linkimage(c.doc.ndgObject.xmlURL+'&outputSchema=original',g.icons_xml,'[XML]')"/>) |
---|
76 | </span></td></tr> |
---|
77 | <tr py:if="c.doc.ndgObject is not None"> |
---|
78 | <td width="20%"><span py:replace="linkimage(c.doc.ndgObject.printableURL,g.icons_prn,'[HTML]')"/></td> |
---|
79 | <td>Viewable XML version of this record |
---|
80 | <span py:if="c.doc.ndgObject.gettable==1"> |
---|
81 | (Original <span py:replace="linkimage(c.doc.ndgObject.printableURL+'&outputSchema=original',g.icons_prn,'[HTML]')"/>) |
---|
82 | </span></td></tr> |
---|
83 | <tr py:if="c.doc.ndgObject.gettable==1"><td></td><td>(Original records are the raw material harvested from data providers)</td></tr> |
---|
84 | </tbody></table> |
---|
85 | </div> <!-- ServiceList --> |
---|
86 | |
---|
87 | |
---|
88 | <div py:def="Spatial(bbox,h)"> |
---|
89 | <!-- Currently this only shows the first bounding box --> |
---|
90 | <table py:if="bbox.nboxes==1"><tbody> |
---|
91 | <tr py:if="h==1"><td colspan="2" class="cellhead">Spatial coverage</td></tr> |
---|
92 | <tr><td colspan="2" align="center">${bbox.boxes[0][0]}</td></tr> |
---|
93 | <tr><td align="center">${bbox.boxes[0][1]}</td><td align="center">${bbox.boxes[0][2]}</td></tr> |
---|
94 | <tr><td colspan="2" align="center">${bbox.boxes[0][3]}</td></tr> |
---|
95 | </tbody></table> |
---|
96 | <span py:if="bbox.nboxes!=1"><p py:if="h==1" class="cellhead">Spatial Coverage</p> |
---|
97 | <p py:if="bbox.nboxes>1"> $bbox.nboxes different areas.</p> |
---|
98 | <p py:if="bbox.nboxes==0"> No spatial coverage information available.</p> |
---|
99 | </span> |
---|
100 | </div> |
---|
101 | |
---|
102 | <div py:def="Coverage(bbox,timcov)"> |
---|
103 | <table cellspacing="0" cellpadding="3" border="0" width="100%"><tbody> |
---|
104 | <tr><td class="linehead" colspan="2"><span class="heading0"> Data Coverage</span> </td></tr> |
---|
105 | <tr><td><div py:replace="Spatial(bbox,1)"/></td> |
---|
106 | <td><table><tr><td colspan="2" class="cellhead"> Temporal coverage</td></tr> |
---|
107 | <span py:if="len(timcov)==1"> |
---|
108 | <tr><td> Start Date: ${timcov[0][0]}</td><td>End Date: ${timcov[0][1]}</td></tr> |
---|
109 | <tr><td colspan="2"> Status:${timcov[0][2]}</td></tr> |
---|
110 | </span> |
---|
111 | <tr py:if="len(timcov)==0"><td colspan="2">No temporal information available.</td></tr> |
---|
112 | <tr py:if="len(timcov)>1"><td colspan="2">${len(timcov)} different periods of data available.</td></tr> |
---|
113 | </table> |
---|
114 | </td></tr> |
---|
115 | </tbody></table> |
---|
116 | </div> |
---|
117 | |
---|
118 | <div py:def="ShortCoverage(e)"> |
---|
119 | <span py:if="len(e.timeCoverage)==1">From ${e.timeCoverage[0][0]} to ${e.timeCoverage[0][1]} |
---|
120 | </span><span py:if="e.bbox.nboxes==1"> |
---|
121 | 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 |
---|
122 | </span> |
---|
123 | </div> |
---|
124 | |
---|
125 | <div py:def="People(ptype,listOf)"> |
---|
126 | <table py:if="listOf!=[]" cellspacing="0" cellpadding="3" border="0" width="100%"><tbody> |
---|
127 | <tr><td class="linehead" colspan="2"><span class="heading0"> $ptype</span></td></tr> |
---|
128 | <tr py:for="p in listOf"><td>${XML(p.core['role'])}</td><td>${XML(p.toHTML())}</td></tr> |
---|
129 | </tbody></table> |
---|
130 | </div> |
---|
131 | |
---|
132 | <div py:def="Centre(cen)"> |
---|
133 | <table cellspacing="0" cellpadding="3" border="0" width="100%"><tbody> |
---|
134 | <tr><td class="linehead"><span class="heading0"> Data Centre</span></td></tr> |
---|
135 | <tr><td>${XML(cen.toHTML())}</td></tr> |
---|
136 | </tbody></table> |
---|
137 | </div> |
---|
138 | |
---|
139 | <div py:def="Keywords(Name,listOf)"> |
---|
140 | <table cellspacing="0" cellpadding="3" border="0" width="100%"><tbody> |
---|
141 | <tr><td class="linehead"><span class="heading0"> $Name</span></td></tr> |
---|
142 | <tr py:for="item in listOf"><td>$item</td></tr> |
---|
143 | </tbody></table> |
---|
144 | </div> |
---|
145 | |
---|
146 | <!--- Create that little list of service icons on the result page --> |
---|
147 | <!-- FUDGE to get different icon showing for ceda browse records until I fix the atom=>dif pipeline (so contentType included) SJD 22/10/09 --> |
---|
148 | <span py:def="serviceIcons(sL)"> |
---|
149 | <span py:for="s in sL"> |
---|
150 | <?python |
---|
151 | |
---|
152 | t=s.contentType |
---|
153 | |
---|
154 | if 'ATOM' in s.description: |
---|
155 | atomFudge=True |
---|
156 | else: |
---|
157 | atomFudge=False |
---|
158 | |
---|
159 | if t=='': t='R' |
---|
160 | if 'GET DATA' in t: t='GET DATA' |
---|
161 | try: |
---|
162 | iconD={'NDG_BROWSE':g.icons_NDGBrwse,'GET DATA':g.icons_A, |
---|
163 | 'VIEW EXTENDED METADATA':g.icons_B, |
---|
164 | 'DISCOVERY':g.icons_D, |
---|
165 | 'R':g.icons_R} |
---|
166 | |
---|
167 | if atomFudge: |
---|
168 | icon=g.icons_NDGBrwse |
---|
169 | |
---|
170 | else: |
---|
171 | icon=iconD[t] |
---|
172 | |
---|
173 | except: |
---|
174 | icon=g.icons_R |
---|
175 | |
---|
176 | |
---|
177 | ?> |
---|
178 | |
---|
179 | <span py:replace="linkimage(s.url,icon,s.description)"/> |
---|
180 | </span> |
---|
181 | </span> |
---|
182 | |
---|
183 | <!--- Easy shortening of text for result pages, should use ajax to expand --> |
---|
184 | <span py:def="abbreviate(text,L,url)"> |
---|
185 | <?python |
---|
186 | if len(text)<L: |
---|
187 | more='' |
---|
188 | else: |
---|
189 | |
---|
190 | if url: |
---|
191 | more=' <a href="%s">(more)</a>'%url |
---|
192 | else: more='...' |
---|
193 | ?> |
---|
194 | ${text[0:L]} ${XML(more)} |
---|
195 | </span> |
---|
196 | |
---|
197 | <!--- Easy shortening of text for result pages, should use ajax to expand --> |
---|
198 | <span py:def="abbreviateAbstract(text,L,url)"> |
---|
199 | <?python |
---|
200 | if len(text)<L: |
---|
201 | more='' |
---|
202 | else: |
---|
203 | |
---|
204 | if url: |
---|
205 | more=' <a href="%s">(more)</a>'%url |
---|
206 | else: more='...' |
---|
207 | ?> |
---|
208 | ${text[0:L]} ${XML(more)} |
---|
209 | </span> |
---|
210 | |
---|
211 | <!-- Abstract more/less --> |
---|
212 | <!--<span py:def="moreAbstract(value)"> |
---|
213 | |
---|
214 | <span > |
---|
215 | |
---|
216 | <img src="$g.helpIcon" alt="Toggle help" class="helpicon"/></a> |
---|
217 | |
---|
218 | $value |
---|
219 | |
---|
220 | <input type="button" class="txtButtons" alt="Click to show/hide rest of abstract" value="(more)" onclick="toggleDiv(1,'$value','shown','hidden','div'); return false;" /> |
---|
221 | |
---|
222 | </span> |
---|
223 | </span>--> |
---|
224 | |
---|
225 | |
---|
226 | <span py:def="result(i,d)"> |
---|
227 | <?python |
---|
228 | |
---|
229 | thisRecordFull = 'fullAbstract_' + str(i) |
---|
230 | thisRecordTrun = 'trunAbstract_' + str(i) |
---|
231 | |
---|
232 | abslen = len(d.abstract) |
---|
233 | |
---|
234 | if len(d.timeCoverage)==1: |
---|
235 | tc=d.timeCoverage[0] |
---|
236 | elif len(d.timeCoverage)==0: |
---|
237 | tc=['','',''] |
---|
238 | else: |
---|
239 | tc=d.timeCoverage[0] |
---|
240 | for m in d.timeCoverage: |
---|
241 | if m[0]<tc[0]:tc[0]=m[0] |
---|
242 | if m[1]>tc[1]:tc[1]=m[1] |
---|
243 | ?> |
---|
244 | <tr class="${i%2 and 'rowhi' or 'rowlo'}"> |
---|
245 | <td> |
---|
246 | <span py:if="d.briefCitation!=''"> |
---|
247 | <span class="ndgem">Citation:</span> ${d.briefCitation}</span> |
---|
248 | <span class="ndgem"> Title:</span> |
---|
249 | <span py:replace="abbreviate(d.name,70,0)"/> |
---|
250 | <br/> |
---|
251 | |
---|
252 | <!-- trunc text --> |
---|
253 | <div id="$thisRecordTrun" class="abstractText_shown"> |
---|
254 | |
---|
255 | |
---|
256 | <span class="ndgem"> Abstract: </span> |
---|
257 | |
---|
258 | <span py:replace="abbreviateAbstract(d.abstract,200,'')"/><!-- the text --> |
---|
259 | |
---|
260 | <!-- Only show "more" button if abstract long enough.. --> |
---|
261 | <span py:if="abslen > 200"> |
---|
262 | <input type="button" class="txtButtons_more" alt="Click to show/hide rest of abstract" value="more" onclick="Div_show('$thisRecordFull');Div_hide('$thisRecordTrun')" /> |
---|
263 | </span> |
---|
264 | </div> |
---|
265 | |
---|
266 | <!-- full text --> |
---|
267 | <div id="$thisRecordFull" class="abstractText_hidden"> |
---|
268 | |
---|
269 | <span class="ndgem"> Abstract: </span> |
---|
270 | |
---|
271 | ${d.abstract} |
---|
272 | <input type="button" class="txtButtons_less" alt="Click to show/hide rest of abstract" value="less" onclick="Div_show('$thisRecordTrun');Div_hide('$thisRecordFull')" /> |
---|
273 | </div> |
---|
274 | |
---|
275 | <span class="ndgem"> Sourced from:</span> ${XML(d.centre.url())} |
---|
276 | <span class="ndgem">Links:</span> |
---|
277 | <!-- Magnifying glass icon courtesy of http://www.deleket.com used for non-commercial purposes within this Discovery Service page and sub-documents --> |
---|
278 | <span py:replace="serviceIcons([d.binding])"/> |
---|
279 | <span py:replace="serviceIcons(d.services)"/> |
---|
280 | </td> |
---|
281 | <td>${tc[0]}</td> |
---|
282 | <td>${tc[1]}</td> |
---|
283 | <td> |
---|
284 | <div py:replace="Spatial(d.bbox,0)"/> |
---|
285 | </td> |
---|
286 | <!-- check if the DIF has already been selected |
---|
287 | <?python |
---|
288 | selected=False |
---|
289 | select_td_id='select_td_id_%s'%d.entryID |
---|
290 | if 'selection' in session: |
---|
291 | for item in session['selection']: |
---|
292 | if item.entryID == d.entryID: |
---|
293 | selected=True |
---|
294 | select_url = h.url_for(controller="visualise/selectedItems", |
---|
295 | action="addSelectedItem", |
---|
296 | entryid=d.entryID, |
---|
297 | divid=select_td_id, |
---|
298 | kmlurl = urlListEncode(d.kmlURL), |
---|
299 | wmcurl = urlListEncode(d.wmcURL), |
---|
300 | title = d.name) |
---|
301 | |
---|
302 | ?> |
---|
303 | |
---|
304 | <td id="$select_td_id" align="center"> |
---|
305 | <span py:if="selected"> |
---|
306 | ${XML(h.link_to_remote("Unselect", |
---|
307 | dict(update=select_td_id, |
---|
308 | url=h.url_for(controller="visualise/selectedItems", |
---|
309 | action="unSelectItem", |
---|
310 | entryid=d.entryID, |
---|
311 | divid=select_td_id))))} |
---|
312 | |
---|
313 | </span> |
---|
314 | <span class="selectme" py:if="not selected"> |
---|
315 | ${XML(h.link_to_remote("Select", |
---|
316 | dict(update=select_td_id, |
---|
317 | url=select_url |
---|
318 | )))} |
---|
319 | </span> |
---|
320 | </td>--> |
---|
321 | </tr> |
---|
322 | </span> |
---|
323 | |
---|
324 | </html> |
---|