2 * Query logic for selecting location / Geospatial search
5 #set($queryOpts = $params.get("queryOpts"))
7 #if($queryOpts == "spatial")
11 #set($loc = $request.params.get('pt'))
12 ## Normalize first trip through to "none" because
13 ## an empty string generates an error message later on
18 #set($dist = $request.params.get('d', "10"))
20 ## Cities for The Select List
23 "45.17614,-93.87341": "Buffalo, MN",
24 "37.7752,-100.0232": "Dodge City, KS",
25 "35.0752,-97.032": "Oklahoma City, OK",
26 "37.7752,-122.4232": "San Francisco CA"
29 <label #annTitle("Add the &pt parameter")>
31 <select id="pt" name="pt">
33 ## Generate <option> tag for each city
34 #foreach( $city_lon_lat in $cities.keySet() )
35 #set( $city_name = $cities.get($city_lon_lat) )
36 <option value="$city_lon_lat"
37 #if($loc == $city_lon_lat)selected="true"#end
47 <span #annTitle("Add the &d parameter")>
49 <input id="d" name="d" type="text" size="6"
50 value="#if($dist != '')${dist}#{else}10#end" ## TODO: isn't the default of 10 above sufficient? no if/else needed?
54 <input type="hidden" name="sfield" value="store"/>
55 <input type="hidden" id="spatialFQ" name="fq" value=""/>
56 <input type="hidden" name="queryOpts" value="spatial"/>
60 <script type="text/javascript">
61 $('#query-form').submit(function() {
62 if ($("#pt").val() != "none") {
63 $("#spatialFQ").val("{!bbox}");
65 $fqs = $("#allFQs").val();
66 $fqs = $fqs.replace("{!bbox}", "");
68 $("#allFQs").remove();
70 $("#allFQs").val($fqs);