Don't hardcode bbox size 0.25, use APP_CONFIG['max_request_area'] instead
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>
Sat, 6 Jun 2009 18:13:11 +0000 (18:13 +0000)
committerÆvar Arnfjörð Bjarmason <avarab@gmail.com>
Sat, 6 Jun 2009 18:13:11 +0000 (18:13 +0000)
app/views/browse/start.rjs
app/views/export/start.rjs

index 244456f119febc65291323302e45053516b0da2b..8eaf9007018a1930aa5cb8511c624262e3010a17 100644 (file)
@@ -186,7 +186,7 @@ page << <<EOJ
     var projected = bounds.clone().transform(new OpenLayers.Projection("EPSG:900913"), new OpenLayers.Projection("EPSG:4326"));
     var size = projected.getWidth() * projected.getHeight();
 
     var projected = bounds.clone().transform(new OpenLayers.Projection("EPSG:900913"), new OpenLayers.Projection("EPSG:4326"));
     var size = projected.getWidth() * projected.getHeight();
 
-    if (size > 0.25) {
+    if (size > #{APP_CONFIG['max_request_area']}) {
       setStatus("#{I18n.t('browse.start_rjs.unable_to_load')} " + size + " #{I18n.t('browse.start_rjs.must_be_smaller')}");
     } else {
       loadGML("/api/#{API_VERSION}/map?bbox=" + projected.toBBOX());
       setStatus("#{I18n.t('browse.start_rjs.unable_to_load')} " + size + " #{I18n.t('browse.start_rjs.must_be_smaller')}");
     } else {
       loadGML("/api/#{API_VERSION}/map?bbox=" + projected.toBBOX());
index dd879132a4b26f65370622a0c545a7d26d1ec978..8a17ca6ae416eb9e6ee4ffbfe759f1ffe4d65bf6 100644 (file)
@@ -190,7 +190,7 @@ page << <<EOJ
   function validateControls() {
     var bounds = new OpenLayers.Bounds($("minlon").value, $("minlat").value, $("maxlon").value, $("maxlat").value);
 
   function validateControls() {
     var bounds = new OpenLayers.Bounds($("minlon").value, $("minlat").value, $("maxlon").value, $("maxlat").value);
 
-    if (bounds.getWidth() * bounds.getHeight() > 0.25) {
+    if (bounds.getWidth() * bounds.getHeight() > #{APP_CONFIG['max_request_area']}) {
       $("format_osm").disabled = true;
       $("format_osm").checked = false;
       $("export_osm").style.display = "none";
       $("format_osm").disabled = true;
       $("format_osm").checked = false;
       $("export_osm").style.display = "none";