X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/f2ae082a1f360c25621f73dd872c746659c61ef2..c7bb260b4c7d7b2d98ef1a1d363c0cb12953c333:/app/views/export/start.rjs diff --git a/app/views/export/start.rjs b/app/views/export/start.rjs index 375c0ab39..abf9e671d 100644 --- a/app/views/export/start.rjs +++ b/app/views/export/start.rjs @@ -1,8 +1,10 @@ -page.replace_html :sidebar_title, 'Export' +page.replace_html :sidebar_title, t('export.start_rjs.export') page.replace_html :sidebar_content, :partial => 'start' page << < 0.25) { - $("format_osm").disabled = true; - $("format_osm").checked = false; - $("export_osm").style.display = "none"; + if (bounds.getWidth() * bounds.getHeight() > #{MAX_REQUEST_AREA}) { + $("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() > #{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; @@ -160,18 +225,31 @@ page << <'; + + // Create "larger map" link var center = bounds.getCenterLonLat(); - var url = "http://#{SERVER_URL}/export/embed.html?lat=" + center.lat.toFixed(5) + "&lon=" + center.lon.toFixed(5) + "&zoom=" + zoom; + var epsg4326 = new OpenLayers.Projection("EPSG:4326"); + var epsg900913 = new OpenLayers.Projection("EPSG:900913"); - if ($("html_marker").checked) { - url += "&marker=true"; - } + bounds.transform(epsg4326, epsg900913); + var zoom = map.getZoomForExtent(bounds); + + var layers = getMapLayers(); + + html += '
'+"#{html_escape_unicode(I18n.t('export.start_rjs.view_larger_map'))}"+''; - var html = ''; $("export_html_text").value = html; if ($("format_html").checked) { @@ -179,8 +257,6 @@ page << <