source: TI07-MOLES/trunk/PythonCode/wsgi/DiscoveryTemplate.py @ 2545

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/TI07-MOLES/trunk/PythonCode/wsgi/DiscoveryTemplate.py@2545
Revision 2545, 11.1 KB checked in by lawrence, 12 years ago (diff)

Woops, forgot to commit these last night.
This is the date ordering change for discovery

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#########################################################################################################
17
18
19# requires mainLogo, helpAddress and advSearchAddress to be declared in parent
20# nb the hack with 10 % columns of no breaking space is to deal with browser variations.
21main='''
22<div class="simpleSearch">
23<form action="%(discoveryURL)s">
24<center><table class="SearchBox">
25<tr><td>
26New search for text in: <input type="radio" name="textTarget" value="All" checked="checked"/> Everything
27                <input type="radio" name="textTarget" value="Authors"/> Authors
28                <input type="radio" name="textTarget" value="Params"/> Parameters&nbsp;&nbsp;
29                (<a href="%(advancedURL)s">Advanced Search</a>,&nbsp;<a href="%(helpAddress)s">Help</a>)
30                </td></tr>
31<tr><td><input type="text" size="66" name="searchString"/>&nbsp;<input type="submit"/></td></tr>
32</table></center>
33<input type="hidden" value="0" name="advanced"/>
34</form></div>'''
35
36# requires mainLogo, helpAddress, and discoveryURL to be declared in parent
37
38searchArea='''
39    <div class="searchMethod">
40        <table>
41        <tr><td colspan="3"><span class="searchHdr"> Refine by Area </span><br/></td></tr>
42        <tr><td colspan="3">
43        <input type="radio" name="spaceLimit" value="0" checked="checked"/> Do not limit by area
44        <input type="radio" name="spaceLimit" value="1"/> Limit by Bounding Box</td></tr>
45        <tr><td>Northerly Latitude:</td>
46            <td colspan="2" align="center">
47            <input size="7" value="+90.00" name="bboxN"/></td></tr>
48        <tr><td>Longitudinal Extent:</td>
49            <td><input size="8" value="-180.00" name="bboxW"/></td>
50            <td><input size="8" value="+180.00" name="bboxE"/></td> </tr>
51        <tr><td> Southerly Latitude:</td>
52            <td colspan="2" align="center">
53            <input size="7"value="-90.00" name="bboxS"/></td></tr>
54        <tr><td colspan="3"> (Units: degrees, north and east positive)</td></tr>
55        </table>
56    </div>
57    '''
58searchSource='''
59   <div class="searchMethod">
60        <table>
61        <tr><td colspan="2"><span class="searchHdr"> Refine by Source Data Centres </span></td></tr>
62        <tr><td colspan="2"><input type="radio" name="sourceLimit" value="0" checked="checked"/> All
63        <input type="radio" name="sourceLimit" value="1"/> Limit scope</td></tr>
64        <tr><td> NERC Data Centres</td><td><input type="checkbox" name="sourceNERC"/></td></tr>
65        <tr><td> Marine Data Partnership (MDIP)</td><td><input type="checkbox" name="sourceMDIP"/></td></tr>
66        </table>
67    </div>
68    '''
69searchTime= '''
70    <div class="searchMethod">
71    <table>
72        <tr><td colspan="2">
73        <span class="searchHdr"> Refine by Time </span></td></tr>
74        <tr><td colspan="2">
75        <input type="radio" name="timeLimit" value="0" checked="checked"/> Do not limit by date
76        <input type="radio" name="timeLimit" value="1"/> Limit by following date range
77        </td></tr>
78        <tr>    <td>Start date: </td>
79                <td><input type="text" value="1" size="2" name="startDateDay"/>
80                <select name="startDateMon">
81                    <option value="1"> Jan </option>
82                    <option value="2"> Feb</option>
83                    <option value="3"> Mar</option>
84                    <option value="4"> Apr</option>
85                    <option value="5"> May</option>
86                    <option value="6"> Jun</option>
87                    <option value="7"> Jul</option>
88                    <option value="8"> Aug</option>
89                    <option value="9"> Sep</option>
90                    <option value="10"> Oct</option>
91                    <option value="11"> Nov</option>
92                    <option value="12"> Dec</option>
93                    </select>
94                 <input type="text" value="2000" name="startDateYear" size="4"/></td>
95        </tr>     
96        <tr>    <td>End date: </td>
97                <td><input type="text" value="31" size="2" name="endDateDay"/>
98                <select name="endDateMon">
99                    <option value="1"> Jan </option>
100                    <option value="2"> Feb</option>
101                    <option value="3"> Mar</option>
102                    <option value="4"> Apr</option>
103                    <option value="5"> May</option>
104                    <option value="6"> Jun</option>
105                    <option value="7"> Jul</option>
106                    <option value="8"> Aug</option>
107                    <option value="9"> Sep</option>
108                    <option value="10"> Oct</option>
109                    <option value="11"> Nov</option>
110                    <option value="12" selected="selected"> Dec</option>
111                    </select>
112                 <input type="text" value="2001" name="endDateYear" size="4"/></td>
113        </tr>
114        </table>
115    </div>
116    '''
117searchText='''
118    <div class="searchMethod">
119    <span class="searchHdr"> Text Search </span><br/>
120                Search in: <input type="radio" name="textTarget" value="All" checked="checked"/> Everything
121                <input type="radio" name="textTarget" value="Authors"/> Authors
122                <input type="radio" name="textTarget" value="Params"/> Parameters
123                <br/>
124            <input type="text" size="60" name="searchString"/><br/>
125            <input type="hidden" value="1" name="advanced"/>
126    </div>
127    '''
128advancedSubmit='''<div class="searchMethod">
129    <table align="center"><tr>
130        <td width="20%%" align="left"><a class="button" href="%(helpAddress)s">Help</a></td>
131            <td width="10%%" align="center">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
132        <td width="40%%" align="center"><button type="submit" class="button">Submit</button></td>
133            <td width="10%%" align="center">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
134        <td width="20%%" align="right"><a class="button" href="%(discoveryURL)s">Simple&nbsp;Search</a></td>
135    </tr></table>
136    </div>'''
137
138advanced='''
139<div class="AdvancedSearch">
140    <form action="%(advancedURL)s">
141    <table class="SearchBox">
142    <tr><td>%(searchText)s</td></tr>
143    <tr><td>%(searchTime)s</td></tr>
144    <tr><td>%(searchArea)s</td></tr>
145    <tr><td>%(searchSource)s</td></tr>
146    <tr><td>%(advancedSubmit)s</td></tr>
147    </table>
148    </form>
149</div>'''
150
151oneLiner='''<input type="text" size="60" name="searchString"><input type="hidden" value="0" name="advanced">
152            (Target:&nbsp;<select name="textTarget">
153            <option value="Authors">Authors</option>
154            <option value="All" selected="selected">All</option>
155            <option value="Params">Parameters</option> </select>)'''
156
157searchTextOneLine='''
158    <div class="searchOneLine"><form action="%(discoveryURL)s">
159        New Search:&nbsp;%(oneLiner)s</form>
160    </div>'''
161   
162
163revisedAdvancedSearch='''
164    <div class="AdvancedSearch">
165        <form action="%(advancedURL)s">
166            <table class="SearchBox"><tbody>
167                <tr><td>Free&nbsp;Text&nbsp;Search:&nbsp;<input type="text" size="60" name="searchString">
168                (Target:&nbsp;<select name="textTarget">
169                    <option value="Authors">Authors</option>
170                    <option value="All" selected="selected">All</option>
171                    <option value="Params">Parameters</option> </select>)</td></tr>
172                <tr><td align="center"><div class="searchMethod">
173                    <table><tbody>
174                        <tr><td colspan="2"><span class="searchHdr"> Refine by Temporal Coverage </span></td></tr>
175                        <tr><td>Start date: </td>
176                            <td><input type="text" value="%(startDateYear)s" size="4" name="startDateYear"/>
177                                <input type="text" value="%(startDateMon)s" size="3" name="startDateMon"/>
178                                <input type="text" value="%(startDateDay)s" size="2" name="startDateDay"/>
179                            </td>
180                        </tr>     
181                        <tr><td>End date: </td>
182                            <td><input type="text" value="%(endDateYear)s" size="4" name="endDateYear"/>
183                                <input type="text" value="%(endDateMon)s" size="3" name="endDateMon"/>
184                                <input type="text" value="%(endDateDay)s" size="2" name="endDateDay"/>
185                            </td>
186                        </tr>
187                        <tr><td colspan="2">(Format: yyyy mmm dd)</td></tr>
188                    </tbody></table>
189                </div></td></tr>
190                <tr><td align="center"><div class="searchMethod">
191                    <table><tbody>
192                        <tr><td colspan="3"><span class="searchHdr"> Refine by Spatial Coverage</span><br/></td></tr>
193                        <tr><td>Northerly Latitude:</td>
194                            <td colspan="2" align="center">
195                            <input size="7" value="%(bboxN)s" name="bboxN"/></td></tr>
196                        <tr><td>Longitudinal Extent:</td>
197                            <td><input size="8" value="%(bboxW)s" name="bboxW"/></td>
198                            <td><input size="8" value="%(bboxE)s" name="bboxE"/></td> </tr>
199                        <tr><td> Southerly Latitude:</td>
200                        <td colspan="2" align="center">
201                        <input size="7"value="%(bboxS)s" name="bboxS"/></td></tr>
202                        <tr><td colspan="3"> (Units: degrees, north and east positive)</td></tr>
203                     </tbody></table>
204                </div></td></tr>
205                <tr><td align="center"><div class="searchMethod">
206                    <table><tbody>
207                        <tr><td colspan="2"><span class="searchHdr"> Refine by Source Data Centres </span></td></tr>
208                        <tr><td> All</td><td><input type="radio" name="source" value="All" checked="checked"></td></tr>
209                        <tr><td> NERC Data Centres</td><td><input type="radio" name="source" value="NERC_DDC"/></td></tr>
210                        <tr><td> Marine Data Partnership (MDIP)</td><td><input type="radio" name="source" value="MDIP"/></td></tr>
211                    </tbody></table>
212                 </div></td></tr>
213                <tr><td align="center"><input type="submit"></td></tr>
214            </tbody></table>
215            <input type="hidden" value="1" name="advanced"/>
216         </form>
217    </div>'''
218   
219   
220   
Note: See TracBrowser for help on using the repository browser.