[NUUG fiksgatami] [patch] Make it trivial to add smartphone app links on front page

Petter Reinholdtsen pere at hungry.com
Sun Mar 20 09:41:47 CET 2011


[Petter Reinholdtsen]
> The result can be seen on <URL: http://fiksgatami-dev.nuug.no/ > at
> the moment.

And here is an updated patch, shortening the title of the block as
well as cleaning up the code a bit.  I changed from H4 to H2.  Not
sure which header make most sense.  I suspect some CSS rules to place
the block might be useful, but I found its default location OK so I
left it alone.

Happy hacking,
-- 
Petter Reinholdtsen
-------------- next part --------------
diff --git a/conf/general-example b/conf/general-example
index 20872ae..0176b04 100644
--- a/conf/general-example
+++ b/conf/general-example
@@ -64,6 +64,8 @@ define('OPTION_FLICKR_API', '');
 
 define('OPTION_IPHONE_URL', '');
 
+define('OPTION_ANDROID_URL', '');
+
 // Log file (used in test harness, and later in admin scripts)
 define('OPTION_HTTPD_ERROR_LOG', '/var/log/apache/error.log');
 
diff --git a/web/index.cgi b/web/index.cgi
index fd6d8a1..882fb86 100755
--- a/web/index.cgi
+++ b/web/index.cgi
@@ -136,18 +136,6 @@ sub front_page {
     my $subhead = _('(like graffiti, fly tipping, broken paving slabs, or street lighting)');
     $out .= '<br><small>' . $subhead . '</small>' if $subhead ne ' ';
     $out .= '</p>';
-    #if (my $url = mySociety::Config::get('IPHONE_URL')) {
-    #    my $getiphone = _("Get FixMyStreet on your iPhone");
-    #    my $new = _("New!");
-    #    if ($q->{site} eq 'fixmystreet') {
-    #        $out .= <<EOF
-#<p align="center" style="margin-bottom:0">
-#<img width="23" height="12" alt="$new" src="/i/new.png" border="0">
-#<a href="$url">$getiphone</a>
-#</p>
-#EOF
-    #    }
-    #}
     $out .= '<p class="error">' . $error . '</p>' if ($error);
 
     # Add pretty commas for display
@@ -204,6 +192,22 @@ EOF
     $out .= '</div>';
     }   
 
+    if (mySociety::Config::get('IPHONE_URL')
+        || mySociety::Config::get('ANDROID_URL')) {
+        $out .= '<div class="smartphone_block"n>';
+        $out .= $q->h2(_("Smartphone application")) . "\n";
+        if (mySociety::Config::get('IPHONE_URL')) {
+            my $url = mySociety::Config::get('IPHONE_URL');
+            # Or download and store in web/i/iphone.png
+            $out .= "<a href=\"$url\" target=\"_blank\"><img src=\"http://fixmystreet.com.br/media/images/prontosocorro_br/iphone.png\"/></a>\n";
+        }
+        if (mySociety::Config::get('ANDROID_URL')) {
+            my $url = mySociety::Config::get('ANDROID_URL');
+            # Or download and store in web/i/android.png
+            $out .= "<a href=\"$url\" target=\"_blank\"><img src=\"http://fixmystreet.com.br/media/images/prontosocorro_br/android.png\"/></a>\n";
+        }
+        $out .= "</div>\n";
+    }
     return ($out, %params);
 }
 


More information about the fiksgatami mailing list