source: TI07-MOLES/trunk/PythonCode/browse/portal/cgi/browse/DiscoveryTemplate.py @ 1671

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/TI07-MOLES/trunk/PythonCode/browse/portal/cgi/browse/DiscoveryTemplate.py@1671
Revision 1671, 6.8 KB checked in by lawrence, 14 years ago (diff)

New NDG discovery interface, including CSS, still a few
bits to do, but functional as WSGI now.

Line 
1######################################################################################################
2# This python template is for providing the search interface to the NDG.
3# It's been laid out to have the minimum of python in it to aid in porting to other languages
4#
5# They key python construct is that we have some local variables which are available in the module
6# imports this one ... for example, in the calling module we have
7#      helpAddress="http://somehost.somewhere"
8# and here we have
9#      somestring='stuff <a href="%(helpAddress)s"> more stuff'
10# In the calling module we do newstring=template.somestring % locals()
11# which results in newstring being: 'stuff <a href="http://somehost.somewhere"> more stuff'
12#
13# Note that this has been deliberately laid out to be used inside some other page driving format
14# including headers, footers etc, and css ...
15#
16# V0.0, Bryan Lawrence, September 28, 2006.
17#
18#########################################################################################################
19
20
21# requires mainLogo, helpAddress and advSearchAddress to be declared in parent
22main='''
23<div class="simpleSearch">
24<form action="%(discoveryURL)s">
25<center><table>
26<tr>
27<td colspan="3" align="center">
28New search for text in: <input type="radio" name="textTarget" value="All" checked="checked"/> Everything
29                <input type="radio" name="textTarget" value="Authors"/> Authors
30                <input type="radio" name="textTarget" value="Params"/> Parameters
31                </td></tr>
32<tr><td colspan="3" align="center"><input type="text" size="66" name="searchString"/></td></tr>
33<tr><td width="30%%"><a href="%(helpAddress)s">Help</a></td><td><input type="submit" value="Run Search"/>
34</td><td width="30%%"><a href="%(advancedURL)s">Advanced Search</a></td></tr></table></center>
35<input type="hidden" value="0" name="advanced"/>
36</form></div>'''
37
38# requires mainLogo, helpAddress, and discoveryURL to be declared in parent
39
40searchArea='''
41    <div class="searchMethod">
42        <table>
43        <tr><td colspan="3"><span class="searchHdr"> Refine by Area </span><br/></td></tr>
44        <tr><td colspan="3">
45        <input type="radio" name="spaceLimit" value="0" checked="checked"/> Do not limit by area
46        <input type="radio" name="spaceLimit" value="1"/> Limit by Bounding Box</td></tr>
47        <tr><td>Northerly Latitude:</td>
48            <td colspan="2" align="center">
49            <input size="7" value="+90.00" name="bboxN"/></td></tr>
50        <tr><td>Longitudinal Extent:</td>
51            <td><input size="8" value="-180.00" name="bboxW"/></td>
52            <td><input size="8" value="+180.00" name="bboxE"/></td> </tr>
53        <tr><td> Southerly Latitude:</td>
54            <td colspan="2" align="center">
55            <input size="7"value="-90.00" name="bboxS"/></td></tr>
56        <tr><td colspan="3"> (Units: degrees, north and east positive)</td></tr>
57        </table>
58    </div>
59    '''
60searchSource='''
61   <div class="searchMethod">
62        <table>
63        <tr><td colspan="2"><span class="searchHdr"> Refine by Source Data Centres </span></td></tr>
64        <tr><td colspan="2"><input type="radio" name="sourceLimit" value="0" checked="checked"/> All
65        <input type="radio" name="sourceLimit" value="1"/> Limit scope</td></tr>
66        <tr><td> NERC Data Centres</td><td><input type="checkbox" name="sourceNERC"/></td></tr>
67        <tr><td> Marine Data Partnership (MDIP)</td><td><input type="checkbox" name="sourceMDIP"/></td></tr>
68        </table>
69    </div>
70    '''
71searchTime= '''
72    <div class="searchMethod">
73    <table>
74        <tr><td colspan="2">
75        <span class="searchHdr"> Refine by Time </span></td></tr>
76        <tr><td colspan="2">
77        <input type="radio" name="timeLimit" value="0" checked="checked"/> Do not limit by date
78        <input type="radio" name="timeLimit" value="1"/> Limit by following date range
79        </td></tr>
80        <tr>    <td>Start date: </td>
81                <td><input type="text" value="1" size="2" name="startDateDay"/>
82                <select name="startDateMon">
83                    <option value="1"> Jan </option>
84                    <option value="2"> Feb</option>
85                    <option value="3"> Mar</option>
86                    <option value="4"> Apr</option>
87                    <option value="5"> May</option>
88                    <option value="6"> Jun</option>
89                    <option value="7"> Jul</option>
90                    <option value="8"> Aug</option>
91                    <option value="9"> Sep</option>
92                    <option value="10"> Oct</option>
93                    <option value="11"> Nov</option>
94                    <option value="12"> Dec</option>
95                    </select>
96                 <input type="text" value="2000" name="startDateYear" size="4"/></td>
97        </tr>     
98        <tr>    <td>End date: </td>
99                <td><input type="text" value="31" size="2" name="endDateDay"/>
100                <select name="endDateMon">
101                    <option value="1"> Jan </option>
102                    <option value="2"> Feb</option>
103                    <option value="3"> Mar</option>
104                    <option value="4"> Apr</option>
105                    <option value="5"> May</option>
106                    <option value="6"> Jun</option>
107                    <option value="7"> Jul</option>
108                    <option value="8"> Aug</option>
109                    <option value="9"> Sep</option>
110                    <option value="10"> Oct</option>
111                    <option value="11"> Nov</option>
112                    <option value="12" selected="selected"> Dec</option>
113                    </select>
114                 <input type="text" value="2001" name="endDateYear" size="4"/></td>
115        </tr>
116        </table>
117    </div>
118    '''
119searchText='''
120    <div class="searchMethod">
121    <span class="searchHdr"> Text Search </span><br/>
122                Search in: <input type="radio" name="textTarget" value="All" checked="checked"/> Everything
123                <input type="radio" name="textTarget" value="Authors"/> Authors
124                <input type="radio" name="textTarget" value="Params"/> Parameters
125                <br/>
126            <input type="text" size="60" name="searchString"/><br/>
127            <input type="hidden" value="1" name="advanced"/>
128    </div>
129    '''
130advancedSubmit='''<div class="searchMethod">
131    <input type="submit" value="Run Search"/>
132    <a class="button" href="%(helpAddress)s">Help</a>
133                <a class="button" href="%(discoveryURL)s"> Simple Search </a>
134    </div>'''
135
136advanced='''
137<div class="AdvancedSearch">
138    <form action="%(advancedURL)s">
139    <table class="AdvBox">
140    <tr><td>%(searchText)s</td></tr>
141    <tr><td>%(searchTime)s</td></tr>
142    <tr><td>%(searchArea)s</td></tr>
143    <tr><td>%(searchSource)s</td></tr>
144    <tr><td>%(advancedSubmit)s</td></tr>
145    </table>
146    </form>
147</div>'''
148
149help='''
150<h3> NDG Search Interface </h3>
151Some help text should appear here
152'''
153   
Note: See TracBrowser for help on using the repository browser.