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

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

Look and feel of result set is now close to Kay's concepts.

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