diff options
19 files changed, 238 insertions, 100 deletions
diff --git a/perllib/CronFns.pm b/perllib/CronFns.pm index 0573b788d..6bf698d2b 100755 --- a/perllib/CronFns.pm +++ b/perllib/CronFns.pm @@ -34,6 +34,7 @@ sub site { my $base_url = shift; my $site = 'fixmystreet'; $site = 'emptyhomes' if $base_url =~ 'emptyhomes'; + $site = 'zurich' if $base_url =~ 'zurich'; return $site; } diff --git a/perllib/FixMyStreet/App/Controller/Admin.pm b/perllib/FixMyStreet/App/Controller/Admin.pm index 0a2a8830c..848871f69 100644 --- a/perllib/FixMyStreet/App/Controller/Admin.pm +++ b/perllib/FixMyStreet/App/Controller/Admin.pm @@ -312,7 +312,7 @@ sub update_contacts : Private { my ( $self, $c ) = @_; my $posted = $c->req->param('posted'); - my $editor = $c->req->remote_user || ($c->user && $c->user->name) || _('*unknown*'); + my $editor = $c->forward('get_user'); if ( $posted eq 'new' ) { $c->forward('check_token'); @@ -590,11 +590,7 @@ sub report_edit : Path('report_edit') : Args(1) { my $site_restriction = $c->cobrand->site_restriction; - my $problem = $c->cobrand->problems->search( - { - id => $id, - } - )->first; + my $problem = $c->cobrand->problems->search( { id => $id } )->first; $c->detach( '/page_error_404_not_found' ) unless $problem; @@ -603,6 +599,11 @@ sub report_edit : Path('report_edit') : Args(1) { $c->forward('get_token'); + if ( $c->req->param('rotate_photo') ) { + $c->forward('rotate_photo'); + return 1; + } + if ( $c->cobrand->moniker eq 'zurich' ) { my $done = $c->cobrand->admin_report_edit(); return if $done; @@ -636,9 +637,6 @@ sub report_edit : Path('report_edit') : Args(1) { elsif ( $c->req->param('banuser') ) { $c->forward('ban_user'); } - elsif ( $c->req->param('rotate_photo') ) { - $c->forward('rotate_photo'); - } elsif ( $c->req->param('submit') ) { $c->forward('check_token'); @@ -1061,6 +1059,16 @@ sub set_allowed_pages : Private { return 1; } +sub get_user : Private { + my ( $self, $c ) = @_; + + my $user = $c->req->remote_user(); + $user ||= ($c->user && $c->user->name); + $user ||= ''; + + return $user; +} + =item get_token Generate a token based on user and secret @@ -1071,12 +1079,8 @@ sub get_token : Private { my ( $self, $c ) = @_; my $secret = $c->model('DB::Secret')->search()->first; - - my $user = $c->req->remote_user(); - $user ||= ''; - + my $user = $c->forward('get_user'); my $token = md5_hex(($user . $secret->secret)); - $c->stash->{token} = $token; return 1; @@ -1103,7 +1107,7 @@ sub check_token : Private { $c->forward( 'log_edit', [ $object_id, $object_type, $action_performed ] ); -Adds an entry into the admin_log table using the current remote_user. +Adds an entry into the admin_log table using the current user. =cut @@ -1111,7 +1115,7 @@ sub log_edit : Private { my ( $self, $c, $id, $object_type, $action ) = @_; $c->model('DB::AdminLog')->create( { - admin_user => ( $c->req->remote_user() || '' ), + admin_user => $c->forward('get_user'), object_type => $object_type, action => $action, object_id => $id, diff --git a/perllib/FixMyStreet/App/Controller/Report/New.pm b/perllib/FixMyStreet/App/Controller/Report/New.pm index 3a6986134..5b53c5dbf 100644 --- a/perllib/FixMyStreet/App/Controller/Report/New.pm +++ b/perllib/FixMyStreet/App/Controller/Report/New.pm @@ -147,7 +147,7 @@ sub report_new_ajax : Path('mobile') : Args(0) { } else { $c->stash->{token_url} = $c->uri_for_email( '/P', $token->token ); $c->send_email( 'problem-confirm.txt', { - to => [ [ $report->user->email, $report->name ] ], + to => [ $report->name ? [ $report->user->email, $report->name ] : $report->user->email ], } ); $c->stash->{ json_response } = { success => 1 }; } @@ -1125,7 +1125,7 @@ sub redirect_or_confirm_creation : Private { } ); $c->stash->{token_url} = $c->uri_for_email( '/P', $token->token ); $c->send_email( 'problem-confirm.txt', { - to => [ [ $report->user->email, $report->name ] ], + to => [ $report->name ? [ $report->user->email, $report->name ] : $report->user->email ], } ); # tell user that they've been sent an email diff --git a/perllib/FixMyStreet/Cobrand/Zurich.pm b/perllib/FixMyStreet/Cobrand/Zurich.pm index d70e785d7..4857dde03 100644 --- a/perllib/FixMyStreet/Cobrand/Zurich.pm +++ b/perllib/FixMyStreet/Cobrand/Zurich.pm @@ -38,6 +38,11 @@ sub show_unconfirmed_reports { 1; } +sub get_body_sender { + my ( $self, $body, $category ) = @_; + return { method => 'Zurich' }; +} + # Specific administrative displays sub admin_pages { @@ -186,6 +191,8 @@ sub admin_report_edit { $extra->{internal_notes} = $c->req->param('internal_notes'); $extra->{publish_photo} = $c->req->params->{publish_photo} || 0; $extra->{third_personal} = $c->req->params->{third_personal} || 0; + # Make sure we have a copy of the original detail field + $extra->{original_detail} = $problem->detail unless $extra->{original_detail}; $problem->extra( { %$extra } ); # Workflow things @@ -293,6 +300,7 @@ sub admin_report_edit { # If they clicked the no more updates button, we're done. if ($c->req->param('no_more_updates')) { $problem->bodies_str( $body->parent->id ); + $problem->whensent( undef ); $problem->state( 'planned' ); $problem->update; # log here diff --git a/perllib/FixMyStreet/DB/ResultSet/Problem.pm b/perllib/FixMyStreet/DB/ResultSet/Problem.pm index 6cecdea7e..897a7e732 100644 --- a/perllib/FixMyStreet/DB/ResultSet/Problem.pm +++ b/perllib/FixMyStreet/DB/ResultSet/Problem.pm @@ -222,8 +222,10 @@ sub send_reports { my $base_url = mySociety::Config::get('BASE_URL'); my $site = CronFns::site($base_url); + my $states = [ 'confirmed', 'fixed' ]; + $states = [ 'unconfirmed', 'confirmed', 'in progress', 'planned', 'closed' ] if $site eq 'zurich'; my $unsent = FixMyStreet::App->model("DB::Problem")->search( { - state => [ 'confirmed', 'fixed' ], + state => $states, whensent => undef, bodies_str => { '!=', undef }, } ); @@ -252,10 +254,12 @@ sub send_reports { my $email_base_url = $cobrand->base_url_for_report($row); my %h = map { $_ => $row->$_ } qw/id title detail name category latitude longitude used_map/; map { $h{$_} = $row->user->$_ } qw/email phone/; - $h{confirmed} = DateTime::Format::Pg->format_datetime( $row->confirmed->truncate (to => 'second' ) ); + $h{confirmed} = DateTime::Format::Pg->format_datetime( $row->confirmed->truncate (to => 'second' ) ) + if $row->confirmed; $h{query} = $row->postcode; $h{url} = $email_base_url . $row->url; + $h{admin_url} = $cobrand->admin_base_url . 'report_edit/' . $row->id; $h{phone_line} = $h{phone} ? _('Phone:') . " $h{phone}\n\n" : ''; if ($row->photo) { $h{has_photo} = _("This web page also contains a photo of the problem, provided by the user.") . "\n\n"; diff --git a/perllib/FixMyStreet/SendReport/Email.pm b/perllib/FixMyStreet/SendReport/Email.pm index b7c15a643..2a580c0d5 100644 --- a/perllib/FixMyStreet/SendReport/Email.pm +++ b/perllib/FixMyStreet/SendReport/Email.pm @@ -55,6 +55,11 @@ sub get_template { return $template; } +sub send_from { + my ( $self, $row ) = @_; + return [ $row->user->email, $row->name ]; +} + sub send { my $self = shift; my ( $row, $h ) = @_; @@ -77,7 +82,7 @@ sub send { _template_ => $self->get_template( $row ), _parameters_ => $h, To => $self->to, - From => [ $row->user->email, $row->name ], + From => $self->send_from( $row ), }, mySociety::Config::get('CONTACT_EMAIL'), \@recips, diff --git a/perllib/FixMyStreet/SendReport/Zurich.pm b/perllib/FixMyStreet/SendReport/Zurich.pm new file mode 100644 index 000000000..7bf6fe1a3 --- /dev/null +++ b/perllib/FixMyStreet/SendReport/Zurich.pm @@ -0,0 +1,53 @@ +package FixMyStreet::SendReport::Zurich; + +use Moose; + +BEGIN { extends 'FixMyStreet::SendReport::Email'; } + +sub build_recipient_list { + my ( $self, $row, $h ) = @_; + + # Only one body ever, most of the time with an email endpoint + my $body = @{ $self->bodies }[0]; + my $body_email = $body->endpoint; + + my @bodies = $body->bodies; + if ($body->parent && @bodies) { + # Division, might have an individual contact email address + my $contact = FixMyStreet::App->model("DB::Contact")->find( { + body_id => $body->id, + category => $row->category + } ); + $body_email = $contact->email if $contact->email; + } + + push @{ $self->to }, [ $body_email, $body->name ]; + return $body_email; +} + +sub get_template { + my ( $self, $row ) = @_; + + my $template; + if ( $row->state eq 'unconfirmed' || $row->state eq 'confirmed' ) { + $template = 'submit.txt'; + } elsif ( $row->state eq 'in progress' ) { + $template = 'submit-in-progress.txt'; + } elsif ( $row->state eq 'planned' ) { + $template = 'submit-feedback-pending.txt'; + } elsif ( $row->state eq 'closed' ) { + $template = 'submit-external.txt'; + } + + my $template_path = FixMyStreet->path_to( "templates", "email", "zurich", $template )->stringify; + $template = Utils::read_file( $template_path ); + return $template; +} + +# Zurich emails come from the site itself +sub send_from { + my ( $self, $row ) = @_; + return [ FixMyStreet->config('CONTACT_EMAIL'), FixMyStreet->config('CONTACT_NAME') ]; +} + +1; diff --git a/templates/email/zurich/submit-external.txt b/templates/email/zurich/submit-external.txt new file mode 100755 index 000000000..0775f7728 --- /dev/null +++ b/templates/email/zurich/submit-external.txt @@ -0,0 +1,8 @@ +Subject: FixMyZurich: New report #<?=$values['id']?> + +Dear <?=$values['bodies_name']?>, + +This report has been sent to you by Stadt Zurich to be dealt with. + +Public URL: <?=$values['url']?> + diff --git a/templates/email/zurich/submit-feedback-pending.txt b/templates/email/zurich/submit-feedback-pending.txt new file mode 100755 index 000000000..ff2e8e8b1 --- /dev/null +++ b/templates/email/zurich/submit-feedback-pending.txt @@ -0,0 +1,10 @@ +Subject: FixMyZurich: report #<?=$values['id']?> pending feedback + +Dear <?=$values['bodies_name']?>, + +This report has been sent back to you by the subdivision for final response and closure. + +Public URL: <?=$values['url']?> + +Admin URL: <?=$values['admin_url']?> + diff --git a/templates/email/zurich/submit-in-progress.txt b/templates/email/zurich/submit-in-progress.txt new file mode 100755 index 000000000..c8d259e09 --- /dev/null +++ b/templates/email/zurich/submit-in-progress.txt @@ -0,0 +1,10 @@ +Subject: FixMyZurich: New report #<?=$values['id']?> + +Dear <?=$values['bodies_name']?>, + +This report has been sent to you by your division to be dealt with. + +Public URL: <?=$values['url']?> + +Admin URL: <?=$values['admin_url']?> + diff --git a/templates/email/zurich/submit.txt b/templates/email/zurich/submit.txt index 57663ef80..752d6c6b4 100755 --- a/templates/email/zurich/submit.txt +++ b/templates/email/zurich/submit.txt @@ -1,6 +1,10 @@ -Subject: Fix my Zurich: #<?=$values['ID']?> +Subject: FixMyZurich: New report #<?=$values['id']?> -<?=$values['url']?> +Dear <?=$values['bodies_name']?>, -<?=$values['detail']?> +A new report has been submitted by a user. + +Public URL: <?=$values['url']?> + +Admin URL: <?=$values['admin_url']?> diff --git a/templates/web/zurich/admin/body.html b/templates/web/zurich/admin/body.html index 4eecb9839..143e61f83 100644 --- a/templates/web/zurich/admin/body.html +++ b/templates/web/zurich/admin/body.html @@ -41,7 +41,6 @@ </p> <input type="hidden" name="confirmed" value="1" id="confirmed"> - <input type="hidden" name="deleted" value="1" id="deleted"> <p> <strong>[% loc('Note:') %] </strong> <textarea name="note" rows="3" cols="40"></textarea> diff --git a/templates/web/zurich/admin/header.html b/templates/web/zurich/admin/header.html index b37a509fa..113839a65 100644 --- a/templates/web/zurich/admin/header.html +++ b/templates/web/zurich/admin/header.html @@ -1,4 +1,15 @@ [% INCLUDE 'header.html' admin = 1, bodyclass = 'fullwidthpage admin' %] +[% + states = { + 'unconfirmed' = loc('Submitted'), + 'confirmed' = loc('Open'), + 'in progress' = loc('In progress'), + 'planned' = loc('Planned'), + 'fixed - council' = loc('Closed'), + 'hidden' = loc('Hidden'), + 'closed' = loc('Closed'), + } +%] <style type="text/css"> dt { clear: left; float: left; font-weight: bold; } dd { margin-left: 8em; } diff --git a/templates/web/zurich/admin/index-dm.html b/templates/web/zurich/admin/index-dm.html index e3111d506..18842d6e5 100644 --- a/templates/web/zurich/admin/index-dm.html +++ b/templates/web/zurich/admin/index-dm.html @@ -1,4 +1,4 @@ -[% INCLUDE 'admin/header.html' title=loc('Summary') -%] +[% PROCESS 'admin/header.html' title=loc('Summary') -%] [% PROCESS 'admin/report_blocks.html' %] [% status_message %] diff --git a/templates/web/zurich/admin/index-sdm.html b/templates/web/zurich/admin/index-sdm.html index 654625457..11276115a 100644 --- a/templates/web/zurich/admin/index-sdm.html +++ b/templates/web/zurich/admin/index-sdm.html @@ -1,4 +1,4 @@ -[% INCLUDE 'admin/header.html' title=loc('Summary') -%] +[% PROCESS 'admin/header.html' title=loc('Summary') -%] [% PROCESS 'admin/report_blocks.html' %] <h2>New reports</h2> @@ -17,6 +17,7 @@ <tr> <th>[% loc('ID') %]</th> <th>[% loc('Title') %]</th> + <th>[% loc('State') %]</th> <th>[% loc('Category') %]</th> <th>[% loc('Created') %]</th> [% IF NOT no_edit %] @@ -26,16 +27,6 @@ <tr class="filter-row"> <td colspan="6"><input type="text" placeholder="[%= loc('Filter report list') %]" /></td> </tr> -[%- FOR problem IN problems %] - <tr[% ' class="adminhidden"' IF problem.state == 'hidden' %]> - <td class="record-id">[% problem.id %]</td> - <td>[% PROCESS value_or_nbsp value=problem.title %]</td> - <td>[% problem.category %]</td> - <td>[% PROCESS format_date this_date=problem.created %]</td> - [% IF NOT no_edit %] - <td><a href="[% c.uri_for( 'report_edit', problem.id ) %]">[% loc('Edit') %]</a></td> - [% END %] - </tr> -[%- END -%] +[% INCLUDE 'admin/problem_row.html' %] </table> [% END %] diff --git a/templates/web/zurich/admin/problem_row.html b/templates/web/zurich/admin/problem_row.html index 2cc94e10c..7fddddf8e 100644 --- a/templates/web/zurich/admin/problem_row.html +++ b/templates/web/zurich/admin/problem_row.html @@ -1,18 +1,9 @@ -[% - states = { - 'unconfirmed' = loc('Submitted'), - 'confirmed' = loc('Open'), - 'in progress' = loc('In progress'), - 'planned' = loc('Planned'), - 'fixed - council' = loc('Closed'), - 'hidden' = loc('Hidden'), - 'closed' = loc('Closed'), - } -%] [%- FOR problem IN problems %] - [% SET p_body = problem.bodies.values.0 %] - [% NEXT IF admin_type == 'sdm' AND p_body.id != body.id %] - [% NEXT IF admin_type == 'dm' AND p_body.id != body.id AND p_body.parent.id != body.id %] + [% IF page == 'search' %] + [% SET p_body = problem.bodies.values.0 %] + [% NEXT IF admin_type == 'sdm' AND p_body.id != body.id %] + [% NEXT IF admin_type == 'dm' AND p_body.id != body.id AND p_body.parent.id != body.id %] + [% END %] <tr[% ' class="adminhidden"' IF problem.state == 'hidden' %]> <td class="record-id">[%- IF problem.is_visible -%] <a href="[% c.uri_for_email( '/report', problem.id ) %]">[% problem.id %]</a> @@ -24,13 +15,17 @@ <td>[% PROCESS format_date this_date=problem.created %]</td> <td>[% PROCESS format_date this_date=problem.lastupdate %]</td> <td>[% states.${problem.state} %]</td> - <td> - [%- IF p_body.parent.id AND p_body.parent.parent.id -%][%# ...it's a subdivision %] - [% PROCESS value_or_nbsp value=p_body.name %] - [%- ELSE -%] - - [%- END -%] - </td> - <td><a href="[% c.uri_for( 'report_edit', problem.id ) %]">[% loc('Edit') %]</a></td> + [% IF admin_type != 'sdm' %] + <td> + [%- IF p_body.parent.id AND p_body.parent.parent.id -%][%# ...it's a subdivision %] + [% PROCESS value_or_nbsp value=p_body.name %] + [%- ELSE -%] + + [%- END -%] + </td> + [% END %] + [% IF NOT no_edit %] + <td><a href="[% c.uri_for( 'report_edit', problem.id ) %]">[% loc('Edit') %]</a></td> + [% END %] </tr> [%- END -%] diff --git a/templates/web/zurich/admin/report_edit-sdm.html b/templates/web/zurich/admin/report_edit-sdm.html index f41595c78..e5add67f6 100644 --- a/templates/web/zurich/admin/report_edit-sdm.html +++ b/templates/web/zurich/admin/report_edit-sdm.html @@ -1,4 +1,4 @@ -[% INCLUDE 'admin/header.html' title=tprintf(loc('Editing problem %d'), problem.id ) -%] +[% PROCESS 'admin/header.html' title=tprintf(loc('Editing problem %d'), problem.id ) -%] [% PROCESS 'admin/report_blocks.html' %] [% status_message %] @@ -10,10 +10,12 @@ <p align="right"><input type="submit" name="send_back" value="[% loc('Not for my subdivision') %]"></p> <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>[% loc('Details:') %] [% problem.detail | html %]</li> +<li><a href="[% c.uri_for_email( '/report', problem.id ) %]">[% loc('View report on site' )%]</a></li> +<li>[% loc('Details:') %] [% problem.detail | html %] +[% IF problem.extra.original_detail %] +<br>[% loc('originally entered') %]: “[% problem.extra.original_detail | html %]” +[% END %] +</li> <li>[% loc('Co-ordinates:') %] [% problem.local_coords.join(',') %] ([% 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('Category:') %] [% problem.category | html %] </li> @@ -23,6 +25,20 @@ <li>[% loc('Phone:') %] [% IF problem.user.phone %][% problem.user.phone | html %][% ELSE %]<em>[% loc('None') %]</em>[% END %]</li> <li>[% loc('Created:') %] [% PROCESS format_time time=problem.created %]</li> +[% IF problem.photo %] +[% photo = problem.get_photo_params %] +<li><img alt="" 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="publish_photo" name="publish_photo" value="1"[% ' checked' IF problem.extra.publish_photo %]> +<label class="inline" for="publish_photo">[% loc("Publish photo") %]</label></li> +[% END %] + +<li>[% loc('State:') %] [% states.${problem.state} %]</li> + <li><label for="internal_notes">[% loc('Internal notes:') %]</label> <textarea name='internal_notes' id='internal_notes' cols=60 rows=5>[% problem.extra.internal_notes | html %]</textarea></li> diff --git a/templates/web/zurich/admin/report_edit.html b/templates/web/zurich/admin/report_edit.html index 468280668..1bc2a5922 100644 --- a/templates/web/zurich/admin/report_edit.html +++ b/templates/web/zurich/admin/report_edit.html @@ -14,23 +14,32 @@ <div style="float:left; margin-top: 1em; width:48%; margin-right:2%"> <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><a href="[% c.uri_for_email( '/report', problem.id ) %]">[% loc('View report on site' )%]</a></li> + +[% IF problem.state == 'fixed - council' OR problem.state == 'closed' %] + <li>[% loc('Details:') %] [% problem.detail | html %] + [% IF problem.extra.original_detail %] + <br>[% loc('originally entered') %]: “[% problem.extra.original_detail | html %]” + [% END %] + </li> +[% ELSE %] + <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> + [% IF problem.extra.original_detail %] + [% loc('originally entered') %]: “[% problem.extra.original_detail | html %]” + [% END %] + </li> +[% END %] + <li>[% loc('Co-ordinates:') %] [% problem.local_coords.join(',') %] ([% 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> -<input type="hidden" name="anonymous" value="[% problem.anonymous %]"> <li>[% loc('Name:') %] [% problem.name | html %] <input type='hidden' name='name' id='name' value='[% problem.name | html %]'></li> <li>[% loc('Email:') %] [% problem.user.email | html %] <input type='hidden' id='email' name='email' value='[% problem.user.email | html %]'> [% IF problem.extra.email_confirmed %][% loc('Confirmed') %][% END %] </li> <li>[% loc('Phone:') %] [% IF problem.user.phone %][% problem.user.phone | html %][% ELSE %]<em>[% loc('None') %]</em>[% END %]</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 %] @@ -51,18 +60,26 @@ <p><label for="internal_notes">[% loc('Internal notes:') %]</label> <textarea name='internal_notes' id='internal_notes' cols=60 rows=5>[% problem.extra.internal_notes | html %]</textarea></p> -[% IF problem.state == 'unconfirmed' OR problem.state == 'confirmed' %] +<p>[% loc('State:') %] <select name="state" id="state"> + <option value="">--</option> + [% FOREACH s IN [ + ['unconfirmed', loc('Submitted')] + ['confirmed', loc('Open')], + ['planned', loc('Planned')], + ['hidden', loc('Hidden')], + ] %] + <option [% 'selected ' IF s.0 == problem.state %] value="[% s.0 %]">[% s.1 %]</option> + [% END %] + [% IF problem.state == 'closed' %] + <option selected value="closed">[% loc('Closed') %]</option> + [% ELSIF problem.state == 'fixed - council' %] + <option selected value="fixed - council">[% loc('Closed') %]</option> + [% ELSIF problem.state == 'in progress' %] + <option selected value="in progress">[% loc('In progress') %]</option> + [% END %] +</select></p> - <p>[% loc('State:') %] <select name="state" id="state"> - <option value="">--</option> - [% FOREACH s IN [ - ['unconfirmed',loc('Submitted')] - ['confirmed', loc('Open')], - ['hidden', loc('Hidden')], - ] %] - <option [% 'selected ' IF s.0 == problem.state %] value="[% s.0 %]">[% s.1 %]</option> - [% END %] - </select></p> +[% IF problem.state == 'unconfirmed' OR problem.state == 'confirmed' %] <ul> <li class="assignation"> @@ -117,20 +134,22 @@ $(function(){ [% ELSIF problem.state == 'planned' %] - <p>[% loc('State:') %] <select name="state" id="state"> - <option value="">--</option> - [% FOREACH s IN [ - ['planned', loc('Planned')], - ['hidden', loc('Hidden')], - ] %] - <option [% 'selected ' IF s.0 == problem.state %] value="[% s.0 %]">[% s.1 %]</option> - [% END %] - </select></p> +<ul> + <li class="assignation"> + <label for="body_subdivision">[% loc('Assign to subdivision:') %]</label> + <select name="body_subdivision" id="body_subdivision"> + <option value="" selected>--</option> + [% FOR body IN bodies %] + [% NEXT UNLESS body.parent.id == c.user.from_body.id %] + <option value="[% body.id %]">[% body.name %]</option> + [% END %] + </select> + </li> - <ul> -<li><label for="status_update">[% loc('Public response:') %]</label> -<textarea name='status_update' id='status_update' cols=60 rows=5></textarea></li> - </ul> + <li><label for="status_update">[% loc('Public response:') %]</label> + <textarea name='status_update' id='status_update' cols=60 rows=5></textarea></li> + +</ul> [% END %] diff --git a/templates/web/zurich/admin/reports.html b/templates/web/zurich/admin/reports.html index 372e94367..5911934c8 100644 --- a/templates/web/zurich/admin/reports.html +++ b/templates/web/zurich/admin/reports.html @@ -1,4 +1,4 @@ -[% INCLUDE 'admin/header.html' title=loc('Search Reports') %] +[% PROCESS 'admin/header.html' title=loc('Search Reports') %] [% PROCESS 'admin/report_blocks.html' %] <form method="get" action="[% c.uri_for('reports') %]" enctype="application/x-www-form-urlencoded" accept-charset="utf-8"> @@ -15,7 +15,7 @@ <th>[% loc('Created') %]</th> <th>*</th> </tr> - [% INCLUDE 'admin/problem_row.html' %] + [% INCLUDE 'admin/problem_row.html', page = 'search' %] </table> [% INCLUDE 'admin/list_updates.html' %] |