[NUUG fiksgatami] [patch] Make iphone URL on front page optional and configurable
Petter Reinholdtsen
pere at hungry.com
Sat Jan 24 11:06:24 CET 2009
The norwegian site do not have a working iphone application available,
and thus should not advertice it. When it is ready, I fear that it
might not be the same version as the one used for fixmystreet.com.
Because of this, I propose to make it optional to show the link on the
front page or not, and the URL used configurable. here is a patch to
do that. It also make the text translatable.
Index: bci/conf/general-example
===================================================================
RCS file: /repos/mysociety/bci/conf/general-example,v
retrieving revision 1.16
diff -u -3 -p -r1.16 general-example
--- bci/conf/general-example 29 Mar 2008 03:03:34 -0000 1.16
+++ bci/conf/general-example 24 Jan 2009 10:03:47 -0000
@@ -56,4 +56,6 @@ define('OPTION_HEARFROMYOURMP_BASE_URL',
define('OPTION_SMTP_SMARTHOST', 'localhost');
define('OPTION_FLICKR_API', '');
+
+define('OPTION_IPHONE_URL', 'http://www.mysociety.org/2008/12/10/fixmystreet-iphone/');
?>
Index: bci/web/index.cgi
===================================================================
RCS file: /repos/mysociety/bci/web/index.cgi,v
retrieving revision 1.240
diff -u -3 -p -r1.240 index.cgi
--- bci/web/index.cgi 15 Jan 2009 10:37:00 -0000 1.240
+++ bci/web/index.cgi 24 Jan 2009 10:03:47 -0000
@@ -103,13 +103,18 @@ sub front_page {
$subhead = '(like graffiti, fly tipping, or neighbourhood noise)' if $q->{site} eq 'scambs';
$out .= '<br><small>' . $subhead . '</small>' if $subhead ne ' ';
$out .= '</p>';
- $out .= '
+ if (mySociety::Config::get('IPHONE_URL')) {
+ my $url = mySociety::Config::get('IPHONE_URL');
+ my $getiphone = _("Get FixMyStreet on your iPhone");
+ if ($q->{site} eq 'fixmystreet') {
+ $out .= <<EOF
<p align="center" style="margin-bottom:0">
<img alt="New!" src="/i/new.png" border="0">
-<a href="http://www.mysociety.org/2008/12/10/fixmystreet-iphone/">
-Get FixMyStreet on your iPhone</a>
+<a href="$url">$getiphone</a>
</p>
-' if $q->{site} eq 'fixmystreet';
+EOF
+ }
+ }
$out .= '<p id="error">' . $error . '</p>' if ($error);
my $fixed = Problems::recent_fixed();
my $updates = Problems::number_comments();
Happy hacking,
--
Petter Reinholdtsen
More information about the fiksgatami
mailing list