aboutsummaryrefslogtreecommitdiffstats
path: root/web/js
diff options
context:
space:
mode:
authorMarius Halden <marius.h@lden.org>2020-09-29 14:23:52 +0200
committerMarius Halden <marius.h@lden.org>2020-09-29 14:23:52 +0200
commita27ce1524d801d2742a2bdb6ec1da45126d64353 (patch)
tree64123c4e17dc1776aa0a7cd65ee01d49d3e7d978 /web/js
parent377bd96aab7cad3434185c30eb908c9da447fe40 (diff)
parent2773c60226b9370fe8ee00f7b205b571bb87c3b5 (diff)
Merge tag 'v3.0.1' into fiksgatami-dev
Diffstat (limited to 'web/js')
-rw-r--r--web/js/duplicates.js134
-rw-r--r--web/js/geolocation.js2
-rw-r--r--web/js/map-OpenLayers.js278
-rw-r--r--web/js/map-OpenStreetMap.js6
-rw-r--r--web/js/map-bing-ol.js7
-rw-r--r--web/js/map-cheshireeast.js33
-rw-r--r--web/js/map-google-ol.js7
-rw-r--r--web/js/map-google.js4
-rw-r--r--web/js/map-mastermap.js25
-rw-r--r--web/js/map-streetview.js2
-rw-r--r--web/js/map-toner-lite.js6
-rw-r--r--web/js/map-wms-base.js20
-rw-r--r--web/js/map-wms-northamptonshire.js38
-rw-r--r--web/js/map-wmts-base.js23
-rw-r--r--web/js/map-wmts-bristol.js19
-rw-r--r--web/js/map-wmts-buckinghamshire.js134
-rw-r--r--web/js/map-wmts-hounslow.js181
-rw-r--r--web/js/map-wmts-isleofwight.js182
-rw-r--r--web/js/map-wmts-zurich.js16
-rw-r--r--web/js/validation_rules.js2
20 files changed, 964 insertions, 155 deletions
diff --git a/web/js/duplicates.js b/web/js/duplicates.js
index 723c357e9..853456932 100644
--- a/web/js/duplicates.js
+++ b/web/js/duplicates.js
@@ -4,12 +4,30 @@
// quickly remove them when we’re finished showing duplicates.
var current_duplicate_markers;
+ // keep track of whether the suggestion UI has already been dismissed
+ // for this category
+ var dismissed = false;
+ var dismissed_category = null;
+
// Report ID will be available on report inspect page,
// but undefined on new report page.
var report_id = $("#report_inspect_form .js-report-id").text() || undefined;
- function refresh_duplicate_list() {
- var category = $('select[name="category"]').val();
+ // Don't make another call whilst one is in progress
+ var in_progress = false;
+
+ function refresh_duplicate_list(evt, params, category) {
+ if (params && params.skip_duplicates) {
+ return;
+ }
+
+ if (in_progress) {
+ return;
+ }
+
+ if (!category) {
+ category = $('select[name="category"]').val();
+ }
if (category === '-- Pick a category --') {
return;
}
@@ -31,12 +49,28 @@
url_params.pin_size = 'normal';
}
+ if ($('html').hasClass('mobile')) {
+ url_params.inline_maps = 1;
+ }
+
+ if (category && params && params.check_duplicates_dismissal ) {
+ dismissed = category === dismissed_category;
+ dismissed_category = category;
+
+ if (!take_effect()) {
+ remove_duplicate_pins();
+ remove_duplicate_list();
+ return;
+ }
+ }
+
+ in_progress = true;
$.ajax({
url: nearby_url,
data: url_params,
dataType: 'json'
}).done(function(response) {
- if ( response.pins.length ){
+ if (response.pins.length && take_effect()) {
render_duplicate_list(response);
render_duplicate_pins(response);
} else {
@@ -61,20 +95,29 @@
$("#js-duplicate-reports ul").empty().prepend( $reports );
fixmystreet.set_up.fancybox_images();
- $('#js-duplicate-reports').hide().removeClass('hidden').slideDown();
+ $('#js-duplicate-reports').hide().removeClass('hidden').slideDown(function(){
+ in_progress = false;
+ });
if ( $('#problem_form').length ) {
$('.js-hide-if-invalid-category').slideUp();
+ $('.js-hide-if-invalid-category_extras').slideUp();
}
- // Highlight map pin when hovering associated list item.
- var timeout;
- $reports.on('mouseenter', function(){
- var id = parseInt( $(this).data('reportId'), 10 );
- clearTimeout( timeout );
- fixmystreet.maps.markers_highlight( id );
- }).on('mouseleave', function(){
- timeout = setTimeout( fixmystreet.maps.markers_highlight, 50 );
- });
+ if (!fixmystreet.map.events.extensions.buttonclick.isDeviceTouchCapable) {
+ // Highlight map pin when hovering associated list item.
+ // (not on touchscreens though because a) the 'mouseenter' handler means
+ // two taps are required on the 'read more' button - one to highlight
+ // the list item and another to activate the button- and b) the pins
+ // might be scrolled off the top of the screen anyway e.g. on phones)
+ var timeout;
+ $reports.on('mouseenter', function(){
+ var id = parseInt( $(this).data('reportId'), 10 );
+ clearTimeout( timeout );
+ fixmystreet.maps.markers_highlight( id );
+ }).on('mouseleave', function(){
+ timeout = setTimeout( fixmystreet.maps.markers_highlight, 50 );
+ });
+ }
// Add a "select this report" button, when on the report inspect form.
if ( $('#report_inspect_form').length ) {
@@ -121,33 +164,44 @@
}
function render_duplicate_pins(api_response) {
+ if (!fixmystreet.markers) {
+ return;
+ }
var markers = fixmystreet.maps.markers_list( api_response.pins, true );
fixmystreet.markers.removeFeatures( current_duplicate_markers );
fixmystreet.markers.addFeatures( markers );
current_duplicate_markers = markers;
- }
- function remove_duplicate_list(cb) {
- var animations = [];
+ // Hide any asset layer that might be visible and get confused with the duplicates
+ var layers = fixmystreet.map.getLayersBy('assets', true);
+ for (var i = 0; i<layers.length; i++) {
+ if (!layers[i].fixmystreet.always_visible && layers[i].getVisibility()) {
+ layers[i].setVisibility(false);
+ }
+ }
+ }
- animations.push( $.Deferred() );
+ function remove_duplicate_list() {
$('#js-duplicate-reports').slideUp(function(){
$(this).addClass('hidden');
$(this).find('ul').empty();
- animations[0].resolve();
+ in_progress = false;
});
- if ( $('#problem_form').length ) {
- animations.push( $.Deferred() );
- $('.js-hide-if-invalid-category').slideDown(function(){
- animations[1].resolve();
- });
+ if ($('#problem_form').length && take_effect()) {
+ $('.js-hide-if-invalid-category').slideDown();
+ $('.js-hide-if-invalid-category_extras').slideDown();
}
-
- $.when.apply(this, animations).then(cb);
}
function remove_duplicate_pins() {
+ if (!fixmystreet.markers) {
+ return;
+ }
fixmystreet.markers.removeFeatures( current_duplicate_markers );
+
+ // In order to reinstate a hidden assets layer, let's pretend we've
+ // just picked the category anew, but skip ourselves
+ $(fixmystreet).trigger('report_new:category_change', { skip_duplicates: true });
}
function inspect_form_state_change() {
@@ -164,7 +218,23 @@
if (!!duplicate_of) {
return;
}
- refresh_duplicate_list();
+ var category = $("#report_inspect_form [name=category]").val();
+ refresh_duplicate_list(undefined, {}, category);
+ }
+
+ function take_effect() {
+ // We do not want to do anything if any other message is being shown
+ if (document.getElementById('js-category-stopper')) {
+ return false;
+ }
+ if ($('.js-responsibility-message:visible').length) {
+ return false;
+ }
+ // On mobile only show once per category
+ if ($('html').hasClass('mobile') && dismissed) {
+ return false;
+ }
+ return true;
}
// Want to show potential duplicates when a regular user starts a new
@@ -179,10 +249,14 @@
$('.js-hide-duplicate-suggestions').on('click', function(e){
e.preventDefault();
- remove_duplicate_pins();
- remove_duplicate_list(function(){
- $('#form_title').focus();
- });
+ fixmystreet.duplicates.hide();
});
+ fixmystreet.duplicates = {
+ hide: function() {
+ remove_duplicate_pins();
+ remove_duplicate_list();
+ dismissed = true;
+ }
+ };
})();
diff --git a/web/js/geolocation.js b/web/js/geolocation.js
index fbef4d7ea..63599d4c1 100644
--- a/web/js/geolocation.js
+++ b/web/js/geolocation.js
@@ -34,7 +34,7 @@ fixmystreet.geolocate = function(element, success_callback) {
fixmystreet.geolocate(link, function(pos) {
var latitude = pos.coords.latitude.toFixed(6);
var longitude = pos.coords.longitude.toFixed(6);
- var coords = 'latitude=' + latitude + ';longitude=' + longitude;
+ var coords = 'lat=' + latitude + '&lon=' + longitude;
location.href = link.href + (link.href.indexOf('?') > -1 ? ';' : '?') + coords;
});
} else {
diff --git a/web/js/map-OpenLayers.js b/web/js/map-OpenLayers.js
index ae86269c9..182cd79a1 100644
--- a/web/js/map-OpenLayers.js
+++ b/web/js/map-OpenLayers.js
@@ -10,6 +10,19 @@ if (!Object.keys) {
};
}
+function debounce(fn, delay) {
+ var timeout;
+ return function() {
+ var that = this, args = arguments;
+ var debounced = function() {
+ timeout = null;
+ fn.apply(that, args);
+ };
+ clearTimeout(timeout);
+ timeout = setTimeout(debounced, delay);
+ };
+}
+
var fixmystreet = fixmystreet || {};
fixmystreet.utils = fixmystreet.utils || {};
@@ -119,8 +132,8 @@ $.extend(fixmystreet.utils, {
new OpenLayers.Projection("EPSG:4326")
);
- var lat = transformedLonlat.lat;
- var lon = transformedLonlat.lon;
+ var lat = transformedLonlat.lat.toFixed(6);
+ var lon = transformedLonlat.lon.toFixed(6);
document.getElementById('fixmystreet.latitude').value = lat;
document.getElementById('fixmystreet.longitude').value = lon;
@@ -237,9 +250,11 @@ $.extend(fixmystreet.utils, {
marker_size: function() {
var zoom = fixmystreet.map.getZoom() + fixmystreet.zoomOffset;
- if (zoom >= 15) {
+ var size_normal = fixmystreet.maps.zoom_for_normal_size || 15;
+ var size_small = fixmystreet.maps.zoom_for_small_size || 13;
+ if (zoom >= size_normal) {
return window.selected_problem_id ? 'small' : 'normal';
- } else if (zoom >= 13) {
+ } else if (zoom >= size_small) {
return window.selected_problem_id ? 'mini' : 'small';
} else {
return 'mini';
@@ -248,9 +263,11 @@ $.extend(fixmystreet.utils, {
selected_marker_size: function() {
var zoom = fixmystreet.map.getZoom() + fixmystreet.zoomOffset;
- if (zoom >= 15) {
+ var size_normal = fixmystreet.maps.zoom_for_normal_size || 15;
+ var size_small = fixmystreet.maps.zoom_for_small_size || 13;
+ if (zoom >= size_normal) {
return 'big';
- } else if (zoom >= 13) {
+ } else if (zoom >= size_small) {
return 'normal';
} else {
return 'small';
@@ -304,6 +321,9 @@ $.extend(fixmystreet.utils, {
// fixmystreet.select_feature).
markers_highlight: function(problem_id) {
+ if (!fixmystreet.markers) {
+ return;
+ }
for (var i = 0; i < fixmystreet.markers.features.length; i++) {
if (typeof problem_id == 'undefined') {
// There is no highlighted marker, so unfade this marker
@@ -359,6 +379,96 @@ $.extend(fixmystreet.utils, {
new OpenLayers.LonLat( state.lon, state.lat ),
state.zoom
);
+ },
+
+ setup_geolocation: function() {
+ if (!OpenLayers.Control.Geolocate || !fixmystreet.map ||
+ !fixmystreet.utils || !fixmystreet.utils.parse_query_string ||
+ fixmystreet.utils.parse_query_string().geolocate !== '1'
+ ) {
+ return;
+ }
+
+ var layer;
+
+ function createCircleOfUncertainty(e) {
+ var loc = new OpenLayers.Geometry.Point(e.point.x, e.point.y);
+ return new OpenLayers.Feature.Vector(
+ OpenLayers.Geometry.Polygon.createRegularPolygon(
+ loc,
+ e.position.coords.accuracy,
+ 40,
+ 0
+ ),
+ {},
+ {
+ fillColor: '#0074FF',
+ fillOpacity: 0.3,
+ strokeWidth: 0
+ }
+ );
+ }
+ function addGeolocationLayer(e) {
+ layer = new OpenLayers.Layer.Vector('Geolocation');
+ fixmystreet.map.addLayer(layer);
+ layer.setZIndex(fixmystreet.map.getLayersByName("Pins")[0].getZIndex() - 1);
+ var marker = new OpenLayers.Feature.Vector(
+ new OpenLayers.Geometry.Point(e.point.x, e.point.y),
+ {
+ marker: true
+ },
+ {
+ graphicName: 'circle',
+ strokeColor: '#fff',
+ strokeWidth: 4,
+ fillColor: '#0074FF',
+ fillOpacity: 1,
+ pointRadius: 10
+ }
+ );
+ layer.addFeatures([ createCircleOfUncertainty(e), marker ]);
+ }
+
+ function updateGeolocationMarker(e) {
+ if (!layer) {
+ addGeolocationLayer(e);
+ } else {
+ // Reuse the existing circle marker so its DOM element (and
+ // hopefully CSS animation) is preserved.
+ var marker = layer.getFeaturesByAttribute('marker', true)[0];
+ // Can't reuse the background circle feature as there seems to
+ // be no easy way to replace its geometry with a new
+ // circle sized according to this location update's accuracy.
+ // Instead recreate the feature from scratch.
+ var uncertainty = createCircleOfUncertainty(e);
+ // Because we're replacing the accuracy circle, it needs to be
+ // rendered underneath the location marker. In order to do this
+ // we have to remove all features and re-add, as simply removing
+ // and re-adding one feature will always render it on top of others.
+ layer.removeAllFeatures();
+ layer.addFeatures([ uncertainty, marker ]);
+
+ // NB The above still breaks CSS animation because the marker
+ // was removed from the DOM and re-added. We could leave the
+ // marker alone and just remove the uncertainty circle
+ // feature, re-add it as a new feature and then manually shift
+ // its position in the DOM by getting its element's ID from
+ // uncertainty.geometry.id and moving it before the <circle>
+ // element.
+
+ // Don't forget to update the position of the GPS marker.
+ marker.move(new OpenLayers.LonLat(e.point.x, e.point.y));
+ }
+ }
+
+ var control = new OpenLayers.Control.Geolocate({
+ bind: false, // Don't want the map to pan to each location
+ watch: true,
+ enableHighAccuracy: true
+ });
+ control.events.register("locationupdated", null, updateGeolocationMarker);
+ fixmystreet.map.addControl(control);
+ control.activate();
}
});
@@ -425,10 +535,10 @@ $.extend(fixmystreet.utils, {
}
}
- function categories_or_status_changed() {
+ var categories_or_status_changed = debounce(function() {
// If the category or status has changed we need to re-fetch map markers
fixmystreet.markers.refresh({force: true});
- }
+ }, 1000);
function replace_query_parameter(qs, id, key) {
var value,
@@ -559,6 +669,9 @@ $.extend(fixmystreet.utils, {
} else {
$.extend(style.defaultStyle, { fillColor: 'black', strokeColor: 'black' });
}
+ if (!this.features.length) {
+ return;
+ }
var geometry = this.features[0].geometry;
if (geometry.CLASS_NAME == 'OpenLayers.Geometry.Collection' ||
geometry.CLASS_NAME == 'OpenLayers.Geometry.MultiPolygon') {
@@ -670,7 +783,7 @@ $.extend(fixmystreet.utils, {
styleMap: pin_layer_style_map
};
if (fixmystreet.page == 'around') {
- fixmystreet.bbox_strategy = fixmystreet.bbox_strategy || new OpenLayers.Strategy.FixMyStreet();
+ fixmystreet.bbox_strategy = fixmystreet.map_bbox_strategy || new OpenLayers.Strategy.FixMyStreet();
pin_layer_options.strategies = [ fixmystreet.bbox_strategy ];
}
if (fixmystreet.page == 'reports') {
@@ -768,6 +881,10 @@ $.extend(fixmystreet.utils, {
setup_inspector_marker_drag();
}
+ if (fixmystreet.page == "around" || fixmystreet.page == "new") {
+ fixmystreet.maps.setup_geolocation();
+ }
+
if ( fixmystreet.zoomToBounds ) {
zoomToBounds( fixmystreet.markers.getDataExtent() );
}
@@ -791,6 +908,10 @@ $.extend(fixmystreet.utils, {
$(function(){
+ if (!document.getElementById('map')) {
+ return;
+ }
+
// Set specific map config - some other JS included in the
// template should define this
fixmystreet.maps.config();
@@ -822,10 +943,23 @@ $.extend(fixmystreet.utils, {
// This option is thankfully used by them both
numZoomLevels: fixmystreet.numZoomLevels
}, fixmystreet.layer_options[i]);
- if (fixmystreet.layer_options[i].matrixIds) {
- layer = new fixmystreet.map_type(fixmystreet.layer_options[i]);
+ var layer_options = fixmystreet.layer_options[i];
+ if (layer_options.wms_version) {
+ var options = {
+ layers: layer_options.layer_names[0],
+ size: layer_options.tile_size,
+ format: layer_options.format
+ };
+ layer = new fixmystreet.map_type(
+ layer_options.name,
+ layer_options.url,
+ options,
+ layer_options
+ );
+ } else if (layer_options.matrixIds) {
+ layer = new fixmystreet.map_type(layer_options);
} else {
- layer = new fixmystreet.map_type(fixmystreet.layer_name, fixmystreet.layer_options[i]);
+ layer = new fixmystreet.map_type(fixmystreet.layer_name, layer_options);
}
fixmystreet.map.addLayer(layer);
}
@@ -928,51 +1062,61 @@ OpenLayers.Control.ArgParserFMS = OpenLayers.Class(OpenLayers.Control.ArgParser,
CLASS_NAME: "OpenLayers.Control.ArgParserFMS"
});
-/* Overriding Permalink so that it can pass the correct zoom to OSM */
-OpenLayers.Control.PermalinkFMS = OpenLayers.Class(OpenLayers.Control.Permalink, {
- _updateLink: function(alter_zoom) {
- // this.base was originally set in initialize(), but the window's href
- // may have changed since then if e.g. the map filters have been updated.
- // NB this won't change the base of the 'problems nearby' permalink on
- // /report, as this would result in it pointing at the wrong page.
- if (this.base !== '/around' && fixmystreet.page !== 'report') {
- this.base = window.location.href;
- }
+/* Replacing Permalink so that it can do things a bit differently */
+OpenLayers.Control.PermalinkFMS = OpenLayers.Class(OpenLayers.Control, {
+ element: null,
+ base: '',
- var separator = this.anchor ? '#' : '?';
- var href = this.base;
- if (href.indexOf(separator) != -1) {
- href = href.substring( 0, href.indexOf(separator) );
+ initialize: function(element, base, options) {
+ OpenLayers.Control.prototype.initialize.apply(this, [options]);
+ this.element = OpenLayers.Util.getElement(element);
+ this.base = base || document.location.href;
+ },
+
+ destroy: function() {
+ if (this.map) {
+ this.map.events.unregister('moveend', this, this.updateLink);
}
+ OpenLayers.Control.prototype.destroy.apply(this, arguments);
+ },
- var center = this.map.getCenter();
+ draw: function() {
+ OpenLayers.Control.prototype.draw.apply(this, arguments);
- var zoom = this.map.getZoom();
- if ( alter_zoom ) {
- zoom += fixmystreet.zoomOffset;
- }
+ // We do not need to listen to change layer events, no layers in our permalinks
+ this.map.events.on({
+ 'moveend': this.updateLink,
+ scope: this
+ });
- var params = this.createParams(center, zoom);
+ // Make it so there is at least a link even though the map may not have
+ // moved yet.
+ this.updateLink();
- // Strip out the ugly OpenLayers layers state string
- delete params.layers;
- if (params.lat && params.lon) {
- // No need for the postcode string either, if we have a latlon
- delete params.pc;
+ return this.div;
+ },
+
+ updateLink: function() {
+ // The window's href may have changed if e.g. the map filters have been
+ // updated. NB this won't change the base of the 'problems nearby'
+ // permalink on /report, as this would result in it pointing at the
+ // wrong page.
+ var href = this.base;
+ if (this.base !== '/around' && fixmystreet.page !== 'report') {
+ href = window.location.href;
}
+ var params = this.createParams(href);
- href += separator + OpenLayers.Util.getParameterString(params);
+ if (href.indexOf('?') != -1) {
+ href = href.substring( 0, href.indexOf('?') );
+ }
+ href += '?' + OpenLayers.Util.getParameterString(params);
// Could use mlat/mlon here as well if we are on a page with a marker
- if (this.base == '/around') {
+ if (this.base === '/around') {
href += '&js=1';
}
- if (this.anchor && !this.element) {
- window.location.href = href;
- }
- else {
- this.element.href = href;
- }
+ this.element.href = href;
if ('replaceState' in history) {
if (fixmystreet.page.match(/around|reports/)) {
@@ -984,9 +1128,37 @@ OpenLayers.Control.PermalinkFMS = OpenLayers.Class(OpenLayers.Control.Permalink,
}
}
},
- updateLink: function() {
- this._updateLink(0);
+
+ createParams: function(href) {
+ center = this.map.getCenter();
+
+ var params = OpenLayers.Util.getParameters(href);
+
+ // If there's still no center, map is not initialized yet.
+ // Break out of this function, and simply return the params from the
+ // base link.
+ if (center) {
+
+ params.zoom = this.map.getZoom();
+
+ var mapPosition = OpenLayers.Projection.transform(
+ { x: center.lon, y: center.lat },
+ this.map.getProjectionObject(),
+ this.map.displayProjection );
+ var lon = mapPosition.x;
+ var lat = mapPosition.y;
+ params.lat = Math.round(lat*100000)/100000;
+ params.lon = Math.round(lon*100000)/100000;
+ }
+
+ if (params.lat && params.lon) {
+ // No need for the postcode string either, if we have a latlon
+ delete params.pc;
+ }
+
+ return params;
},
+
CLASS_NAME: "OpenLayers.Control.PermalinkFMS"
});
@@ -1178,3 +1350,15 @@ OpenLayers.Renderer.SVGBig = OpenLayers.Class(OpenLayers.Renderer.SVG, {
CLASS_NAME: "OpenLayers.Renderer.SVGBig"
});
+
+/* Stop sending a needless header so that no preflight CORS request */
+OpenLayers.Request.XMLHttpRequest.prototype.setRequestHeader = function(sName, sValue) {
+ if (sName.toLowerCase() == 'x-requested-with') {
+ return;
+ }
+ if (!this._headers) {
+ this._headers = {};
+ }
+ this._headers[sName] = sValue;
+ return this._object.setRequestHeader(sName, sValue);
+};
diff --git a/web/js/map-OpenStreetMap.js b/web/js/map-OpenStreetMap.js
index 52eb95493..9ed3a2ee3 100644
--- a/web/js/map-OpenStreetMap.js
+++ b/web/js/map-OpenStreetMap.js
@@ -1,14 +1,10 @@
fixmystreet.maps.config = function() {
- var permalink_id;
- if ($('#map_permalink').length) {
- permalink_id = 'map_permalink';
- }
fixmystreet.controls = [
new OpenLayers.Control.ArgParserFMS(),
new OpenLayers.Control.Attribution(),
//new OpenLayers.Control.LayerSwitcher(),
new OpenLayers.Control.Navigation(),
- new OpenLayers.Control.PermalinkFMS(permalink_id),
+ new OpenLayers.Control.PermalinkFMS('map'),
new OpenLayers.Control.PanZoomFMS({id: 'fms_pan_zoom' })
];
};
diff --git a/web/js/map-bing-ol.js b/web/js/map-bing-ol.js
index 6c9ab8a62..4e01ff58b 100644
--- a/web/js/map-bing-ol.js
+++ b/web/js/map-bing-ol.js
@@ -1,14 +1,9 @@
fixmystreet.maps.config = function() {
- var permalink_id;
- if ($('#map_permalink').length) {
- permalink_id = 'map_permalink';
- }
-
fixmystreet.controls = [
new OpenLayers.Control.Attribution(),
new OpenLayers.Control.ArgParserFMS(),
new OpenLayers.Control.Navigation(),
- new OpenLayers.Control.PermalinkFMS(permalink_id),
+ new OpenLayers.Control.PermalinkFMS('map'),
new OpenLayers.Control.PanZoomFMS({id: 'fms_pan_zoom' })
];
/* Linking back to around from report page, keeping track of map moves */
diff --git a/web/js/map-cheshireeast.js b/web/js/map-cheshireeast.js
new file mode 100644
index 000000000..cedc92dba
--- /dev/null
+++ b/web/js/map-cheshireeast.js
@@ -0,0 +1,33 @@
+fixmystreet.maps.config = function() {
+ fixmystreet.controls = [
+ new OpenLayers.Control.Attribution(),
+ new OpenLayers.Control.ArgParserFMS(),
+ new OpenLayers.Control.Navigation(),
+ new OpenLayers.Control.PermalinkFMS('map'),
+ new OpenLayers.Control.PanZoomFMS({id: 'fms_pan_zoom' })
+ ];
+ /* Linking back to around from report page, keeping track of map moves */
+ if ( fixmystreet.page == 'report' ) {
+ fixmystreet.controls.push( new OpenLayers.Control.PermalinkFMS('key-tool-problems-nearby', '/around') );
+ }
+ fixmystreet.map_type = OpenLayers.Layer.CheshireEast;
+};
+
+OpenLayers.Layer.CheshireEast = OpenLayers.Class(OpenLayers.Layer.XYZ, {
+ url: 'https://maps-cache.cheshiresharedservices.gov.uk/maps/?wmts/CE_OS_AllBasemaps_COLOUR/oscce_grid/${z}/${x}/${y}.jpeg&KEY=3a3f5c60eca1404ea114e6941c9d3895',
+
+ initialize: function(name, options) {
+ options = OpenLayers.Util.extend({
+ units: "m",
+ projection: new OpenLayers.Projection("EPSG:27700"),
+ maxExtent: new OpenLayers.Bounds(-3276800, -3276800, 3276800, 3276800),
+ resolutions: [1792.003584007169, 896.0017920035843, 448.0008960017922, 224.0004480008961, 112.000224000448, 56.000112000224014, 28.000056000111993, 14.000028000056004, 7.000014000028002, 2.8000056000112004, 1.4000028000056002, 0.7000014000028001, 0.35000070000140004, 0.14000028000056003].slice(fixmystreet.zoomOffset || 0),
+ }, options);
+ OpenLayers.Layer.XYZ.prototype.initialize.call(this, name, this.url, options);
+ },
+
+ CLASS_NAME: "OpenLayers.Layer.CheshireEast"
+});
+
+fixmystreet.maps.zoom_for_normal_size = 7;
+fixmystreet.maps.zoom_for_small_size = 4;
diff --git a/web/js/map-google-ol.js b/web/js/map-google-ol.js
index 4b2d818c9..2769853ce 100644
--- a/web/js/map-google-ol.js
+++ b/web/js/map-google-ol.js
@@ -17,15 +17,10 @@ $(function(){
});
fixmystreet.maps.config = function() {
- var permalink_id;
- if ($('#map_permalink').length) {
- permalink_id = 'map_permalink';
- }
-
fixmystreet.controls = [
new OpenLayers.Control.ArgParserFMS(),
new OpenLayers.Control.Navigation(),
- new OpenLayers.Control.PermalinkFMS(permalink_id),
+ new OpenLayers.Control.PermalinkFMS('map'),
new OpenLayers.Control.PanZoomFMS({id: 'fms_pan_zoom' })
];
diff --git a/web/js/map-google.js b/web/js/map-google.js
index bf9909f02..fc515b9dd 100644
--- a/web/js/map-google.js
+++ b/web/js/map-google.js
@@ -11,8 +11,8 @@ fixmystreet.maps = {};
(function() {
fixmystreet.maps.update_pin = function(lonlat) {
- var lat = lonlat.lat();
- var lon = lonlat.lng();
+ var lat = lonlat.lat().toFixed(6);
+ var lon = lonlat.lng().toFixed(6);
document.getElementById('fixmystreet.latitude').value = lat;
document.getElementById('fixmystreet.longitude').value = lon;
return {
diff --git a/web/js/map-mastermap.js b/web/js/map-mastermap.js
new file mode 100644
index 000000000..bb9adf532
--- /dev/null
+++ b/web/js/map-mastermap.js
@@ -0,0 +1,25 @@
+fixmystreet.maps.config = (function(original) {
+ return function(){
+ original();
+ fixmystreet.map_type = OpenLayers.Layer.MasterMap;
+ };
+})(fixmystreet.maps.config);
+
+OpenLayers.Layer.MasterMap = OpenLayers.Class(OpenLayers.Layer.BingUK, {
+ get_urls: function(bounds, z) {
+ if (z < 17) {
+ return OpenLayers.Layer.BingUK.prototype.get_urls.apply(this, arguments);
+ }
+
+ var urls = [];
+ var servers = [ '', 'a.', 'b.', 'c.' ];
+ var layer = fixmystreet.staging ? 'mastermap-staging' : 'mastermap';
+ var base = "//{S}tilma.mysociety.org/" + layer + "/${z}/${x}/${y}.png";
+ for (var i=0; i < servers.length; i++) {
+ urls.push( base.replace('{S}', servers[i]) );
+ }
+ return urls;
+ },
+
+ CLASS_NAME: "OpenLayers.Layer.MasterMap"
+});
diff --git a/web/js/map-streetview.js b/web/js/map-streetview.js
index 4701a7f20..f36b7eaea 100644
--- a/web/js/map-streetview.js
+++ b/web/js/map-streetview.js
@@ -2,7 +2,7 @@ fixmystreet.maps.config = function() {
fixmystreet.controls = [
new OpenLayers.Control.ArgParserFMS(),
new OpenLayers.Control.Navigation(),
- new OpenLayers.Control.Permalink(),
+ new OpenLayers.Control.PermalinkFMS('map'),
new OpenLayers.Control.PanZoomFMS()
];
fixmystreet.map_type = OpenLayers.Layer.StreetView;
diff --git a/web/js/map-toner-lite.js b/web/js/map-toner-lite.js
index 0700dbb55..6e44437a0 100644
--- a/web/js/map-toner-lite.js
+++ b/web/js/map-toner-lite.js
@@ -1,12 +1,8 @@
fixmystreet.maps.config = function() {
- var permalink_id;
- if ($('#map_permalink').length) {
- permalink_id = 'map_permalink';
- }
fixmystreet.controls = [
new OpenLayers.Control.ArgParserFMS(),
new OpenLayers.Control.Navigation(),
- new OpenLayers.Control.PermalinkFMS(permalink_id),
+ new OpenLayers.Control.PermalinkFMS('map'),
new OpenLayers.Control.PanZoomFMS({id: 'fms_pan_zoom' })
];
fixmystreet.layer_options = [ {
diff --git a/web/js/map-wms-base.js b/web/js/map-wms-base.js
new file mode 100644
index 000000000..54b88bfe3
--- /dev/null
+++ b/web/js/map-wms-base.js
@@ -0,0 +1,20 @@
+// Functionality required by all OpenLayers WMS base maps
+
+fixmystreet.maps.setup_wms_base_map = function() {
+ fixmystreet.map_type = OpenLayers.Layer.WMS;
+
+ fixmystreet.map_options = {
+ maxExtent: this.layer_bounds,
+ units: 'm'
+ };
+
+ fixmystreet.layer_options = [];
+ $.each(fixmystreet.wms_config.layer_names, function(i, v) {
+ fixmystreet.layer_options.push(OpenLayers.Util.extend({
+ projection: new OpenLayers.Projection(fixmystreet.wms_config.map_projection),
+ name: v,
+ layer: v,
+ url: fixmystreet.wms_config.tile_urls[i]
+ }, fixmystreet.wms_config));
+ });
+};
diff --git a/web/js/map-wms-northamptonshire.js b/web/js/map-wms-northamptonshire.js
new file mode 100644
index 000000000..40d6d10a8
--- /dev/null
+++ b/web/js/map-wms-northamptonshire.js
@@ -0,0 +1,38 @@
+/*
+ * Maps for FMS using Northamptonshire's tile server
+ */
+
+fixmystreet.maps.layer_bounds = new OpenLayers.Bounds(
+395000,210000,572000,325000
+);
+
+/*
+ * maps.config() is called on dom ready in map-OpenLayers.js
+ * to setup the way the map should operate.
+ */
+fixmystreet.maps.config = function() {
+ fixmystreet.controls = [
+ new OpenLayers.Control.ArgParserFMS(),
+ new OpenLayers.Control.Navigation(),
+ new OpenLayers.Control.PermalinkFMS('map'),
+ new OpenLayers.Control.PanZoomFMS({id: 'fms_pan_zoom' })
+ ];
+
+ /* Linking back to around from report page, keeping track of map moves */
+ if ( fixmystreet.page == 'report' ) {
+ fixmystreet.controls.push( new OpenLayers.Control.PermalinkFMS('key-tool-problems-nearby', '/around') );
+ }
+
+ this.setup_wms_base_map();
+};
+
+fixmystreet.maps.marker_size = function() {
+ var zoom = fixmystreet.map.getZoom() + fixmystreet.zoomOffset;
+ if (zoom >= 8) {
+ return 'normal';
+ } else if (zoom >= 4) {
+ return 'small';
+ } else {
+ return 'mini';
+ }
+};
diff --git a/web/js/map-wmts-base.js b/web/js/map-wmts-base.js
index fe8d8015e..43f829ab5 100644
--- a/web/js/map-wmts-base.js
+++ b/web/js/map-wmts-base.js
@@ -28,27 +28,4 @@ fixmystreet.maps.setup_wmts_base_map = function() {
tileOrigin: new OpenLayers.LonLat(fixmystreet.wmts_config.origin_x, fixmystreet.wmts_config.origin_y)
});
});
-
- // Give main code a new bbox_strategy that translates between
- // lat/lon and our WMTS layer's coordinates
- fixmystreet.bbox_strategy = new OpenLayers.Strategy.ReprojectBBOX({
- ratio: 1
- });
};
-
-OpenLayers.Strategy.ReprojectBBOX = OpenLayers.Class(OpenLayers.Strategy.BBOX, {
- getMapBounds: function() {
- // Get the map bounds but return them in lat/lon, not
- // local coordinates
- if (this.layer.map === null) {
- return null;
- }
-
- var localBounds = this.layer.map.getExtent();
- // Transform bound corners into WGS84
- localBounds.transform( new OpenLayers.Projection(fixmystreet.wmts_config.map_projection), new OpenLayers.Projection("EPSG:4326") );
- return localBounds;
- },
-
- CLASS_NAME: "OpenLayers.Strategy.ReprojectBBOX"
-});
diff --git a/web/js/map-wmts-bristol.js b/web/js/map-wmts-bristol.js
index 88db20c52..2090fa0cf 100644
--- a/web/js/map-wmts-bristol.js
+++ b/web/js/map-wmts-bristol.js
@@ -98,15 +98,10 @@ fixmystreet.maps.matrix_ids = [
* to setup the way the map should operate.
*/
fixmystreet.maps.config = function() {
- var permalink_id;
- if ($('#map_permalink').length) {
- permalink_id = 'map_permalink';
- }
-
fixmystreet.controls = [
new OpenLayers.Control.ArgParserFMS(),
new OpenLayers.Control.Navigation(),
- new OpenLayers.Control.PermalinkFMS(permalink_id)
+ new OpenLayers.Control.PermalinkFMS('map')
];
if ( fixmystreet.page != 'report' || !$('html').hasClass('mobile') ) {
fixmystreet.controls.push( new OpenLayers.Control.PanZoomFMS({id: 'fms_pan_zoom' }) );
@@ -120,13 +115,5 @@ fixmystreet.maps.config = function() {
this.setup_wmts_base_map();
};
-fixmystreet.maps.marker_size = function() {
- var zoom = fixmystreet.map.getZoom() + fixmystreet.zoomOffset;
- if (zoom >= 7) {
- return 'normal';
- } else if (zoom >= 4) {
- return 'small';
- } else {
- return 'mini';
- }
-};
+fixmystreet.maps.zoom_for_normal_size = 7;
+fixmystreet.maps.zoom_for_small_size = 4;
diff --git a/web/js/map-wmts-buckinghamshire.js b/web/js/map-wmts-buckinghamshire.js
new file mode 100644
index 000000000..bcdadcdd5
--- /dev/null
+++ b/web/js/map-wmts-buckinghamshire.js
@@ -0,0 +1,134 @@
+/*
+ * Maps for FMS using Buckinghamshire Council's WMTS tile server
+ */
+
+fixmystreet.maps.layer_bounds = new OpenLayers.Bounds(
+ 381056.269,
+ 138592.641,
+ 584521.259,
+ 284907.516);
+
+fixmystreet.maps.matrix_ids = [
+ {
+ "identifier": "0",
+ "supportedCRS": "urn:ogc:def:crs:EPSG:27700",
+ "scaleDenominator": 944942.3660750897,
+ "tileWidth": 256,
+ "tileHeight": 256,
+ "matrixWidth": 86,
+ "matrixHeight": 64,
+ },
+ {
+ "identifier": "1",
+ "supportedCRS": "urn:ogc:def:crs:EPSG:27700",
+ "scaleDenominator": 472471.18303754483,
+ "tileWidth": 256,
+ "tileHeight": 256,
+ "matrixWidth": 172,
+ "matrixHeight": 128,
+ },
+ {
+ "identifier": "2",
+ "supportedCRS": "urn:ogc:def:crs:EPSG:27700",
+ "scaleDenominator": 236235.59151877242,
+ "tileWidth": 256,
+ "tileHeight": 256,
+ "matrixWidth": 343,
+ "matrixHeight": 256,
+ },
+ {
+ "identifier": "3",
+ "supportedCRS": "urn:ogc:def:crs:EPSG:27700",
+ "scaleDenominator": 118117.79575938621,
+ "tileWidth": 256,
+ "tileHeight": 256,
+ "matrixWidth": 686,
+ "matrixHeight": 512,
+ },
+ {
+ "identifier": "4",
+ "supportedCRS": "urn:ogc:def:crs:EPSG:27700",
+ "scaleDenominator": 60476.31142880573,
+ "tileWidth": 256,
+ "tileHeight": 256,
+ "matrixWidth": 1340,
+ "matrixHeight": 1000,
+ },
+ {
+ "identifier": "5",
+ "supportedCRS": "urn:ogc:def:crs:EPSG:27700",
+ "scaleDenominator": 30238.155714402867,
+ "tileWidth": 256,
+ "tileHeight": 256,
+ "matrixWidth": 2679,
+ "matrixHeight": 1999,
+ },
+ {
+ "identifier": "6",
+ "supportedCRS": "urn:ogc:def:crs:EPSG:27700",
+ "scaleDenominator": 15119.077857201433,
+ "tileWidth": 256,
+ "tileHeight": 256,
+ "matrixWidth": 5357,
+ "matrixHeight": 3997,
+ },
+ {
+ "identifier": "7",
+ "supportedCRS": "urn:ogc:def:crs:EPSG:27700",
+ "scaleDenominator": 7559.538928600717,
+ "tileWidth": 256,
+ "tileHeight": 256,
+ "matrixWidth": 10713,
+ "matrixHeight": 7994,
+ },
+ {
+ "identifier": "8",
+ "supportedCRS": "urn:ogc:def:crs:EPSG:27700",
+ "scaleDenominator": 3779.7694643003583,
+ "tileWidth": 256,
+ "tileHeight": 256,
+ "matrixWidth": 21426,
+ "matrixHeight": 15988,
+ },
+ {
+ "identifier": "9",
+ "supportedCRS": "urn:ogc:def:crs:EPSG:27700",
+ "scaleDenominator": 1889.8847321501792,
+ "tileWidth": 256,
+ "tileHeight": 256,
+ "matrixWidth": 42852,
+ "matrixHeight": 31976,
+ },
+ {
+ "identifier": "10",
+ "supportedCRS": "urn:ogc:def:crs:EPSG:27700",
+ "scaleDenominator": 944.9423660750896,
+ "tileWidth": 256,
+ "tileHeight": 256,
+ "matrixWidth": 85703,
+ "matrixHeight": 63951,
+ }
+];
+
+/*
+ * maps.config() is called on dom ready in map-OpenLayers.js
+ * to setup the way the map should operate.
+ */
+fixmystreet.maps.config = function() {
+ fixmystreet.controls = [
+ new OpenLayers.Control.ArgParserFMS(),
+ new OpenLayers.Control.Navigation(),
+ new OpenLayers.Control.PermalinkFMS('map'),
+ new OpenLayers.Control.PanZoomFMS({id: 'fms_pan_zoom' })
+ ];
+
+ /* Linking back to around from report page, keeping track of map moves */
+ if ( fixmystreet.page == 'report' ) {
+ fixmystreet.controls.push( new OpenLayers.Control.PermalinkFMS('key-tool-problems-nearby', '/around') );
+ }
+
+ this.setup_wmts_base_map();
+};
+
+fixmystreet.maps.zoom_for_normal_size = 7;
+fixmystreet.maps.zoom_for_small_size = 4;
diff --git a/web/js/map-wmts-hounslow.js b/web/js/map-wmts-hounslow.js
new file mode 100644
index 000000000..d021fab50
--- /dev/null
+++ b/web/js/map-wmts-hounslow.js
@@ -0,0 +1,181 @@
+/*
+ * Maps for FMS using Hounslow Highways' WMTS tile server
+ */
+
+fixmystreet.maps.layer_bounds = new OpenLayers.Bounds(
+ 500968.38879189314,
+ 164348.14012837573,
+ 528802.2803971764,
+ 185779.43299096148);
+
+fixmystreet.maps.matrix_ids = [
+ // The first 5 levels don't load and are really zoomed-out, so
+ // they're not included here.
+ // {
+ // "identifier": 0,
+ // "scaleDenominator": 566965.4196450538,
+ // "supportedCRS": "urn:ogc:def:crs:EPSG:27700",
+ // "tileWidth": 256,
+ // "tileHeight": 256,
+ // "matrixWidth": 142,
+ // "matrixHeight": 106,
+ // },
+ // {
+ // "identifier": 1,
+ // "scaleDenominator": 472471.18303754483,
+ // "supportedCRS": "urn:ogc:def:crs:EPSG:27700",
+ // "tileWidth": 256,
+ // "tileHeight": 256,
+ // "matrixWidth": 170,
+ // "matrixHeight": 128,
+ // },
+ // {
+ // "identifier": 2,
+ // "scaleDenominator": 377976.9464300358,
+ // "supportedCRS": "urn:ogc:def:crs:EPSG:27700",
+ // "tileWidth": 256,
+ // "tileHeight": 256,
+ // "matrixWidth": 213,
+ // "matrixHeight": 159,
+ // },
+ // {
+ // "identifier": 3,
+ // "scaleDenominator": 283482.7098225269,
+ // "supportedCRS": "urn:ogc:def:crs:EPSG:27700",
+ // "tileWidth": 256,
+ // "tileHeight": 256,
+ // "matrixWidth": 283,
+ // "matrixHeight": 212,
+ // },
+ // {
+ // "identifier": 4,
+ // "scaleDenominator": 188988.4732150179,
+ // "supportedCRS": "urn:ogc:def:crs:EPSG:27700",
+ // "tileWidth": 256,
+ // "tileHeight": 256,
+ // "matrixWidth": 425,
+ // "matrixHeight": 318,
+ // },
+ {
+ "identifier": 5,
+ "scaleDenominator": 94494.23660750895,
+ "supportedCRS": "urn:ogc:def:crs:EPSG:27700",
+ "tileWidth": 256,
+ "tileHeight": 256,
+ "matrixWidth": 849,
+ "matrixHeight": 636,
+ },
+ {
+ "identifier": 6,
+ "scaleDenominator": 70870.67745563173,
+ "supportedCRS": "urn:ogc:def:crs:EPSG:27700",
+ "tileWidth": 256,
+ "tileHeight": 256,
+ "matrixWidth": 1132,
+ "matrixHeight": 848,
+ },
+ {
+ "identifier": 7,
+ "scaleDenominator": 47247.118303754476,
+ "supportedCRS": "urn:ogc:def:crs:EPSG:27700",
+ "tileWidth": 256,
+ "tileHeight": 256,
+ "matrixWidth": 1698,
+ "matrixHeight": 1272,
+ },
+ {
+ "identifier": 8,
+ "scaleDenominator": 23623.559151877238,
+ "supportedCRS": "urn:ogc:def:crs:EPSG:27700",
+ "tileWidth": 256,
+ "tileHeight": 256,
+ "matrixWidth": 3396,
+ "matrixHeight": 2543,
+ },
+ {
+ "identifier": 9,
+ "scaleDenominator": 9449.423660750896,
+ "supportedCRS": "urn:ogc:def:crs:EPSG:27700",
+ "tileWidth": 256,
+ "tileHeight": 256,
+ "matrixWidth": 8488,
+ "matrixHeight": 6358,
+ },
+ {
+ "identifier": 10,
+ "scaleDenominator": 7559.538928600717,
+ "supportedCRS": "urn:ogc:def:crs:EPSG:27700",
+ "tileWidth": 256,
+ "tileHeight": 256,
+ "matrixWidth": 10610,
+ "matrixHeight": 7947,
+ },
+ {
+ "identifier": 11,
+ "scaleDenominator": 5669.654196450538,
+ "supportedCRS": "urn:ogc:def:crs:EPSG:27700",
+ "tileWidth": 256,
+ "tileHeight": 256,
+ "matrixWidth": 14147,
+ "matrixHeight": 10596,
+ },
+ {
+ "identifier": 12,
+ "scaleDenominator": 3779.7694643003583,
+ "supportedCRS": "urn:ogc:def:crs:EPSG:27700",
+ "tileWidth": 256,
+ "tileHeight": 256,
+ "matrixWidth": 21220,
+ "matrixHeight": 15893,
+ },
+ {
+ "identifier": 13,
+ "scaleDenominator": 1889.8847321501792,
+ "supportedCRS": "urn:ogc:def:crs:EPSG:27700",
+ "tileWidth": 256,
+ "tileHeight": 256,
+ "matrixWidth": 42440,
+ "matrixHeight": 31786,
+ },
+ {
+ "identifier": 14,
+ "scaleDenominator": 944.9423660750896,
+ "supportedCRS": "urn:ogc:def:crs:EPSG:27700",
+ "tileWidth": 256,
+ "tileHeight": 256,
+ "matrixWidth": 84880,
+ "matrixHeight": 63571,
+ },
+ {
+ "identifier": 15,
+ "scaleDenominator": 377.9769464300358,
+ "supportedCRS": "urn:ogc:def:crs:EPSG:27700",
+ "tileWidth": 256,
+ "tileHeight": 256,
+ "matrixWidth": 212200,
+ "matrixHeight": 158927,
+ }
+];
+
+/*
+ * maps.config() is called on dom ready in map-OpenLayers.js
+ * to setup the way the map should operate.
+ */
+fixmystreet.maps.config = function() {
+ fixmystreet.controls = [
+ new OpenLayers.Control.ArgParserFMS(),
+ new OpenLayers.Control.Navigation(),
+ new OpenLayers.Control.PermalinkFMS('map'),
+ new OpenLayers.Control.PanZoomFMS({id: 'fms_pan_zoom' })
+ ];
+
+ /* Linking back to around from report page, keeping track of map moves */
+ if ( fixmystreet.page == 'report' ) {
+ fixmystreet.controls.push( new OpenLayers.Control.PermalinkFMS('key-tool-problems-nearby', '/around') );
+ }
+
+ this.setup_wmts_base_map();
+};
+
+fixmystreet.maps.zoom_for_normal_size = 8;
+fixmystreet.maps.zoom_for_small_size = 4;
diff --git a/web/js/map-wmts-isleofwight.js b/web/js/map-wmts-isleofwight.js
new file mode 100644
index 000000000..0e725e3f1
--- /dev/null
+++ b/web/js/map-wmts-isleofwight.js
@@ -0,0 +1,182 @@
+/*
+ * Maps for FMS using Island Roads' WMTS tile server
+ */
+
+fixmystreet.maps.layer_bounds = new OpenLayers.Bounds(
+ 428576.1131782566,
+ 70608.46901095579,
+ 468137.51522498735,
+ 101069.6062942903
+);
+
+fixmystreet.maps.matrix_ids = [
+ // The first 5 levels don't load and are really zoomed-out, so
+ // they're not included here.
+ //{
+ //"identifier": 0,
+ //"scaleDenominator": 566965.4196450538,
+ //"supportedCRS": "urn:ogc:def:crs:EPSG:27700",
+ //"tileWidth": 256,
+ //"tileHeight": 256,
+ //"matrixWidth": 140,
+ //"matrixHeight": 109
+ //},
+ //{
+ //"identifier": 1,
+ //"scaleDenominator": 472471.18303754483,
+ //"supportedCRS": "urn:ogc:def:crs:EPSG:27700",
+ //"tileWidth": 256,
+ //"tileHeight": 256,
+ //"matrixWidth": 168,
+ //"matrixHeight": 130
+ //},
+ //{
+ //"identifier": 2,
+ //"scaleDenominator": 377976.9464300358,
+ //"supportedCRS": "urn:ogc:def:crs:EPSG:27700",
+ //"tileWidth": 256,
+ //"tileHeight": 256,
+ //"matrixWidth": 210,
+ //"matrixHeight": 163
+ //},
+ //{
+ //"identifier": 3,
+ //"scaleDenominator": 283482.7098225269,
+ //"supportedCRS": "urn:ogc:def:crs:EPSG:27700",
+ //"tileWidth": 256,
+ //"tileHeight": 256,
+ //"matrixWidth": 280,
+ //"matrixHeight": 217
+ //},
+ //{
+ //"identifier": 4,
+ //"scaleDenominator": 188988.4732150179,
+ //"supportedCRS": "urn:ogc:def:crs:EPSG:27700",
+ //"tileWidth": 256,
+ //"tileHeight": 256,
+ //"matrixWidth": 420,
+ //"matrixHeight": 325
+ //},
+ {
+ "identifier": 5,
+ "scaleDenominator": 94494.23660750895,
+ "supportedCRS": "urn:ogc:def:crs:EPSG:27700",
+ "tileWidth": 256,
+ "tileHeight": 256,
+ "matrixWidth": 840,
+ "matrixHeight": 650
+ },
+ {
+ "identifier": 6,
+ "scaleDenominator": 70870.67745563173,
+ "supportedCRS": "urn:ogc:def:crs:EPSG:27700",
+ "tileWidth": 256,
+ "tileHeight": 256,
+ "matrixWidth": 1120,
+ "matrixHeight": 867
+ },
+ {
+ "identifier": 7,
+ "scaleDenominator": 47247.118303754476,
+ "supportedCRS": "urn:ogc:def:crs:EPSG:27700",
+ "tileWidth": 256,
+ "tileHeight": 256,
+ "matrixWidth": 1680,
+ "matrixHeight": 1300
+ },
+ {
+ "identifier": 8,
+ "scaleDenominator": 23623.559151877238,
+ "supportedCRS": "urn:ogc:def:crs:EPSG:27700",
+ "tileWidth": 256,
+ "tileHeight": 256,
+ "matrixWidth": 3360,
+ "matrixHeight": 2599
+ },
+ {
+ "identifier": 9,
+ "scaleDenominator": 9449.423660750896,
+ "supportedCRS": "urn:ogc:def:crs:EPSG:27700",
+ "tileWidth": 256,
+ "tileHeight": 256,
+ "matrixWidth": 8399,
+ "matrixHeight": 6496
+ },
+ {
+ "identifier": 10,
+ "scaleDenominator": 7559.538928600717,
+ "supportedCRS": "urn:ogc:def:crs:EPSG:27700",
+ "tileWidth": 256,
+ "tileHeight": 256,
+ "matrixWidth": 10499,
+ "matrixHeight": 8120
+ },
+ {
+ "identifier": 11,
+ "scaleDenominator": 5669.654196450538,
+ "supportedCRS": "urn:ogc:def:crs:EPSG:27700",
+ "tileWidth": 256,
+ "tileHeight": 256,
+ "matrixWidth": 13998,
+ "matrixHeight": 10826
+ },
+ {
+ "identifier": 12,
+ "scaleDenominator": 3779.7694643003583,
+ "supportedCRS": "urn:ogc:def:crs:EPSG:27700",
+ "tileWidth": 256,
+ "tileHeight": 256,
+ "matrixWidth": 20997,
+ "matrixHeight": 16239
+ },
+ {
+ "identifier": 13,
+ "scaleDenominator": 1889.8847321501792,
+ "supportedCRS": "urn:ogc:def:crs:EPSG:27700",
+ "tileWidth": 256,
+ "tileHeight": 256,
+ "matrixWidth": 41993,
+ "matrixHeight": 32478
+ },
+ {
+ "identifier": 14,
+ "scaleDenominator": 944.9423660750896,
+ "supportedCRS": "urn:ogc:def:crs:EPSG:27700",
+ "tileWidth": 256,
+ "tileHeight": 256,
+ "matrixWidth": 83985,
+ "matrixHeight": 64955
+ },
+ {
+ "identifier": 15,
+ "scaleDenominator": 377.9769464300358,
+ "supportedCRS": "urn:ogc:def:crs:EPSG:27700",
+ "tileWidth": 256,
+ "tileHeight": 256,
+ "matrixWidth": 209961,
+ "matrixHeight": 162387
+ }
+];
+
+/*
+ * maps.config() is called on dom ready in map-OpenLayers.js
+ * to setup the way the map should operate.
+ */
+fixmystreet.maps.config = function() {
+ fixmystreet.controls = [
+ new OpenLayers.Control.ArgParserFMS(),
+ new OpenLayers.Control.Navigation(),
+ new OpenLayers.Control.PermalinkFMS('map'),
+ new OpenLayers.Control.PanZoomFMS({id: 'fms_pan_zoom' })
+ ];
+
+ /* Linking back to around from report page, keeping track of map moves */
+ if ( fixmystreet.page == 'report' ) {
+ fixmystreet.controls.push( new OpenLayers.Control.PermalinkFMS('key-tool-problems-nearby', '/around') );
+ }
+
+ this.setup_wmts_base_map();
+};
+
+fixmystreet.maps.zoom_for_normal_size = 7;
+fixmystreet.maps.zoom_for_small_size = 4;
diff --git a/web/js/map-wmts-zurich.js b/web/js/map-wmts-zurich.js
index 346e9b89a..7ed7bbbc3 100644
--- a/web/js/map-wmts-zurich.js
+++ b/web/js/map-wmts-zurich.js
@@ -102,8 +102,8 @@ fixmystreet.maps.matrix_ids = [
(function() {
function pin_dragged(lonlat) {
- document.getElementById('fixmystreet.latitude').value = lonlat.y;
- document.getElementById('fixmystreet.longitude').value = lonlat.x;
+ document.getElementById('fixmystreet.latitude').value = lonlat.y.toFixed(6);
+ document.getElementById('fixmystreet.longitude').value = lonlat.x.toFixed(6);
}
$(function(){
@@ -152,13 +152,5 @@ fixmystreet.maps.config = function() {
fixmystreet.area_format = { fillColor: 'none', strokeWidth: 4, strokeColor: 'black' };
};
-fixmystreet.maps.marker_size = function() {
- var zoom = fixmystreet.map.getZoom() + fixmystreet.zoomOffset;
- if (zoom >= 6) {
- return 'normal';
- } else if (zoom >= 3) {
- return 'small';
- } else {
- return 'mini';
- }
-};
+fixmystreet.maps.zoom_for_normal_size = 6;
+fixmystreet.maps.zoom_for_small_size = 3;
diff --git a/web/js/validation_rules.js b/web/js/validation_rules.js
index 3e7b010f2..9044def73 100644
--- a/web/js/validation_rules.js
+++ b/web/js/validation_rules.js
@@ -1,5 +1,5 @@
core_validation_rules = {
- title: { required: true },
+ title: { required: true, notEmail: true },
detail: { required: true },
update: { required: true },
password_register: {