diff options
author | louise <louise> | 2009-11-17 13:58:47 +0000 |
---|---|---|
committer | louise <louise> | 2009-11-17 13:58:47 +0000 |
commit | 0965d501ff89fe0dbde3f2ef1290d1544f089e13 (patch) | |
tree | 319935ceea57652a0cc60b06f2c21392e8d913eb | |
parent | b09bd296208858f2248a5407b084f48fb84e10ff (diff) |
Allow cobrands to determin display of update offensiveness reporting links
-rw-r--r-- | perllib/Cobrand.pm | 24 | ||||
-rw-r--r-- | perllib/Page.pm | 15 |
2 files changed, 32 insertions, 7 deletions
diff --git a/perllib/Cobrand.pm b/perllib/Cobrand.pm index ccf508b9d..13ba644a9 100644 --- a/perllib/Cobrand.pm +++ b/perllib/Cobrand.pm @@ -7,7 +7,7 @@ # Copyright (c) 2009 UK Citizens Online Democracy. All rights reserved. # Email: louise@mysociety.org. WWW: http://www.mysociety.org # -# $Id: Cobrand.pm,v 1.39 2009-11-17 10:36:35 louise Exp $ +# $Id: Cobrand.pm,v 1.40 2009-11-17 13:58:47 louise Exp $ package Cobrand; use strict; @@ -585,6 +585,28 @@ sub allow_photo_display { } } +=item allow_update_reporting COBRAND + +Return a boolean indication whether users should see links next to updates allowing them +to report them as offensive. + +=cut + +sub allow_update_reporting { + my ($cobrand) = @_; + my $handle; + if ($cobrand){ + $handle = cobrand_handle($cobrand); + } + if ( !$cobrand || !$handle || !$handle->can('allow_update_reporting')){ + return 0; + } else{ + return $handle->allow_update_reporting(); + } + +} + + =item council_check COBRAND COUNCILS QUERY Return a boolean indicating whether the councils for the location passed any extra checks defined by the cobrand diff --git a/perllib/Page.pm b/perllib/Page.pm index 0b85afa6c..246e5a211 100644 --- a/perllib/Page.pm +++ b/perllib/Page.pm @@ -6,7 +6,7 @@ # Copyright (c) 2006 UK Citizens Online Democracy. All rights reserved. # Email: matthew@mysociety.org; WWW: http://www.mysociety.org/ # -# $Id: Page.pm,v 1.207 2009-11-17 10:17:31 louise Exp $ +# $Id: Page.pm,v 1.208 2009-11-17 13:58:48 louise Exp $ # package Page; @@ -860,11 +860,14 @@ sub display_problem_updates($$) { if ($display_photos && $row->{has_photo}) { $out .= '<p><img alt="" height=100 src="/photo?tn=1;c=' . $row->{id} . '"></p>'; } - my $contact = '/contact?id=' . $id . ';update_id='. $row->{id}; - my $contact_url = Cobrand::url($cobrand, $contact, $q); - $out .= '<p>'; - $out .= $q->a({rel => 'nofollow', class => 'unsuitable-report', href => $contact_url}, _('Offensive? Unsuitable? Tell us')); - $out .= '</p>'; + my $allow_update_reporting = Cobrand::allow_update_reporting($cobrand); + if ($allow_update_reporting) { + my $contact = '/contact?id=' . $id . ';update_id='. $row->{id}; + my $contact_url = Cobrand::url($cobrand, $contact, $q); + $out .= '<p>'; + $out .= $q->a({rel => 'nofollow', class => 'unsuitable-report', href => $contact_url}, _('Offensive? Unsuitable? Tell us')); + $out .= '</p>'; + } $out .= '</div>'; } $out .= '</div>'; |