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

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

First cut of standalone discovery code ... integrated into one python
module with the browe stuff ... (next steps include split into two
parents and one child egg as well as making it actually work).

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 actin="%(discoveryURL)s">
25<h4> Text Search </h4>
26<table>
27<tr>
28<td colspan="3">
29Search in: <input type="radio" name="textTarget" value="All" checked> Everything
30                <input type="radio" name="textTarget" value="Authors"> Authors
31                <input type="radio" name="textTarget" value="Params"> Parameters
32                </td></tr>
33<tr><td colspan="3"><input type="text" size=60 name="searchString"/></td></tr>
34<tr></tr>
35<tr><td><a href="%(helpAddress)s">Help</a><td><input type="submit" value="Run Search"/>
36    <td><a href="%(advancedURL)s">Advanced Search</a></td></tr>
37<input type="hidden" value="0" name="advanced">
38</table></form></div>'''
39
40# requires mainLogo, helpAddress, and discoveryURL to be declared in parent
41advanced='''
42<div class="AdvancedSearch">
43    <form action="%(advancedURL)s">
44    <div class="searchMethod">
45    <h4> Text Search </h4>
46                Search in: <input type="radio" name="textTarget" value="All" checked> Everything
47                <input type="radio" name="textTarget" value="Authors"> Authors
48                <input type="radio" name="textTarget" value="Params"> Parameters
49                <br/>
50            <input type="text" size=60 name="searchString"><br/>
51            <input type="hidden" value="1" name="advanced">
52    </div>
53    <div class="searchMethod">
54        <h4> Refine by Time </h4>
55        <input type="radio" name="timeLimit" value="0" checked> Do not limit by date
56        <input type="radio" name="timeLimit" value="1"> Limit by following date range
57        <table>
58        <tr>    <td>Start date: </td>
59                <td><input type=text value="1" size="2" name="startDateDay"/></td>
60                <td><select name="startDateMon">
61                    <option value="1"> Jan
62                    <option value="2"> Feb
63                    <option value="3"> Mar
64                    <option value="4"> Apr
65                    <option value="5"> May
66                    <option value="6"> Jun
67                    <option value="7"> Jul
68                    <option value="8"> Aug
69                    <option value="9"> Sep
70                    <option value="10"> Oct
71                    <option value="11"> Nov
72                    <option value="12"> Dec
73                    </select></td>
74                 <td><input type=text value="2000" name="startDateYear" size="4"/>
75        </tr>     
76        <tr>    <td>End date: </td>
77                <td><input type=text value="31" size="2" name="endDateDay"/></td>
78                <td><select name="endDateMon">
79                    <option value="1"> Jan
80                    <option value="2"> Feb
81                    <option value="3"> Mar
82                    <option value="4"> Apr
83                    <option value="5"> May
84                    <option value="6"> Jun
85                    <option value="7"> Jul
86                    <option value="8"> Aug
87                    <option value="9"> Sep
88                    <option value="10"> Oct
89                    <option value="11"> Nov
90                    <option value="12" selected> Dec
91                    </select></td>
92                 <td><input type=text value="2001" name="endDateYear" size="4"/>
93        </tr>
94        </table>
95    </div>
96    <div class="searchMethod">
97        <h4> Refine by Area </h4>
98        <input type="radio" name="spaceLimit" value="None" checked> Do not limit by area
99        <input type="radio" name="spaceLimit" value="BBOX"> Limit by Bounding Box
100        <table>
101        <tr><td>Northerly Latitude:</td>
102            <td colspan="2" align="center">
103            <input size="7" value="+90.00" name="bboxN"/></td></tr>
104        <tr><td>Longitudinal Extent:</td>
105            <td><input size="8" value="-180.00" name="bboxW"/></td>
106            <td><input size="8" value="+180.00" name="bboxE"/></td> </tr>
107        <tr><td> Southerly Latitude:</td>
108            <td colspan="2" align="center">
109            <input size="7"value="-90.00" name="bboxS"></td></tr>
110        <tr><td colspan="3"> (Units: degrees, north and east positive)</td></tr>
111        </table>
112    </div>
113    <div class="searchMethod">
114        <h4> Refine by Source Data Centre </h4>
115        <input type="radio" name="sourceLimit" value="0" checked> Do not limit by source
116    </div>
117    <input type="submit" value="Run Search"/>
118    <a href="%(helpAddress)s">Help</a>,
119                <a href="%(discoveryURL)s"> Simple Search </a>
120    </form>
121</div>'''
122   
Note: See TracBrowser for help on using the repository browser.