diff options
42 files changed, 1139 insertions, 70 deletions
diff --git a/.gitignore b/.gitignore index 5f56f9b27..8034d46d2 100644 --- a/.gitignore +++ b/.gitignore @@ -26,6 +26,7 @@ FixMyStreet-EmptyHomes.po /web/cobrands/default/*.css /web/cobrands/fixmystreet/*.css /web/cobrands/bromley/*.css +/web/cobrands/fixmybarangay/*.css /web/cobrands/barnet/*.css /web/cobrands/zurich/*.css /web/photo diff --git a/bin/make_css b/bin/make_css index 9d033b5dc..175440bb4 100755 --- a/bin/make_css +++ b/bin/make_css @@ -14,14 +14,14 @@ DIRECTORY=$(cd `dirname $0`/../web && pwd) # FixMyStreet uses compass -compass compile --output-style compressed $DIRECTORY/cobrands/fixmystreet -compass compile --output-style compressed $DIRECTORY/cobrands/bromley -compass compile --output-style compressed $DIRECTORY/cobrands/barnet -compass compile --output-style compressed $DIRECTORY/cobrands/zurich -compass compile --output-style compressed $DIRECTORY/cobrands/default +NEWSTYLE="fixmystreet bromley fixmybarangay barnet zurich default" +NEWSTYLE_REGEX=${NEWSTYLE// /\\|} +for site in $NEWSTYLE; do + compass compile --output-style compressed $DIRECTORY/cobrands/$site +done # The rest are plain sass -for scss in `find $DIRECTORY -name "*.scss" -exec dirname {} \; | uniq | grep -v "cobrands/\(fixmystreet\|bromley\|barnet\|default\|zurich\)"` +for scss in `find $DIRECTORY -name "*.scss" -exec dirname {} \; | uniq | grep -v "cobrands/\($NEWSTYLE_REGEX\)"` do sass --scss --update --style compressed $scss done diff --git a/conf/crontab.ugly b/conf/crontab.ugly index 3eeffa791..399b520bb 100644 --- a/conf/crontab.ugly +++ b/conf/crontab.ugly @@ -22,7 +22,7 @@ MAILTO=!!(*= $user *)!!@mysociety.org #2 * * * * !!(*= $user *)!! run-with-lockfile -n /data/vhost/!!(*= $vhost *)!!/send-alerts.lock "/data/vhost/!!(*= $vhost *)!!/fixmystreet/bin/cron-wrapper send-alerts" || echo "stalled?" 0,30 * * * * !!(*= $user *)!! run-with-lockfile -n /data/vhost/!!(*= $vhost *)!!/send-questionnaires.lock "/data/vhost/!!(*= $vhost *)!!/fixmystreet/bin/cron-wrapper send-questionnaires" || echo "stalled?" -!!(* } elsif (($vhost eq 'www.fixmystreet.com') || ($vhost eq 'bromley.test.mysociety.org') || ($vhost eq 'integration-staging.fixmystreet.com')) { *)!! +!!(* } elsif (($vhost eq 'www.fixmystreet.com') || ($vhost eq 'bromley.test.mysociety.org') || ($vhost eq 'integration-staging.fixmystreet.com') || ($vhost eq 'fixmybarangay.test.mysociety.org')) { *)!! 5,10,15,20,25,30,35,40,45,50,55 * * * * !!(*= $user *)!! run-with-lockfile -n /data/vhost/!!(*= $vhost *)!!/send-reports.lock "/data/vhost/!!(*= $vhost *)!!/fixmystreet/bin/cron-wrapper send-reports" || echo "stalled?" 0 0-8,10,11,13,14,16,17,19-23 * * * !!(*= $user *)!! run-with-lockfile -n /data/vhost/!!(*= $vhost *)!!/send-reports.lock "/data/vhost/!!(*= $vhost *)!!/fixmystreet/bin/cron-wrapper send-reports" || echo "stalled?" 0 9,12,15,18 * * * !!(*= $user *)!! run-with-lockfile -n /data/vhost/!!(*= $vhost *)!!/send-reports.lock "/data/vhost/!!(*= $vhost *)!!/fixmystreet/bin/cron-wrapper send-reports --verbose" || echo "stalled?" diff --git a/conf/general.yml-example b/conf/general.yml-example index fd9ecad21..b826dd89d 100644 --- a/conf/general.yml-example +++ b/conf/general.yml-example @@ -127,9 +127,12 @@ GAZE_URL: 'http://gaze.mysociety.org/gaze' # Should problem reports link to the council summary pages? AREA_LINKS_FROM_PROBLEMS: '0' -# Used to override the STAGING SERVER safety mechanism in send-reports +# used to override the STAGING SERVER safety mechanism in send-reports TESTING_COUNCILS: '' +# if you're using Message Manager, include the URL here (see https://github.com/mysociety/message-manager/) +MESSAGE_MANAGER_URL: '' + # ----------------------------------------------------------------------- # fixmystreet.com specific config variables. You won't need any of these. @@ -139,4 +142,3 @@ LONDON_REPORTIT_KEY: '' LONDON_REPORTIT_SECRET: '' AUTH_SHARED_SECRET: '' HEARFROMYOURMP_BASE_URL: '' - diff --git a/db/schema.sql b/db/schema.sql index 832104991..690b7080f 100644 --- a/db/schema.sql +++ b/db/schema.sql @@ -198,7 +198,11 @@ create table problem ( send_fail_timestamp timestamp, -- record send_method used, which can be used to infer usefulness of external_id - send_method_used text + send_method_used text, + + -- record details about messages from external sources, eg. message manager + external_source text, + external_source_id text ); create index problem_state_latitude_longitude_idx on problem(state, latitude, longitude); create index problem_user_id_idx on problem ( user_id ); diff --git a/db/schema_0021-add_external_source_columns_to_problem.sql b/db/schema_0021-add_external_source_columns_to_problem.sql new file mode 100644 index 000000000..a74bcce7d --- /dev/null +++ b/db/schema_0021-add_external_source_columns_to_problem.sql @@ -0,0 +1,8 @@ +begin; + +ALTER table problem + ADD column external_source TEXT; +ALTER table problem + ADD column external_source_id TEXT; + +commit; diff --git a/perllib/FixMyStreet/App/Controller/Around.pm b/perllib/FixMyStreet/App/Controller/Around.pm index 3047b195c..f2bb23350 100644 --- a/perllib/FixMyStreet/App/Controller/Around.pm +++ b/perllib/FixMyStreet/App/Controller/Around.pm @@ -45,7 +45,7 @@ sub around_index : Path : Args(0) { || $c->forward('/location/determine_location_from_pc'); # Check to see if the spot is covered by a council - if not show an error. - return unless $c->forward('check_location_is_acceptable'); + return unless $c->cobrand->moniker eq 'fixmybarangay' || $c->forward('check_location_is_acceptable'); # If we have a partial - redirect to /report/new so that it can be # completed. @@ -204,6 +204,7 @@ sub display_location : Private { longitude => $short_longitude, clickable => 1, pins => \@pins, + area => $c->cobrand->areas_on_around, ); return 1; diff --git a/perllib/FixMyStreet/App/Controller/Report/New.pm b/perllib/FixMyStreet/App/Controller/Report/New.pm index ede0cd219..b18e6e39f 100644 --- a/perllib/FixMyStreet/App/Controller/Report/New.pm +++ b/perllib/FixMyStreet/App/Controller/Report/New.pm @@ -1001,6 +1001,13 @@ sub save_user_and_report : Private { # Set unknown to DB unknown $report->council( undef ) if $report->council eq '-1'; + # if there is a Message Manager message ID, pass it back to the client view + if ($c->cobrand->moniker eq 'fixmybarangay' && $c->req->param('external_source_id')=~/^\d+$/) { + $c->stash->{external_source_id} = $c->req->param('external_source_id'); + $report->external_source_id( $c->req->param('external_source_id') ); + $report->external_source( $c->config->{MESSAGE_MANAGER_URL} ) ; + } + # save the report; $report->in_storage ? $report->update : $report->insert(); @@ -1071,7 +1078,13 @@ sub redirect_or_confirm_creation : Private { if ( $report->confirmed ) { # Subscribe problem reporter to email updates $c->forward( 'create_reporter_alert' ); - my $report_uri = $c->cobrand->base_url_for_report( $report ) . $report->url; + my $report_uri; + + if ( $c->cobrand->moniker eq 'fixmybarangay' && $c->user->from_council && $c->stash->{external_source_id}) { + $report_uri = $c->uri_for( '/report', $report->id, undef, { external_source_id => $c->stash->{external_source_id} } ); + } else { + $report_uri = $c->cobrand->base_url_for_report( $report ) . $report->url; + } $c->log->info($report->user->id . ' was logged in, redirecting to /report/' . $report->id); $c->res->redirect($report_uri); $c->detach; diff --git a/perllib/FixMyStreet/Cobrand/Default.pm b/perllib/FixMyStreet/Cobrand/Default.pm index 04265963a..0eff95d48 100644 --- a/perllib/FixMyStreet/Cobrand/Default.pm +++ b/perllib/FixMyStreet/Cobrand/Default.pm @@ -650,6 +650,24 @@ sub example_places { return FixMyStreet->config('EXAMPLE_PLACES') || [ 'High Street', 'Main Street' ]; } +=head2 only_authed_can_create + +If true, only users with the from_council flag set are able to create reports. + +=cut + +sub only_authed_can_create { + return 0; +} + +=head2 areas_on_around + +If set to an arrayref, will plot those area ID(s) from mapit on all the /around pages. + +=cut + +sub areas_on_around {} + sub process_extras {} =head 2 pin_colour diff --git a/perllib/FixMyStreet/Cobrand/FixMyBarangay.pm b/perllib/FixMyStreet/Cobrand/FixMyBarangay.pm new file mode 100644 index 000000000..1092a5f07 --- /dev/null +++ b/perllib/FixMyStreet/Cobrand/FixMyBarangay.pm @@ -0,0 +1,57 @@ +package FixMyStreet::Cobrand::FixMyBarangay; +use base 'FixMyStreet::Cobrand::Default'; + +use strict; +use warnings; + +sub get_council_sender { + my ( $self, $area_id, $area_info ) = @_; + + my $send_method; + + my $council_config = FixMyStreet::App->model("DB::Open311conf")->search( { area_id => $area_id } )->first; + $send_method = $council_config->send_method if $council_config; + + return $send_method if $send_method; + + return 'Email'; +} + +sub path_to_web_templates { + my $self = shift; + return [ + FixMyStreet->path_to( 'templates/web', $self->moniker )->stringify, + FixMyStreet->path_to( 'templates/web/fixmystreet' )->stringify + ]; +} + +sub country { + return 'PH'; +} + +sub area_types { + return ( 'BGY' ); +} + +sub disambiguate_location { + return { + country => 'ph', + bing_country => 'Philippines', + }; +} + +sub site_title { + my ($self) = @_; + return 'FixMyBarangay'; +} + +sub only_authed_can_create { + return 1; +} + +sub areas_on_around { + return [ 1, 2 ]; +} + +1; + diff --git a/perllib/FixMyStreet/Cobrand/FixMyStreet.pm b/perllib/FixMyStreet/Cobrand/FixMyStreet.pm index 04c137674..00f161dea 100644 --- a/perllib/FixMyStreet/Cobrand/FixMyStreet.pm +++ b/perllib/FixMyStreet/Cobrand/FixMyStreet.pm @@ -1,11 +1,19 @@ package FixMyStreet::Cobrand::FixMyStreet; use base 'FixMyStreet::Cobrand::UK'; +sub area_types { return qw(DIS LBO MTD UTA CTY COI); } +sub area_min_generation { 10 } + # FixMyStreet should return all cobrands sub restriction { return {}; } +sub enter_postcode_text { + my ( $self ) = @_; + return _("Enter a nearby GB postcode, or street name and area"); +} + sub admin_base_url { return 'https://secure.mysociety.org/admin/bci/'; } diff --git a/perllib/FixMyStreet/DB/Result/Comment.pm b/perllib/FixMyStreet/DB/Result/Comment.pm index 91695d7d0..8c9fea282 100644 --- a/perllib/FixMyStreet/DB/Result/Comment.pm +++ b/perllib/FixMyStreet/DB/Result/Comment.pm @@ -54,10 +54,6 @@ __PACKAGE__->add_columns( { data_type => "boolean", default_value => \"false", is_nullable => 0 }, "problem_state", { data_type => "text", is_nullable => 1 }, - "external_id", - { data_type => "text", is_nullable => 1 }, - "extra", - { data_type => "text", is_nullable => 1 }, "send_fail_count", { data_type => "integer", default_value => 0, is_nullable => 0 }, "send_fail_reason", @@ -66,6 +62,10 @@ __PACKAGE__->add_columns( { data_type => "timestamp", is_nullable => 1 }, "whensent", { data_type => "timestamp", is_nullable => 1 }, + "external_id", + { data_type => "text", is_nullable => 1 }, + "extra", + { data_type => "text", is_nullable => 1 }, ); __PACKAGE__->set_primary_key("id"); __PACKAGE__->belongs_to( @@ -82,8 +82,8 @@ __PACKAGE__->belongs_to( ); -# Created by DBIx::Class::Schema::Loader v0.07017 @ 2012-03-26 15:44:18 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:nvkElEgSU6XcLd9znSqhmQ +# Created by DBIx::Class::Schema::Loader v0.07017 @ 2012-07-11 18:53:26 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:tSejJzLxHD/fMWjpa10lfA __PACKAGE__->filter_column( extra => { diff --git a/perllib/FixMyStreet/DB/Result/Problem.pm b/perllib/FixMyStreet/DB/Result/Problem.pm index 9ae040acc..c55ed3403 100644 --- a/perllib/FixMyStreet/DB/Result/Problem.pm +++ b/perllib/FixMyStreet/DB/Result/Problem.pm @@ -85,13 +85,17 @@ __PACKAGE__->add_columns( "geocode", { data_type => "bytea", is_nullable => 1 }, "send_fail_count", - { data_type => "integer", is_nullable => 1 }, + { data_type => "integer", default_value => 0, is_nullable => 0 }, "send_fail_reason", { data_type => "text", is_nullable => 1 }, "send_fail_timestamp", { data_type => "timestamp", is_nullable => 1 }, "send_method_used", { data_type => "text", is_nullable => 1 }, + "external_source", + { data_type => "text", is_nullable => 1 }, + "external_source_id", + { data_type => "integer", is_nullable => 1 }, ); __PACKAGE__->set_primary_key("id"); __PACKAGE__->has_many( @@ -114,8 +118,8 @@ __PACKAGE__->belongs_to( ); -# Created by DBIx::Class::Schema::Loader v0.07017 @ 2012-05-03 16:05:20 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:EvwI91Ot7SioQWqwnXRTBQ +# Created by DBIx::Class::Schema::Loader v0.07017 @ 2012-07-12 11:05:48 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:sOVQRjsQJUtpzElZvuCp8Q # Add fake relationship to stored procedure table __PACKAGE__->has_one( diff --git a/perllib/FixMyStreet/SendReport/Open311.pm b/perllib/FixMyStreet/SendReport/Open311.pm index 42c103b82..56473cf5f 100644 --- a/perllib/FixMyStreet/SendReport/Open311.pm +++ b/perllib/FixMyStreet/SendReport/Open311.pm @@ -94,10 +94,15 @@ sub send { $row->user->name( $row->user->id . ' ' . $row->user->name ); } + if ($row->cobrand eq 'fixmybarangay') { + # FixMyBarangay endpoints expect external_id as an attribute + $row->extra( [ { 'name' => 'external_id', 'value' => $row->id } ] ); + } + my $resp = $open311->send_service_request( $row, $h, $contact->email ); # make sure we don't save user changes from above - if ( $row->council =~ /2218/ || $row->council =~ /2482/ ) { + if ( $row->council =~ /2218/ || $row->council =~ /2482/ || $row->cobrand eq 'fixmybarangay') { $row->discard_changes(); } diff --git a/perllib/Open311/PopulateServiceList.pm b/perllib/Open311/PopulateServiceList.pm index 7b5f4c7fe..39502f3b1 100644 --- a/perllib/Open311/PopulateServiceList.pm +++ b/perllib/Open311/PopulateServiceList.pm @@ -21,6 +21,7 @@ sub process_councils { while ( my $council = $self->council_list->next ) { next unless $council->endpoint; + next unless $council->send_method eq 'open311'; $self->_current_council( $council ); $self->process_council; } diff --git a/templates/web/default/maps/openlayers.html b/templates/web/default/maps/openlayers.html index e815642f1..b75e2bbd8 100644 --- a/templates/web/default/maps/openlayers.html +++ b/templates/web/default/maps/openlayers.html @@ -8,7 +8,7 @@ <script type="text/javascript"> var fixmystreet = { 'page': '[% page %]', - 'area': '[% map.area %]', + 'area': [ [% map.area.join(',') %] ], 'all_pins': '[% all_pins %]', 'latitude': [% map.latitude %], 'longitude': [% map.longitude %], diff --git a/templates/web/fixmybarangay/around/tabbed_lists.html b/templates/web/fixmybarangay/around/tabbed_lists.html new file mode 100644 index 000000000..77ca84ee4 --- /dev/null +++ b/templates/web/fixmybarangay/around/tabbed_lists.html @@ -0,0 +1,84 @@ +[% allow_creation = !c.cobrand.only_authed_can_create || (c.user && c.user.from_council); + +IF allow_creation %] +<menu id="problems-nav" class="tab-nav"> + <ul> + <li><a href="#current">Problems on the map</a></li> + <li><a href="#message_manager">Problems via text</a></li> + </ul> +</menu> +[% END %] + +<ul id="current" class="issue-list-a tab"> + [% INCLUDE "around/on_map_list_items.html" %] +</ul> + +[% IF allow_creation %] +<ul id="message_manager" class="issue-list-a tab"> + <li id="message-control"> + <div id="mm-username-container">username: <span id="mm-received-username"></span></div> + <div id="mm-status-message-container"> + <div id="mm-status-message"></div> + </div> + <div id="mm-login-container"> + <div class="input text"> + <label for="mm-htauth-username">MM username</label> + <input name="mm-htauth-username" id="mm-htauth-username" type="text"/> + </div> + <div class="input password"> + <label for="mm-htauth-password">Password</label> + <input name="mm-htauth-password" id="mm-htauth-password" type="password"/> + </div> + <div class="submit"> + <input id="available-submit" type="submit" value="Get available messages"/> + </div> + </div> + </li> + <li> + <div id="mm-message-list" style="min-height:1em;"></div> + </li> +</ul> + +<script type="text/javascript"> + +$(document).ready(function() { + + var mm_url = "[% c.config.MESSAGE_MANAGER_URL %]"; // from config + + var mm_populate_list = function(data) { + $('#mm-status-message-container').text("Accessed message server as " + data['username']); + $('input[name=mm_text]').prop('checked', false); // uncheck all + } + + var mm_selected_message = function(data) { + var msg_text = ""; + var service_id = ""; + if (data['success']) { + // msg_text = $('#form_detail').val( $('input[name=mm_text]:checked').val() ); # == message data + msg_text = data['data']['Message']['message']; + service_id = data['data']['Message']['id']; + } else { + $('input[name=mm_text]').prop('checked', false); // uncheck all + } + $('#form_detail').val(msg_text); + $('#external_source_id').val(service_id); + } + + message_manager.config({url_root: mm_url}); + message_manager.setup_click_listener({callback:mm_selected_message}); + + // problem form hidden input "external_source_id": pass the MM id into FMS, if used + $('<input type="hidden"/>').attr({ + 'id': 'external_source_id', + 'name': 'external_source_id', + }).appendTo($('#problem_form')); + + $('#available-submit').click(function(e){ + e.preventDefault(); + message_manager.get_available_messages({callback:mm_populate_list}); + }); + $('#available-submit').click(); +}); + +</script> +[% END %] diff --git a/templates/web/fixmybarangay/faq/faq-en-gb.html b/templates/web/fixmybarangay/faq/faq-en-gb.html new file mode 100644 index 000000000..9eba12c40 --- /dev/null +++ b/templates/web/fixmybarangay/faq/faq-en-gb.html @@ -0,0 +1,84 @@ +[% INCLUDE 'header.html', title => loc('Frequently Asked Questions'), bodyclass => 'twothirdswidthpage' %] + +<div class="sticky-sidebar"> + <aside> + <ul class="plain-list"> + <li><a href="#faq">Frequently Asked Questions</a></li> + <li><a href="#practical">Staff Questions</a></li> + <li><a href="#organisation">Organisation Questions</a></li> + </ul> + </aside> +</div> + +<h1><a name="faq"></a>Frequently Asked Questions</h1> + <dl> + <dt>What is FixMyBarangay?</dt> + <dd>FixMyBarangay is a site to help people report, view, +or discuss local problems they’ve found to the city departments. +The pilot project lets you report the problems by SMS (or dropping +into the barangay center). +</dd> + <dt>What areas are covered?</dt> + <dd> + The pilot project is just running in two barangays in Cebu – + Luz and Basak San Nicolas. + </dd> + <dt>What sort of problems should I report with FixMyBarangay?</dt> + <dd>The FixMyBarangay pilot project is just for potholes (and similar + road surface problems) and broken streetlights. + </dd> + + <dt>What isn’t FixMyBarangay for?</dt> + <dd>FixMyStreet is not a way of getting in touch with Cebu City Hall for other problems + – please use FixMyBarangay only for potholes and streetlights while the pilot + project is running.. + </dd> + + <dt>Staff only: How do I use the site?</dt> + <dd>If you have a staff login, you can view problems already reported in that area, +or report ones of your own simply by clicking on the map at the location of +the problem.</dd> + <dt>How are the problems solved?</dt> + <dd>Problems sent by SMS are initially handled by the barangay staff – they'll + confirm the problem and report it to the relevant department automatically. + Once it's in the department's problem-tracking system, they'll get onto it as + soon as they can.</dd> + <dt>Is it free?</dt> + <dd>The site is free to use, yes. The pilot project has been funded by the World Bank.</dd> + + </dl> + + <h2><a name="practical"></a>Staff questions</h2> + <dl> + <dt>Login issues</dt> + <dd>TODO</dd> + <dt>Reporting</dt> + <dd>TODO</dd> + <dt>Message Manager</dt> + <dd>TODO</dd> + + <h2><a name="organisation"></a>Organisation Questions</h2> + <dl> + <dt>Who built FixMyBarangay?</dt> + <dd>This site was built by <a href="http://www.mysociety.org/">mySociety</a>, in conjunction with the <a href="www.worldbank.org/">World Bank</a>. +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.com</a> in the UK. +mySociety’s primary mission is to build Internet projects which give people simple, tangible +benefits in the civic and community aspects of their lives. +The charity is called UK Citizens Online Democracy and is charity number 1076346. mySociety +can be contacted by email at <a href="mailto:hello@mysociety.org">hello@mysociety.org</a>, +or by post at:<br> +mySociety<br> +483 Green Lanes<br> +London<br> +N13 4BS<br> +UK</dd> + <dt>I’d like a site like this for my own location/ where’s the "source code" to this site?</dt> + <dd> +The software behind this site is open source, and available +to you mainly under the GNU Affero GPL software license. +See <a href="http://code.fixmystreet.com/">code.fixmystreet.com</a> for more information about setting up +and running sites like these. +</dd> + </dl> +[% INCLUDE 'footer.html' pagefooter = 'yes' %] diff --git a/templates/web/fixmybarangay/footer.html b/templates/web/fixmybarangay/footer.html new file mode 100644 index 000000000..658d654c4 --- /dev/null +++ b/templates/web/fixmybarangay/footer.html @@ -0,0 +1,31 @@ + </div><!-- .content role=main --> + </div><!-- .container --> + </div><!-- .table-cell --> + + <div class="nav-wrapper"> + <div class="nav-wrapper-2"> + <div id="main-nav" role="navigation"> + <ul id="mysoc-menu"> + <li><a id="mysoc-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> + + <ul id="main-menu"> + <li><[% IF c.req.uri.path == '/' %]span[% ELSE %]a href="/"[% END %] class="report-a-problem-btn" + >View problems</[% c.req.uri.path == '/' ? '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> + </div> + </div> + </div> + +<!-- [% INCLUDE 'debug_footer.html' %] --> + </div> <!-- .wrapper --> +</body> +</html> diff --git a/templates/web/fixmybarangay/header.html b/templates/web/fixmybarangay/header.html new file mode 100644 index 000000000..a3c079565 --- /dev/null +++ b/templates/web/fixmybarangay/header.html @@ -0,0 +1,75 @@ +<!doctype html> +<!--[if lt IE 7]><html class="no-js ie6 oldie" lang="[% lang_code %]"><![endif]--> +<!--[if IE 7]> <html class="no-js ie7 oldie" lang="[% lang_code %]"><![endif]--> +<!--[if IE 8]> <html class="no-js ie8 oldie" lang="[% lang_code %]"><![endif]--> +<!--[if IE 9]> <html class="no-js ie9 oldie" lang="[% lang_code %]"><![endif]--> +<!--[if gt IE 9]><!--><html class="no-js" lang="[% lang_code %]"><!--<![endif]--> + <head> + <meta name="viewport" content="initial-scale=1.0"> + + <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1"> + <meta name="HandHeldFriendly" content="true"> + <meta name="mobileoptimized" content="0"> + + <link rel="stylesheet" href="[% version('/cobrands/fixmybarangay/base.css') %]"> + <link rel="stylesheet" href="[% version('/cobrands/fixmybarangay/layout.css') %]" media="(min-width:48em)"> + [% extra_css %] + <!--[if (lt IE 9) & (!IEMobile)]> + <link rel="stylesheet" href="[% version('/cobrands/fixmybarangay/layout.css') %]"> + <![endif]--> + + <script src="[% version('/js/modernizr.custom.js') %]" charset="utf-8"></script> + <script src="[% version('/cobrands/fixmybarangay/position_map.js') %]" charset="utf-8"></script> + [% INCLUDE 'common_header_tags.html', js_override = '/cobrands/fixmystreet/fixmystreet.js' %] + [% extra_js %] + + [% allow_creation = !c.cobrand.only_authed_can_create || (c.user && c.user.from_council); %] + [% IF allow_creation %] + <script src="[% version('/cobrands/fixmybarangay/message_manager_client.js') %]" charset="utf-8"></script> + <script> + $(document).ready(function() { + + $('#mm_sign_out').click(function(){ + message_manager.sign_out(); + }); + + [% IF c.req.params.external_source_id && problem && problem.external_source_id.match('^\d+$') %] + var mm_msg_id ="[% c.req.params.external_source_id %]"; + var fms_id = "[% problem.id %]"; + if (mm_msg_id && fms_id) { + message_manager.config({url_root: "[% c.config.MESSAGE_MANAGER_URL %]"}); + message_manager.assign_fms_id(mm_msg_id, fms_id); + } + [% END %] + }); + </script> + [% END %] + </head> + <body class="[% bodyclass | html IF bodyclass %]"> + + <div class="wrapper"> + <div class="table-cell"> + <header id="site-header" role="banner"> + <div class="container"> + <a href="/" id="site-logo">[% c.cobrand.site_title %]</a> + <a href="#main-nav" id="nav-link">Main Navigation</a> + </div> + </header> + + <div id="user-meta"> + [% IF c.user_exists %] + <p> + [% tprintf(loc('Hi %s'), c.user.name || c.user.email) %] + <a href="/auth/sign_out" id="mm_sign_out">[% loc('sign out') %]</a> + </p> + [% ELSE %] + <!-- <a href="/auth">[% loc('Sign in') %]</a> --> + [% END %] + </div> + + [% pre_container_extra %] + + <div class="container"> + <div class="content[% " $mainclass" | html IF mainclass %]" role="main"> + + <!-- [% INCLUDE 'debug_header.html' %] --> diff --git a/templates/web/fixmystreet/around/display_location.html b/templates/web/fixmystreet/around/display_location.html index a7240688f..bad7c7af0 100755 --- a/templates/web/fixmystreet/around/display_location.html +++ b/templates/web/fixmystreet/around/display_location.html @@ -34,8 +34,11 @@ rss => [ loc('Recent local problems, FixMyStreet'), rss_url ], bodyclass => 'mappage', robots => 'noindex,nofollow'; + + allow_creation = !c.cobrand.only_authed_can_create || (c.user && c.user.from_council); %] +[% IF allow_creation %] <form action="[% c.uri_for('/report/new') %]" method="post" name="mapForm" id="mapForm" enctype="multipart/form-data" class="validate"> [% IF c.req.params.map_override %] <input type="hidden" name="map_override" value="[% c.req.params.map_override | html %]"> @@ -44,6 +47,7 @@ <input type="hidden" name="latitude" id="fixmystreet.latitude" value="[% short_latitude | html %]"> <input type="hidden" name="longitude" id="fixmystreet.longitude" value="[% short_longitude | html %]"> +[% END %] [% map_html %] @@ -69,13 +73,13 @@ <div id="side"> - <h1 class="big-green-banner">[% - loc( 'Click map to report a problem' ); - IF c.cobrand.moniker == 'bromley'; - '<span>Yellow pins show existing reports</span>'; - END - %]</h1> - + [% IF allow_creation %] + <h1 class="big-green-banner"> + [% loc( 'Click map to report a problem' ) %] + [% IF c.cobrand.moniker == 'bromley' %] + <span>Yellow pins show existing reports</span> + [% END %] + </h1> <p id="skip-this-step"> [% tprintf( @@ -84,6 +88,7 @@ ) %] </p> + [% END %] <div class="shadow-wrap"> <ul id="key-tools" class="singleton"> @@ -92,23 +97,11 @@ </div> <section class="full-width"> - <menu id="problems-nav" class="tab-nav"> - <ul> - <li><a href="#current">[% loc('Problems on the map') %]</a></li> - <li><a href="#current_near">[% loc( 'Problems nearby' ) %]</a></li> - </ul> - </menu> - - <ul id="current" class="issue-list-a tab"> - [% INCLUDE "around/on_map_list_items.html" %] - </ul> - - <ul id="current_near" class="issue-list-a tab"> - [% INCLUDE "around/around_map_list_items.html" %] - </ul> + [% INCLUDE "around/tabbed_lists.html" %] </section> </div> + [% IF allow_creation %] <div style="display:none" id="side-form"> [% INCLUDE "report/new/fill_in_details_form.html" js = 1, @@ -116,6 +109,10 @@ report.name = c.user.name %] </div> + [% END %] + +[% IF allow_creation %] </form> +[% END %] [% INCLUDE 'footer.html' %] diff --git a/templates/web/fixmystreet/around/postcode_form.html b/templates/web/fixmystreet/around/postcode_form.html index a98959d3a..3b63a52d4 100644 --- a/templates/web/fixmystreet/around/postcode_form.html +++ b/templates/web/fixmystreet/around/postcode_form.html @@ -2,6 +2,9 @@ <div id="front-main-container"> [% IF c.cobrand.moniker == 'bromley' %] <h1 class="main mob-only">Reporting a problem in Bromley’s streets or parks</h1> + [% ELSIF c.cobrand.moniker == 'fixmybarangay' %] + <h1>View local problems</h1> + <h2>(potholes or street lighting)</h2> [% ELSE %] <h1>[% loc('Report, view, or discuss local problems') %]</h1> <h2>[% loc('(like graffiti, fly tipping, broken paving slabs, or street lighting)') %]</h2> @@ -12,11 +15,18 @@ %] <form action="[% c.uri_for('/around') %]" method="get" name="postcodeForm" id="postcodeForm"> + [% IF c.cobrand.moniker == 'fixmybarangay' %] + <p> + <a href="/around?latitude=10.322;longitude=123.907" class="yellow-btn">Bgy. Luz</a> + <a href="/around?latitude=10.288;longitude=123.870" class="yellow-btn">Bgy. Basak San Nicolas</a> + </p> + [% ELSE %] <label for="pc">[% question %]:</label> <div> <input type="text" name="pc" value="[% pc | html %]" id="pc" size="10" maxlength="200" placeholder="[% tprintf(loc('e.g. ā%sā or ā%sā'), c.cobrand.example_places) %]"> <input type="submit" value="[% loc('Go') %]" id="submit"> </div> + [% END %] [% IF partial_token %] <input type="hidden" name="partial" value="[% partial_token.token %]"> diff --git a/templates/web/fixmystreet/around/tabbed_lists.html b/templates/web/fixmystreet/around/tabbed_lists.html new file mode 100644 index 000000000..77c5a521b --- /dev/null +++ b/templates/web/fixmystreet/around/tabbed_lists.html @@ -0,0 +1,14 @@ +<menu id="problems-nav" class="tab-nav"> + <ul> + <li><a href="#current">[% loc('Problems on the map') %]</a></li> + <li><a href="#current_near">[% loc( 'Problems nearby' ) %]</a></li> + </ul> +</menu> + +<ul id="current" class="issue-list-a tab"> + [% INCLUDE "around/on_map_list_items.html" %] +</ul> + +<ul id="current_near" class="issue-list-a tab"> + [% INCLUDE "around/around_map_list_items.html" %] +</ul> diff --git a/templates/web/fixmystreet/auth/general.html b/templates/web/fixmystreet/auth/general.html index 6ecbcadc5..7fa2b57fe 100644 --- a/templates/web/fixmystreet/auth/general.html +++ b/templates/web/fixmystreet/auth/general.html @@ -26,7 +26,11 @@ <input type="email" class="required email" id="email" name="email" value="[% email | html %]" placeholder="[% loc('Your email address') %]"> <div id="form_sign_in"> + [% IF c.cobrand.moniker == 'fixmybarangay' %] + <h3>[% loc("Do you have a FixMyBarangay password?") %]</h3> + [% ELSE %] <h3>[% loc("Do you have a FixMyStreet password?") %]</h3> + [% END %] <div id="form_sign_in_yes" class="form-box"> <h5>[% loc('<strong>Yes</strong> I have a password') %]</h5> diff --git a/templates/web/fixmystreet/header.html b/templates/web/fixmystreet/header.html index 8d10d4c04..cb6ca8c43 100644 --- a/templates/web/fixmystreet/header.html +++ b/templates/web/fixmystreet/header.html @@ -36,7 +36,7 @@ <div class="table-cell"> <header id="site-header" role="banner"> <div class="container"> - <a href="/" id="site-logo">FixMyStreet</a> + <a href="/" id="site-logo">[% c.cobrand.site_title %]</a> <a href="#main-nav" id="nav-link">Main Navigation</a> </div> </header> diff --git a/templates/web/fixmystreet/index.html b/templates/web/fixmystreet/index.html index 492adbbe5..72dba9376 100644 --- a/templates/web/fixmystreet/index.html +++ b/templates/web/fixmystreet/index.html @@ -16,11 +16,47 @@ Modernizr.load({ </script> [% END %] +<<<<<<< HEAD +[% pre_container_extra = BLOCK %] +<div id="front-main"> + <div id="front-main-container"> + [% IF c.cobrand.moniker == 'bromley' %] + <h1 class="main mob-only">Reporting a problem in Bromley’s streets or parks</h1> + [% ELSIF c.cobrand.moniker == 'fixmybarangay' %] + <h1>View local problems</h1> + <h2>(potholes or street lighting)</h2> + [% ELSE %] + <h1>[% loc('Report, view, or discuss local problems') %]</h1> + <h2>[% loc('(like graffiti, fly tipping, broken paving slabs, or street lighting)') %]</h2> + [% END %] + + [% + question = c.cobrand.enter_postcode_text(); + %] + + <form action="[% c.uri_for('/around') %]" method="get" name="postcodeForm" id="postcodeForm"> + [% IF c.cobrand.moniker == 'fixmybarangay' %] + <p> + <a href="/around?latitude=10.322;longitude=123.907" class="yellow-btn">Bgy. Luz</a> + <a href="/around?latitude=10.288;longitude=123.870" class="yellow-btn">Bgy. Basak San Nicolas</a> + </p> + [% ELSE %] + <label for="pc">[% question %]:</label> + <div> + <input type="text" name="pc" value="" id="pc" size="10" maxlength="200" placeholder="[% tprintf(loc('e.g. ā%sā or ā%sā'), c.cobrand.example_places) %]"> + <input type="submit" value="[% loc('Go') %]" id="submit"> + </div> + [% END %] + </form> + </div> +</div> +======= [% pre_container_extra = PROCESS 'around/postcode_form.html' %] [% INCLUDE 'header.html', title = '', bodyclass = 'frontpage fullwidthpage' %] [% IF error %] <p class="form-error">[% error %]</p> +>>>>>>> origin/master [% END %] [% IF c.cobrand.moniker == 'bromley' %] @@ -36,6 +72,11 @@ kinds of problems like missed bins use our <h2>[% loc('How to report a problem') %]</h2> <ol class="big-numbers"> + [% IF c.cobrand.moniker == 'fixmybarangay' %] + <li>Text LUZ or BSN followed by your report to 12345</li> + <li>Visit the Barangay Center in person</li> + <li>Staff? <a href="/auth">Sign in</a> and click on the map! + [% ELSE %] <li>[% question %]</li> <li>[% loc('Locate the problem on a map of the area') %]</li> <li>[% loc('Enter details of the problem') %]</li> @@ -44,6 +85,7 @@ kinds of problems like missed bins use our [% ELSE %] <li>[% loc('We send it to the council on your behalf') %]</li> [% END %] + [% END %] </ol> <section class="full-width"> diff --git a/templates/web/fixmystreet/report/display.html b/templates/web/fixmystreet/report/display.html index a22de373d..1adc1c1e7 100644 --- a/templates/web/fixmystreet/report/display.html +++ b/templates/web/fixmystreet/report/display.html @@ -8,6 +8,8 @@ rss = [ loc('Updates to this problem, FixMyStreet'), "/rss/$problem.id" ] robots = 'index, nofollow' bodyclass = 'mappage' + + allow_creation = !c.cobrand.only_authed_can_create || (c.user && c.user.from_council); %] [% map_html %] @@ -46,6 +48,7 @@ [% INCLUDE 'report/updates.html' %] +[% IF allow_creation %] <div id="update_form"> <h2>[% loc( 'Provide an update') %]</h2> @@ -167,7 +170,7 @@ </fieldset> </form> </div> - +[% END %] [% INCLUDE 'footer.html' %] diff --git a/web/cobrands/fixmybarangay/_colours.scss b/web/cobrands/fixmybarangay/_colours.scss new file mode 100644 index 000000000..fdc43f360 --- /dev/null +++ b/web/cobrands/fixmybarangay/_colours.scss @@ -0,0 +1,9 @@ +/* COLOURS */ + +$primary: #ffff99; +$primary_b: #000000; +$primary_text: #222222; + +$contrast1: #00BD08; +$contrast1_dark: #4B8304; +$contrast2: #AA8D11; diff --git a/web/cobrands/fixmybarangay/base.scss b/web/cobrands/fixmybarangay/base.scss new file mode 100644 index 000000000..2963d2454 --- /dev/null +++ b/web/cobrands/fixmybarangay/base.scss @@ -0,0 +1,28 @@ +@import "../fixmystreet/_h5bp"; +@import "./_colours"; +@import "../fixmystreet/_mixins"; +@import "compass"; + +@import "../fixmystreet/_base"; + +#site-logo{ + width: 225px !important; + background: url('/cobrands/fixmybarangay/images/sprite.png') -3px -3px no-repeat; +} +.ie6 #site-logo { + background: url('/cobrands/fixmybarangay/images/ie_logo.gif') 0 -5px no-repeat; +} + +.ie6 body.frontpage #site-logo { + background:url(/cobrands/fixmybarangay/images/ie_front_logo.gif) 0 0 no-repeat; +} + +.yellow-btn, +a.yellow-btn, +button.yellow-btn, +input.yellow-btn{ + @include button-reset(#FFD000, #cc9000, #aa7000, #300, #FFD000, #cc9000, #aa7000, #300); + &:visited, &:hover { + color:#300; + } +} diff --git a/web/cobrands/fixmybarangay/config.rb b/web/cobrands/fixmybarangay/config.rb new file mode 100644 index 000000000..cab97b18f --- /dev/null +++ b/web/cobrands/fixmybarangay/config.rb @@ -0,0 +1,25 @@ +# Require any additional compass plugins here. + +# Set this to the root of your project when deployed: +http_path = "/" +css_dir = "" +sass_dir = "" +images_dir = "" +javascripts_dir = "" + +# You can select your preferred output style here (can be overridden via the command line): +# output_style = :expanded or :nested or :compact or :compressed + +# To enable relative paths to assets via compass helper functions. Uncomment: +# relative_assets = true + +# To disable debugging comments that display the original location of your selectors. Uncomment: +# line_comments = false + +# If you prefer the indented syntax, you might want to regenerate this +# project again passing --syntax sass, or you can uncomment this: +# preferred_syntax = :sass +# and then run: +# sass-convert -R --from scss --to sass sass scss && rm -rf sass && mv scss sass + +line_comments = false # by Compass.app diff --git a/web/cobrands/fixmybarangay/images/ie_front_logo.gif b/web/cobrands/fixmybarangay/images/ie_front_logo.gif Binary files differnew file mode 100644 index 000000000..2eeda87ef --- /dev/null +++ b/web/cobrands/fixmybarangay/images/ie_front_logo.gif diff --git a/web/cobrands/fixmybarangay/images/ie_logo.png b/web/cobrands/fixmybarangay/images/ie_logo.png Binary files differnew file mode 100644 index 000000000..df73a7785 --- /dev/null +++ b/web/cobrands/fixmybarangay/images/ie_logo.png diff --git a/web/cobrands/fixmybarangay/images/sprite.png b/web/cobrands/fixmybarangay/images/sprite.png Binary files differnew file mode 100644 index 000000000..fad72a23a --- /dev/null +++ b/web/cobrands/fixmybarangay/images/sprite.png diff --git a/web/cobrands/fixmybarangay/layout.scss b/web/cobrands/fixmybarangay/layout.scss new file mode 100644 index 000000000..c032c6e60 --- /dev/null +++ b/web/cobrands/fixmybarangay/layout.scss @@ -0,0 +1,59 @@ +@import "_colours"; +@import "../fixmystreet/_layout"; + +body { + background: #1A1A1A; +} + + +body.frontpage { + #site-logo{ + width: 370px !important; + background: url('/cobrands/fixmybarangay/images/sprite.png') -3px -106px no-repeat; + } +} + +#front-main { + color: $primary_text; + background: $primary; + + #postcodeForm { + margin-left: 0; + margin-right: 0; + } + + a { + text-decoration:none; + } + + p { + padding-bottom:4px; + } +} + +.nav-wrapper { + .nav-wrapper-2 { + border-top: solid 4px $primary; + @include border-image(none); + } +} +#main-nav { + ul { + &#mysoc-menu { + background:$primary; + } + } +} + +#front-howto { + #front_stats { + border-top: 0.25em solid #000; + div { + big { + color: #000; + } + } + } +} + +@import "message_manager";
\ No newline at end of file diff --git a/web/cobrands/fixmybarangay/message_manager.scss b/web/cobrands/fixmybarangay/message_manager.scss new file mode 100644 index 000000000..46567efce --- /dev/null +++ b/web/cobrands/fixmybarangay/message_manager.scss @@ -0,0 +1,73 @@ +$mm_status_message_color: #a66; +$mm_border_color: #eee; + +#message_manager { + + #message-control { + #mm-username-container { + display: none; // hidden during dev + padding: 8px; + text-align: right; + color: $mm_status_message_color; + font-style: italic; + span { + color: #000; + font-style: normal; + } + } + #mm-status-message-container { + min-height: 1.4em; + margin: 0 0 8px 0.5em; + padding: 8px 4px; + color: $mm_status_message_color; + font-style: italic; + } + #mm-login-container { + display: none; // only shown on/after a 403 + border: 1px solid $mm_border_color; + padding: 0 1em; + margin: 1em; + input { + margin-bottom: 1em; + } + } + } + + #mm-message-list { + ul { + list-style-type: none; + padding: 0; + margin: 0; + li { + clear: both; + margin: 4px 0 0 0; + padding: 0; + cursor: pointer; + background-color: #F6F6F6; + p { + background-color: inherit; + } + &.msg-is-locked { background-color: #fdd;} + &.msg-is-owned { background-color: #dfd;} + &.msg-is-busy { background-color: #ffd;} + &:hover { background-color: #efe;} + span.msg-tag { + width: 3em; + float:left; + } + input[type=radio] { + display: block; + float: left; + } + label, span.msg-text { + display: block; + font-weight: normal; + margin: 0.1em 0 0.1em 4.5em; + } + } + } + } + p.mm-empty { + margin: 1em; + } +} diff --git a/web/cobrands/fixmybarangay/message_manager_client.js b/web/cobrands/fixmybarangay/message_manager_client.js new file mode 100644 index 000000000..940c27ee4 --- /dev/null +++ b/web/cobrands/fixmybarangay/message_manager_client.js @@ -0,0 +1,340 @@ +/* + * message_manager.config(settings) + * + * Accepts settings for the Message Manager client. Even if you accept all the defaults, + * you *MUST* call config when the page is loaded (i.e., call message_manager.config()) + * + * The (optional) single parameter is a hash of name-value pairs: + * + * url_root accepts the root URL to the message manager. + * + * want_unique_locks normally MM clients should relinquish all other locks + * when claiming a new one so want_unique_locks defaults + * to true; but you can set it explicitly here. + * + * msg_prefix all message <li> items have this as their ID prefix + * + * *_selector these are the jQuery selects that will be used to find + * the respective elements: + * + * message_list_selector: list of messages + * status_selector: status message display + * login_selector: login form + * + * + * Summary of all methods: + * message_manager.config([options]) + * message_manager.setup_click_listener([options]) + * message_manager.get_available_messages([options]) + * message_manager.request_lock(msg_id, [options]) (default use: client code doesn't need to call this explicitly) + * message_manager.assign_fms_id(msg_id, fms_id, [options]) + * + * Note: options are {name:value, ...} hashes and often include "callback" which is a function that is executed on success + * but see the docs (request_lock executes callback if the call is successful even if the lock was denied, for example). + * Some methods take 'callback' as the only option, but you still need to pass it as a named option. +*/ + +var message_manager = (function() { + + // default/config values: to be overridden using "config({name:value, ...})" + + var _url_root = 'http://www.example.com/message_manager/'; + var _want_unique_locks = true; + var _msg_prefix = "msg-"; + var _username; + + // cached jQuery elements, populated by the (mandatory) call to config() + var $message_list_element; + var $status_element; + var $login_element; + var $htauth_username; + var $htauth_password; + + var config = function(settings) { + var selectors = { + message_list_selector: '#mm-message-list', + status_selector: '#mm-status-message-container', + login_selector: '#mm-login-container', + username_selector: '#mm-received-username', + htauth_username_selector: '#mm-htauth-username', + htauth_password_selector: '#mm-htauth-password' + }; + if (settings) { + if (typeof settings.url_root === 'string') { + _url_root = settings.url_root; + if (_url_root.charAt(_url_root.length-1) !== "/") { + _url_root+="/"; + } + } + if (typeof settings.want_unique_locks !== 'undefined') { + _want_unique_locks = settings.want_unique_locks; + } + if (typeof settings.msg_prefix === 'string') { + _msg_prefix = settings.msg_prefix; + } + for (var sel in selectors) { + if (typeof settings[sel] === 'string') { + selectors[sel] = settings[sel]; + } + } + } + $message_list_element = $(selectors.message_list_selector); + $status_element = $(selectors.status_selector); + $login_element = $(selectors.login_selector); + $htauth_username = $(selectors.htauth_username_selector); + $htauth_password = $(selectors.htauth_password_selector); + }; + + // btoa doesn't work on all browers? + var make_base_auth = function(user, password) { + var tok = user + ':' + password; + var hash = btoa(tok); + return "Basic " + hash; + }; + + var get_current_auth_credentials = function() { + var base_auth = ""; + var htauth_un = ""; + var htauth_pw = ""; + if ($htauth_username.size()) { + htauth_un = $htauth_username.val(); + htauth_pw = $htauth_password.val(); + } + if (htauth_un.length === 0 && Modernizr.sessionstorage && sessionStorage.getItem('mm_auth')) { + base_auth = sessionStorage.getItem('mm_auth'); + } else { + base_auth = make_base_auth(htauth_un, htauth_pw); + if (Modernizr.sessionstorage) { + sessionStorage.mm_auth = base_auth; + } + } + return base_auth; + }; + + var sign_out = function() { // clear_current_auth_credentials + if (Modernizr.sessionstorage) { + sessionStorage.removeItem('mm_auth'); // FF doesn't support .clear()? + } + if ($htauth_password) { + $htauth_password.val(''); + } + }; + + var show_login_form = function() { + $('.mm-msg', $message_list_element).remove(); // remove (old) messages + $login_element.stop().slideDown(); + }; + + var say_status = function (msg) { + if ($status_element) { + $status_element.stop().show().text(msg); + } + }; + + var show_available_messages = function(data) { + var messages = data.messages; + _username = data.username; + var $output = $message_list_element; + if (messages instanceof Array) { + if (messages.length === 0) { + $output.html('<p class="mm-empty">No messages available.</p>'); + } else { + var $ul = $('<ul/>'); + for(var i=0; i< messages.length; i++) { + var msg = messages[i].Message; // or use label value + var lockkeeper = messages[i].Lockkeeper.username; + var escaped_text = $('<div/>').text(msg.message).html(); + var tag = (!msg.tag || msg.tag === 'null')? ' ' : msg.tag; + tag = $('<span class="msg-tag"/>').html(tag); + var radio = $('<input type="radio"/>').attr({ + 'id': 'mm_text_' + msg.id, + 'name': 'mm_text', + 'value': escaped_text + }).wrap('<p/>').parent().html(); + var label = $('<label/>', { + 'class': 'msg-text', + 'for': 'mm_text_' + msg.id + }).text(escaped_text).wrap('<p/>').parent().html(); + var p = $('<p/>').append(tag).append(radio).append(label); + var litem = $('<li id="' + _msg_prefix + msg.id + '" class="mm-msg">').append(p); + if (lockkeeper) { + litem.addClass(lockkeeper == _username? 'msg-is-owned' : 'msg-is-locked'); + } + $ul.append(litem); + } + $output.empty().append($ul); + } + } else { + $output.html('<p>No messages (server did not send a list).</p>'); + } + }; + + // accept an element (e.g., message_list) and add the click event to the *radio button* within it + // A bit specific to expect li's perhaps. + // options are passed through to the lock + var setup_click_listener = function(options) { + $message_list_element.on('click', 'input[type=radio]', function(event) { + var $li = $(this).closest('li'); + var id = $li.attr('id').replace(_msg_prefix, ''); + if ($li.hasClass('msg-is-locked')) { + say_status("Trying for lock..."); + } else if ($li.hasClass('msg-is-owned')) { + say_status("Checking lock..."); + } else { + say_status("Trying for lock..."); + } + request_lock(id, options); + }); + }; + + // gets messages or else requests login + var get_available_messages = function(options) { + var base_auth = get_current_auth_credentials(); + if (base_auth === "") { + show_login_form(); + return; + } + if (options) { + if (typeof(options.callback) === 'function') { + callback = options.callback; + } + } + $login_element.stop().hide(); + $.ajax({ + dataType: "json", + type: "post", + url: _url_root +"messages/available.json", + beforeSend: function (xhr){ + xhr.setRequestHeader('Authorization', get_current_auth_credentials()); + xhr.withCredentials = true; + }, + success: function(data, textStatus) { + show_available_messages(data); + if (typeof(callback) === "function") { + callback.call($(this), data); // execute callback + } + }, + error: function(jqXHR, textStatus, errorThrown) { + var st = jqXHR.status; + if (st == 401 || st == 403) { + var msg = (st == 401)? "Invalid username or password" : "Access denied: please log in"; + say_status(msg); + show_login_form(); + } else { + var err_msg = "Unable to load messages: "; + if (st === 0 && textStatus === 'error') { // x-domain hard to detect, sometimes intermittent? + err_msg += "maybe try refreshing page?"; + } else { + err_msg += textStatus + " (" + st + ")"; + } + say_status(err_msg); + } + } + }); + }; + + var request_lock = function(msg_id, options) { + var $li = $('#' + _msg_prefix + msg_id); + var lock_unique = _want_unique_locks; + var callback = null; + if (options) { + if (typeof(options.callback) === 'function') { + callback = options.callback; + } + if (typeof(options.lock_unique) !== undefined && options.lock_unique !== undefined) { + lock_unique = options.lock_unique; + } + } + $li.addClass('msg-is-busy'); + $.ajax({ + dataType:"json", + type:"post", + url: _url_root +"messages/" + + (lock_unique? "lock_unique" : "lock") + + "/" + msg_id + ".json", + beforeSend: function (xhr){ + xhr.setRequestHeader('Authorization', get_current_auth_credentials()); + xhr.withCredentials = true; + }, + success:function(data, textStatus) { + if (data.success) { + if (lock_unique) { + $('.msg-is-owned', $message_list_element).removeClass('msg-is-owned'); + } + $li.removeClass('msg-is-busy msg-is-locked').addClass('msg-is-owned'); + say_status("Lock granted OK"); // to data['data']['Lockkeeper']['username']? + } else { + $li.removeClass('msg-is-busy').addClass('msg-is-locked'); + say_status("failed: " + data.error); + } + if (typeof(callback) === "function") { // note callbacks must check data['success'] + callback.call($(this), data); // returned data['data'] is 'Message', 'Source', 'Lockkeeper' for success + } + }, + error: function(jqXHR, textStatus, errorThrown) { + $li.removeClass('msg-is-busy'); + say_status("error: " + textStatus + ": " + errorThrown); + } + }); + }; + + var assign_fms_id = function(msg_id, fms_id, options) { + var check_li_exists = false; + if (options) { + if (typeof(options.callback) === 'function') { + callback = options.callback; + } + if (typeof(options.check_li_exists) !== undefined && options.check_li_exists !== undefined) { + check_li_exists = true; // MM dummy + } + } + var $li = $('#' + _msg_prefix + msg_id); + if (check_li_exists) { + if ($li.size() === 0) { + say_status("Couldn't find message with ID " + msg_id); + return; + } + } + if (isNaN(parseInt(fms_id,10))) { + say_status("missing FMS id"); + return; + } + $li.addClass('msg-is-busy'); + $.ajax({ + dataType:"json", + type:"post", + data: {fms_id: fms_id}, + url: _url_root +"messages/assign_fms_id/" + msg_id + ".json", + beforeSend: function (xhr){ + xhr.setRequestHeader('Authorization', get_current_auth_credentials()); + xhr.withCredentials = true; + }, + success:function(data, textStatus) { + if (data.success) { + $li.removeClass('msg-is-busy msg-is-locked').addClass('msg-is-owned').fadeOut('slow'); // no longer available + say_status("FMS ID assigned"); // to data['data']['Lockkeeper']['username']? + if (typeof(callback) === "function") { + callback.call($(this), data.data); // returned data['data'] is 'Message', 'Source', 'Lockkeeper' for success + } + } else { + $li.removeClass('msg-is-busy').addClass('msg-is-locked'); + say_status("failed: " + data.error); + } + }, + error: function(jqXHR, textStatus, errorThrown) { + say_status("error: " + textStatus + ": " + errorThrown); + $li.removeClass('msg-is-busy'); + } + }); + }; + + // revealed public methods: + return { + config: config, + setup_click_listener: setup_click_listener, + get_available_messages: get_available_messages, + request_lock: request_lock, + assign_fms_id: assign_fms_id, + sign_out: sign_out + }; +})(); diff --git a/web/cobrands/fixmybarangay/messages.js b/web/cobrands/fixmybarangay/messages.js new file mode 100644 index 000000000..aebf35156 --- /dev/null +++ b/web/cobrands/fixmybarangay/messages.js @@ -0,0 +1,26 @@ +$(function(){ + + var mm = $('#message_manager'); + + $.getJSON('/cobrands/fixmybarangay/test-texts.json', function(data) { + var items = []; + $.each(data, function(k, v) { + var item = $('<input type="radio"/>').attr({ + 'id': 'mm_text_' + v.id, + 'name': 'mm_text', + 'value': v.text + }).wrap('<p/>').parent().html(); + var label = $('<label/>', { + 'class': 'inline', + 'for': 'mm_text_' + v.id + }).text(v.text).wrap('<p/>').parent().html(); + item = '<li><p>' + item + ' ' + label + '</p></li>'; + items.push(item); + }); + mm.html(items.join('')); + mm.find('input').click(function(){ + $('#form_detail').val( $('input[name=mm_text]:checked').val() ); + }); + }); + +}); diff --git a/web/cobrands/fixmybarangay/position_map.js b/web/cobrands/fixmybarangay/position_map.js new file mode 100644 index 000000000..753b5f854 --- /dev/null +++ b/web/cobrands/fixmybarangay/position_map.js @@ -0,0 +1,22 @@ +function position_map_box() { + var $html = $('html'); + if ($html.hasClass('ie6')) { + $('#map_box').prependTo('.wrapper').css({ + zIndex: 0, position: 'absolute', + top: 0, left: 0, right: 0, bottom: 0, + width: '100%', height: $(window).height(), + margin: 0 + }); + } else { + $('#map_box').prependTo('.wrapper').css({ + zIndex: 0, position: 'fixed', + top: 0, left: 0, right: 0, bottom: 0, + width: '100%', height: '100%', + margin: 0 + }); + } +} + +function map_fix() {} +var slide_wards_down = 0; + diff --git a/web/cobrands/fixmybarangay/test-texts.json b/web/cobrands/fixmybarangay/test-texts.json new file mode 100644 index 000000000..7acde1e32 --- /dev/null +++ b/web/cobrands/fixmybarangay/test-texts.json @@ -0,0 +1,17 @@ +[ + { + "id" : 1, + "number" : "032-9999999", + "text" : "Pothole on corner of G. De Vera and T. Padilla" + }, + { + "id" : 2, + "number" : "032-1234567", + "text" : "Broken street light on Rahmann Street" + }, + { + "id" : 3, + "number" : "+63 917 0000000", + "text" : "F. Manalo giant pothole" + } +] diff --git a/web/cobrands/fixmystreet/_layout.scss b/web/cobrands/fixmystreet/_layout.scss index 56b2f41d5..0973e645d 100644 --- a/web/cobrands/fixmystreet/_layout.scss +++ b/web/cobrands/fixmystreet/_layout.scss @@ -732,7 +732,7 @@ textarea.form-error { .no-js #report-a-problem-sidebar { position: static; width: auto; - @include box-shadow(rgba(0, 0, 0, 0), 0, 0, 0); + @include box-shadow(rgba(0, 0, 0, 0) 0 0 0); .sidebar-tips, .sidebar-notes { font-size:1em; @@ -1012,7 +1012,7 @@ body.frontpage { .general-sidebar-notes { position: static; width: auto; - @include box-shadow(rgba(0, 0, 0, 0), 0, 0, 0); + @include box-shadow(rgba(0, 0, 0, 0) 0 0 0); .sidebar-tips, .sidebar-notes { font-size:1em; diff --git a/web/js/map-OpenLayers.js b/web/js/map-OpenLayers.js index d98994d84..4c96e771c 100644 --- a/web/js/map-OpenLayers.js +++ b/web/js/map-OpenLayers.js @@ -70,26 +70,30 @@ function fms_markers_list(pins, transform) { } function fixmystreet_onload() { - if ( fixmystreet.area ) { - var area = new OpenLayers.Layer.Vector("KML", { - strategies: [ new OpenLayers.Strategy.Fixed() ], - protocol: new OpenLayers.Protocol.HTTP({ - url: "/mapit/area/" + fixmystreet.area + ".kml?simplify_tolerance=0.0001", - format: new OpenLayers.Format.KML() - }) - }); - fixmystreet.map.addLayer(area); - area.events.register('loadend', null, function(a,b,c) { - var bounds = area.getDataExtent(); - if (bounds) { - var center = bounds.getCenterLonLat(); - var z = fixmystreet.map.getZoomForExtent(bounds); - if ( z < 13 && $('html').hasClass('mobile') ) { - z = 13; - } - fixmystreet.map.setCenter(center, z, false, true); + if ( fixmystreet.area.length ) { + for (var i=0; i<fixmystreet.area.length; i++) { + var area = new OpenLayers.Layer.Vector("KML", { + strategies: [ new OpenLayers.Strategy.Fixed() ], + protocol: new OpenLayers.Protocol.HTTP({ + url: "/mapit/area/" + fixmystreet.area[i] + ".kml?simplify_tolerance=0.0001", + format: new OpenLayers.Format.KML() + }) + }); + fixmystreet.map.addLayer(area); + if ( fixmystreet.area.length == 1 ) { + area.events.register('loadend', null, function(a,b,c) { + var bounds = area.getDataExtent(); + if (bounds) { + var center = bounds.getCenterLonLat(); + var z = fixmystreet.map.getZoomForExtent(bounds); + if ( z < 13 && $('html').hasClass('mobile') ) { + z = 13; + } + fixmystreet.map.setCenter(center, z, false, true); + } + }); } - }); + } } var pin_layer_style_map = new OpenLayers.StyleMap({ diff --git a/web/js/modernizr.custom.js b/web/js/modernizr.custom.js index c4d6ffdfc..026c0efad 100644 --- a/web/js/modernizr.custom.js +++ b/web/js/modernizr.custom.js @@ -1,4 +1,4 @@ -/* Modernizr 2.5.3 (Custom Build) | MIT & BSD
- * Build: http://www.modernizr.com/download/#-shiv-load
+/* Modernizr 2.6.1 (Custom Build) | MIT & BSD
+ * Build: http://modernizr.com/download/#-sessionstorage-shiv-load
*/
-;window.Modernizr=function(a,b,c){function t(a){i.cssText=a}function u(a,b){return t(prefixes.join(a+";")+(b||""))}function v(a,b){return typeof a===b}function w(a,b){return!!~(""+a).indexOf(b)}function x(a,b,d){for(var e in a){var f=b[a[e]];if(f!==c)return d===!1?a[e]:v(f,"function")?f.bind(d||b):f}return!1}var d="2.5.3",e={},f=b.documentElement,g="modernizr",h=b.createElement(g),i=h.style,j,k={}.toString,l={},m={},n={},o=[],p=o.slice,q,r={}.hasOwnProperty,s;!v(r,"undefined")&&!v(r.call,"undefined")?s=function(a,b){return r.call(a,b)}:s=function(a,b){return b in a&&v(a.constructor.prototype[b],"undefined")},Function.prototype.bind||(Function.prototype.bind=function(b){var c=this;if(typeof c!="function")throw new TypeError;var d=p.call(arguments,1),e=function(){if(this instanceof e){var a=function(){};a.prototype=c.prototype;var f=new a,g=c.apply(f,d.concat(p.call(arguments)));return Object(g)===g?g:f}return c.apply(b,d.concat(p.call(arguments)))};return e});for(var y in l)s(l,y)&&(q=y.toLowerCase(),e[q]=l[y](),o.push((e[q]?"":"no-")+q));return t(""),h=j=null,function(a,b){function g(a,b){var c=a.createElement("p"),d=a.getElementsByTagName("head")[0]||a.documentElement;return c.innerHTML="x<style>"+b+"</style>",d.insertBefore(c.lastChild,d.firstChild)}function h(){var a=k.elements;return typeof a=="string"?a.split(" "):a}function i(a){var b={},c=a.createElement,e=a.createDocumentFragment,f=e();a.createElement=function(a){var e=(b[a]||(b[a]=c(a))).cloneNode();return k.shivMethods&&e.canHaveChildren&&!d.test(a)?f.appendChild(e):e},a.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+h().join().replace(/\w+/g,function(a){return b[a]=c(a),f.createElement(a),'c("'+a+'")'})+");return n}")(k,f)}function j(a){var b;return a.documentShived?a:(k.shivCSS&&!e&&(b=!!g(a,"article,aside,details,figcaption,figure,footer,header,hgroup,nav,section{display:block}audio{display:none}canvas,video{display:inline-block;*display:inline;*zoom:1}[hidden]{display:none}audio[controls]{display:inline-block;*display:inline;*zoom:1}mark{background:#FF0;color:#000}")),f||(b=!i(a)),b&&(a.documentShived=b),a)}var c=a.html5||{},d=/^<|^(?:button|form|map|select|textarea)$/i,e,f;(function(){var a=b.createElement("a");a.innerHTML="<xyz></xyz>",e="hidden"in a,f=a.childNodes.length==1||function(){try{b.createElement("a")}catch(a){return!0}var c=b.createDocumentFragment();return typeof c.cloneNode=="undefined"||typeof c.createDocumentFragment=="undefined"||typeof c.createElement=="undefined"}()})();var k={elements:c.elements||"abbr article aside audio bdi canvas data datalist details figcaption figure footer header hgroup mark meter nav output progress section summary time video",shivCSS:c.shivCSS!==!1,shivMethods:c.shivMethods!==!1,type:"default",shivDocument:j};a.html5=k,j(b)}(this,b),e._version=d,e}(this,this.document),function(a,b,c){function d(a){return o.call(a)=="[object Function]"}function e(a){return typeof a=="string"}function f(){}function g(a){return!a||a=="loaded"||a=="complete"||a=="uninitialized"}function h(){var a=p.shift();q=1,a?a.t?m(function(){(a.t=="c"?B.injectCss:B.injectJs)(a.s,0,a.a,a.x,a.e,1)},0):(a(),h()):q=0}function i(a,c,d,e,f,i,j){function k(b){if(!o&&g(l.readyState)&&(u.r=o=1,!q&&h(),l.onload=l.onreadystatechange=null,b)){a!="img"&&m(function(){t.removeChild(l)},50);for(var d in y[c])y[c].hasOwnProperty(d)&&y[c][d].onload()}}var j=j||B.errorTimeout,l={},o=0,r=0,u={t:d,s:c,e:f,a:i,x:j};y[c]===1&&(r=1,y[c]=[],l=b.createElement(a)),a=="object"?l.data=c:(l.src=c,l.type=a),l.width=l.height="0",l.onerror=l.onload=l.onreadystatechange=function(){k.call(this,r)},p.splice(e,0,u),a!="img"&&(r||y[c]===2?(t.insertBefore(l,s?null:n),m(k,j)):y[c].push(l))}function j(a,b,c,d,f){return q=0,b=b||"j",e(a)?i(b=="c"?v:u,a,b,this.i++,c,d,f):(p.splice(this.i++,0,a),p.length==1&&h()),this}function k(){var a=B;return a.loader={load:j,i:0},a}var l=b.documentElement,m=a.setTimeout,n=b.getElementsByTagName("script")[0],o={}.toString,p=[],q=0,r="MozAppearance"in l.style,s=r&&!!b.createRange().compareNode,t=s?l:n.parentNode,l=a.opera&&o.call(a.opera)=="[object Opera]",l=!!b.attachEvent&&!l,u=r?"object":l?"script":"img",v=l?"script":u,w=Array.isArray||function(a){return o.call(a)=="[object Array]"},x=[],y={},z={timeout:function(a,b){return b.length&&(a.timeout=b[0]),a}},A,B;B=function(a){function b(a){var a=a.split("!"),b=x.length,c=a.pop(),d=a.length,c={url:c,origUrl:c,prefixes:a},e,f,g;for(f=0;f<d;f++)g=a[f].split("="),(e=z[g.shift()])&&(c=e(c,g));for(f=0;f<b;f++)c=x[f](c);return c}function g(a,e,f,g,i){var j=b(a),l=j.autoCallback;j.url.split(".").pop().split("?").shift(),j.bypass||(e&&(e=d(e)?e:e[a]||e[g]||e[a.split("/").pop().split("?")[0]]||h),j.instead?j.instead(a,e,f,g,i):(y[j.url]?j.noexec=!0:y[j.url]=1,f.load(j.url,j.forceCSS||!j.forceJS&&"css"==j.url.split(".").pop().split("?").shift()?"c":c,j.noexec,j.attrs,j.timeout),(d(e)||d(l))&&f.load(function(){k(),e&&e(j.origUrl,i,g),l&&l(j.origUrl,i,g),y[j.url]=2})))}function i(a,b){function c(a,c){if(a){if(e(a))c||(j=function(){var a=[].slice.call(arguments);k.apply(this,a),l()}),g(a,j,b,0,h);else if(Object(a)===a)for(n in m=function(){var b=0,c;for(c in a)a.hasOwnProperty(c)&&b++;return b}(),a)a.hasOwnProperty(n)&&(!c&&!--m&&(d(j)?j=function(){var a=[].slice.call(arguments);k.apply(this,a),l()}:j[n]=function(a){return function(){var b=[].slice.call(arguments);a&&a.apply(this,b),l()}}(k[n])),g(a[n],j,b,n,h))}else!c&&l()}var h=!!a.test,i=a.load||a.both,j=a.callback||f,k=j,l=a.complete||f,m,n;c(h?a.yep:a.nope,!!i),i&&c(i)}var j,l,m=this.yepnope.loader;if(e(a))g(a,0,m,0);else if(w(a))for(j=0;j<a.length;j++)l=a[j],e(l)?g(l,0,m,0):w(l)?B(l):Object(l)===l&&i(l,m);else Object(a)===a&&i(a,m)},B.addPrefix=function(a,b){z[a]=b},B.addFilter=function(a){x.push(a)},B.errorTimeout=1e4,b.readyState==null&&b.addEventListener&&(b.readyState="loading",b.addEventListener("DOMContentLoaded",A=function(){b.removeEventListener("DOMContentLoaded",A,0),b.readyState="complete"},0)),a.yepnope=k(),a.yepnope.executeStack=h,a.yepnope.injectJs=function(a,c,d,e,i,j){var k=b.createElement("script"),l,o,e=e||B.errorTimeout;k.src=a;for(o in d)k.setAttribute(o,d[o]);c=j?h:c||f,k.onreadystatechange=k.onload=function(){!l&&g(k.readyState)&&(l=1,c(),k.onload=k.onreadystatechange=null)},m(function(){l||(l=1,c(1))},e),i?k.onload():n.parentNode.insertBefore(k,n)},a.yepnope.injectCss=function(a,c,d,e,g,i){var e=b.createElement("link"),j,c=i?h:c||f;e.href=a,e.rel="stylesheet",e.type="text/css";for(j in d)e.setAttribute(j,d[j]);g||(n.parentNode.insertBefore(e,n),m(c,0))}}(this,document),Modernizr.load=function(){yepnope.apply(window,[].slice.call(arguments,0))};
\ No newline at end of file +;window.Modernizr=function(a,b,c){function t(a){i.cssText=a}function u(a,b){return t(prefixes.join(a+";")+(b||""))}function v(a,b){return typeof a===b}function w(a,b){return!!~(""+a).indexOf(b)}function x(a,b,d){for(var e in a){var f=b[a[e]];if(f!==c)return d===!1?a[e]:v(f,"function")?f.bind(d||b):f}return!1}var d="2.6.1",e={},f=b.documentElement,g="modernizr",h=b.createElement(g),i=h.style,j,k={}.toString,l={},m={},n={},o=[],p=o.slice,q,r={}.hasOwnProperty,s;!v(r,"undefined")&&!v(r.call,"undefined")?s=function(a,b){return r.call(a,b)}:s=function(a,b){return b in a&&v(a.constructor.prototype[b],"undefined")},Function.prototype.bind||(Function.prototype.bind=function(b){var c=this;if(typeof c!="function")throw new TypeError;var d=p.call(arguments,1),e=function(){if(this instanceof e){var a=function(){};a.prototype=c.prototype;var f=new a,g=c.apply(f,d.concat(p.call(arguments)));return Object(g)===g?g:f}return c.apply(b,d.concat(p.call(arguments)))};return e}),l.sessionstorage=function(){try{return sessionStorage.setItem(g,g),sessionStorage.removeItem(g),!0}catch(a){return!1}};for(var y in l)s(l,y)&&(q=y.toLowerCase(),e[q]=l[y](),o.push((e[q]?"":"no-")+q));return e.addTest=function(a,b){if(typeof a=="object")for(var d in a)s(a,d)&&e.addTest(d,a[d]);else{a=a.toLowerCase();if(e[a]!==c)return e;b=typeof b=="function"?b():b,enableClasses&&(f.className+=" "+(b?"":"no-")+a),e[a]=b}return e},t(""),h=j=null,function(a,b){function k(a,b){var c=a.createElement("p"),d=a.getElementsByTagName("head")[0]||a.documentElement;return c.innerHTML="x<style>"+b+"</style>",d.insertBefore(c.lastChild,d.firstChild)}function l(){var a=r.elements;return typeof a=="string"?a.split(" "):a}function m(a){var b=i[a[g]];return b||(b={},h++,a[g]=h,i[h]=b),b}function n(a,c,f){c||(c=b);if(j)return c.createElement(a);f||(f=m(c));var g;return f.cache[a]?g=f.cache[a].cloneNode():e.test(a)?g=(f.cache[a]=f.createElem(a)).cloneNode():g=f.createElem(a),g.canHaveChildren&&!d.test(a)?f.frag.appendChild(g):g}function o(a,c){a||(a=b);if(j)return a.createDocumentFragment();c=c||m(a);var d=c.frag.cloneNode(),e=0,f=l(),g=f.length;for(;e<g;e++)d.createElement(f[e]);return d}function p(a,b){b.cache||(b.cache={},b.createElem=a.createElement,b.createFrag=a.createDocumentFragment,b.frag=b.createFrag()),a.createElement=function(c){return r.shivMethods?n(c,a,b):b.createElem(c)},a.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+l().join().replace(/\w+/g,function(a){return b.createElem(a),b.frag.createElement(a),'c("'+a+'")'})+");return n}")(r,b.frag)}function q(a){a||(a=b);var c=m(a);return r.shivCSS&&!f&&!c.hasCSS&&(c.hasCSS=!!k(a,"article,aside,figcaption,figure,footer,header,hgroup,nav,section{display:block}mark{background:#FF0;color:#000}")),j||p(a,c),a}var c=a.html5||{},d=/^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i,e=/^<|^(?:a|b|button|code|div|fieldset|form|h1|h2|h3|h4|h5|h6|i|iframe|img|input|label|li|link|ol|option|p|param|q|script|select|span|strong|style|table|tbody|td|textarea|tfoot|th|thead|tr|ul)$/i,f,g="_html5shiv",h=0,i={},j;(function(){try{var a=b.createElement("a");a.innerHTML="<xyz></xyz>",f="hidden"in a,j=a.childNodes.length==1||function(){b.createElement("a");var a=b.createDocumentFragment();return typeof a.cloneNode=="undefined"||typeof a.createDocumentFragment=="undefined"||typeof a.createElement=="undefined"}()}catch(c){f=!0,j=!0}})();var r={elements:c.elements||"abbr article aside audio bdi canvas data datalist details figcaption figure footer header hgroup mark meter nav output progress section summary time video",shivCSS:c.shivCSS!==!1,supportsUnknownElements:j,shivMethods:c.shivMethods!==!1,type:"default",shivDocument:q,createElement:n,createDocumentFragment:o};a.html5=r,q(b)}(this,b),e._version=d,e}(this,this.document),function(a,b,c){function d(a){return"[object Function]"==o.call(a)}function e(a){return"string"==typeof a}function f(){}function g(a){return!a||"loaded"==a||"complete"==a||"uninitialized"==a}function h(){var a=p.shift();q=1,a?a.t?m(function(){("c"==a.t?B.injectCss:B.injectJs)(a.s,0,a.a,a.x,a.e,1)},0):(a(),h()):q=0}function i(a,c,d,e,f,i,j){function k(b){if(!o&&g(l.readyState)&&(u.r=o=1,!q&&h(),l.onload=l.onreadystatechange=null,b)){"img"!=a&&m(function(){t.removeChild(l)},50);for(var d in y[c])y[c].hasOwnProperty(d)&&y[c][d].onload()}}var j=j||B.errorTimeout,l=b.createElement(a),o=0,r=0,u={t:d,s:c,e:f,a:i,x:j};1===y[c]&&(r=1,y[c]=[]),"object"==a?l.data=c:(l.src=c,l.type=a),l.width=l.height="0",l.onerror=l.onload=l.onreadystatechange=function(){k.call(this,r)},p.splice(e,0,u),"img"!=a&&(r||2===y[c]?(t.insertBefore(l,s?null:n),m(k,j)):y[c].push(l))}function j(a,b,c,d,f){return q=0,b=b||"j",e(a)?i("c"==b?v:u,a,b,this.i++,c,d,f):(p.splice(this.i++,0,a),1==p.length&&h()),this}function k(){var a=B;return a.loader={load:j,i:0},a}var l=b.documentElement,m=a.setTimeout,n=b.getElementsByTagName("script")[0],o={}.toString,p=[],q=0,r="MozAppearance"in l.style,s=r&&!!b.createRange().compareNode,t=s?l:n.parentNode,l=a.opera&&"[object Opera]"==o.call(a.opera),l=!!b.attachEvent&&!l,u=r?"object":l?"script":"img",v=l?"script":u,w=Array.isArray||function(a){return"[object Array]"==o.call(a)},x=[],y={},z={timeout:function(a,b){return b.length&&(a.timeout=b[0]),a}},A,B;B=function(a){function b(a){var a=a.split("!"),b=x.length,c=a.pop(),d=a.length,c={url:c,origUrl:c,prefixes:a},e,f,g;for(f=0;f<d;f++)g=a[f].split("="),(e=z[g.shift()])&&(c=e(c,g));for(f=0;f<b;f++)c=x[f](c);return c}function g(a,e,f,g,h){var i=b(a),j=i.autoCallback;i.url.split(".").pop().split("?").shift(),i.bypass||(e&&(e=d(e)?e:e[a]||e[g]||e[a.split("/").pop().split("?")[0]]),i.instead?i.instead(a,e,f,g,h):(y[i.url]?i.noexec=!0:y[i.url]=1,f.load(i.url,i.forceCSS||!i.forceJS&&"css"==i.url.split(".").pop().split("?").shift()?"c":c,i.noexec,i.attrs,i.timeout),(d(e)||d(j))&&f.load(function(){k(),e&&e(i.origUrl,h,g),j&&j(i.origUrl,h,g),y[i.url]=2})))}function h(a,b){function c(a,c){if(a){if(e(a))c||(j=function(){var a=[].slice.call(arguments);k.apply(this,a),l()}),g(a,j,b,0,h);else if(Object(a)===a)for(n in m=function(){var b=0,c;for(c in a)a.hasOwnProperty(c)&&b++;return b}(),a)a.hasOwnProperty(n)&&(!c&&!--m&&(d(j)?j=function(){var a=[].slice.call(arguments);k.apply(this,a),l()}:j[n]=function(a){return function(){var b=[].slice.call(arguments);a&&a.apply(this,b),l()}}(k[n])),g(a[n],j,b,n,h))}else!c&&l()}var h=!!a.test,i=a.load||a.both,j=a.callback||f,k=j,l=a.complete||f,m,n;c(h?a.yep:a.nope,!!i),i&&c(i)}var i,j,l=this.yepnope.loader;if(e(a))g(a,0,l,0);else if(w(a))for(i=0;i<a.length;i++)j=a[i],e(j)?g(j,0,l,0):w(j)?B(j):Object(j)===j&&h(j,l);else Object(a)===a&&h(a,l)},B.addPrefix=function(a,b){z[a]=b},B.addFilter=function(a){x.push(a)},B.errorTimeout=1e4,null==b.readyState&&b.addEventListener&&(b.readyState="loading",b.addEventListener("DOMContentLoaded",A=function(){b.removeEventListener("DOMContentLoaded",A,0),b.readyState="complete"},0)),a.yepnope=k(),a.yepnope.executeStack=h,a.yepnope.injectJs=function(a,c,d,e,i,j){var k=b.createElement("script"),l,o,e=e||B.errorTimeout;k.src=a;for(o in d)k.setAttribute(o,d[o]);c=j?h:c||f,k.onreadystatechange=k.onload=function(){!l&&g(k.readyState)&&(l=1,c(),k.onload=k.onreadystatechange=null)},m(function(){l||(l=1,c(1))},e),i?k.onload():n.parentNode.insertBefore(k,n)},a.yepnope.injectCss=function(a,c,d,e,g,i){var e=b.createElement("link"),j,c=i?h:c||f;e.href=a,e.rel="stylesheet",e.type="text/css";for(j in d)e.setAttribute(j,d[j]);g||(n.parentNode.insertBefore(e,n),m(c,0))}}(this,document),Modernizr.load=function(){yepnope.apply(window,[].slice.call(arguments,0))};
\ No newline at end of file |