diff options
Diffstat (limited to 'web')
-rw-r--r-- | web/cobrands/fixmystreet-uk-councils/roadworks.js | 9 | ||||
-rw-r--r-- | web/cobrands/fixmystreet/staff.js | 3 | ||||
-rw-r--r-- | web/cobrands/hounslow/_colours.scss | 38 | ||||
-rw-r--r-- | web/cobrands/hounslow/assets.js | 241 | ||||
-rw-r--r-- | web/cobrands/hounslow/base.scss | 38 | ||||
-rw-r--r-- | web/cobrands/hounslow/images/logo.gif | bin | 0 -> 6883 bytes | |||
-rw-r--r-- | web/cobrands/hounslow/js.js | 30 | ||||
-rw-r--r-- | web/cobrands/hounslow/layout.scss | 21 | ||||
-rw-r--r-- | web/js/map-wmts-hounslow.js | 194 |
9 files changed, 571 insertions, 3 deletions
diff --git a/web/cobrands/fixmystreet-uk-councils/roadworks.js b/web/cobrands/fixmystreet-uk-councils/roadworks.js index 05417545d..083f669c8 100644 --- a/web/cobrands/fixmystreet-uk-councils/roadworks.js +++ b/web/cobrands/fixmystreet-uk-councils/roadworks.js @@ -34,11 +34,16 @@ OpenLayers.Format.RoadworksForwardPlanning = OpenLayers.Class(OpenLayers.Format. var results = null; var obj = null; if (typeof json == "string") { - obj = OpenLayers.Format.JSON.prototype.read.apply(this, [json, filter]); + try { + obj = OpenLayers.Format.JSON.prototype.read.apply(this, [json, filter]); + } catch (error) { + OpenLayers.Console.error("Bad JSON: " + error); + return; + } } else { obj = json; } - if(!obj) { + if(!obj || !obj.query) { OpenLayers.Console.error("Bad JSON: " + json); return; } diff --git a/web/cobrands/fixmystreet/staff.js b/web/cobrands/fixmystreet/staff.js index 7dccedcd9..0bbf65aae 100644 --- a/web/cobrands/fixmystreet/staff.js +++ b/web/cobrands/fixmystreet/staff.js @@ -390,7 +390,8 @@ $(fixmystreet).on('display:report', function() { $(fixmystreet).on('report_new:category_change', function(evt, $this) { var category = $this.val(); var prefill_reports = $this.data('prefill'); - var body = $this.data('body'); + var display_names = fixmystreet.reporting_data.display_names || {}; + var body = display_names[ $this.data('body') ] || $this.data('body'); if (prefill_reports) { var title = 'A ' + category + ' problem has been found'; diff --git a/web/cobrands/hounslow/_colours.scss b/web/cobrands/hounslow/_colours.scss new file mode 100644 index 000000000..0a4476720 --- /dev/null +++ b/web/cobrands/hounslow/_colours.scss @@ -0,0 +1,38 @@ +/* COLOURS */ + +$menu-image: 'menu-black'; + +$mappage-header-height: 134px; + +// Primary +$white: #fff; +$purple: rgb(125, 43, 128); +$green: rgb(139, 197, 79); + +// Secondary +$orange: rgb(245,132,35); +$red: rgb(211,17,69); +$blue: rgb(0, 85, 150); +$dark_green: rgb(0, 137, 82); +$magenta: rgb(236, 0, 140); +$cyan: rgb(0, 174, 239); + +$primary: $purple; +//$primary: #dce6f2; // From bexley.gov.uk/services +$primary_b: #222; +$primary_text: $white; + +$base_bg: $white; +$base_fg: #222; + +$nav_background_colour: $white; +$nav_colour: $purple; +$nav_hover_background_colour: darken($purple, 10%); + +$col_click_map: $green; + +$header-top-border: false; + +$heading-font: InfoText, Frutiger, Arial, sans-serif; +$body-font: Frutiger, Arial, sans-serif; +$meta-font: $body-font; diff --git a/web/cobrands/hounslow/assets.js b/web/cobrands/hounslow/assets.js new file mode 100644 index 000000000..e6d3383ff --- /dev/null +++ b/web/cobrands/hounslow/assets.js @@ -0,0 +1,241 @@ +(function(){ + +if (!fixmystreet.maps) { + return; +} + +var defaults = { + http_options: { + url: "https://tilma.mysociety.org/mapserver/hounslow", + params: { + SERVICE: "WFS", + VERSION: "1.1.0", + REQUEST: "GetFeature", + SRSNAME: "urn:ogc:def:crs:EPSG::27700" + } + }, + format_class: OpenLayers.Format.GML.v3.MultiCurveFix, + asset_type: 'spot', + max_resolution: { + 'hounslow': 0.5291677250021167, + 'fixmystreet': 1.194328566789627 + }, + min_resolution: 0.00001, + asset_id_field: 'CentralAssetId', + attributes: { + central_asset_id: 'CentralAssetId', + asset_details: 'FeatureId' + }, + geometryName: 'msGeometry', + srsName: "EPSG:27700", + strategy_class: OpenLayers.Strategy.FixMyStreet, + body: "Hounslow Borough Council" +}; + +fixmystreet.assets.add($.extend(true, {}, defaults, { + http_options: { + params: { + TYPENAME: "bins" + } + }, + asset_category: "Litter Bins", + asset_item: 'bin' +})); + +fixmystreet.assets.add($.extend(true, {}, defaults, { + http_options: { + params: { + TYPENAME: "trees" + } + }, + asset_id_field: 'central_asset_id', + attributes: { + central_asset_id: 'central_asset_id', + asset_details: 'asset_Id' + }, + asset_category: [ + "Tree Danger/Obstruction", + "Branches overhanging", + "Damage By Tree", + "Dead/Dying/Diseased", + "Dying or dangerous tree", + "Empty tree Pit", + "Fallen or leaning tree", + "General Maintenance and pruning", + "Illuminated Traffic signal obstructed by vegetation", + "Traffic signal obstructed by vegetation", + "Pest: Tree/Shrub", + "Pests in trees and shrubs", + "Tree Branches Overhanging", + "Tree Maintenance", + "Tree causing damage to property", + "Tree obstructing street light", + "Trees or shrubs blocking visibility", + "Trees or shrubs causing obstruction of highway", + "Trees" + ], + asset_item: 'tree' +})); + +fixmystreet.assets.add($.extend(true, {}, defaults, { + http_options: { + params: { + TYPENAME: "signs" + } + }, + asset_category: [ + "Sign Obstructed: Vegetation", + "Missing sign", + "Missing/ damaged traffic sign", + "Sign or road marking missing following works", + "Street nameplate damaged", + "Traffic Sign obstructed (vegetation)", + "Unlit sign knocked down" + ], + asset_item: 'sign' +})); + +// "We do not want to show gullies as an asset layer, until we are +// confident that the inventory is accurate." +// https://3.basecamp.com/4020879/buckets/10951425/todos/1780668464 +// fixmystreet.assets.add($.extend(true, {}, defaults, { +// http_options: { +// params: { +// TYPENAME: "gulleys" +// } +// }, +// asset_category: [ +// "Bad smell", +// "Flooding", +// "Blocked gully", +// "Damaged/ cracked drain or man hole cover", +// "Missing drain or man hole cover" +// ], +// asset_item: 'gulley' +// })); + +var pin_prefix = fixmystreet.pin_prefix || document.getElementById('js-map-data').getAttribute('data-pin_prefix'); + +var streetlight_default = { + fillColor: "#FFFF00", + fillOpacity: 0.6, + strokeColor: "#000000", + strokeOpacity: 0.8, + strokeWidth: 2, + pointRadius: 6 +}; + +var streetlight_select = { + externalGraphic: pin_prefix + "pin-spot.png", + fillColor: "#55BB00", + graphicWidth: 48, + graphicHeight: 64, + graphicXOffset: -24, + graphicYOffset: -56, + backgroundGraphic: pin_prefix + "pin-shadow.png", + backgroundWidth: 60, + backgroundHeight: 30, + backgroundXOffset: -7, + backgroundYOffset: -22, + popupYOffset: -40, + graphicOpacity: 1.0, + + label: "${FeatureId}", + labelOutlineColor: "white", + labelOutlineWidth: 3, + labelYOffset: 65, + fontSize: '15px', + fontWeight: 'bold' +}; + +// The label for street light markers should be everything after the final +// '/' in the feature's FeatureId attribute. +// This seems to be the easiest way to perform custom processing +// on style attributes in OpenLayers... +var select_style = new OpenLayers.Style(streetlight_select); +select_style.createLiterals = function() { + var literals = Object.getPrototypeOf(this).createLiterals.apply(this, arguments); + if (literals.label && literals.label.split) { + literals.label = literals.label.split("/").slice(-1)[0]; + } + return literals; +}; + +var streetlight_stylemap = new OpenLayers.StyleMap({ + 'default': new OpenLayers.Style(streetlight_default), + 'select': select_style +}); + +var labeled_defaults = $.extend(true, {}, defaults, { + select_action: true, + stylemap: streetlight_stylemap, + feature_code: 'FeatureId', + actions: { + asset_found: function(asset) { + var id = asset.attributes[this.fixmystreet.feature_code] || ''; + if (id !== '' && id.split) { + var code = id.split("/").slice(-1)[0]; + $('.category_meta_message').html('You have selected column <b>' + code + '</b>'); + } else { + $('.category_meta_message').html('You can pick a <b class="asset-spot">' + this.fixmystreet.asset_item + '</b> from the map »'); + } + }, + asset_not_found: function() { + $('.category_meta_message').html('You can pick a <b class="asset-spot">' + this.fixmystreet.asset_item + '</b> from the map »'); + } + } +}); + +fixmystreet.assets.add($.extend(true, {}, labeled_defaults, { + http_options: { + params: { + TYPENAME: "lighting" + } + }, + asset_category: [ + "Damage to paintwork", + "Damage to paintwork/ column", + "Door Missing/ open", + "Lights too bright/ dull", + "New LED lights not working", + "New LED lights too bright", + "New LED lights too dull", + "Not coming on/ faulty", + "Street light leaning", + "Street light not working", + "Street light on during the day", + "Street light wiring exposed", + "Street lights on during the day", + "Unauthorised sign", + "Veg Obstructed: Street Light", + "Zebra crossing beacon fault" + ], + asset_item: 'light' +})); + +fixmystreet.assets.add($.extend(true, {}, defaults, { + http_options: { + params: { + TYPENAME: "streets" + } + }, + max_resolution: { + 'hounslow': 6.614596562526458, + 'fixmystreet': 4.777314267158508 + }, + always_visible: true, + non_interactive: true, + usrn: { + attribute: 'SITE_CODE', + field: 'site_code' + }, + stylemap: new OpenLayers.StyleMap({ + 'default': new OpenLayers.Style({ + fill: false, + stroke: false + }) + }) +})); + + +})(); diff --git a/web/cobrands/hounslow/base.scss b/web/cobrands/hounslow/base.scss new file mode 100644 index 000000000..a7b14c245 --- /dev/null +++ b/web/cobrands/hounslow/base.scss @@ -0,0 +1,38 @@ +@import "../sass/h5bp"; +@import "./_colours"; +@import "../sass/mixins"; +@import "../sass/base"; + +#site-logo { + width: 115px; + height: 51px; + padding: 0.5em 0; + background: url(/cobrands/hounslow/images/logo.gif) 0 50% no-repeat; + background-size: 115px 51px; +} + +#postcodeForm .form-hint { + color: $white; +} + +#map_box #map { + background-color: white; +} + +.btn-primary, +.green-btn, +.btn--primary { + border: none; + background: $green; + + &:hover, + &:active { + background: lighten($green, 5%); + } +} + +.general-notes { + .box-warning { + font-size: 1.2em; + } +} diff --git a/web/cobrands/hounslow/images/logo.gif b/web/cobrands/hounslow/images/logo.gif Binary files differnew file mode 100644 index 000000000..3bc1019ac --- /dev/null +++ b/web/cobrands/hounslow/images/logo.gif diff --git a/web/cobrands/hounslow/js.js b/web/cobrands/hounslow/js.js new file mode 100644 index 000000000..e8772b691 --- /dev/null +++ b/web/cobrands/hounslow/js.js @@ -0,0 +1,30 @@ +(function(){ + +if (!fixmystreet.maps) { + return; +} + +var org_id = '5540'; +var body = "Hounslow Borough Council"; +fixmystreet.assets.add($.extend(true, {}, fixmystreet.roadworks.layer_future, { + http_options: { params: { organisation_id: org_id } }, + body: body +})); +fixmystreet.assets.add($.extend(true, {}, fixmystreet.roadworks.layer_planned, { + http_options: { params: { organisation_id: org_id } }, + body: body +})); + +if (fixmystreet.cobrand == 'hounslow') { + // We want the cobranded site to always display "Hounslow Highways" + // as the destination for reports in the "Public details" section. + // This is OK because the cobranded site only shows categories which + // Hounslow Highways actually handle. + // Replacing this function with a no-op stops the changes made + // to the cobranded councils_text_all.html from being clobbered and + // the 'correct' (according to bodies set up within FMS) body names + // being shown. + fixmystreet.update_public_councils_text = function() {}; +} + +})(); diff --git a/web/cobrands/hounslow/layout.scss b/web/cobrands/hounslow/layout.scss new file mode 100644 index 000000000..6917305de --- /dev/null +++ b/web/cobrands/hounslow/layout.scss @@ -0,0 +1,21 @@ +@import "_colours"; + +@import "../sass/layout"; + +body.twothirdswidthpage .content .sticky-sidebar aside { + top: 10em; +} + +#site-logo { + width: 231px; + height: 102px; + padding: 1em 0; + background-size: 231px 102px; +} + +// Stop visited nav links being purple when hovering over them +.nav-menu--main { + a:hover { + color: $primary_text; + } +} diff --git a/web/js/map-wmts-hounslow.js b/web/js/map-wmts-hounslow.js new file mode 100644 index 000000000..ea414a3d8 --- /dev/null +++ b/web/js/map-wmts-hounslow.js @@ -0,0 +1,194 @@ +/* + * 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() { + 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.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.marker_size = function() { + var zoom = fixmystreet.map.getZoom() + fixmystreet.zoomOffset; + if (zoom >= 8) { + return 'normal'; + } else if (zoom >= 4) { + return 'small'; + } else { + return 'mini'; + } +}; |