aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStruan Donald <struan@exo.org.uk>2012-07-12 15:11:39 +0100
committerStruan Donald <struan@exo.org.uk>2012-07-12 15:11:39 +0100
commit5e85e2e217d5b453212924765d592c235eb93071 (patch)
treea57d1b1ef463f5907da1ad9f85523d9aa342671d
parenta2dee2c1cb846615c1915b93d19d85a2f9dc22e0 (diff)
parent8c297f3f178dc8e3678ab28d5d686d2ee542d96c (diff)
Merge remote-tracking branch 'origin/fmb-read-only' into fmb-read-only
-rw-r--r--db/schema_0021-add_external_source_columns_to_problem.sql8
-rw-r--r--perllib/FixMyStreet/App/Controller/Report/New.pm13
-rw-r--r--perllib/FixMyStreet/DB/Result/Comment.pm12
-rw-r--r--perllib/FixMyStreet/DB/Result/Problem.pm10
-rw-r--r--templates/web/fixmybarangay/around/tabbed_lists.html8
-rw-r--r--templates/web/fixmybarangay/header.html26
6 files changed, 46 insertions, 31 deletions
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..4105ebb39
--- /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 INTEGER;
+
+commit;
diff --git a/perllib/FixMyStreet/App/Controller/Report/New.pm b/perllib/FixMyStreet/App/Controller/Report/New.pm
index c09b721b9..b0b338c69 100644
--- a/perllib/FixMyStreet/App/Controller/Report/New.pm
+++ b/perllib/FixMyStreet/App/Controller/Report/New.pm
@@ -1002,11 +1002,12 @@ sub save_user_and_report : Private {
$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->req->param('mm_msg_id')) {
- $c->stash->{mm_msg_id} = $c->req->param('mm_msg_id');
- $report->service( $c->req->param('mm_msg_id') );
+ 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,8 +1072,8 @@ sub redirect_or_confirm_creation : Private {
$c->forward( 'create_reporter_alert' );
my $report_uri;
- if ( $c->cobrand->moniker eq 'fixmybarangay' && $c->user->from_council && $c->stash->{mm_msg_id}) {
- $report_uri = $c->uri_for( '/report', $report->id, undef, { mm_msg_id => $c->stash->{mm_msg_id} } );
+ 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->uri_for( '/report', $report->id );
}
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 9cbaef6c2..4f35e7c94 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/templates/web/fixmybarangay/around/tabbed_lists.html b/templates/web/fixmybarangay/around/tabbed_lists.html
index d73935a9c..77ca84ee4 100644
--- a/templates/web/fixmybarangay/around/tabbed_lists.html
+++ b/templates/web/fixmybarangay/around/tabbed_lists.html
@@ -61,16 +61,16 @@ $(document).ready(function() {
$('input[name=mm_text]').prop('checked', false); // uncheck all
}
$('#form_detail').val(msg_text);
- $('#mm_msg_id').val(service_id);
+ $('#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 "mm_msg_id": pass the MM id into FMS, if used
+ // problem form hidden input "external_source_id": pass the MM id into FMS, if used
$('<input type="hidden"/>').attr({
- 'id': 'mm_msg_id',
- 'name': 'mm_msg_id',
+ 'id': 'external_source_id',
+ 'name': 'external_source_id',
}).appendTo($('#problem_form'));
$('#available-submit').click(function(e){
diff --git a/templates/web/fixmybarangay/header.html b/templates/web/fixmybarangay/header.html
index 55cf47789..052b2dd4d 100644
--- a/templates/web/fixmybarangay/header.html
+++ b/templates/web/fixmybarangay/header.html
@@ -23,20 +23,22 @@
[% INCLUDE 'common_header_tags.html', js_override = '/cobrands/fixmystreet/fixmystreet.js' %]
<script src="[% version('/js/fancybox/jquery.fancybox-1.3.4.pack.js') %]" charset="utf-8"></script>
- <script src="[% version('/cobrands/fixmybarangay/message_manager_client.js') %]" charset="utf-8"></script>
[% allow_creation = !c.cobrand.only_authed_can_create || (c.user && c.user.from_council); %]
- [%IF allow_creation && problem.service %]
- <script>
- $(document).ready(function() {
- var mm_msg_id ="[% problem.service %]".match(/\d+$/);
- 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);
- }
- });
- </script>
+ [% IF allow_creation %]
+ <script src="[% version('/cobrands/fixmybarangay/message_manager_client.js') %]" charset="utf-8"></script>
+ [% IF c.req.params.external_source_id && problem && problem.external_source_id.match('^\d+$') %]
+ <script>
+ $(document).ready(function() {
+ 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);
+ }
+ });
+ </script>
+ [% END %]
[% END %]
</head>
<body class="[% bodyclass | html IF bodyclass %]">