diff options
author | Struan Donald <struan@exo.org.uk> | 2011-10-17 19:22:47 +0100 |
---|---|---|
committer | Struan Donald <struan@exo.org.uk> | 2011-10-17 19:22:47 +0100 |
commit | 1fac2719996a060f4e1c75bef9c1980ac8a5f9ac (patch) | |
tree | 71317fc07eff1f146fc0cb712e84b7a717afe303 | |
parent | c0e8290e1a1e846dc555d6b03d2fe8bb71057a2c (diff) |
notes on creating a cobrand plus a quick helper script for generating location data
-rw-r--r-- | bin/generate_council_location | 26 | ||||
-rw-r--r-- | notes/cobranding.txt | 40 |
2 files changed, 66 insertions, 0 deletions
diff --git a/bin/generate_council_location b/bin/generate_council_location new file mode 100644 index 000000000..36bf14d04 --- /dev/null +++ b/bin/generate_council_location @@ -0,0 +1,26 @@ +use strict; +use JSON; +use LWP::Simple; + +my $id = shift; + +my $url = sprintf( 'http://mapit.mysociety.org/area/%s/geometry', $id); + +my $json = get( $url ); +my $geo = decode_json( $json ); + +my $max_lat = $geo->{max_lat}; +my $min_lat = $geo->{min_lat}; +my $max_lon = $geo->{max_lon}; +my $min_lon = $geo->{min_lon}; +my $c_lat = $geo->{centre_lat}; +my $c_lon = $geo->{centre_lon}; + +my $spn_lat = $max_lat - $min_lat; +my $spn_lon = $max_lon - $min_lon; + +print <<"EOT"; + centre => '$c_lat,$c_lon', + span => '$spn_lat,$spn_lon', + bounds => [ '$min_lat,$min_lon','$max_lat,$max_lon' ], +EOT diff --git a/notes/cobranding.txt b/notes/cobranding.txt new file mode 100644 index 000000000..9bfc2d47a --- /dev/null +++ b/notes/cobranding.txt @@ -0,0 +1,40 @@ +Notes on adding a co brand +-------------------------- + +Basic steps + +Assumes cobrand is for ExampleCom + +NB: this is moderately specific to producing cobrands for UK councils + +1: copy an exiting perllib/FixMyStreet/Cobrand/ file to perllib/FixMyStreet/Cobrand/ExampleCom.pm + * Change package name at top of file + * Change following functions accordingly: + site_title + site_restriction + problems_clause + enter_postcode_text + council_check + base_url + all_councils_report should return 0 + disambiguate_location - see below for details on this + +2: create a web/cobrands/examplecom folder and put custom css/images/js in here + +3: create templates/web/examplecom/ and put a header.html and footer.html with relevant html + +4: edit conf/general and add examplecom to allowed cobrands + +5: restart server + +6: on dev server you can append ?_override_cobrand_moniker=examplecom +to display the cobrand. ?_override_clear_all=1 will remove this + +disambiguate_location + +The results of this are used to provide a bounding box for reverse +geolocation. + +There's a script in bin - generate_council_location that takes the +mapit area code for the council as a argument and generates the +contents of the disambiguate_location hash. |