diff options
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Admin/Users.pm | 20 | ||||
-rw-r--r-- | templates/email/default/problem-confirm.html | 2 | ||||
-rw-r--r-- | templates/email/default/problem-confirm.txt | 4 | ||||
-rw-r--r-- | templates/email/hounslow/problem-confirm.html | 31 | ||||
-rw-r--r-- | templates/email/hounslow/problem-confirm.txt | 31 | ||||
-rw-r--r-- | templates/web/base/admin/users/import.html | 4 | ||||
-rw-r--r-- | web/cobrands/bristol/assets.js | 2 |
7 files changed, 78 insertions, 16 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Admin/Users.pm b/perllib/FixMyStreet/App/Controller/Admin/Users.pm index e55a3d111..d29d2b8b9 100644 --- a/perllib/FixMyStreet/App/Controller/Admin/Users.pm +++ b/perllib/FixMyStreet/App/Controller/Admin/Users.pm @@ -459,10 +459,9 @@ sub import :Local { my $csv = Text::CSV->new({ binary => 1}); my $fh = $c->req->upload('csvfile')->fh; - $csv->getline($fh); # discard the header - while (my $row = $csv->getline($fh)) { - my ($name, $email, $from_body, $permissions, $roles) = @$row; - $email = lc Utils::trim_text($email); + $csv->header($fh); + while (my $row = $csv->getline_hr($fh)) { + my $email = lc Utils::trim_text($row->{email}); my $user = FixMyStreet::DB->resultset("User")->find_or_new({ email => $email, email_verified => 1 }); if ($user->in_storage) { @@ -470,12 +469,13 @@ sub import :Local { next; } - $user->name($name); - $user->from_body($from_body || undef); - $user->update_or_insert; + $user->name($row->{name}); + $user->from_body($row->{from_body} || undef); + $user->password($row->{passwordhash}, 1) if $row->{passwordhash}; + $user->insert; - if ($roles) { - my @roles = split(/:/, $roles); + if ($row->{roles}) { + my @roles = split(/:/, $row->{roles}); foreach my $role (@roles) { $role = FixMyStreet::DB->resultset("Role")->find({ body_id => $user->from_body->id, @@ -484,7 +484,7 @@ sub import :Local { $user->add_to_roles($role); } } else { - my @permissions = split(/:/, $permissions); + my @permissions = split(/:/, $row->{permissions}); my @user_permissions = grep { $available_permissions{$_} } @permissions; foreach my $permission_type (@user_permissions) { $user->user_body_permissions->find_or_create({ diff --git a/templates/email/default/problem-confirm.html b/templates/email/default/problem-confirm.html index f545d7385..b8c98534c 100644 --- a/templates/email/default/problem-confirm.html +++ b/templates/email/default/problem-confirm.html @@ -20,7 +20,7 @@ of problem, so it will instead be sent to [% report.body %]. [% TRY %][% INCLUDE '_problem-confirm_extra.html' %][% CATCH file %][% END %] </p> - <p style="[% p_style %]">Your report will also appear on the [% site_name %] website.</p> + [% UNLESS report.non_public %]<p style="[% p_style %]">Your report will also appear on the [% site_name %] website.</p>[% END %] <p style="margin: 20px auto; text-align: center"> <a style="[% button_style %]" href="[% token_url %]">Yes, send my report</a> </p> diff --git a/templates/email/default/problem-confirm.txt b/templates/email/default/problem-confirm.txt index 693d7a131..7939a988a 100644 --- a/templates/email/default/problem-confirm.txt +++ b/templates/email/default/problem-confirm.txt @@ -3,8 +3,8 @@ Subject: Confirm your report on [% site_name %] Hello [% report.name %], Please click on the link below to confirm that you want to send your report to -[% report.body %]. Note that your report will also appear on the [% site_name %] -website: +[% report.body %].[% UNLESS report.non_public %] Note that your report will also +appear on the [% site_name %] website.[% END %] [% token_url %] diff --git a/templates/email/hounslow/problem-confirm.html b/templates/email/hounslow/problem-confirm.html new file mode 100644 index 000000000..00108adee --- /dev/null +++ b/templates/email/hounslow/problem-confirm.html @@ -0,0 +1,31 @@ +[% + +email_summary = "You need to confirm your " _ site_name _ " report before it can be sent to Hounslow Highways."; +email_columns = 2; + +PROCESS '_email_settings.html'; + +INCLUDE '_email_top.html'; + +%] + +<th style="[% td_style %][% primary_column_style %]" id="primary_column"> + [% start_padded_box %] + <h1 style="[% h1_style %]">Please confirm your report</h1> + <p style="[% p_style %]">Please click on the link below to confirm that you want to send your report to Hounslow Highways. + +[% TRY %][% INCLUDE '_problem-confirm_extra.html' %][% CATCH file %][% END %] + </p> + [% UNLESS report.non_public %]<p style="[% p_style %]">Your report will also appear on the [% site_name %] website.</p>[% END %] + <p style="margin: 20px auto; text-align: center"> + <a style="[% button_style %]" href="[% token_url %]">Yes, send my report</a> + </p> + <p style="[% p_style %]">If you no longer wish to send this report, please take no further action.</p> + [% end_padded_box %] +</th> +[% WRAPPER '_email_sidebar.html' object = report, url = token_url %] + <h2 style="[% h2_style %]">[% report.title | html %]</h2> + <p style="[% secondary_p_style %]">[% report.detail | html %]</p> +[% END %] + +[% INCLUDE '_email_bottom.html' %] diff --git a/templates/email/hounslow/problem-confirm.txt b/templates/email/hounslow/problem-confirm.txt new file mode 100644 index 000000000..9343b2a6e --- /dev/null +++ b/templates/email/hounslow/problem-confirm.txt @@ -0,0 +1,31 @@ +Subject: Confirm your report on [% site_name %] + +Hello [% report.name %], + +Please click on the link below to confirm that you want to send your report to +Hounslow Highways.[% UNLESS report.non_public %] Note that your report will also +appear on the [% site_name %] website.[% END %] + +[% token_url %] + +If your email program does not let you click on this link, copy and paste it +into your web browser and press return. +[% TRY %][% INCLUDE '_problem-confirm_extra.txt' %][% CATCH file %][% END %] +Your problem had the title: + +[% report.title %] + +And details: + +[% report.detail %] + +If you no longer wish to send this report, please take no further action. + +Thank you for submitting a report through [% site_name %]. + + + +[% signature %] + +This email was sent automatically, from an unmonitored email account - so +please do not reply to it. diff --git a/templates/web/base/admin/users/import.html b/templates/web/base/admin/users/import.html index 4a93e0255..6e11c74a9 100644 --- a/templates/web/base/admin/users/import.html +++ b/templates/web/base/admin/users/import.html @@ -65,8 +65,8 @@ <p>[% loc('This page is a quick way to create many new staff users in one go.') %]</p> <p>[% loc("Existing users won't be modified.") %]</p> <p> - [% loc("The uploaded CSV file must contain a header row, and records must have the following fields (in this order):") %] - <pre>name,email,from_body,permissions,roles</pre> + [% loc("The uploaded CSV file must contain a header row, and records can have the following fields:") %] + <pre>name,email,from_body,permissions,roles,passwordhash</pre> <ul> <li><code>from_body</code>: [% loc("the database id of the body to associate that user with, e.g. <code>2217</code> for Buckinghamshire.") %]</li> <li><code>permissions</code>: [% loc("a colon-separated list of permissions to grant that user, e.g. <code>contribute_as_body:moderate:user_edit</code>.") %]</li> diff --git a/web/cobrands/bristol/assets.js b/web/cobrands/bristol/assets.js index 8a3b963a1..ac1f0c861 100644 --- a/web/cobrands/bristol/assets.js +++ b/web/cobrands/bristol/assets.js @@ -54,7 +54,7 @@ fixmystreet.assets.add(options, { var lighting_options = $.extend({}, common_options, { wfs_url: "https://maps.bristol.gov.uk/arcgis/services/ext/datagov/MapServer/WFSServer", - wfs_feature: "Streetlights", + wfs_feature: "Streetlights_and_Street_Furniture", asset_id_field: 'Unit_ID', propertyNames: [ 'USRN', 'Unit_ID', 'Unit_type_description' ], attributes: { |