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 | import string |
---|
6 | |
---|
7 | ?> |
---|
8 | |
---|
9 | <html xmlns="http://www.w3.org/1999/xhtml" xmlns:py="http://purl.org/kid/ns#"> |
---|
10 | |
---|
11 | <!-- Parameter list class, used in StubB and DIF --> |
---|
12 | |
---|
13 | <div py:def="ParameterList(params)" class="ParameterList"> |
---|
14 | <table py:if="params!={}" cellspacing="0" cellpadding="3" border="0" width="100%"><tbody> |
---|
15 | <tr><td class="linehead"><span class="heading0"> Parameters</span></td></tr> |
---|
16 | <span py:for="item in params"> |
---|
17 | <tr><td class="rowhead">$item</td></tr> |
---|
18 | <?python |
---|
19 | #should make sure keyword with spaces are not split inappropriately |
---|
20 | keywords='; '.join([k.replace(' ',' ') for k in params[item]]) |
---|
21 | ?> |
---|
22 | <tr py:if="params[item]!=[]"><td>${XML(keywords)}</td></tr> |
---|
23 | </span> |
---|
24 | </tbody></table> |
---|
25 | </div> |
---|
26 | |
---|
27 | <div py:def="Distribution(dlist)"> |
---|
28 | <table py:if="dlist!=[]" cellspacing="0" cellpadding="3" width=" 100%" border="0"> |
---|
29 | <tr><td class="linehead" colspan="4"><span class="headingO">Distribution</span></td></tr> |
---|
30 | <tr><th> Format </th> <th> Size </th> <th> Media </th> <th> Fees </th> </tr> |
---|
31 | <tr py:for="d in dlist"> |
---|
32 | <td>${d['Distribution_Format']}</td> |
---|
33 | <td>${d['Distribution_Size']}</td> |
---|
34 | <td>${d['Distribution_Media']}</td> |
---|
35 | <td>${d['Fees']}</td> |
---|
36 | </tr> |
---|
37 | </table> |
---|
38 | </div> |
---|
39 | |
---|
40 | <div py:def="Services()" id="ServiceList"> |
---|
41 | <table cellspacing="0" cellpadding="3" width=" 100%" border="0"><tbody> |
---|
42 | |
---|
43 | <!-- Add anchor point so links from all results page to links and services come straight here --> |
---|
44 | <a name="linksAndServices"/> |
---|
45 | |
---|
46 | <tr><td class="linehead" colspan="3"><span class="headingO">Links and Services</span></td></tr> |
---|
47 | <tr py:for="s in c.doc.services"> |
---|
48 | <?python |
---|
49 | t=s.contentType |
---|
50 | |
---|
51 | isWMC = False |
---|
52 | |
---|
53 | |
---|
54 | #check for wms, wfs, wcs, vis in contentTypes - according to types on vocab dif accepted terms list |
---|
55 | if 'WEB MAP SERVICE' in t: |
---|
56 | t = 'WMS' |
---|
57 | |
---|
58 | if 'WEB COVERAGE SERVICE' in t: |
---|
59 | t = 'WCS' |
---|
60 | |
---|
61 | if 'WEB FEATURE SERVICE' in t: |
---|
62 | t = 'WFS' |
---|
63 | |
---|
64 | if 'ACCESS MAP VIEWER' in t: |
---|
65 | t = 'VIS' |
---|
66 | |
---|
67 | |
---|
68 | if 'WEB MAP CONTEXT' in t: |
---|
69 | isWMC = True |
---|
70 | if t=='': |
---|
71 | t='R' |
---|
72 | if 'GET DATA' in t: |
---|
73 | t='GET DATA' |
---|
74 | try: |
---|
75 | icon={'NDG_BROWSE':g.icons_NDGBrwse,'GET DATA':g.icons_A, |
---|
76 | 'VIEW EXTENDED METADATA':g.icons_B, |
---|
77 | 'DISCOVERY':g.icons_D, |
---|
78 | 'R':g.icons_R,'WMS':g.wmsIcon,'WCS':g.wcsIcon,'WFS':g.wfsIcon,'VIS':g.visIcon}[t] |
---|
79 | except: |
---|
80 | icon=g.icons_R |
---|
81 | ?> |
---|
82 | <td width="20%" py:if="isWMC"> |
---|
83 | scooby doo $g.server |
---|
84 | <span py:replace="linkimage(g.server + '/viewItems?ENDPOINT=' + s.url,icon,s.description)" py:strip="True"/> |
---|
85 | </td> |
---|
86 | <td width="20%" py:if="not isWMC"> |
---|
87 | <span py:replace="linkimage(s.url,icon,s.description)" py:strip="True"/> |
---|
88 | </td> |
---|
89 | <td>${s.description}</td> |
---|
90 | |
---|
91 | <!-- Add in the actual URL of service so user can cut and paste --> |
---|
92 | <td> |
---|
93 | ${s.url} |
---|
94 | </td> |
---|
95 | |
---|
96 | |
---|
97 | </tr> |
---|
98 | <tr py:if="c.doc.ndgObject is not None"> |
---|
99 | <td width="20%"><span py:replace="linkimage(c.doc.ndgObject.xmlURL,g.icons_xml,'[XML]')"/></td> |
---|
100 | <td>Downloadable XML version of this record |
---|
101 | <span py:if="c.doc.ndgObject.gettable==1"> |
---|
102 | (Original <span py:replace="linkimage(c.doc.ndgObject.xmlURL+'&outputSchema=original',g.icons_xml,'[XML]')"/>) |
---|
103 | </span></td></tr> |
---|
104 | <tr py:if="c.doc.ndgObject is not None"> |
---|
105 | <td width="20%"><span py:replace="linkimage(c.doc.ndgObject.printableURL,g.icons_prn,'[HTML]')"/></td> |
---|
106 | <td>Viewable XML version of this record |
---|
107 | <span py:if="c.doc.ndgObject.gettable==1"> |
---|
108 | (Original <span py:replace="linkimage(c.doc.ndgObject.printableURL+'&outputSchema=original',g.icons_prn,'[HTML]')"/>) |
---|
109 | </span></td></tr> |
---|
110 | <tr py:if="c.doc.ndgObject.gettable==1"><td></td><td>(Original records are the raw material harvested from data providers)</td></tr> |
---|
111 | </tbody></table> |
---|
112 | </div> <!-- ServiceList --> |
---|
113 | |
---|
114 | |
---|
115 | <div py:def="Spatial(bbox,h)"> |
---|
116 | <!-- Currently this only shows the first bounding box --> |
---|
117 | <table py:if="bbox.nboxes==1"><tbody> |
---|
118 | <tr py:if="h==1"><td colspan="2" class="cellhead">Spatial coverage</td></tr> |
---|
119 | <tr><td colspan="2" align="center">${bbox.boxes[0][0]}</td></tr> |
---|
120 | <tr><td align="center">${bbox.boxes[0][1]}</td><td align="center">${bbox.boxes[0][2]}</td></tr> |
---|
121 | <tr><td colspan="2" align="center">${bbox.boxes[0][3]}</td></tr> |
---|
122 | </tbody></table> |
---|
123 | <span py:if="bbox.nboxes!=1"><p py:if="h==1" class="cellhead">Spatial Coverage</p> |
---|
124 | <p py:if="bbox.nboxes>1"> $bbox.nboxes different areas.</p> |
---|
125 | <p py:if="bbox.nboxes==0"> No spatial coverage information available.</p> |
---|
126 | </span> |
---|
127 | </div> |
---|
128 | |
---|
129 | <div py:def="Coverage(bbox,timcov)"> |
---|
130 | <table cellspacing="0" cellpadding="3" border="0" width="100%"><tbody> |
---|
131 | <tr><td class="linehead" colspan="2"><span class="heading0"> Data Coverage</span> </td></tr> |
---|
132 | <tr><td><div py:replace="Spatial(bbox,1)"/></td> |
---|
133 | <td><table><tr><td colspan="2" class="cellhead"> Temporal coverage</td></tr> |
---|
134 | <span py:if="len(timcov)==1"> |
---|
135 | <tr><td> Start Date: ${timcov[0][0]}</td><td>End Date: ${timcov[0][1]}</td></tr> |
---|
136 | <tr><td colspan="2"> Status:${timcov[0][2]}</td></tr> |
---|
137 | </span> |
---|
138 | <tr py:if="len(timcov)==0"><td colspan="2">No temporal information available.</td></tr> |
---|
139 | <tr py:if="len(timcov)>1"><td colspan="2">${len(timcov)} different periods of data available.</td></tr> |
---|
140 | </table> |
---|
141 | </td></tr> |
---|
142 | </tbody></table> |
---|
143 | </div> |
---|
144 | |
---|
145 | <div py:def="ShortCoverage(e)"> |
---|
146 | <span py:if="len(e.timeCoverage)==1">From ${e.timeCoverage[0][0]} to ${e.timeCoverage[0][1]} |
---|
147 | </span><span py:if="e.bbox.nboxes==1"> |
---|
148 | 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 |
---|
149 | </span> |
---|
150 | </div> |
---|
151 | |
---|
152 | <div py:def="People(ptype,listOf)"> |
---|
153 | <table py:if="listOf!=[]" cellspacing="0" cellpadding="3" border="0" width="100%"><tbody> |
---|
154 | <tr><td class="linehead" colspan="2"><span class="heading0"> $ptype</span></td></tr> |
---|
155 | <tr py:for="p in listOf"><td>${XML(p.core['role'])}</td><td>${XML(p.toHTML())}</td></tr> |
---|
156 | </tbody></table> |
---|
157 | </div> |
---|
158 | |
---|
159 | <div py:def="Centre(cen)"> |
---|
160 | <table cellspacing="0" cellpadding="3" border="0" width="100%"><tbody> |
---|
161 | <tr><td class="linehead"><span class="heading0"> Data Centre</span></td></tr> |
---|
162 | <tr><td>${XML(cen.toHTML())}</td></tr> |
---|
163 | </tbody></table> |
---|
164 | </div> |
---|
165 | |
---|
166 | <div py:def="Keywords(Name,listOf)"> |
---|
167 | <table cellspacing="0" cellpadding="3" border="0" width="100%"><tbody> |
---|
168 | <tr><td class="linehead"><span class="heading0"> $Name</span></td></tr> |
---|
169 | <tr py:for="item in listOf"><td>$item</td></tr> |
---|
170 | </tbody></table> |
---|
171 | </div> |
---|
172 | |
---|
173 | <!--- Create that little list of service icons on the result page --> |
---|
174 | <!-- FUDGE to get different icon showing for ceda browse records until I fix the atom=>dif pipeline (so contentType included on all ceda difs) SJD 22/10/09 --> |
---|
175 | <span py:def="serviceIcons(sL)"> |
---|
176 | <span py:for="s in sL"> |
---|
177 | <?python |
---|
178 | |
---|
179 | |
---|
180 | listServiceEsc=['GET WEB MAP SERVICE','GET WEB COVERAGE SERVICE','GET WEB FEATURE SERVICE','ACCESS MAP VIEWER'] |
---|
181 | |
---|
182 | t=s.contentType |
---|
183 | serviceStatus='False' |
---|
184 | loopy = False |
---|
185 | |
---|
186 | #flag whether we need to produce an icon i.e. if content above is in contentType then we don't need it as producing a service button instead. |
---|
187 | for service in listServiceEsc: |
---|
188 | if loopy: |
---|
189 | break |
---|
190 | |
---|
191 | if service in t: |
---|
192 | serviceStatus='True' |
---|
193 | loopy = True |
---|
194 | |
---|
195 | |
---|
196 | if 'ATOM' in s.description: |
---|
197 | atomFudge=True |
---|
198 | else: |
---|
199 | atomFudge=False |
---|
200 | |
---|
201 | if t=='': t='R' |
---|
202 | |
---|
203 | if 'GET DATA' in t: t='GET DATA' |
---|
204 | |
---|
205 | try: |
---|
206 | iconD={'NDG_BROWSE':g.icons_NDGBrwse,'GET DATA':g.icons_A,'VIEW EXTENDED METADATA':g.icons_B,'DISCOVERY':g.icons_D,'R':g.icons_R} |
---|
207 | |
---|
208 | if atomFudge: |
---|
209 | icon=g.icons_NDGBrwse |
---|
210 | |
---|
211 | else: |
---|
212 | icon=iconD[t] |
---|
213 | |
---|
214 | except: |
---|
215 | |
---|
216 | icon=g.icons_R |
---|
217 | |
---|
218 | if serviceStatus == 'True': |
---|
219 | icon='' |
---|
220 | |
---|
221 | ?> |
---|
222 | |
---|
223 | <span py:if="icon!=''"> |
---|
224 | <span py:replace="linkimage(s.url,icon,s.description)"/> |
---|
225 | </span> |
---|
226 | </span> |
---|
227 | </span> |
---|
228 | |
---|
229 | <!-- in order to get around displaying a huge list of service icons for wms etc, generate buttons with number info --> |
---|
230 | <span py:def="serviceButtons(sL,discoveryViewLinkBinding)"> |
---|
231 | |
---|
232 | <?python |
---|
233 | |
---|
234 | numWMS = 0 |
---|
235 | numWCS = 0 |
---|
236 | numWFS = 0 |
---|
237 | numVis = 0 |
---|
238 | |
---|
239 | counter = 0 |
---|
240 | |
---|
241 | #discoveryViewLink passed from d.binding, coding for which is deep down somewhere. Just parse and strip out the url for now.. |
---|
242 | #..and can add anchor for links and service in at this point too.. |
---|
243 | discoveryViewLink=discoveryViewLinkBinding + '#linksAndServices' |
---|
244 | |
---|
245 | ?> |
---|
246 | <!-- Loop through each service content block and count numbers of relevant services - NOTE based on GCMD accepted terms --> |
---|
247 | <span py:for="s in sL"> |
---|
248 | |
---|
249 | <?python |
---|
250 | t=s.contentType |
---|
251 | |
---|
252 | if 'GET WEB MAP SERVICE' in t: |
---|
253 | numWMS = numWMS + 1 |
---|
254 | |
---|
255 | if 'GET WEB COVERAGE SERVICE' in t: |
---|
256 | numWCS = numWCS + 1 |
---|
257 | |
---|
258 | if 'GET WEB FEATURE SERVICE' in t: |
---|
259 | numWFS = numWFS + 1 |
---|
260 | |
---|
261 | if 'ACCESS MAP VIEWER' in t: |
---|
262 | numVis = numVis + 1 |
---|
263 | |
---|
264 | counter = counter+1 |
---|
265 | ?> |
---|
266 | |
---|
267 | </span> |
---|
268 | |
---|
269 | <!-- now formulate buttons to add to links and services bar --> |
---|
270 | <span py:if="numWMS > 0"> |
---|
271 | <input type="button" class="txtButtons_WMS" onMouseOver="goLite(this.form.name,this.name)" onMouseOut="goDim(this.form.name,this.name)" alt="$numWMS OGC Web Map Services available - click for more info" value="$numWMS WMS" onclick="window.location.href='$discoveryViewLink'"/> |
---|
272 | </span> |
---|
273 | <span py:if="numWCS > 0"> |
---|
274 | <input type="button" class="txtButtons_WCS" onMouseOver="goLite(this.form.name,this.name)" onMouseOut="goDim(this.form.name,this.name)" alt="$numWCS OGC Web Coverage Services available - click for more info" value="$numWCS WCS" onclick="window.location.href='$discoveryViewLink'"/> |
---|
275 | </span> |
---|
276 | <span py:if="numWFS > 0"> |
---|
277 | <input type="button" class="txtButtons_WFS" onMouseOver="goLite(this.form.name,this.name)" onMouseOut="goDim(this.form.name,this.name)" alt="$numWFS OGC Web Feature Services available - click for more info" value="$numWFS WCS" onclick="window.location.href='$discoveryViewLink'"/> |
---|
278 | </span> |
---|
279 | <span py:if="numVis > 0"> |
---|
280 | <input type="button" class="txtButtons_VIS" onMouseOver="goLite(this.form.name,this.name)" onMouseOut="goDim(this.form.name,this.name)" alt="$numVis Data Visualisation Services - click for more info" value="$numVis Visualisations" onclick="window.location.href='$discoveryViewLink'"/> |
---|
281 | </span> |
---|
282 | |
---|
283 | |
---|
284 | </span> |
---|
285 | |
---|
286 | <!--- Easy shortening of text for result pages, should use ajax to expand --> |
---|
287 | <span py:def="abbreviate(text,L,url)"> |
---|
288 | <?python |
---|
289 | if len(text)<L: |
---|
290 | more='' |
---|
291 | else: |
---|
292 | |
---|
293 | if url: |
---|
294 | more=' <a href="%s">(more)</a>'%url |
---|
295 | else: more='...' |
---|
296 | ?> |
---|
297 | ${text[0:L]} ${XML(more)} |
---|
298 | </span> |
---|
299 | |
---|
300 | <!--- Easy shortening of text for result pages, should use ajax to expand --> |
---|
301 | <span py:def="abbreviateAbstract(text,L,url)"> |
---|
302 | <?python |
---|
303 | if len(text)<L: |
---|
304 | more='' |
---|
305 | else: |
---|
306 | |
---|
307 | if url: |
---|
308 | more=' <a href="%s">(more)</a>'%url |
---|
309 | else: more='...' |
---|
310 | ?> |
---|
311 | ${text[0:L]} ${XML(more)} |
---|
312 | </span> |
---|
313 | |
---|
314 | <!-- Abstract more/less --> |
---|
315 | <!--<span py:def="moreAbstract(value)"> |
---|
316 | |
---|
317 | <span > |
---|
318 | |
---|
319 | <img src="$g.helpIcon" alt="Toggle help" class="helpicon"/></a> |
---|
320 | |
---|
321 | $value |
---|
322 | |
---|
323 | <input type="button" class="txtButtons" alt="Click to show/hide rest of abstract" value="(more)" onclick="toggleDiv(1,'$value','shown','hidden','div'); return false;" /> |
---|
324 | |
---|
325 | </span> |
---|
326 | </span>--> |
---|
327 | |
---|
328 | |
---|
329 | <span py:def="result(i,d)"> |
---|
330 | <?python |
---|
331 | |
---|
332 | thisRecordFull = 'fullAbstract_' + str(i) |
---|
333 | thisRecordTrun = 'trunAbstract_' + str(i) |
---|
334 | |
---|
335 | abslen = len(d.abstract) |
---|
336 | |
---|
337 | if len(d.timeCoverage)==1: |
---|
338 | tc=d.timeCoverage[0] |
---|
339 | elif len(d.timeCoverage)==0: |
---|
340 | tc=['','',''] |
---|
341 | else: |
---|
342 | tc=d.timeCoverage[0] |
---|
343 | for m in d.timeCoverage: |
---|
344 | if m[0]<tc[0]:tc[0]=m[0] |
---|
345 | if m[1]>tc[1]:tc[1]=m[1] |
---|
346 | ?> |
---|
347 | <tr class="${i%2 and 'rowhi' or 'rowlo'}"> |
---|
348 | <td> |
---|
349 | <span py:if="d.briefCitation!=''"> |
---|
350 | <span class="ndgem">Citation:</span> ${d.briefCitation}</span> |
---|
351 | <span class="ndgem"> Title:</span> |
---|
352 | <span py:replace="abbreviate(d.name,70,0)"/> |
---|
353 | <br/> |
---|
354 | |
---|
355 | <!-- trunc text |
---|
356 | <div id="$thisRecordTrun" class="abstractText_shown">--> |
---|
357 | <div id="$thisRecordTrun" class="${i%2 and 'abstractText_shown_hi' or 'abstractText_shown_lo'}"> |
---|
358 | |
---|
359 | <span class="ndgem"> Abstract: </span> |
---|
360 | |
---|
361 | <span py:replace="abbreviateAbstract(d.abstract,200,'')"/><!-- the text --> |
---|
362 | |
---|
363 | <!-- Only show "more" button if abstract long enough.. --> |
---|
364 | <span py:if="abslen > 200"> |
---|
365 | <input type="button" class="txtButtons_more" alt="Click to show/hide rest of abstract" value="more" onclick="Div_show('$thisRecordFull');Div_hide('$thisRecordTrun')" /> |
---|
366 | </span> |
---|
367 | </div> |
---|
368 | |
---|
369 | <!-- full text |
---|
370 | <div id="$thisRecordFull" class="abstractText_hidden">--> |
---|
371 | <div id="$thisRecordFull" class="${i%2 and 'abstractText_hidden_hi' or 'abstractText_hidden_lo'}"> |
---|
372 | |
---|
373 | <span class="ndgem"> Abstract: </span> |
---|
374 | |
---|
375 | ${d.abstract} |
---|
376 | <input type="button" class="txtButtons_less" alt="Click to show/hide rest of abstract" value="less" onclick="Div_show('$thisRecordTrun');Div_hide('$thisRecordFull')" /> |
---|
377 | </div> |
---|
378 | |
---|
379 | <span class="ndgem"> Sourced from:</span> ${XML(d.centre.url())} |
---|
380 | <span class="ndgem">Links:</span> |
---|
381 | <!-- Magnifying glass icon courtesy of http://www.deleket.com used for non-commercial purposes within this Discovery Service page and sub-documents --> |
---|
382 | <span py:replace="serviceIcons([d.binding])"/> <!-- Discovery View link --> |
---|
383 | <span py:replace="serviceIcons(d.services)"/> <!-- Logos, homepage etc etc --> |
---|
384 | |
---|
385 | <br/><span class="ndgem" py:if="d.serviceCounter > 0">Services:</span> |
---|
386 | <span py:replace="serviceButtons(d.services,d.discoveryViewURL)"/> <!-- Buttons for links to wms, wcs, vis services etc --> |
---|
387 | |
---|
388 | </td> |
---|
389 | <td>${tc[0]}</td> |
---|
390 | <td>${tc[1]}</td> |
---|
391 | <td> |
---|
392 | <div py:replace="Spatial(d.bbox,0)"/> |
---|
393 | </td> |
---|
394 | <!-- check if the DIF has already been selected |
---|
395 | <?python |
---|
396 | selected=False |
---|
397 | select_td_id='select_td_id_%s'%d.entryID |
---|
398 | if 'selection' in session: |
---|
399 | for item in session['selection']: |
---|
400 | if item.entryID == d.entryID: |
---|
401 | selected=True |
---|
402 | select_url = h.url_for(controller="visualise/selectedItems", |
---|
403 | action="addSelectedItem", |
---|
404 | entryid=d.entryID, |
---|
405 | divid=select_td_id, |
---|
406 | kmlurl = urlListEncode(d.kmlURL), |
---|
407 | wmcurl = urlListEncode(d.wmcURL), |
---|
408 | title = d.name) |
---|
409 | |
---|
410 | ?> |
---|
411 | |
---|
412 | <td id="$select_td_id" align="center"> |
---|
413 | <span py:if="selected"> |
---|
414 | ${XML(h.link_to_remote("Unselect", |
---|
415 | dict(update=select_td_id, |
---|
416 | url=h.url_for(controller="visualise/selectedItems", |
---|
417 | action="unSelectItem", |
---|
418 | entryid=d.entryID, |
---|
419 | divid=select_td_id))))} |
---|
420 | |
---|
421 | </span> |
---|
422 | <span class="selectme" py:if="not selected"> |
---|
423 | ${XML(h.link_to_remote("Select", |
---|
424 | dict(update=select_td_id, |
---|
425 | url=select_url |
---|
426 | )))} |
---|
427 | </span> |
---|
428 | </td>--> |
---|
429 | </tr> |
---|
430 | </span> |
---|
431 | |
---|
432 | </html> |
---|