aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Somerville <matthew@mysociety.org>2012-12-20 12:32:28 +0000
committerMatthew Somerville <matthew@mysociety.org>2012-12-20 12:32:28 +0000
commitd596894460f92d2a5978879ee97dd6d13e6032f0 (patch)
tree47f7a7150206265eb57fb40d951cd8544d9d7a5f
parent723e67ba1944b031d52b196bd1e756ac15070e53 (diff)
Zurich admin report editing changes.
-rw-r--r--perllib/FixMyStreet/App/Controller/Admin.pm10
-rw-r--r--perllib/FixMyStreet/Cobrand/Zurich.pm15
-rw-r--r--templates/web/default/admin/report_edit.html11
-rw-r--r--templates/web/zurich/admin/report_edit.html64
4 files changed, 94 insertions, 6 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Admin.pm b/perllib/FixMyStreet/App/Controller/Admin.pm
index c38c2b7da..d40a4c61d 100644
--- a/perllib/FixMyStreet/App/Controller/Admin.pm
+++ b/perllib/FixMyStreet/App/Controller/Admin.pm
@@ -587,6 +587,10 @@ sub reports : Path('reports') {
sub report_edit : Path('report_edit') : Args(1) {
my ( $self, $c, $id ) = @_;
+ if ( $c->cobrand->moniker eq 'zurich' ) {
+ $c->cobrand->admin_bodies();
+ }
+
my $site_restriction = $c->cobrand->site_restriction;
my $problem = $c->cobrand->problems->search(
@@ -660,6 +664,8 @@ sub report_edit : Path('report_edit') : Args(1) {
|| $c->req->param('email') ne $problem->user->email
|| $c->req->param('title') ne $problem->title
|| $c->req->param('detail') ne $problem->detail
+ || ($c->req->param('body') && $c->req->param('body') ne $problem->bodies_str)
+ || ($c->req->param('extra') && $c->req->param('extra') ne $problem->extra)
|| $flagged != $problem->flagged
|| $non_public != $problem->non_public )
{
@@ -669,8 +675,10 @@ sub report_edit : Path('report_edit') : Args(1) {
$problem->anonymous( $c->req->param('anonymous') );
$problem->title( $c->req->param('title') );
$problem->detail( $c->req->param('detail') );
- $problem->state( $c->req->param('state') );
+ $problem->state( $new_state );
$problem->name( $c->req->param('name') );
+ $problem->bodies_str( $c->req->param('body') ) if $c->req->param('body');
+ $problem->extra( $c->req->param('extra') ) if $c->req->param('extra');
$problem->flagged( $flagged );
$problem->non_public( $non_public );
diff --git a/perllib/FixMyStreet/Cobrand/Zurich.pm b/perllib/FixMyStreet/Cobrand/Zurich.pm
index 73e36ebd4..d3cc638c1 100644
--- a/perllib/FixMyStreet/Cobrand/Zurich.pm
+++ b/perllib/FixMyStreet/Cobrand/Zurich.pm
@@ -1,6 +1,8 @@
package FixMyStreet::Cobrand::Zurich;
use base 'FixMyStreet::Cobrand::Default';
+use POSIX qw(strcoll);
+
use strict;
use warnings;
@@ -72,4 +74,17 @@ sub admin {
}
}
+sub admin_bodies {
+ my $self = shift;
+ my $c = $self->{c};
+ my $type = $self->admin_type();
+
+ if ($type eq 'dm') {
+ my $body = $c->stash->{body};
+ my @bodies = $c->model('DB::Body')->search( [ { id => $body->id }, { parent => $body->id } ] );
+ @bodies = sort { strcoll($a->name, $b->name) } @bodies;
+ $c->stash->{bodies} = \@bodies;
+ }
+}
+
1;
diff --git a/templates/web/default/admin/report_edit.html b/templates/web/default/admin/report_edit.html
index 9cd2c1d8c..a1a0d2bec 100644
--- a/templates/web/default/admin/report_edit.html
+++ b/templates/web/default/admin/report_edit.html
@@ -11,10 +11,11 @@
[%- cobrand_data = c.data_for_generic_problem IF !problem.cobrand %]
<li><a href="[% c.uri_for_email( '/report', problem.id, cobrand_data ) %]">[% loc('View report on site' )%]</a></li>
<li><label for='title'>[% loc('Subject:') %]</label> <input size=60 type='text' id='title' name='title' value='[% problem.title | html %]'></li>
-<li><label for='detail'>[% loc('Details:') %]</label><br><textarea name='detail' id='detail' cols=60 rows=10>[% problem.detail | html %]</textarea></li>
+<li><label for='detail'>[% loc('Details:') %]</label>
+<textarea name='detail' id='detail' cols=60 rows=10>[% problem.detail | html %]</textarea></li>
<li>[% loc('Co-ordinates:') %] [% problem.latitude %], [% problem.longitude %] ( [% loc('originally entered') %] [% problem.postcode | html %] , [% IF problem.used_map %][% loc('used map') %][% ELSE %][% loc("didn't use map") %][% END %])</li>
<li>[% loc('For council(s):') %] [% IF problem.bodies_str %][% problem.bodies_str %][% ELSE %]<em>[% loc('None' ) %]</em>[% END %] ([% loc('other areas:') %] [% problem.areas | remove('^,') | remove( ',$' ) %])</li>
-<li><label for="state">[% loc('State:') %]</label> <select name="state" id="state">
+<li><label class="inline" for="state">[% loc('State:') %]</label> <select name="state" id="state">
[% FOREACH state IN [ ['confirmed', loc('Open')], ['investigating',
loc('Investigating')], ['planned', loc('Planned')], ['in progress',
loc('In Progress')], ['closed', loc('Closed')], ['fixed', loc('Fixed')], ['fixed - user',
@@ -23,7 +24,7 @@
[% END %]
</select></li>
<li>[% loc('Category:') %] [% problem.category | html %] </li>
-<li><label for="anonymous">[% loc('Anonymous:') %]</label> <select name="anonymous" id="anonymous">
+<li><label class="inline" for="anonymous">[% loc('Anonymous:') %]</label> <select name="anonymous" id="anonymous">
<option [% 'selected ' IF problem.anonymous %]value="1">[% loc('Yes') %]</option>
<option [% 'selected ' IF !problem.anonymous %]value="0">[% loc('No') %]</option>
</select></li>
@@ -39,8 +40,8 @@
<li>[% loc('Cobrand data:') %] [% problem.cobrand_data %]</li>
<li>[% loc('Extra data:') %] [% problem.extra ? 'Yes' : 'No' %]</li>
<li>[% loc('Going to send questionnaire?') %] [% IF problem.send_questionnaire %][% loc('Yes') %][% ELSE %][% loc('No') %][% END %]</li>
-<li><label for="flagged">[% loc('Flagged:') %]</label> <input type="checkbox" name="flagged"[% ' checked' IF problem.flagged %]></li>
-<li><label for="non_public">[% loc('Private') %]:</label> <input type="checkbox" name="non_public"[% ' checked' IF problem.non_public %]></li>
+<li><label class="inline" for="flagged">[% loc('Flagged:') %]</label> <input type="checkbox" name="flagged"[% ' checked' IF problem.flagged %]></li>
+<li><label class="inline" for="non_public">[% loc('Private') %]:</label> <input type="checkbox" name="non_public"[% ' checked' IF problem.non_public %]></li>
[% IF problem.photo %]
[% photo = problem.get_photo_params %]
diff --git a/templates/web/zurich/admin/report_edit.html b/templates/web/zurich/admin/report_edit.html
new file mode 100644
index 000000000..ef3bbe5d1
--- /dev/null
+++ b/templates/web/zurich/admin/report_edit.html
@@ -0,0 +1,64 @@
+[% INCLUDE 'admin/header.html' title=tprintf(loc('Editing problem %d'), problem.id ) -%]
+[% PROCESS 'admin/report_blocks.html' %]
+
+[% status_message %]
+
+<form method="post" action="[% c.uri_for( 'report_edit', problem.id ) %]" enctype="application/x-www-form-urlencoded" accept-charset="utf-8">
+ <input type="hidden" name="token" value="[% token %]" >
+ <input type="hidden" name="submit" value="1" >
+<ul>
+ [%- cobrand_data = problem.cobrand_data %]
+ [%- cobrand_data = c.data_for_generic_problem IF !problem.cobrand %]
+<li><a href="[% c.uri_for_email( '/report', problem.id, cobrand_data ) %]">[% loc('View report on site' )%]</a></li>
+<li><label for='title'>[% loc('Subject:') %]</label> <input size=60 type='text' id='title' name='title' value='[% problem.title | html %]'></li>
+<li><label for='detail'>[% loc('Details:') %]</label>
+<textarea name='detail' id='detail' cols=60 rows=5>[% problem.detail | html %]</textarea></li>
+<li>[% loc('Co-ordinates:') %] [% problem.latitude %], [% problem.longitude %] ( [% loc('originally entered') %] &lsquo;[% problem.postcode | html %]&rsquo;, [% IF problem.used_map %][% loc('used map') %][% ELSE %][% loc("didn't use map") %][% END %])</li>
+<li>[% loc('Body:') %]
+ <select name="body">
+ [% FOR body IN bodies %]
+ <option value="[% body.id %]"[% IF body.id == problem.bodies_str%] selected[% END %]>[% body.name %]</option>
+ [% END %]
+ </select>
+</li>
+<li><label for="extra">[% loc('Internal notes:') %]</label>
+<textarea name='extra' id='extra' cols=60 rows=5>[% problem.extra | html %]</textarea></li>
+
+<li><label class="inline" for="state">[% loc('State:') %]</label> <select name="state" id="state">
+ [% FOREACH state IN [
+ ['unconfirmed',loc('Submitted')]
+ ['confirmed', loc('Open')],
+ ['in progress', loc('In Progress')],
+ ['fixed - council', loc('Fixed')],
+ ['hidden', loc('Hidden')],
+ ['closed', loc('Third party')],
+ ] %]
+ <option [% 'selected ' IF state.0 == problem.state %] value="[% state.0 %]">[% state.1 %]</option>
+ [% END %]
+</select></li>
+<li>[% loc('Category:') %] [% problem.category | html %] </li>
+<input type="hidden" name="anonymous" value="[% problem.anonymous %]">
+<li>[% loc('Name:') %] <input type='text' name='name' id='name' value='[% problem.name | html %]'></li>
+<li>[% loc('Email:') %] <input type='text' id='email' name='email' value='[% problem.user.email | html %]'></li>
+<li>[% loc('Phone:') %] [% problem.user.phone | html %]</li>
+<li>[% loc('Created:') %] [% PROCESS format_time time=problem.created %]</li>
+<input type="hidden" name="flagged" value="[% problem.flagged %]">
+<input type="hidden" name="non_public" value="[% problem.non_public %]">
+
+[% IF problem.photo %]
+[% photo = problem.get_photo_params %]
+<li><img alt="" height="[% photo.height %]" width="[% photo.width %]" src="[% c.cobrand.base_url %][% photo.url %]">
+<br>
+[% IF rotated %]Photo may be cached. View image directly to check<br>[% END %]
+<input type="submit" name="rotate_photo" value="Rotate Left" />
+<input type="submit" name="rotate_photo" value="Rotate Right" />
+<br>
+<input type="checkbox" id="remove_photo" name="remove_photo" value="1">
+<label for="remove_photo">[% loc("Remove photo (can't be undone!)") %]</label></li>
+[% END %]
+</ul>
+<input type="submit" name="Submit changes" value="[% loc('Submit changes') %]" ></form>
+
+[% INCLUDE 'admin/list_updates.html' %]
+
+[% INCLUDE 'admin/footer.html' %]