wisest owl (wisest_owl) wrote in changelog,
wisest owl
wisest_owl
changelog

[livejournal] r18253: LJSUP-7908. Link to mobile

Committer: gprochaev
LJSUP-7908. Link to mobile

U   trunk/bin/upgrading/en.dat
U   trunk/cgi-bin/LJ/ControlStrip.pm
U   trunk/cgi-bin/weblib.pl
U   trunk/templates/ControlStrip/main.tmpl
Modified: trunk/bin/upgrading/en.dat
===================================================================
--- trunk/bin/upgrading/en.dat	2011-02-10 05:43:36 UTC (rev 18252)
+++ trunk/bin/upgrading/en.dat	2011-02-10 06:43:17 UTC (rev 18253)
@@ -2740,6 +2740,8 @@
 
 langname.en=English
 
+link.mobile=<a href="http://m.livejournal.com/?from_url=[[url]]">Go to mobile version</a>
+
 ljfeedback.text=Like to vote?  Join [[journal]] where we post polls and surveys that help influence and improve LJ.
 
 ljlib.pageofpages=Page [[page]] of [[total]]

Modified: trunk/cgi-bin/LJ/ControlStrip.pm
===================================================================
--- trunk/cgi-bin/LJ/ControlStrip.pm	2011-02-10 05:43:36 UTC (rev 18252)
+++ trunk/cgi-bin/LJ/ControlStrip.pm	2011-02-10 06:43:17 UTC (rev 18253)
@@ -317,9 +317,21 @@
         die_on_bad_params => 1,
         strict => 0,
     ) or die "Can't open template: $!";
-        
-    $tmpl->param(flatten($data));
 
+    my $mobile_link = '';
+    if (Apache::WURFL->is_mobile()) {
+        my $uri = LJ::Request->uri;
+        my $hostname = LJ::Request->hostname;
+        my $args = LJ::Request->args;
+        my $args_wq = $args ? "?$args" : "";
+        my $is_ssl = $LJ::IS_SSL = LJ::run_hook("ssl_check");
+        my $proto = $is_ssl ? "https://" : "http://";
+        my $url = LJ::eurl ($proto.$hostname.$uri.$args_wq);
+        $mobile_link = LJ::Lang::ml('link.mobile', { url => $url });
+    }
+
+    $tmpl->param(flatten($data), link_mobile => $mobile_link );
+
     # use Data::Dumper;
     # warn Dumper({flatten($data)}), "\n";
  

Modified: trunk/cgi-bin/weblib.pl
===================================================================
--- trunk/cgi-bin/weblib.pl	2011-02-10 05:43:36 UTC (rev 18252)
+++ trunk/cgi-bin/weblib.pl	2011-02-10 06:43:17 UTC (rev 18253)
@@ -21,6 +21,7 @@
                       LJ::M::FriendsOf
                       );
 use LJ::ControlStrip;
+use Apache::WURFL;
 
 # <LJFUNC>
 # name: LJ::img
@@ -2188,7 +2189,18 @@
     my $message;
     $message = LJ::Widget::SiteMessages->render if LJ::Widget::SiteMessages->should_render;
 
-    return "<table id='lj_controlstrip' cellpadding='0' cellspacing='0'><tr valign='top'>$ret</tr><tr><td colspan='5'>$message</td></tr></table>";
+    my $mobile_link = '';
+    if (Apache::WURFL->is_mobile()) {
+        my $uri = LJ::Request->uri;
+        my $hostname = LJ::Request->hostname;
+        my $args = LJ::Request->args;
+        my $args_wq = $args ? "?$args" : "";
+        my $is_ssl = $LJ::IS_SSL = LJ::run_hook("ssl_check");
+        my $proto = $is_ssl ? "https://" : "http://";
+        my $url = LJ::eurl ($proto.$hostname.$uri.$args_wq);
+        $mobile_link = "<table><tr><td style='color:#FFFFFF'>".LJ::Lang::ml('link.mobile', { url => $url })."</td></tr></table>";
+    }
+    return "<table id='lj_controlstrip' cellpadding='0' cellspacing='0'><tr><td colspan='5'>$mobile_link</td></tr><tr valign='top'>$ret</tr><tr><td colspan='5'>$message</td></tr></table>";
 }
 
 sub control_strip_js_inject

Modified: trunk/templates/ControlStrip/main.tmpl
===================================================================
--- trunk/templates/ControlStrip/main.tmpl	2011-02-10 05:43:36 UTC (rev 18252)
+++ trunk/templates/ControlStrip/main.tmpl	2011-02-10 06:43:17 UTC (rev 18253)
@@ -1,3 +1,4 @@
+<TMPL_VAR link_mobile>
 <TMPL_IF remote_is_logged_in>
 <TMPL_INCLUDE name="user.tmpl">
 <TMPL_ELSE>

Tags: dat, livejournal, pl, pm, tmpl, wisest-owl
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments