diff options
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Admin.pm | 4 | ||||
-rw-r--r-- | templates/web/base/admin/bodies.html | 8 | ||||
-rw-r--r-- | templates/web/base/admin/body-form.html | 16 | ||||
-rw-r--r-- | templates/web/base/admin/body.html | 6 | ||||
-rw-r--r-- | templates/web/base/admin/category_edit.html | 8 | ||||
-rw-r--r-- | web/js/fixmystreet-admin.js | 2 |
6 files changed, 24 insertions, 20 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Admin.pm b/perllib/FixMyStreet/App/Controller/Admin.pm index 114a2e19f..7b760d26d 100644 --- a/perllib/FixMyStreet/App/Controller/Admin.pm +++ b/perllib/FixMyStreet/App/Controller/Admin.pm @@ -425,7 +425,7 @@ sub update_contacts : Private { sub body_params : Private { my ( $self, $c ) = @_; - my @fields = qw/name endpoint jurisdiction api_key send_method send_comments suppress_alerts send_extended_statuses comment_user_id can_be_devolved parent deleted/; + my @fields = qw/name endpoint jurisdiction api_key send_method external_url/; my %defaults = map { $_ => '' } @fields; %defaults = ( %defaults, send_comments => 0, @@ -436,7 +436,7 @@ sub body_params : Private { parent => undef, deleted => 0, ); - my %params = map { $_ => $c->get_param($_) || $defaults{$_} } @fields; + my %params = map { $_ => $c->get_param($_) || $defaults{$_} } keys %defaults; return \%params; } diff --git a/templates/web/base/admin/bodies.html b/templates/web/base/admin/bodies.html index a039f8208..4c95423c0 100644 --- a/templates/web/base/admin/bodies.html +++ b/templates/web/base/admin/bodies.html @@ -35,13 +35,13 @@ [% IF c.cobrand.moniker == 'zurich' %] [% FILTER repeat(4*body.api_key) %] [% END %] [% IF admin_type == 'super' %] - <a href="[% c.uri_for( 'body', id ) %]">[% body.name %]</a> + <a href="[% c.uri_for( 'body', id ) %]">[% body.name | html %]</a> [% ELSE %] - [% body.name %] + [% body.name | html %] [% END %] [% ELSE %] [%# not Zurich: all bodies should be links %] - <a href="[% c.uri_for( 'body', id ) %]">[% body.name %]</a> - [%- ', ' _ body.parent.name IF body.parent -%] + <a href="[% c.uri_for( 'body', id ) %]">[% body.name | html%]</a> + [%- IF body.parent %], [% body.parent.name | html %][% END -%] [% END %] </td> [% IF c.cobrand.moniker == 'zurich' %] diff --git a/templates/web/base/admin/body-form.html b/templates/web/base/admin/body-form.html index 608a77dc2..4122ecd3f 100644 --- a/templates/web/base/admin/body-form.html +++ b/templates/web/base/admin/body-form.html @@ -16,7 +16,7 @@ </div> <p> <label for="name">[% loc('Name') %]</label> - <input type="text" name="name" id="name" value="[% body.name %]" size="50"> + <input type="text" name="name" id="name" value="[% body.name | html %]" size="50"> </p> <div class="admin-hint"> @@ -72,17 +72,21 @@ [% SET body_areas = body.areas %] [% FOR area IN areas %] [% SET aid = area.id %] - <option value="[% area.id %]"[% ' selected' IF body_areas.$aid %]>[% area.name %]</option> + <option value="[% area.id %]"[% ' selected' IF body_areas.$aid %]>[% area.name | html %]</option> [% END %] </select> </p> + <p> + <label for="external_url">[% loc('External URL') %]</label> + <input type="text" name="external_url" id="external_url" value="[% body.external_url | html %]" size="50"> + </p> <div class="admin-hint"> <p>[% loc( "You can mark a body as deleted if you do not want it to be active on the site." ) %]</p> </div> <p> - <label for="deleted">[% loc('Flag as deleted') %]</label> <input type="checkbox" name="deleted" id="deleted" value="1"[% ' checked' IF body.deleted %]> + <label for="deleted" class="inline">[% loc('Flag as deleted') %]</label> </p> <div class="admin-hint"> @@ -124,7 +128,7 @@ </div> <p> <label for="endpoint">[% loc('Endpoint') %]</label> - <input type="text" name="endpoint" id="endpoint" value="[% body.endpoint %]" size="50"> + <input type="text" name="endpoint" id="endpoint" value="[% body.endpoint | html %]" size="50"> </p> <div class="admin-hint"> @@ -137,7 +141,7 @@ </div> <p> <label for="jurisdiction">Open311 Jurisdiction</label> - <input type="text" name="jurisdiction" id="jurisdiction" value="[% body.jurisdiction %]" size="50"> + <input type="text" name="jurisdiction" id="jurisdiction" value="[% body.jurisdiction | html %]" size="50"> </p> <div class="admin-hint"> @@ -150,7 +154,7 @@ </div> <p> <label for="api_key">Open311 API Key</label> - <input type="text" name="api_key" id="api_key" value="[% body.api_key %]" size="25"> + <input type="text" name="api_key" id="api_key" value="[% body.api_key | html %]" size="25"> </p> <div class="admin-hint"> diff --git a/templates/web/base/admin/body.html b/templates/web/base/admin/body.html index cd87a5af8..867c981e3 100644 --- a/templates/web/base/admin/body.html +++ b/templates/web/base/admin/body.html @@ -65,7 +65,7 @@ </tr> [% WHILE ( cat = contacts.next ) %] <tr [% IF cat.deleted %]class="is-deleted"[% END %]> - <td class="contact-category"><a href="[% c.uri_for( 'body', body_id, cat.category ) %]">[% cat.category %]</a> + <td class="contact-category"><a href="[% c.uri_for( 'body', body_id, cat.category ) %]">[% cat.category | html %]</a> <br>[% cat.email | html %]</td> <td> [% loc('Confirmed') %]: @@ -79,10 +79,10 @@ <br>[% loc('Devolved') %]: [%- IF body.can_be_devolved AND cat.send_method %][% loc('Yes') %][% ELSE %][% loc('No') %][% END %] </td> - <td>[% cat.editor %] + <td>[% cat.editor | html %] <br><small>[% PROCESS format_time time=cat.whenedited %]</small></td> <td>[% cat.note | html %]</td> - <td><input type="checkbox" name="confirmed" value="[% cat.category %]"></td> + <td><input type="checkbox" name="confirmed" value="[% cat.category | html %]"></td> </tr> [% END %] </table> diff --git a/templates/web/base/admin/category_edit.html b/templates/web/base/admin/category_edit.html index ef7a0a11c..fb7475e1f 100644 --- a/templates/web/base/admin/category_edit.html +++ b/templates/web/base/admin/category_edit.html @@ -48,17 +48,17 @@ <form method="post" action="[% c.uri_for('body', body_id ) %]" enctype="application/x-www-form-urlencoded" accept-charset="utf-8"> <p> <label for="endpoint">Endpoint</label> - <input type="text" name="endpoint" id="endpoint" value="[% contact.endpoint %]" size="50"> + <input type="text" name="endpoint" id="endpoint" value="[% contact.endpoint | html %]" size="50"> </p> <p> <label for="jurisdiction">Jurisdiction</label> - <input type="text" name="jurisdiction" id="jurisdiction" value="[% contact.jurisdiction %]" size="50"> + <input type="text" name="jurisdiction" id="jurisdiction" value="[% contact.jurisdiction | html %]" size="50"> </p> <p> <label for="api_key">Api Key</label> - <input type="text" name="api_key" id="api_key" value="[% contact.api_key %]" size="25"> + <input type="text" name="api_key" id="api_key" value="[% contact.api_key | html %]" size="25"> </p> <p> @@ -93,7 +93,7 @@ <td>[% PROCESS highlightchanged old=prev new=contact value='email' %]</td> <td>[% PROCESS highlightchanged_yesno old=prev new=contact value='confirmed' %]</td> <td>[% PROCESS highlightchanged_yesno old=prev new=contact value='deleted' %]</td> - <td>[% contact.editor %]</td> + <td>[% contact.editor | html %]</td> <td>[% contact.note | html %]</td> </tr> [%- prev = contact %] diff --git a/web/js/fixmystreet-admin.js b/web/js/fixmystreet-admin.js index e49516a5c..5e0d873c5 100644 --- a/web/js/fixmystreet-admin.js +++ b/web/js/fixmystreet-admin.js @@ -9,7 +9,7 @@ $(function(){ var show_open311 = false; if ($('#endpoint').val()) { show_open311 = true; // always show the form if there is an endpoint value - } else if (send_method && send_method.toLowerCase() != 'email') { + } else if (send_method && !send_method.match(/^(email|emptyhomes|noop|refused)$/i)) { show_open311 = true; } if (show_open311) { |