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

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

Improvements associated with ticket:733

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
22# nb the hack with 10 % columns of no breaking space is to deal with browser variations.
23main='''
24<div class="simpleSearch">
25<form action="%(discoveryURL)s">
26<center><table class="SearchBox">
27<tr><td>
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&nbsp;&nbsp;
31                (<a href="%(advancedURL)s">Advanced Search</a>,&nbsp;<a href="%(helpAddress)s">Help</a>)
32                </td></tr>
33<tr><td><input type="text" size="66" name="searchString"/>&nbsp;<input type="submit"/></td></tr>
34</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    <table align="center"><tr>
132        <td width="20%%" align="left"><a class="button" href="%(helpAddress)s">Help</a></td>
133            <td width="10%%" align="center">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
134        <td width="40%%" align="center"><button type="submit" class="button">Submit</button></td>
135            <td width="10%%" align="center">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
136        <td width="20%%" align="right"><a class="button" href="%(discoveryURL)s">Simple&nbsp;Search</a></td>
137    </tr></table>
138    </div>'''
139
140advanced='''
141<div class="AdvancedSearch">
142    <form action="%(advancedURL)s">
143    <table class="SearchBox">
144    <tr><td>%(searchText)s</td></tr>
145    <tr><td>%(searchTime)s</td></tr>
146    <tr><td>%(searchArea)s</td></tr>
147    <tr><td>%(searchSource)s</td></tr>
148    <tr><td>%(advancedSubmit)s</td></tr>
149    </table>
150    </form>
151</div>'''
152
153searchTextOneLine='''
154    <div class="searchOneLine"><form action="%(discoveryURL)s">
155        New Search:&nbsp;
156        <input type="text" size="60" name="searchString"><input type="hidden" value="0" name="advanced">
157        (Target:&nbsp;<select name="textTarget">
158            <option value="Authors">Authors</option>
159            <option value="All" selected="selected">All</option>
160            <option value="Params">Parameters</option> </select>) </form>
161    </div>'''
Note: See TracBrowser for help on using the repository browser.