From aac4776dd1c0fd3403196f5298e971c6fbf18a94 Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Fri, 26 Feb 2010 14:16:04 +0000 Subject: [PATCH 1/1] When the area selected for export is too large to be downloaded from the API then disable the export button and display a message rather than forcibly disabling that export option. Closes #1996. --- app/views/export/_start.html.erb | 10 ++++++++++ app/views/export/start.rjs | 10 +++++----- config/locales/en.yml | 3 +++ 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/app/views/export/_start.html.erb b/app/views/export/_start.html.erb index 9e3d64783..d541aae8b 100644 --- a/app/views/export/_start.html.erb +++ b/app/views/export/_start.html.erb @@ -34,6 +34,14 @@

<%= t'export.start.export_details' %>

+ +
+

<%= t'export.start.too_large.heading' %>

+ +
+

<%= t'export.start.too_large.body' %>

+
@@ -57,6 +65,7 @@

<%= t'export.start.options' %>

+

<%= t'export.start.output' %>

+

<%= t'export.start.paste_html' %>

diff --git a/app/views/export/start.rjs b/app/views/export/start.rjs index 3c6722044..d556d8bf9 100644 --- a/app/views/export/start.rjs +++ b/app/views/export/start.rjs @@ -191,16 +191,16 @@ page << < #{APP_CONFIG['max_request_area']}) { - $("format_osm").disabled = true; - $("format_osm").checked = false; - $("export_osm").style.display = "none"; + $("export_osm_too_large").style.display = "block"; } else { - $("format_osm").disabled = false; + $("export_osm_too_large").style.display = "none"; } var max_scale = maxMapnikScale(); - if ($("format_mapnik").checked && $("mapnik_scale").value < max_scale) { + if ($("format_osm").checked && bounds.getWidth() * bounds.getHeight() > #{APP_CONFIG['max_request_area']}) { + $("export_commit").disabled = true; + } else if ($("format_mapnik").checked && $("mapnik_scale").value < max_scale) { $("export_commit").disabled = true; } else { $("export_commit").disabled = false; diff --git a/config/locales/en.yml b/config/locales/en.yml index baff12f9e..64690965d 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -362,6 +362,9 @@ en: embeddable_html: "Embeddable HTML" licence: "Licence" export_details: 'OpenStreetMap data is licensed under the Creative Commons Attribution-ShareAlike 2.0 license.' + too_large: + heading: "Area Too Large" + body: "This area is too large to be exported as OpenStreetMap XML Data. Please zoom in or select a smaller area." options: "Options" format: "Format" scale: "Scale" -- 2.43.2