aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xbin/showcouncilrates5
-rw-r--r--conf/packages2
-rw-r--r--notes/INSTALL18
-rw-r--r--notes/no-update-server534
-rw-r--r--perllib/FixMyStreet/App/Controller/Admin.pm2
-rw-r--r--t/app/controller/admin.t2
-rw-r--r--templates/web/default/footer.html26
-rw-r--r--templates/web/default/header.html6
-rw-r--r--templates/web/emptyhomes/faq/faq-cy.html14
-rwxr-xr-xtemplates/web/emptyhomes/faq/faq-en-gb.html29
-rw-r--r--templates/web/emptyhomes/header.html1
-rw-r--r--templates/web/emptyhomes/index.html15
-rw-r--r--web/cobrands/fixmystreet/base.scss2
-rw-r--r--web/cobrands/fixmystreet/layout.scss24
-rw-r--r--web/js/fixmystreet.js19
-rw-r--r--web/js/map-OpenLayers.js219
16 files changed, 736 insertions, 182 deletions
diff --git a/bin/showcouncilrates b/bin/showcouncilrates
index cc8ce8d10..1dacae597 100755
--- a/bin/showcouncilrates
+++ b/bin/showcouncilrates
@@ -26,9 +26,10 @@ BEGIN {
my $query = "SELECT council, COUNT(*) AS total, SUM(fixed) AS fixed
FROM (SELECT council,
- CASE WHEN state = 'fixed' THEN 1 ELSE 0 END AS fixed
+ CASE WHEN state in ('fixed','fixed - user', 'fixed - council')
+ THEN 1 ELSE 0 END AS fixed
FROM problem WHERE confirmed IS NOT NULL AND
- state IN ('fixed', 'confirmed') AND
+ state IN ('fixed', 'fixed - user', 'fixed - council', 'confirmed') AND
whensent < NOW() - INTERVAL '4 weeks') AS a
GROUP BY council";
diff --git a/conf/packages b/conf/packages
index 7e383d7b9..d5ebbb3db 100644
--- a/conf/packages
+++ b/conf/packages
@@ -35,3 +35,5 @@ liblist-moreutils-perl
libhaml-ruby
libtemplate-perl
postgresql-server-dev-8.4
+gnuplot
+ttf-bitstream-vera
diff --git a/notes/INSTALL b/notes/INSTALL
index 7287aa3d3..560eb6c0f 100644
--- a/notes/INSTALL
+++ b/notes/INSTALL
@@ -14,14 +14,14 @@ conf/packages is a list of Debian packages that are needed, so install them if
you're on Debian/Ubuntu. You'll also probably need to install lots of CPAN
modules, see the section on that below.
-FixMyStreet expects a PostgreSQL database with the postGIS extension, so set one
-of them up - the schema is available in db/schema.sql. You will also need to load
-in db/alert_types.sql to populate the alert types table.
+FixMyStreet expects a PostgreSQL database, so set one of them up - the schema
+is available in db/schema.sql. You will also need to load in db/alert_types.sql
+to populate the alert types table.
-Copy conf/general-example to conf/general and set it up appropriately:
+Copy conf/general.yml-example to conf/general.yml and set it up appropriately:
* provide the relevant database connection details
-* the OPTION_BASE_URL to be where your test site will run - eg 'http://localhost'
-* set OPTION_UPLOAD_CACHE and OPTION_GEO_CACHE to your preferred values
+* the BASE_URL to be where your test site will run - eg 'http://localhost'
+* set UPLOAD_CACHE and GEO_CACHE to your preferred values
* MAP_TYPE - OSM is probably the best one to try to start with, it's being
successfully used.
@@ -83,6 +83,12 @@ Note: Others are starting to work on this and it might be a good idea to switch
to their output:
http://blogs.perl.org/users/sebastian_willert/2011/03/how-i-distribute-my-projects.html
+Notes
+-----
+
+* no-update-server is a shell script used by NUUG for setting up
+ www.fiksgatami.no using the FixMyStreet codebase.
+
Running the code
================
diff --git a/notes/no-update-server b/notes/no-update-server
new file mode 100644
index 000000000..ad1ce26e2
--- /dev/null
+++ b/notes/no-update-server
@@ -0,0 +1,534 @@
+#!/bin/sh
+#
+# This is a script used by Norway to bootstrap/update their FixMyStreet and
+# mapit installations. It may be helpful to you in order to see what it does,
+# but also is quite specific about where things are located and so on.
+# We hope to improve the installation process in the near future.
+#
+# Single argument is one of 'bootstrap' 'update' 'remove' or 'update_map'
+
+# Exit on first error
+set -e
+
+PATH=/sbin:/usr/sbin:$PATH
+export PATH
+
+servername=$(hostname)
+basedir=/srv/$servername
+codename=$(lsb_release -cs)
+
+install_debs() {
+ # Statistics::Distributions is created locally
+ dpkg -i /root/libstatistics-distributions-perl_1.02-1_all.deb
+
+ # Install fixmystreet dependencies
+ apt-get install -y $(cat fixmystreet/conf/packages) \
+ libregexp-common-perl
+# libcache-memcached-perl libfile-slurp-perl \
+# libgeography-nationalgrid-perl liberror-perl libwww-perl \
+# libimage-magick-perl libdbd-pg-perl libio-string-perl \
+# libregexp-common-perl libmath-bigint-gmp-perl libdigest-sha1-perl \
+# libxml-rss-perl libfcgi-perl libjson-perl libimage-size-perl \
+# php5-cli postgresql apache2 libtext-template-perl libtext-csv-perl
+
+ # Install mapit dependencies
+ apt-get install -y $(cat mapit/conf/packages)
+
+ apt-get install -y libapache2-mod-fcgid
+ apt-get install -y pwgen
+
+ apt-get install -y gnuplot ttf-bitstream-vera
+
+ # XXX Also need to fetch and compile
+ # https://secure.mysociety.org/cvstrac/dir?d=mysociety/run-with-lockfile
+}
+
+# Load Debian and CPAN packages needed for the Catalyst version
+install_dev_catalyst() {
+ apt-get install -y libcatalyst-perl \
+ libreadonly-perl \
+ libclass-c3-componentised-perl \
+ libfile-find-rule-perl \
+ libcatalyst-modules-perl \
+ libcatalyst-modules-extra-perl \
+ libdatetime-format-iso8601-perl \
+ libdatetime-format-http-perl \
+ libdatetime-format-pg-perl \
+ libdbd-pg-perl \
+ libsub-override-perl \
+ libhtml-treebuilder-xpath-perl \
+ libtest-requires-perl \
+ libhtml-selector-xpath-perl \
+ libtest-base-perl \
+ libdbix-class-encodedcolumn-perl \
+ libcrypt-eksblowfish-perl \
+ libdatetime-format-w3cdtf-perl \
+ libhaml-ruby
+
+ # Workaround for missing Perl modules in Debian
+ (
+ installcpandeb() {
+ pkg=$1
+ echo "info: Generating deb for $pkg"
+ debs=$(LC_ALL=C cpan2deb $pkg 2>&1 |grep 'dpkg-deb: building package'| sed "s/.* in \`\(.*\)'./\1/" | sed 's%^../%%')
+ echo "info: Installing $debs"
+ dpkg -i $debs
+ }
+
+ mkdir -p /srv/src
+ cd /srv/src
+
+ apt-get install -y dh-make-perl apt-file
+ apt-file update
+
+ installcpandeb URI::SmartURI
+ installcpandeb Catalyst::Plugin::SmartURI
+ installcpandeb Catalyst::Plugin::Unicode::Encoding
+ installcpandeb Web::Scraper
+ installcpandeb Sort::Key
+ installcpandeb Term::Size::Perl
+ installcpandeb Devel::Hide
+ installcpandeb Term::Size::Any
+ installcpandeb Template::Plugin::DateTime::Format
+ installcpandeb Template::Plugin::Comma
+ # Upgrade from 0.34 in Squeeze, to get expose_methods provided
+ # since 0.35.
+ installcpandeb Catalyst::View::TT
+
+ # App::cpanminus, Bundle::DBD::Pg, CPAN::ParseDistribution
+ )
+}
+
+pgsql_createuser() {
+ dbuser="$1"
+ dbpassword="$2"
+ su postgres -c "createuser -SDRl $dbuser"
+ su postgres -c "psql -c \"alter user \\\"$dbuser\\\" with password '$dbpassword';\""
+}
+
+pgsql_fixmystreet_bootstrap() {
+ dbuser="$1"
+ dbname="$2"
+ su postgres -c "createdb -E UTF8 --owner $dbuser $dbname; createlang plpgsql $dbname"
+ su $dbuser -c "psql $dbname -f $basedir/fixmystreet/db/schema.sql"
+ su $dbuser -c "psql $dbname -f $basedir/fixmystreet/db/alert_types.sql"
+}
+
+pgsql_mapit_bootstrap() {
+ dbuser="$1"
+ dbname="$2"
+ su postgres -c "createdb -E UTF8 -T template_postgis --owner $dbuser $dbname"
+ # No need to use "createlang plpgsql $dbname", as template_postgis
+ # already include it.
+}
+
+pgsql_remove_db() {
+ dbname="$1"
+ su postgres -c "dropdb $dbname"
+}
+pgsql_remove_user() {
+ dbuser="$1"
+ su postgres -c "dropuser $dbuser"
+}
+
+postgis_bootstrap() {
+ case "$codename" in
+ lenny)
+ POSTGIS_SQL_PATH=/usr/share/postgresql-8.3-postgis
+ POSTGISSQL=lwpostgis.sql
+ ;;
+ *)
+ POSTGIS_SQL_PATH=/usr/share/postgresql/8.4/contrib/postgis-1.5
+ POSTGISSQL=postgis.sql
+ ;;
+ esac
+
+ su postgres -c "createdb -E UTF8 template_postgis"
+ su postgres -c "createlang -d template_postgis plpgsql"
+ su postgres -c "psql -d postgres -c \"UPDATE pg_database SET datistemplate='true' WHERE datname='template_postgis';\""
+
+ # Loading the PostGIS SQL routines
+ su postgres -c "psql -d template_postgis -f $POSTGIS_SQL_PATH/$POSTGISSQL"
+ su postgres -c "psql -d template_postgis -f $POSTGIS_SQL_PATH/spatial_ref_sys.sql"
+ # Enabling users to alter spatial tables.
+ su postgres -c "psql -d template_postgis -c \"GRANT ALL ON geometry_columns TO PUBLIC;\""
+ su postgres -c "psql -d template_postgis -c \"GRANT ALL ON spatial_ref_sys TO PUBLIC;\""
+}
+
+postgis_remove() {
+ # Change template status to make it possible to drop the database
+ su postgres -c "psql -d postgres -c \"UPDATE pg_database SET datistemplate='false' WHERE datname='template_postgis';\""
+ su postgres -c "dropdb template_postgis"
+}
+
+apache_config() {
+ cat > /etc/apache2/sites-available/fixmystreet <<EOF
+<VirtualHost *:80>
+ ServerName $servername
+ ServerAlias fiksgatami.no www.fiksgatami.no
+ DocumentRoot $basedir/fixmystreet/web/
+
+ # 5 MB limit to allow large images to be uploaded
+ FcgidMaxRequestLen 5242880
+
+ RewriteEngine on
+ RewriteCond %{HTTP_HOST} ^fiksgatami\.no
+ RewriteRule ^(.*)$ http://www.fiksgatami.no$1 [R=permanent,L]
+ RewriteCond %{HTTP_HOST} ^fiksgatami\.nuug\.no
+ RewriteRule ^(.*)$ http://www.fiksgatami.no$1 [R=permanent,L]
+
+ # Pull in the specific config
+ Include $basedir/fixmystreet/conf/httpd.conf
+
+ <Directory $basedir/fixmystreet/web>
+ # You also need to enable cgi files to run as CGI scripts. For example:
+ # on production servers these are run under fastcgi
+ Options +ExecCGI
+ AddHandler fcgid-script .cgi
+ </Directory>
+
+ <Location /admin>
+ Options +ExecCGI
+ AddHandler fcgid-script .cgi
+
+ AllowOverride AuthConfig
+ Order Allow,Deny
+ Allow From All
+
+ AuthName "Fiksgatami Admin Access"
+ AuthType Basic
+ AuthUserFile /etc/apache2/htpasswd.fixmystreet.users
+ require valid-user
+ </Location>
+
+ Alias /admin/ $basedir/fixmystreet/web-admin/
+ Alias /jslib/ $basedir/fixmystreet/commonlib/jslib/
+</VirtualHost>
+EOF
+
+ (
+ cd $basedir
+ sed s/mapit.mysociety.org/mapit.nuug.no/ \
+ < fixmystreet/conf/httpd.conf-example \
+ > fixmystreet/conf/httpd.conf
+ )
+
+ htpwdfile=/etc/apache2/htpasswd.fixmystreet.users
+ if [ ! -e $htpwdfile ] ; then
+ htpasswd -cmb $htpwdfile admin "$webpassword"
+ fi
+
+ case "$codename" in
+ lenny)
+ djangodir=/var/lib/python-support/python2.5/django
+ ;;
+ *)
+ djangodir=/var/lib/python-support/python2.6/django
+ ;;
+ esac
+ cat > /etc/apache2/sites-available/mapit <<EOF
+<VirtualHost *:80>
+ ServerName mapit.nuug.no
+ ServerAlias mapit-dev.nuug.no
+ DocumentRoot $basedir/mapit/web/
+
+ WSGIDaemonProcess mapit.nuug.no user=www-data group=www-data processes=5 threads=1 display-name=mapit.nuug.no
+ WSGIProcessGroup mapit.nuug.no
+
+ WSGIScriptAlias / $basedir/mapit/web/django.wsgi
+
+ Alias /media $djangodir/contrib/admin/media
+ Alias /static $basedir/mapit/mapit/static
+
+ <Directory $basedir/mapit/web>
+ # You also need to enable cgi files to run as CGI scripts. For example:
+ # on production servers these are run under fastcgi
+ Options +ExecCGI
+ AddHandler fcgid-script .cgi
+ </Directory>
+</VirtualHost>
+EOF
+ a2dissite default
+ a2ensite fixmystreet
+ a2ensite mapit
+ a2enmod proxy rewrite
+ a2enmod proxy_http
+ a2enmod expires
+ /etc/init.d/apache2 restart
+}
+
+apache_stop() {
+ /etc/init.d/apache2 stop
+}
+
+apache_remove() {
+ a2dissite fixmystreet
+ a2dissite mapit
+ /etc/init.d/apache2 restart
+ rm /etc/apache2/sites-available/fixmystreet
+ rm /etc/apache2/sites-available/mapit
+}
+
+
+fetch_git_source() {
+ for gitmodule in fixmystreet mapit ; do
+ if [ ! -d $gitmodule ] ; then
+ git clone git://github.com/petterreinholdtsen/$gitmodule.git -b $servername || \
+ git clone https://github.com/mysociety/$gitmodule.git
+ (cd $gitmodule &&
+ git submodule update --init)
+ else
+ (cd $gitmodule &&
+ git pull &&
+ git submodule update &&
+ git diff) | cat
+ fi
+ done
+
+ # Update translation files
+ (cd fixmystreet && commonlib/bin/gettext-makemo)
+
+ # Generate CSS files
+ (cd fixmystreet && bin/make_css)
+
+ # Not quite sure why this directory is needed
+ mkdir -p fixmystreet/perl-external/local-lib
+}
+
+update_fixmystreet_config() {
+ dbuser="$1"
+ fgmdbpassword="$2"
+ dbname="$3"
+ cat > $basedir/fixmystreet/conf/general.yml <<EOF
+# general-example.yml:
+# Example values for the "general" config file.
+#
+# Configuration parameters, in YAML syntax.
+#
+# Copy this file to one called "general.yml" in the same directory. Or
+# have multiple config files and use a symlink to change between them.
+
+FMS_DB_HOST: 'localhost'
+FMS_DB_PORT: '5432'
+FMS_DB_NAME: '$dbname'
+FMS_DB_USER: '$dbuser'
+FMS_DB_PASS: '$fgmdbpassword'
+
+BASE_URL: 'http://$servername'
+
+EMAIL_DOMAIN: 'nuug.no'
+CONTACT_EMAIL: ''
+TEST_EMAIL_PREFIX: ''
+
+CONTACT_NAME: 'FiksGataMi'
+STAGING_SITE: 1
+
+UPLOAD_CACHE: '/var/lib/fixmystreet/upload/'
+GEO_CACHE: '/var/lib/fixmystreet/cache/'
+GOOGLE_MAPS_API_KEY: ''
+
+MAPIT_URL: 'http://mapit.nuug.no'
+MAP_TYPE: 'OSM'
+EVEL_URL: ''
+GAZE_URL: 'http://gaze.mysociety.org/gaze'
+
+# empty = use /usr/sbin/sendmail'
+SMTP_SMARTHOST: ''
+
+AUTH_SHARED_SECRET: ''
+HEARFROMYOURMP_BASE_URL: ''
+
+IPHONE_URL: ''
+ANDROID_URL: 'http://wiki.nuug.no/grupper/fiksgatami/android'
+
+# Log file (used in test harness, and later in admin scripts)
+HTTPD_ERROR_LOG: '/var/log/apache/error.log
+
+ALLOWED_COBRANDS: 'fiksgatami'
+
+# How many items are returned in the GeoRSS feeds by default
+RSS_LIMIT: '200'
+
+OSM_GUESS_OPERATOR: 1
+
+# Should problem reports link to the council summary pages?
+AREA_LINKS_FROM_PROBLEMS: 1
+
+EOF
+ if [ ! -d /var/lib/fixmystreet ] ; then
+ (
+ mkdir /var/lib/fixmystreet && \
+ cd /var/lib/fixmystreet && \
+ mkdir cache && \
+ mkdir upload && \
+ chown www-data cache && \
+ chown www-data upload
+ )
+ fi
+}
+
+update_mapit_config() {
+ dbuser="$1"
+ dbpassword="$2"
+ dbname="$3"
+
+ if [ -e $basedir/mapit/conf/general ] ; then
+ mv $basedir/mapit/conf/general $basedir/mapit/conf/general.old-$$
+ fi
+ cat > $basedir/mapit/conf/general.yml <<EOF
+# Connection details for database
+MAPIT_DB_NAME: '$dbname'
+MAPIT_DB_USER: '$dbuser'
+MAPIT_DB_PASS: '$dbpassword'
+
+MAPIT_DB_HOST: null
+MAPIT_DB_PORT: null
+
+# Country is currently one of GB, NO, or KE
+COUNTRY: 'NO'
+# An EPSG code for what the areas are stored as. 27700 is OSGB, 4326 for WGS84.
+AREA_SRID: 4326
+STAGING: 0
+RATE_LIMIT: []
+BUGS_EMAIL: ''
+
+DJANGO_SECRET_KEY: ''
+EOF
+}
+
+mapit_manage="$basedir/mapit/project/manage.py"
+
+load_mapit_n5000() {
+ N5000SHP="$basedir/N5000 shape/N5000_AdministrativFlate.shp"
+ su www-data -c "$mapit_manage generation_create --commit --desc 'N5000 Norway'"
+ su www-data -c "$mapit_manage import_norway_n5000 --commit '$N5000SHP'"
+# su www-data -c "$mapit_manage find_parents"
+ su www-data -c "$mapit_manage generation_activate --commit"
+}
+
+load_mapit_osm() {
+ python $basedir/mapit/bin/osm_to_kml
+ # This require changes in the code
+ if [ new-generation = "$1" ] ; then
+ su www-data -c "$mapit_manage generation_create --commit --desc 'OpenStreetmap.org'"
+ fi
+ su www-data -c "$mapit_manage import_norway_osm --commit $basedir/mapit/data/cache/*.kml"
+# su www-data -c "$mapit_manage find_parents"
+# su www-data -c "$mapit_manage import_area_unions --commit data/norway/regions.csv"
+ if [ new-generation = "$1" ] ; then
+ su www-data -c "$mapit_manage generation_activate --commit"
+ fi
+}
+
+load_mapit_postcodes() {
+ rm -f postnummer-utf8.txt postnummer-ekstra.csv
+ wget http://www.erikbolstad.no/nedlasting/postnummer-utf8.txt
+ wget http://www.nuug.no/prosjekt/fiksgatami/postnummer-ekstra.csv
+ su www-data -c "$mapit_manage import_bolstad_postcodes postnummer-utf8.txt"
+ su www-data -c "$mapit_manage import_bolstad_postcodes postnummer-ekstra.csv"
+}
+
+# This one need to run as user www-data
+load_mapit() {
+ su www-data -c "$mapit_manage syncdb --noinput"
+ su www-data -c "$mapit_manage migrate"
+ su www-data -c "$mapit_manage loaddata norway"
+ #load_mapit_n5000
+ load_mapit_osm new-generation
+ load_mapit_postcodes || true
+}
+
+setup_locale() {
+ cat > /etc/locale.gen <<EOF
+en_GB.UTF-8 UTF-8
+en_US.UTF-8 UTF-8
+nb_NO.UTF-8 UTF-8
+nn_NO.UTF-8 UTF-8
+EOF
+ locale-gen
+}
+
+flush_memcache() {
+ (echo flush_all; sleep 1) | telnet localhost 11211 || true
+}
+
+append_if_missing() {
+ file="$1"
+ string="$2"
+ if [ -e "$file" ] ; then
+ if ! grep -qxF "$string" "$file" ; then
+ echo "Appending '$string' to $file."
+ echo "$string" >> $file
+ fi
+ fi
+}
+tune_postgresql() {
+ conf=/etc/postgresql/8.4/main/postgresql.conf
+ append_if_missing $conf "effective_cache_size = 256MB"
+ append_if_missing $conf "shared_buffers = 128MB"
+ append_if_missing $conf "log_min_duration_statement = 250"
+
+ touch /etc/sysctl.d/postgresql.conf
+ append_if_missing /etc/sysctl.d/postgresql.conf "kernel.shmmax = 136314880"
+ sysctl -w kernel.shmmax=$(( 130 * 1024 * 1024 ))
+ /etc/init.d/postgresql reload
+}
+
+cd /srv/$servername/
+
+case "$1" in
+ bootstrap)
+ fetch_git_source
+ install_debs
+ if [ yes = "$CATALYST" ] ; then
+ install_dev_catalyst
+ fi
+
+
+# Not yet ready, should adjust dynamically based on memory size
+# tune_postgresql
+
+ # Password to use when connecting to the postgresql database.
+ fgmdbpassword="$(pwgen -1)"
+ midbpassword="$(pwgen -1)"
+ webpassword="$(pwgen -1)"
+
+ postgis_bootstrap
+ pgsql_createuser www-data "$fgmdbpassword"
+ pgsql_createuser mapit "$midbpassword"
+ pgsql_fixmystreet_bootstrap www-data fixmystreet
+ update_fixmystreet_config www-data "$fgmdbpassword" fixmystreet
+ pgsql_mapit_bootstrap www-data mapit
+ update_mapit_config www-data "$midbpassword" mapit
+ load_mapit
+ setup_locale
+ apache_config
+ ;;
+ remove)
+ apache_stop
+ flush_memcache
+ pgsql_remove_db fixmystreet || true
+ pgsql_remove_db mapit || true
+ pgsql_remove_user mapit || true
+ pgsql_remove_user www-data || true
+ postgis_remove || true
+ apache_remove || true
+ rm $basedir/mapit/data/cache/relation-*
+ ;;
+ update)
+ fetch_git_source
+ fgmdbpassword=$(grep OPTION_BCI_DB_PASS $basedir/fixmystreet/conf/general | cut -d\' -f4)
+ midbpassword=$(grep OPTION_MAPIT_DB_PASS $basedir/mapit/conf/general | cut -d\' -f4)
+
+ update_fixmystreet_config www-data $fgmdbpassword fixmystreet
+ update_mapit_config www-data $midbpassword mapit
+ apache_config
+ flush_memcache
+ ;;
+ update_map)
+ rm $basedir/mapit/data/cache/relation-*
+ load_mapit_osm
+ flush_memcache
+ ;;
+esac
+
diff --git a/perllib/FixMyStreet/App/Controller/Admin.pm b/perllib/FixMyStreet/App/Controller/Admin.pm
index c988b23c1..04dfaf409 100644
--- a/perllib/FixMyStreet/App/Controller/Admin.pm
+++ b/perllib/FixMyStreet/App/Controller/Admin.pm
@@ -770,7 +770,7 @@ sub update_edit : Path('update_edit') : Args(1) {
# If we're hiding an update, see if it marked as fixed and unfix if so
if ( $new_state eq 'hidden' && $update->mark_fixed ) {
- if ( $update->problem->state eq 'fixed' ) {
+ if ( $update->problem->state =~ /^fixed/ ) {
$update->problem->state('confirmed');
$update->problem->update;
}
diff --git a/t/app/controller/admin.t b/t/app/controller/admin.t
index beeb6c9c1..0a6f09585 100644
--- a/t/app/controller/admin.t
+++ b/t/app/controller/admin.t
@@ -947,7 +947,7 @@ subtest 'hiding comment marked as fixed reopens report' => sub {
$update->mark_fixed( 1 );
$update->update;
- $report->state('fixed');
+ $report->state('fixed - user');
$report->update;
diff --git a/templates/web/default/footer.html b/templates/web/default/footer.html
index ae2a3798a..089eb1cb7 100644
--- a/templates/web/default/footer.html
+++ b/templates/web/default/footer.html
@@ -1,18 +1,24 @@
</div><!-- #mysociety .container -->
- <div id="top" class="container">
+ <div id="navigation" class="container" role="navigation">
<div class="spacer"></div>
- <ul id="top-nav" class="nav">
- <li><a href="/my">[% loc("Your reports") %]</a></li>
- <li><a href="/reports">[% loc("All reports") %]</a></li>
- <li><a href="/alert[% pc ? '/list?pc=' : '' %][% pc | uri %]">[% loc("Local alerts") %]</a></li>
- <li><a href="/faq">[% loc("Help") %]</a></li>
+ <ul id="site-nav" class="nav">
+ <li><[% IF c.req.uri.path == '/' %]span[% ELSE %]a href="/"[% END
+ %]>[% loc("Report a problem") %]</[% c.req.uri.path == '/' ? 'span' : 'a' %]></li>[%
+ %]<li><[% IF c.req.uri.path == '/my' %]span[% ELSE %]a href="/my"[% END
+ %]>[% loc("Your reports") %]</[% c.req.uri.path == '/my' ? 'span' : 'a' %]></li>[%
+ %]<li><[% IF c.req.uri.path == '/reports' %]span[% ELSE %]a href="/reports"[% END
+ %]>[% loc("All reports") %]</[% c.req.uri.path == '/reports' ? 'span' : 'a' %]></li>[%
+ %]<li><[% IF c.req.uri.path == '/alert' %]span[% ELSE %]a href="/alert[% pc ? '/list?pc=' : '' %][% pc | uri %]"[% END
+ %]>[% loc("Local alerts") %]</[% c.req.uri.path == '/alert' ? 'span' : 'a' %]></li>[%
+ %]<li><[% IF c.req.uri.path == '/faq' %]span[% ELSE %]a href="/faq"[% END
+ %]>[% loc("Help") %]</[% c.req.uri.path == '/faq' ? 'span' : 'a' %]></li>
</ul>
- <ul id="mysociety-tab" class="nav">
- <li><a id="mysociety-logo" href="http://www.mysociety.org/">mySociety</a></li>
- <li><a href="http://mysociety.org/donate/">Donate</a></li>
- <li><a href="http://www.mysociety.org/projects/">Our Sites</a></li>
+ <ul id="mysociety-nav" class="nav">
+ <li><a id="mysociety-logo" href="http://www.mysociety.org/">mySociety</a></li>[%
+ %]<li><a href="http://mysociety.org/donate/">Donate</a></li>[%
+ %]<li><a href="http://www.mysociety.org/projects/">Our Sites</a></li>
</ul>
</div>
diff --git a/templates/web/default/header.html b/templates/web/default/header.html
index 898c1b9fe..556f55523 100644
--- a/templates/web/default/header.html
+++ b/templates/web/default/header.html
@@ -13,7 +13,7 @@
<link rel="stylesheet" href="[% version('/css/core.css') %]">
<link rel="stylesheet" href="[% version('/cobrands/fixmystreet/base.css') %]">
- <link rel="stylesheet" href="[% version('/cobrands/fixmystreet/layout.css') %]" media="(min-width:40em)">
+ <link rel="stylesheet" href="[% version('/cobrands/fixmystreet/layout.css') %]" media="(min-width:48em)">
<!--[if (lt IE 9) & (!IEMobile)]>
<link rel="stylesheet" href="[% version('/cobrands/fixmystreet/layout.css') %]">
<![endif]-->
@@ -31,7 +31,7 @@
<div id="wrapper"><div id="wrapper2"><div id="wrapper3">
- [% IF NOT title AND NOT c.req.path %]<h1 id="header">[% ELSE %]<div id="header"><a href="/">[% END %]
+ [% IF NOT title AND NOT c.req.path %]<h1 id="header" role="banner">[% ELSE %]<div id="header" role="banner"><a href="/">[% END %]
[%- loc('Fix<span id="my">My</span>Street') %]
[%- IF NOT title AND NOT c.req.path %]</h1>[% ELSE %]</a></div>[% END %]
@@ -44,6 +44,6 @@
[% END %]
</ul>
- <div id="mysociety" class="container">
+ <div id="mysociety" class="container" role="main">
[% INCLUDE 'debug_header.html' %]
diff --git a/templates/web/emptyhomes/faq/faq-cy.html b/templates/web/emptyhomes/faq/faq-cy.html
index 6d32845ca..3bea990c8 100644
--- a/templates/web/emptyhomes/faq/faq-cy.html
+++ b/templates/web/emptyhomes/faq/faq-cy.html
@@ -4,13 +4,13 @@
<dl>
<dt>Beth yw diben y safle hwn?</dt>
-<dd>Diben y safle hwn yw ei gwneud mor hawdd â phosibl i chi gael tai gwag yn eich ardal yn ôl mewn defnydd. Mae’n caniatáu i chi weld adroddiadau am dai gwag a gweld beth sydd wedi cael ei wneud yn eu cylch. Mae’n gwneud cynghorau’n atebol am ymateb i’r tai gwag rydych chi’n rhoi gwybod amdanynt, ac am ddelio â nhw.</dd>
+<dd>Diben y safle hwn yw ei gwneud mor hawdd â phosibl i chi gael tai gwag yn eich ardal yn ôl mewn defnydd. Mae’n gwneud cynghorau’n atebol am ymateb i’r tai gwag rydych chi’n rhoi gwybod amdanynt, ac am ddelio â nhw.</dd>
<dt>Sut ydw i’n defnyddio’r safle?</dt>
-<dd>Rhowch god post neu gyfeiriad yn y blwch ar y dudalen hafan ac fe gyflwynir map o’r ardal honno i chi. Cliciwch ar y man lle mae’r eiddo gwag, llenwch y manylion, llwythwch ffotograff i fyny os oes un gennych a phwyswch anfon. A dyna’r cyfan. Gallwch hefyd weld adroddiadau am eiddo gwag eraill a gweld beth wnaed amdanyn nhw.</dd>
+<dd>Rhowch god post neu gyfeiriad yn y blwch ar y dudalen hafan ac fe gyflwynir map o’r ardal honno i chi. Cliciwch ar y man lle mae’r eiddo gwag, llenwch y manylion, llwythwch ffotograff i fyny os oes un gennych a phwyswch anfon. A dyna’r cyfan.</dd>
<dt>A yw’r gwasanaeth ar gael am ddim?</dt>
<dd>Ydy. Talwyd am gostau datblygu a chynnal y safle hwn gan yr Asiantaeth Tai Gwag a Shelter Cymru drwy haelioni eu cyllidwyr. Mae'r Asiantaeth Tai Gwag a Shelter Cymru yn elusennau cofrestredig, felly os ydych yn credu yn ein nodau a hoffech gyfrannu, mae croeso i chi wneud hynny.
-<a href="http://www.emptyhomes.com/donate.html">Asiantaeth Tai Gwag</a>
-/ <a href="http://www.sheltercymru.org.uk/shelter/cymraeg/howtohelp/ood.asp">Shelter Cymru</a>.</dd>
+<a href="https://secure.thebiggive.org.uk/donate/donate.php?charity_id=6651">Asiantaeth Tai Gwag</a>
+/ <a href="http://cymraeg.sheltercymru.org.uk/Help/donating.aspx?ParentID=7&year=0&type=1&subcat=32&pageid=93">Shelter Cymru</a>.</dd>
<dt>Ydych chi’n cael gwared ar gynnwys gwirion neu anghyfreithlon?</dt>
<dd>Rydym yn cadw’r hawl i ddileu unrhyw adroddiadau neu ddiweddariadau yr ydym yn eu hystyried yn amhriodol.</dd>
@@ -21,7 +21,7 @@ Mae cynghorau’n helpu ac yn dwyn perswâd ar berchenogion i adfer eu heiddo iâ
Hyd yn oed wedyn, gall y broses fod yn araf, yn enwedig os yw’r eiddo mewn cyflwr gwael iawn neu os yw’r perchennog yn amharod i wneud unrhyw beth. Yn y rhan fwyaf o achosion, bydd chwe mis yn mynd heibio cyn y gallwch ddisgwyl gweld unrhyw beth yn newid, weithiau hwy. Nid yw hyn yn golygu nad yw’r cyngor yn gwneud unrhyw beth, a dyma pam rydym ni’n annog y cyngor i ddiweddaru’r wefan fel y gallwch weld beth sy’n digwydd.</p> <p>
Byddwn yn cysylltu â chi ddwywaith (mis a chwe mis ar ôl i chi roi gwybod am yr eiddo gwag), fel y gallwch ddweud wrthym beth sydd wedi digwydd. Os nad yw’r cyngor yn gwneud unrhyw beth, neu os ydych chi’n meddwl bod eu hymateb yn annigonol, byddwn yn rhoi cyngor i chi ar beth i’w wneud nesaf.</p> <p>
Os taw’r llywodraeth neu un o’i hasiantaethau sy’n berchen ar yr eiddo gwag, nid oes gan gynghorau unrhyw bŵer i helpu’n aml. Fodd bynnag, mae’n bosibl y byddwch yn gallu gweithredu’ch hunan yn uniongyrchol gan ddefnyddio PROD:
-<a href="http://www.emptyhomes.com/usefulinformation/policy_docs/prods.html">http://www.emptyhomes.com/usefulinformation/policy_docs/prods.html</a>
+<a href="http://www.emptyhomes.com/what-you-can-do-2/resources/prods-2">http://www.emptyhomes.com/what-you-can-do-2/resources/prods-2</a>
</dd>
<dt>A fydd adrodd am eiddo gwag yn gwneud unrhyw wahaniaeth?</dt>
<dd><p>Bydd. Gall cynghorau wneud gwahaniaeth gwirioneddol, ond mae ganddynt lawer o bethau i’w gwneud. Bydd llawer o gynghorau ddim ond yn delio ag eiddo gwag sydd wedi cael eu hysbysu iddyn nhw. Os nad yw pobl yn rhoi gwybod am eiddo gwag, mae’n bosibl iawn y daw cynghorau i’r casgliad bod meysydd gwaith eraill yn fwy pwysig.</p> <p>
@@ -31,9 +31,7 @@ Os taw’r llywodraeth neu un o’i hasiantaethau sy’n berchen ar yr eiddo gwa
<h2>Cwestiynau Preifatrwydd </h2>
<dl>
<dt>Pwy sy’n cael gweld fy nghyfeiriad e-bost?</dt>
- <dd>Os gwnaethoch gyflwyno eiddo gwag, wrth reswm, mae eich manylion yn cael eu darparu i ni.
- Bydd eich enw’n cael ei arddangos ar y safle os ydych yn caniatáu i ni wneud hynny, ond nid eich cyfeiriad e-bost;
- felly y mae hi gyda diweddariadau. Ni fyddwn byth yn rhoi nac yn gwerthu eich cyfeiriad e-bost i unrhyw un arall, oni bai ein bod ni’n gorfod gwneud hynny yn ôl y gyfraith.</dd>
+ <dd>Os gwnaethoch gyflwyno eiddo gwag, wrth reswm, mae eich manylion yn cael eu darparu i ni. Ni fyddwn byth yn rhoi nac yn gwerthu eich cyfeiriad e-bost i unrhyw un arall, oni bai ein bod ni’n gorfod gwneud hynny yn ôl y gyfraith.</dd>
<dt>A fyddwch chi’n anfon negeseuon sbam budr, bwystfilaidd at fy nghyfeiriad e-bost?</dt>
<dd>Byth. Byddwn yn anfon neges e-bost atoch os yw rhywun yn gadael diweddariad ar adroddiad a wnaed gennych, ac yn anfon holiaduron e-bost atoch chi bedair wythnos a chwe mis wedi i chi gyflwyno problem yn gofyn am ddiweddariad am ei statws; dim ond ynghylch eich problem y byddwn yn anfon negeseuon e-bost atoch chi.</dd>
</dl>
diff --git a/templates/web/emptyhomes/faq/faq-en-gb.html b/templates/web/emptyhomes/faq/faq-en-gb.html
index 0222fcd9e..9f66613a7 100755
--- a/templates/web/emptyhomes/faq/faq-en-gb.html
+++ b/templates/web/emptyhomes/faq/faq-en-gb.html
@@ -4,23 +4,18 @@
<dl>
<dt>What is this site for?</dt>
<dd>This site is to help make it as easy as possible for you to get
-empty homes in your area put back into use. It allows you, to view empty homes
-that have been reported and see what has been done about them. It makes
-councils accountable for responding and dealing with the empty homes you
+empty homes in your area put back into use. It makes councils accountable for responding and dealing with the empty homes you
report.</dd>
<dt>How do I use the site?</dt>
<dd>Enter a postcode or address in the box on the homepage and you
are presented with a map of that area. Click where the empty property is, fill
in the details, upload a photo if you have one and press submit. That&rsquo;s
-it. You can also view other empty properties that have been reported and see
-what has been done about them.</dd>
+it. </dd>
<dt>Is it free?</dt>
<dd>Yes. The costs of developing and running this site are shared
-between the Empty Homes Agency and Shelter Cymru through the generosity of
-their funders. Both the Empty Homes Agency and Shelter Cymru are registered charities,
-so if you believe in their aims and would like to make a contribution, please do:
-<a href="http://www.emptyhomes.com/donate.html">Empty Homes Agency</a>
-or <a href="http://www.sheltercymru.org.uk/shelter/howtohelp/ood.asp">Shelter Cymru</a>.</dd>
+between the Empty Homes Agency, Shelter Cymru and Shlter Scotland through the generosity of their funders. We are all registered charities, so if you believe in their aims and would like to make a contribution, please do:
+<a href="https://secure.thebiggive.org.uk/donate/donate.php?charity_id=6651">Empty Homes</a>
+or <a href="http://www.sheltercymru.org.uk/Help/donating.aspx?ParentID=7&year=0&type=1&subcat=32&pageid=93">Shelter Cymru</a>.</dd>
<dt>Do you remove silly or illegal content?</dt>
<dd>We reserve the right to remove any reports or updates
which we consider to be inappropriate.</dd>
@@ -40,15 +35,15 @@ Even so the process can be slow, especially if the property is in very poor
repair or the owner is unwilling to do anything. In most cases it takes six
months before you can expect to see anything change, occasionally longer. This
doesn&rsquo;t mean the council isn&rsquo;t doing anything, which is why we encourage
-councils to update the website so you can see what is happening.</p> <p>
+councils to update you to let you know what is happening.</p> <p>
We will contact you twice (a month and six months after you report the empty
home) so you can tell us what has happened. If the council doesn&rsquo;t do anything,
or you think their response is inadequate we will advise you what you can do
next.</p> <p>
If the empty home is owned by the government or one its agencies, councils are
often powerless to help. However you might be able to take action directly
-yourself using a PROD:
-<a href="http://www.emptyhomes.com/usefulinformation/policy_docs/prods.html">http://www.emptyhomes.com/usefulinformation/policy_docs/prods.html</a>
+yourself using the
+<a href="http://emptyhomes.com/what-you-can-do-2/resources/prods-2/">Community Right to Reclaim Land</a>
</dd>
<dt>Will reporting an empty home make any difference?</dt>
<dd><p>Yes. Councils can make a real difference, but they have lots of
@@ -68,15 +63,13 @@ save 10 million tonnes of CO<sub>2</sub> over building the same number of new ho
<h2>Privacy Questions</h2>
<dl>
<dt>Who gets to see my email address?</dt>
- <dd>If you submit an empty property, your details are provided to us and to the council.
-Your name is displayed upon the site if you let us, but not your email address;
-similarly with updates. We will never give or sell your email address to
+ <dd>If you submit an empty property, your details are provided to us and to the council. We will never give or sell your email address to
anyone else, unless we are obliged to by law.</dd>
<dt>Will you send nasty, brutish spam to my email address?</dt>
<dd>Never. We will email you if someone leaves an update on a
report you&rsquo;ve made, and send you questionnaire emails four weeks and six months
after you submit a problem, asking for a status update; we&rsquo;ll only ever
-send you emails in relation to your problem.</dd>
+send you emails in relation to your report.</dd>
</dl>
<h2>Organisation Questions</h2>
<dl>
@@ -85,7 +78,7 @@ send you emails in relation to your problem.</dd>
mySociety is the project of a registered charity which has grown out of the community of
volunteers who built sites like <a href="http://www.theyworkforyou.com/">TheyWorkForYou</a>.
mySociety&rsquo;s primary mission is to build Internet projects which give people simple, tangible
-benefits in the civic and community aspects of their lives. Our first project
+benefits in the civic and community aspects of their lives. Their first project
was <a href="http://www.writetothem.com/">WriteToThem</a>, where you can write to any of your
elected representatives, for free.
<a href="https://secure.mysociety.org/donate/">Donate to mySociety</a></dd>
diff --git a/templates/web/emptyhomes/header.html b/templates/web/emptyhomes/header.html
index d7fbcb6af..063cbba18 100644
--- a/templates/web/emptyhomes/header.html
+++ b/templates/web/emptyhomes/header.html
@@ -25,7 +25,6 @@
<div id="navigation">
<ul>
<li><a href="/">[% loc("Report a problem") %]</a></li>
- <li><a href="/reports">[% loc("All reports") %]</a></li>
<li><a href="/faq">[% loc("Help") %]</a></li>
<li><a href="/about">[% loc('About us') %]</a></li>
[% IF lang_code == 'en-gb' %]
diff --git a/templates/web/emptyhomes/index.html b/templates/web/emptyhomes/index.html
index 7c4d6881b..595dae0fd 100644
--- a/templates/web/emptyhomes/index.html
+++ b/templates/web/emptyhomes/index.html
@@ -6,10 +6,17 @@
<div class="video"><object id="flashObj" width="480" height="270" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,47,0"><param name="movie" value="http://c.brightcove.com/services/viewer/federated_f9?isVid=1&isUI=1" /><param name="bgcolor" value="#FFFFFF" /><param name="flashVars" value="@videoPlayer=1293919404001&playerID=1242807532001&playerKey=AQ~~,AAABIWs5YNk~,K8Yb_Dc0PlMA8gCUiCBbnEcXR1bU7HRm&domain=embed&dynamicStreaming=true" /><param name="base" value="http://admin.brightcove.com" /><param name="seamlesstabbing" value="false" /><param name="allowFullScreen" value="true" /><param name="swLiveConnect" value="true" /><param name="allowScriptAccess" value="always" /><embed src="http://c.brightcove.com/services/viewer/federated_f9?isVid=1&isUI=1" bgcolor="#FFFFFF" flashVars="@videoPlayer=1293919404001&playerID=1242807532001&playerKey=AQ~~,AAABIWs5YNk~,K8Yb_Dc0PlMA8gCUiCBbnEcXR1bU7HRm&domain=embed&dynamicStreaming=true" base="http://admin.brightcove.com" name="flashObj" width="480" height="270" seamlesstabbing="false" type="application/x-shockwave-flash" allowFullScreen="true" allowScriptAccess="always" swLiveConnect="true" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></embed></object></div>
-<p>We&#8217;re really excited to be offical advisors to the forthcoming new
-empty homes TV series<br><strong>The Great British Property Scandal</strong>!</p>
-<p>The series will highlight the nearly two million British families who don’t
-have adequate housing, and the million-odd homes lying empty across the UK.</p>
+<p>
+Empty Homes were offical advisors to the recent empty homes TV series <strong>The Great British Property Scandal</strong>!
+</p>
+
+<p>
+The series highlighted the nearly two million British families who don’t have adequate housing, and the million-odd homes lying empty across the UK.
+</p>
+
+<p>
+The TV series launched a campaign for action and while this is running, our <a href="[% uri => '/' %]">www.reportemptyhomes.com</a> website has been merged with the campaign's reporting system so that all reports are gathered together and sent on to the local councils. Please use these links to report empty properties which you know of:
+</p>
<ul class="channel4">
diff --git a/web/cobrands/fixmystreet/base.scss b/web/cobrands/fixmystreet/base.scss
index affd3c46b..41a408a96 100644
--- a/web/cobrands/fixmystreet/base.scss
+++ b/web/cobrands/fixmystreet/base.scss
@@ -145,7 +145,7 @@ a:active, a:hover {
margin: 0 auto;
}
-#top {
+#navigation {
display: table;
width: 100%;
border-top: solid 1px $colour;
diff --git a/web/cobrands/fixmystreet/layout.scss b/web/cobrands/fixmystreet/layout.scss
index 01c23e8d0..994a8a336 100644
--- a/web/cobrands/fixmystreet/layout.scss
+++ b/web/cobrands/fixmystreet/layout.scss
@@ -37,7 +37,7 @@ body {
/* Giving this a display: table-caption, and #wrapper3 a caption-side: top,
* means that this div appears above the main content, even though it is below
* it in source order. */
-#top {
+#navigation {
border: none;
padding-top: 0;
margin: 0;
@@ -45,7 +45,7 @@ body {
line-height: 1.2;
}
-#top .spacer {
+#navigation .spacer {
display: table-cell;
width: 100%;
}
@@ -66,22 +66,26 @@ body {
display: inline-block;
}
-.nav a {
+.nav a, .nav span {
text-decoration: none;
display: block;
padding: 10px;
}
-ul#top-nav li a {
+.nav span {
+ text-decoration: underline;
+}
+
+#site-nav a, #site-nav span {
color: $colour;
padding: 9px 20px 8px 0px;
}
-ul#top-nav li a:hover {
+#site-nav a:hover {
color: #000;
}
-ul#mysociety-tab {
+#mysociety-nav {
line-height: 1.5;
font-size: 68.75%;
text-transform: uppercase;
@@ -91,11 +95,11 @@ ul#mysociety-tab {
-webkit-border-radius: 0 0 6px 6px;
}
-ul#mysociety-tab li a {
+#mysociety-nav li a {
color: #fff;
}
-ul#mysociety-tab li a:hover {
+#mysociety-nav li a:hover {
color: #000;
}
@@ -126,14 +130,14 @@ ul#mysociety-tab li a:hover {
* items. */
.ie6, .ie7 {
- #top {
+ #navigation {
position: absolute;
top: 7px;
right: 0;
width: 38em;
}
- #top .spacer {
+ #navigation .spacer {
display: none;
}
diff --git a/web/js/fixmystreet.js b/web/js/fixmystreet.js
index 524bcdafa..23c43567e 100644
--- a/web/js/fixmystreet.js
+++ b/web/js/fixmystreet.js
@@ -10,11 +10,11 @@ function form_category_onchange() {
};
if ( typeof fixmystreet !== 'undefined' ) {
- args['latitude'] = fixmystreet.latitude;
- args['longitude'] = fixmystreet.longitude;
+ args.latitude = fixmystreet.latitude;
+ args.longitude = fixmystreet.longitude;
} else {
- args['latitude'] = $('input[name="latitude"]').val();
- args['longitude'] = $('input[name="longitude"]').val();
+ args.latitude = $('input[name="latitude"]').val();
+ args.longitude = $('input[name="longitude"]').val();
}
$.getJSON('/report/new/category_extras', args, function(data) {
@@ -66,11 +66,11 @@ $(function(){
// FIXME - needs to use translated string
jQuery.validator.addMethod('validCategory', function(value, element) {
- return this.optional(element) || value != '-- Pick a category --'; }, validation_strings['category'] );
+ return this.optional(element) || value != '-- Pick a category --'; }, validation_strings.category );
jQuery.validator.addMethod('validName', function(value, element) {
var validNamePat = /\ba\s*n+on+((y|o)mo?u?s)?(ly)?\b/i;
- return this.optional(element) || value.length > 5 && value.match( /\S/ ) && !value.match( validNamePat ) }, validation_strings['category'] );
+ return this.optional(element) || value.length > 5 && value.match( /\S/ ) && !value.match( validNamePat ); }, validation_strings.category );
var form_submitted = 0;
@@ -108,7 +108,9 @@ $(function(){
},
// make sure we can see the error message when we focus on invalid elements
showErrors: function( errorMap, errorList ) {
- submitted && errorList.length && $(window).scrollTop( $(errorList[0].element).offset().top - 40 );
+ if ( submitted && errorList.length ) {
+ $(window).scrollTop( $(errorList[0].element).offset().top - 40 );
+ }
this.defaultShowErrors();
submitted = false;
},
@@ -140,8 +142,9 @@ $(function(){
} );
$('#email_alert').click(function(e) {
- if (!$('#email_alert_box').length)
+ if (!$('#email_alert_box').length) {
return true;
+ }
e.preventDefault();
if ($('#email_alert_box').is(':visible')) {
email_alert_close();
diff --git a/web/js/map-OpenLayers.js b/web/js/map-OpenLayers.js
index c8bdb85df..2a67eb811 100644
--- a/web/js/map-OpenLayers.js
+++ b/web/js/map-OpenLayers.js
@@ -1,65 +1,46 @@
-$(function(){
-
- var perm = new OpenLayers.Control.Permalink();
- set_map_config(perm);
-
- fixmystreet.map = new OpenLayers.Map("map", {
- controls: fixmystreet.controls,
- displayProjection: new OpenLayers.Projection("EPSG:4326")
- });
-
- fixmystreet.layer_options = OpenLayers.Util.extend({
- zoomOffset: fixmystreet.zoomOffset,
- transitionEffect: 'resize',
- numZoomLevels: fixmystreet.numZoomLevels
- }, fixmystreet.layer_options);
- var layer = new fixmystreet.map_type("", fixmystreet.layer_options);
- fixmystreet.map.addLayer(layer);
-
- if (!fixmystreet.map.getCenter()) {
- var centre = new OpenLayers.LonLat( fixmystreet.longitude, fixmystreet.latitude );
- centre.transform(
- new OpenLayers.Projection("EPSG:4326"),
- fixmystreet.map.getProjectionObject()
- );
- fixmystreet.map.setCenter(centre, fixmystreet.zoom || 3);
- }
-
- if (document.getElementById('mapForm')) {
- var click = new OpenLayers.Control.Click();
- fixmystreet.map.addControl(click);
- click.activate();
- }
-
- /* To let permalink not be caught by the Click layer, answer found
- * at http://www.mail-archive.com/users@openlayers.org/msg12958.html
- * Not sure why you can't use eventListeners or events.register...
- */
- OpenLayers.Event.observe( perm.element, "click", function(e) {
- OpenLayers.Event.stop(e);
- location.href = OpenLayers.Event.element(e).href;
- return false;
- });
+// This function might be passed either an OpenLayers.LonLat (so has
+// lon and lat) or an OpenLayers.Geometry.Point (so has x and y)
+function fixmystreet_update_pin(lonlat) {
+ lonlat.transform(
+ fixmystreet.map.getProjectionObject(),
+ new OpenLayers.Projection("EPSG:4326")
+ );
+ document.getElementById('fixmystreet.latitude').value = lonlat.lat || lonlat.y;
+ document.getElementById('fixmystreet.longitude').value = lonlat.lon || lonlat.x;
+}
- $(window).hashchange(function(){
- if (location.hash) return;
- // Okay, back to around view.
- fixmystreet.bbox_strategy.activate();
- fixmystreet.markers.refresh( { force: true } );
- fixmystreet.drag.deactivate();
- $('#side-form').hide();
- $('#side').show();
- $('#sub_map_links').show();
- fixmystreet.page = 'around';
- });
+function fixmystreet_activate_drag() {
+ fixmystreet.drag = new OpenLayers.Control.DragFeature( fixmystreet.markers, {
+ onComplete: function(feature, e) {
+ fixmystreet_update_pin( feature.geometry.clone() );
+ }
+ } );
+ fixmystreet.map.addControl( fixmystreet.drag );
+ fixmystreet.drag.activate();
+}
- // Vector layers must be added onload as IE sucks
- if ($.browser.msie) {
- $(window).load(fixmystreet_onload);
- } else {
- fixmystreet_onload();
+function fms_markers_list(pins, transform) {
+ var cols = { 'red':'R', 'green':'G', 'blue':'B', 'purple':'P' };
+ var markers = [];
+ for (var i=0; i<pins.length; i++) {
+ var pin = pins[i];
+ var loc = new OpenLayers.Geometry.Point(pin[1], pin[0]);
+ if (transform) {
+ // The Strategy does this for us, so don't do it in that case.
+ loc.transform(
+ new OpenLayers.Projection("EPSG:4326"),
+ fixmystreet.map.getProjectionObject()
+ );
+ }
+ var marker = new OpenLayers.Feature.Vector(loc, {
+ type: cols[pin[2]],
+ id: pin[3],
+ title: pin[4]
+ });
+ markers.push( marker );
}
-});
+ return markers;
+}
function fixmystreet_onload() {
if ( fixmystreet.area ) {
@@ -173,28 +154,68 @@ function fixmystreet_onload() {
}
-function fms_markers_list(pins, transform) {
- var cols = { 'red':'R', 'green':'G', 'blue':'B', 'purple':'P' };
- var markers = [];
- for (var i=0; i<pins.length; i++) {
- var pin = pins[i];
- var loc = new OpenLayers.Geometry.Point(pin[1], pin[0]);
- if (transform) {
- // The Strategy does this for us, so don't do it in that case.
- loc.transform(
- new OpenLayers.Projection("EPSG:4326"),
- fixmystreet.map.getProjectionObject()
- );
- }
- var marker = new OpenLayers.Feature.Vector(loc, {
- type: cols[pin[2]],
- id: pin[3],
- title: pin[4]
- });
- markers.push( marker );
+$(function(){
+
+ var perm = new OpenLayers.Control.Permalink();
+ set_map_config(perm);
+
+ fixmystreet.map = new OpenLayers.Map("map", {
+ controls: fixmystreet.controls,
+ displayProjection: new OpenLayers.Projection("EPSG:4326")
+ });
+
+ fixmystreet.layer_options = OpenLayers.Util.extend({
+ zoomOffset: fixmystreet.zoomOffset,
+ transitionEffect: 'resize',
+ numZoomLevels: fixmystreet.numZoomLevels
+ }, fixmystreet.layer_options);
+ var layer = new fixmystreet.map_type("", fixmystreet.layer_options);
+ fixmystreet.map.addLayer(layer);
+
+ if (!fixmystreet.map.getCenter()) {
+ var centre = new OpenLayers.LonLat( fixmystreet.longitude, fixmystreet.latitude );
+ centre.transform(
+ new OpenLayers.Projection("EPSG:4326"),
+ fixmystreet.map.getProjectionObject()
+ );
+ fixmystreet.map.setCenter(centre, fixmystreet.zoom || 3);
}
- return markers;
-}
+
+ if (document.getElementById('mapForm')) {
+ var click = new OpenLayers.Control.Click();
+ fixmystreet.map.addControl(click);
+ click.activate();
+ }
+
+ /* To let permalink not be caught by the Click layer, answer found
+ * at http://www.mail-archive.com/users@openlayers.org/msg12958.html
+ * Not sure why you can't use eventListeners or events.register...
+ */
+ OpenLayers.Event.observe( perm.element, "click", function(e) {
+ OpenLayers.Event.stop(e);
+ location.href = OpenLayers.Event.element(e).href;
+ return false;
+ });
+
+ $(window).hashchange(function(){
+ if (location.hash) { return; }
+ // Okay, back to around view.
+ fixmystreet.bbox_strategy.activate();
+ fixmystreet.markers.refresh( { force: true } );
+ fixmystreet.drag.deactivate();
+ $('#side-form').hide();
+ $('#side').show();
+ $('#sub_map_links').show();
+ fixmystreet.page = 'around';
+ });
+
+ // Vector layers must be added onload as IE sucks
+ if ($.browser.msie) {
+ $(window).load(fixmystreet_onload);
+ } else {
+ fixmystreet_onload();
+ }
+});
/* Overridding the buttonDown function of PanZoom so that it does
zoomTo(0) rather than zoomToMaxExtent()
@@ -261,10 +282,13 @@ OpenLayers.Format.FixMyStreet = OpenLayers.Class(OpenLayers.Format.JSON, {
} else {
obj = json;
}
- if (typeof(obj.current) != 'undefined')
- document.getElementById('current').innerHTML = obj.current;
- if (typeof(obj.current_near) != 'undefined')
- document.getElementById('current_near').innerHTML = obj.current_near;
+ var current, current_near;
+ if (typeof(obj.current) != 'undefined' && (current = document.getElementById('current'))) {
+ current.innerHTML = obj.current;
+ }
+ if (typeof(obj.current_near) != 'undefined' && (current_near = document.getElementById('current_near'))) {
+ current_near.innerHTML = obj.current_near;
+ }
var markers = fms_markers_list( obj.pins, false );
return markers;
},
@@ -283,16 +307,14 @@ OpenLayers.Control.Click = OpenLayers.Class(OpenLayers.Control, {
initialize: function(options) {
this.handlerOptions = OpenLayers.Util.extend(
- {}, this.defaultHandlerOptions
- );
+ {}, this.defaultHandlerOptions);
OpenLayers.Control.prototype.initialize.apply(
this, arguments
);
this.handler = new OpenLayers.Handler.Click(
this, {
'click': this.trigger
- }, this.handlerOptions
- );
+ }, this.handlerOptions);
},
trigger: function(e) {
@@ -337,24 +359,3 @@ OpenLayers.Control.Click = OpenLayers.Class(OpenLayers.Control, {
}
});
-// This function might be passed either an OpenLayers.LonLat (so has
-// lon and lat) or an OpenLayers.Geometry.Point (so has x and y)
-function fixmystreet_update_pin(lonlat) {
- lonlat.transform(
- fixmystreet.map.getProjectionObject(),
- new OpenLayers.Projection("EPSG:4326")
- );
- document.getElementById('fixmystreet.latitude').value = lonlat.lat || lonlat.y;
- document.getElementById('fixmystreet.longitude').value = lonlat.lon || lonlat.x;
-}
-
-function fixmystreet_activate_drag() {
- fixmystreet.drag = new OpenLayers.Control.DragFeature( fixmystreet.markers, {
- onComplete: function(feature, e) {
- fixmystreet_update_pin( feature.geometry.clone() );
- }
- } );
- fixmystreet.map.addControl( fixmystreet.drag );
- fixmystreet.drag.activate();
-}
-