diff options
Diffstat (limited to 'web/cobrands')
-rw-r--r-- | web/cobrands/bathnes/assets.js (renamed from web/cobrands/bathnes/js.js) | 1 | ||||
-rw-r--r-- | web/cobrands/bristol/assets.js (renamed from web/cobrands/bristol/js.js) | 1 | ||||
-rw-r--r-- | web/cobrands/bromley/assets.js | 125 | ||||
-rw-r--r-- | web/cobrands/bromley/map.js | 125 | ||||
-rw-r--r-- | web/cobrands/buckinghamshire/assets.js | 202 | ||||
-rw-r--r-- | web/cobrands/buckinghamshire/js.js | 194 | ||||
-rw-r--r-- | web/cobrands/fixmystreet-uk-councils/roadworks.js | 1 |
7 files changed, 330 insertions, 319 deletions
diff --git a/web/cobrands/bathnes/js.js b/web/cobrands/bathnes/assets.js index 86b835d3d..e455d78e9 100644 --- a/web/cobrands/bathnes/js.js +++ b/web/cobrands/bathnes/assets.js @@ -28,6 +28,7 @@ fixmystreet.maps.banes_defaults = { asset_id_field: 'feature_no', attributes: null, geometryName: 'msGeometry', + body: "Bath and North East Somerset Council", srsName: "EPSG:27700" }; diff --git a/web/cobrands/bristol/js.js b/web/cobrands/bristol/assets.js index 9a4d1ec46..6d2020bfe 100644 --- a/web/cobrands/bristol/js.js +++ b/web/cobrands/bristol/assets.js @@ -16,6 +16,7 @@ var options = { asset_id: 'COD_ASSET_ID', usrn: 'COD_USRN' }, + body: "Bristol City Council", geometryName: 'SHAPE' }; diff --git a/web/cobrands/bromley/assets.js b/web/cobrands/bromley/assets.js new file mode 100644 index 000000000..6d05e0084 --- /dev/null +++ b/web/cobrands/bromley/assets.js @@ -0,0 +1,125 @@ +(function(){ + +if (!fixmystreet.maps) { + return; +} + +var defaults = { + http_options: { + url: "https://tilma.staging.mysociety.org/mapserver/bromley_wfs", + params: { + SERVICE: "WFS", + VERSION: "1.1.0", + REQUEST: "GetFeature", + SRSNAME: "urn:ogc:def:crs:EPSG::3857" + } + }, + format_class: OpenLayers.Format.GML.v3.MultiCurveFix, + asset_type: 'spot', + max_resolution: 2.388657133579254, + min_resolution: 0.5971642833948135, + asset_id_field: 'CENTRAL_AS', + geometryName: 'msGeometry', + srsName: "EPSG:3857", + body: "Bromley Council", + strategy_class: OpenLayers.Strategy.FixMyStreet +}; + +fixmystreet.assets.add($.extend(true, {}, defaults, { + http_options: { + params: { + TYPENAME: "Streetlights" + } + }, + asset_id_field: 'FEATURE_ID', + attributes: { + feature_id: 'FEATURE_ID' + }, + asset_category: ["Faulty street light"], + asset_item: 'street light' +})); + +fixmystreet.assets.add($.extend(true, {}, defaults, { + http_options: { + params: { + TYPENAME: "Bins" + } + }, + asset_category: ["Overflowing litter bin"], + asset_item: 'park bin', + asset_item_message: 'For our parks, pick a <b class="asset-spot">bin</b> from the map »' +})); + +fixmystreet.assets.add($.extend(true, {}, defaults, { + http_options: { + params: { + TYPENAME: "Street_Trees" + } + }, + asset_category: ["Public Tree related issue"], + asset_item: 'tree' +})); + +var highways_stylemap = new OpenLayers.StyleMap({ + 'default': new OpenLayers.Style({ + fill: false, + stroke: false + }) +}); + +fixmystreet.assets.add($.extend(true, {}, defaults, { + http_options: { + params: { + TYPENAME: "TFL_Red_Route" + } + }, + stylemap: highways_stylemap, + always_visible: true, + asset_category: ["Blocked drains", "Faulty street light", 'Faulty street sign', 'Floral displays', 'Grass needs cutting', 'Obstructions (skips, A boards)', 'Overhanging vegetation from private land', 'Pavement defect', 'Public Tree related issue', "Road defect"], + non_interactive: true, + road: true, + body: 'Bromley Council', + actions: { + found: function(layer, feature) { + if (!fixmystreet.assets.selectedFeature()) { + $('#single_body_only').val('TfL'); + } + }, + not_found: function(layer) { + $('#single_body_only').val(''); + } + } +})); + +var prow_stylemap = new OpenLayers.StyleMap({ + 'default': new OpenLayers.Style({ + fill: false, + fillOpacity: 0, + strokeColor: "#660099", + strokeOpacity: 0.5, + strokeWidth: 6 + }) +}); + +fixmystreet.assets.add($.extend(true, {}, defaults, { + http_options: { + params: { + TYPENAME: "PROW" + } + }, + stylemap: prow_stylemap, + always_visible: true, + non_interactive: true, + road: true, + all_categories: true, + actions: { + found: function(layer, feature) { + $('#form_prow_reference').val(feature.attributes.PROW_REFER); + }, + not_found: function(layer) { + $('#form_prow_reference').val(''); + } + } +})); + +})(); diff --git a/web/cobrands/bromley/map.js b/web/cobrands/bromley/map.js index 8ad2b328b..0753907cc 100644 --- a/web/cobrands/bromley/map.js +++ b/web/cobrands/bromley/map.js @@ -1,126 +1 @@ fixmystreet.maps.tile_base = [ [ "", "a-" ], "https://{S}fix.bromley.gov.uk/tilma" ]; - -(function(){ - -if (!fixmystreet.maps) { - return; -} - -var defaults = { - http_options: { - url: "https://tilma.staging.mysociety.org/mapserver/bromley_wfs", - params: { - SERVICE: "WFS", - VERSION: "1.1.0", - REQUEST: "GetFeature", - SRSNAME: "urn:ogc:def:crs:EPSG::3857" - } - }, - format_class: OpenLayers.Format.GML.v3.MultiCurveFix, - asset_type: 'spot', - max_resolution: 2.388657133579254, - min_resolution: 0.5971642833948135, - asset_id_field: 'CENTRAL_AS', - geometryName: 'msGeometry', - srsName: "EPSG:3857", - strategy_class: OpenLayers.Strategy.FixMyStreet -}; - -fixmystreet.assets.add($.extend(true, {}, defaults, { - http_options: { - params: { - TYPENAME: "Streetlights" - } - }, - asset_id_field: 'FEATURE_ID', - attributes: { - feature_id: 'FEATURE_ID' - }, - asset_category: ["Faulty street light"], - asset_item: 'street light' -})); - -fixmystreet.assets.add($.extend(true, {}, defaults, { - http_options: { - params: { - TYPENAME: "Bins" - } - }, - asset_category: ["Overflowing litter bin"], - asset_item: 'park bin', - asset_item_message: 'For our parks, pick a <b class="asset-spot">bin</b> from the map »' -})); - -fixmystreet.assets.add($.extend(true, {}, defaults, { - http_options: { - params: { - TYPENAME: "Street_Trees" - } - }, - asset_category: ["Public Tree related issue"], - asset_item: 'tree' -})); - -var highways_stylemap = new OpenLayers.StyleMap({ - 'default': new OpenLayers.Style({ - fill: false, - stroke: false - }) -}); - -fixmystreet.assets.add($.extend(true, {}, defaults, { - http_options: { - params: { - TYPENAME: "TFL_Red_Route" - } - }, - stylemap: highways_stylemap, - always_visible: true, - asset_category: ["Blocked drains", "Faulty street light", 'Faulty street sign', 'Floral displays', 'Grass needs cutting', 'Obstructions (skips, A boards)', 'Overhanging vegetation from private land', 'Pavement defect', 'Public Tree related issue', "Road defect"], - non_interactive: true, - road: true, - body: 'Bromley Council', - actions: { - found: function(layer, feature) { - if (!fixmystreet.assets.selectedFeature()) { - $('#single_body_only').val('TfL'); - } - }, - not_found: function(layer) { - $('#single_body_only').val(''); - } - } -})); - -var prow_stylemap = new OpenLayers.StyleMap({ - 'default': new OpenLayers.Style({ - fill: false, - fillOpacity: 0, - strokeColor: "#660099", - strokeOpacity: 0.5, - strokeWidth: 6 - }) -}); - -fixmystreet.assets.add($.extend(true, {}, defaults, { - http_options: { - params: { - TYPENAME: "PROW" - } - }, - stylemap: prow_stylemap, - always_visible: true, - non_interactive: true, - road: true, - all_categories: true, - actions: { - found: function(layer, feature) { - $('#form_prow_reference').val(feature.attributes.PROW_REFER); - }, - not_found: function(layer) { - $('#form_prow_reference').val(''); - } - } -})); - -})(); diff --git a/web/cobrands/buckinghamshire/assets.js b/web/cobrands/buckinghamshire/assets.js new file mode 100644 index 000000000..a67f16a4e --- /dev/null +++ b/web/cobrands/buckinghamshire/assets.js @@ -0,0 +1,202 @@ +(function(){ + +if (!fixmystreet.maps) { + return; +} + +var defaults = { + http_options: { + url: "https://tilma.mysociety.org/mapserver/bucks", + params: { + SERVICE: "WFS", + VERSION: "1.1.0", + REQUEST: "GetFeature", + SRSNAME: "urn:ogc:def:crs:EPSG::3857" + } + }, + format_class: OpenLayers.Format.GML.v3.MultiCurveFix, + asset_type: 'spot', + max_resolution: 2.388657133579254, + min_resolution: 0.5971642833948135, + asset_id_field: 'central_as', + attributes: { + central_asset_id: 'central_as', + site_code: 'Site_code' + }, + geometryName: 'msGeometry', + srsName: "EPSG:3857", + body: "Buckinghamshire County Council", + strategy_class: OpenLayers.Strategy.FixMyStreet +}; + +fixmystreet.assets.add($.extend(true, {}, defaults, { + http_options: { + params: { + TYPENAME: "Grit_Bins" + } + }, + attributes: { + central_asset_id: 'central_as', + site_code: 'site_code' // different capitalisation, sigh + }, + asset_category: ["Salt bin damaged", "Salt bin refill"], + asset_item: 'grit bin' +})); + +fixmystreet.assets.add($.extend(true, {}, defaults, { + http_options: { + params: { + TYPENAME: "StreetLights_Merged" + } + }, + attributes: { + central_asset_id: 'central_as', + site_code: 'Site_code' + }, + asset_category: [ + 'Light on during the day', + 'Street light dim', + 'Street light intermittent', + 'Street light not working' ], + asset_item: 'street light' +})); + + +// The "whole street asset" layer indicates who is responsible for maintaining +// a road via the 'feature_ty' attribute on features. +// These are roads that Bucks maintain. +var bucks_types = [ + "2", // HW: STRATEGIC ROUTE + "3A", // HW: MAIN DISTRIBUTOR + "3B", // HW: SECONDARY DISTRIBUTOR + "4A", // HW: LINK ROAD + "4B", // HW: LOCAL ACCESS ROAD +]; +// And these are roads they don't maintain. +var non_bucks_types = [ + "HE", // HW: HIGHWAYS ENGLAND + "HWOA", // OTHER AUTHORITY + "HWSA", // HW: Whole Street Asset + "P", // HW: PRIVATE +]; + +// We show roads that Bucks are and aren't responsible for, and display a +// message to the user if they click something Bucks don't maintain. +var types_to_show = bucks_types.concat(non_bucks_types); + +// Some road types we don't want to display at all. +var types_to_hide = [ + "11", // HW: BYWAY OPEN TO TRAFFIC + "12", // HW: FOOTPATH PROW + "13", // HW: BYWAY RESTRICTED + "14", // HW: BRIDLEWAY + "9", // HW: NO CARRIAGEWAY +]; + +var highways_style = new OpenLayers.Style({ + fill: false, + strokeColor: "#5555FF", + strokeOpacity: 0.1, + strokeWidth: 7 +}); + +function bucks_owns_feature(f) { + return f && + f.attributes && + f.attributes.feature_ty && + OpenLayers.Util.indexOf(bucks_types, f.attributes.feature_ty) > -1; +} + +function bucks_does_not_own_feature(f) { + return !bucks_owns_feature(f); +} + +var rule_owned = new OpenLayers.Rule({ + filter: new OpenLayers.Filter.FeatureId({ + type: OpenLayers.Filter.Function, + evaluate: bucks_owns_feature + }) +}); + +var rule_not_owned = new OpenLayers.Rule({ + filter: new OpenLayers.Filter.FeatureId({ + type: OpenLayers.Filter.Function, + evaluate: bucks_does_not_own_feature + }), + symbolizer: { + strokeColor: "#555555" + } +}); +highways_style.addRules([rule_owned, rule_not_owned]); + +function show_responsibility_error(id) { + hide_responsibility_errors(); + $("#js-roads-responsibility").removeClass("hidden"); + $("#js-roads-responsibility .js-responsibility-message").addClass("hidden"); + $(id).removeClass("hidden"); +} + +function hide_responsibility_errors() { + $("#js-roads-responsibility").addClass("hidden"); + $("#js-roads-responsibility .js-responsibility-message").addClass("hidden"); +} + +function disable_report_form() { + $("#problem_form").hide(); +} + +function enable_report_form() { + $("#problem_form").show(); +} + +fixmystreet.assets.add($.extend(true, {}, defaults, { + http_options: { + params: { + TYPENAME: "Whole_Street" + } + }, + stylemap: new OpenLayers.StyleMap({ + 'default': highways_style + }), + always_visible: true, + non_interactive: true, + road: true, + asset_item: 'road', + all_categories: true, + actions: { + found: function(layer, feature) { + if (fixmystreet.assets.selectedFeature()) { + hide_responsibility_errors(); + enable_report_form(); + } else if (OpenLayers.Util.indexOf(bucks_types, feature.attributes.feature_ty) != -1) { + hide_responsibility_errors(); + enable_report_form(); + } else { + // User has clicked a road that Bucks don't maintain. + show_responsibility_error("#js-not-council-road"); + disable_report_form(); + } + }, + + not_found: function(layer) { + // If a feature wasn't found at the location they've clicked, it's + // probably a field or something. Show an error to that effect, + // unless an asset is selected. + if (fixmystreet.assets.selectedFeature()) { + hide_responsibility_errors(); + enable_report_form(); + } else { + show_responsibility_error("#js-not-a-road"); + disable_report_form(); + } + } + }, + usrn: { + attribute: 'site_code', + field: 'site_code' + }, + filter_key: 'feature_ty', + filter_value: types_to_show, +})); + +})(); diff --git a/web/cobrands/buckinghamshire/js.js b/web/cobrands/buckinghamshire/js.js index 9094fdb8e..ebbfe36e0 100644 --- a/web/cobrands/buckinghamshire/js.js +++ b/web/cobrands/buckinghamshire/js.js @@ -4,200 +4,6 @@ if (!fixmystreet.maps) { return; } -var defaults = { - http_options: { - url: "https://tilma.mysociety.org/mapserver/bucks", - params: { - SERVICE: "WFS", - VERSION: "1.1.0", - REQUEST: "GetFeature", - SRSNAME: "urn:ogc:def:crs:EPSG::3857" - } - }, - format_class: OpenLayers.Format.GML.v3.MultiCurveFix, - asset_type: 'spot', - max_resolution: 2.388657133579254, - min_resolution: 0.5971642833948135, - asset_id_field: 'central_as', - attributes: { - central_asset_id: 'central_as', - site_code: 'Site_code' - }, - geometryName: 'msGeometry', - srsName: "EPSG:3857", - strategy_class: OpenLayers.Strategy.FixMyStreet -}; - -fixmystreet.assets.add($.extend(true, {}, defaults, { - http_options: { - params: { - TYPENAME: "Grit_Bins" - } - }, - attributes: { - central_asset_id: 'central_as', - site_code: 'site_code' // different capitalisation, sigh - }, - asset_category: ["Salt bin damaged", "Salt bin refill"], - asset_item: 'grit bin' -})); - -fixmystreet.assets.add($.extend(true, {}, defaults, { - http_options: { - params: { - TYPENAME: "StreetLights_Merged" - } - }, - attributes: { - central_asset_id: 'central_as', - site_code: 'Site_code' - }, - asset_category: [ - 'Light on during the day', - 'Street light dim', - 'Street light intermittent', - 'Street light not working' ], - asset_item: 'street light' -})); - - -// The "whole street asset" layer indicates who is responsible for maintaining -// a road via the 'feature_ty' attribute on features. -// These are roads that Bucks maintain. -var bucks_types = [ - "2", // HW: STRATEGIC ROUTE - "3A", // HW: MAIN DISTRIBUTOR - "3B", // HW: SECONDARY DISTRIBUTOR - "4A", // HW: LINK ROAD - "4B", // HW: LOCAL ACCESS ROAD -]; -// And these are roads they don't maintain. -var non_bucks_types = [ - "HE", // HW: HIGHWAYS ENGLAND - "HWOA", // OTHER AUTHORITY - "HWSA", // HW: Whole Street Asset - "P", // HW: PRIVATE -]; - -// We show roads that Bucks are and aren't responsible for, and display a -// message to the user if they click something Bucks don't maintain. -var types_to_show = bucks_types.concat(non_bucks_types); - -// Some road types we don't want to display at all. -var types_to_hide = [ - "11", // HW: BYWAY OPEN TO TRAFFIC - "12", // HW: FOOTPATH PROW - "13", // HW: BYWAY RESTRICTED - "14", // HW: BRIDLEWAY - "9", // HW: NO CARRIAGEWAY -]; - -var highways_style = new OpenLayers.Style({ - fill: false, - strokeColor: "#5555FF", - strokeOpacity: 0.1, - strokeWidth: 7 -}); - -function bucks_owns_feature(f) { - return f && - f.attributes && - f.attributes.feature_ty && - OpenLayers.Util.indexOf(bucks_types, f.attributes.feature_ty) > -1; -} - -function bucks_does_not_own_feature(f) { - return !bucks_owns_feature(f); -} - -var rule_owned = new OpenLayers.Rule({ - filter: new OpenLayers.Filter.FeatureId({ - type: OpenLayers.Filter.Function, - evaluate: bucks_owns_feature - }) -}); - -var rule_not_owned = new OpenLayers.Rule({ - filter: new OpenLayers.Filter.FeatureId({ - type: OpenLayers.Filter.Function, - evaluate: bucks_does_not_own_feature - }), - symbolizer: { - strokeColor: "#555555" - } -}); -highways_style.addRules([rule_owned, rule_not_owned]); - -function show_responsibility_error(id) { - hide_responsibility_errors(); - $("#js-bucks-responsibility").removeClass("hidden"); - $("#js-bucks-responsibility .js-responsibility-message").addClass("hidden"); - $(id).removeClass("hidden"); -} - -function hide_responsibility_errors() { - $("#js-bucks-responsibility").addClass("hidden"); - $("#js-bucks-responsibility .js-responsibility-message").addClass("hidden"); -} - -function disable_report_form() { - $("#problem_form").hide(); -} - -function enable_report_form() { - $("#problem_form").show(); -} - -fixmystreet.assets.add($.extend(true, {}, defaults, { - http_options: { - params: { - TYPENAME: "Whole_Street" - } - }, - stylemap: new OpenLayers.StyleMap({ - 'default': highways_style - }), - always_visible: true, - non_interactive: true, - road: true, - asset_item: 'road', - all_categories: true, - actions: { - found: function(layer, feature) { - if (fixmystreet.assets.selectedFeature()) { - hide_responsibility_errors(); - enable_report_form(); - } else if (OpenLayers.Util.indexOf(bucks_types, feature.attributes.feature_ty) != -1) { - hide_responsibility_errors(); - enable_report_form(); - } else { - // User has clicked a road that Bucks don't maintain. - show_responsibility_error("#js-not-bucks-road"); - disable_report_form(); - } - }, - - not_found: function(layer) { - // If a feature wasn't found at the location they've clicked, it's - // probably a field or something. Show an error to that effect, - // unless an asset is selected. - if (fixmystreet.assets.selectedFeature()) { - hide_responsibility_errors(); - enable_report_form(); - } else { - show_responsibility_error("#js-not-a-road"); - disable_report_form(); - } - } - }, - usrn: { - attribute: 'site_code', - field: 'site_code' - }, - filter_key: 'feature_ty', - filter_value: types_to_show, -})); - fixmystreet.assets.add(fixmystreet.roadworks.layer_future); fixmystreet.assets.add(fixmystreet.roadworks.layer_planned); diff --git a/web/cobrands/fixmystreet-uk-councils/roadworks.js b/web/cobrands/fixmystreet-uk-councils/roadworks.js index a11279645..ccd8531b6 100644 --- a/web/cobrands/fixmystreet-uk-councils/roadworks.js +++ b/web/cobrands/fixmystreet-uk-councils/roadworks.js @@ -136,6 +136,7 @@ var roadworks_defaults = { format_class: OpenLayers.Format.RoadworksForwardPlanning, strategy_class: OpenLayers.Strategy.FixMyStreet, stylemap: stylemap, + body: "Buckinghamshire County Council", non_interactive: true, always_visible: true }; |