]> git.mxchange.org Git - friendica.git/commitdiff
add mobile toggle to frost mobile
authorZach Prezkuta <fermion@gmx.com>
Thu, 13 Sep 2012 03:35:51 +0000 (21:35 -0600)
committerZach Prezkuta <fermion@gmx.com>
Thu, 13 Sep 2012 03:35:51 +0000 (21:35 -0600)
boot.php
mod/toggle_mobile.php [new file with mode: 0644]
view/theme/frost-mobile/default.php
view/theme/frost-mobile/login-style.css
view/theme/frost-mobile/style.css

index c0a7a0e298522830fca8070ef443e6d04a1479d4..758193450912af9ea13c36ba4ca70f78c3db6064 100644 (file)
--- a/boot.php
+++ b/boot.php
@@ -1511,14 +1511,20 @@ if(! function_exists('current_theme')) {
                $is_mobile = $mobile_detect->isMobile() || $mobile_detect->isTablet();
        
                if($is_mobile) {
-                       $system_theme = ((isset($a->config['system']['mobile-theme'])) ? $a->config['system']['mobile-theme'] : '');
-                       $theme_name = ((isset($_SESSION) && x($_SESSION,'mobile-theme')) ? $_SESSION['mobile-theme'] : $system_theme);
-
-                       if($theme_name === '---') {
-                               // user has selected to have the mobile theme be the same as the normal one
+                       if(isset($_SESSION['show-mobile']) && !$_SESSION['show-mobile']) {
                                $system_theme = '';
                                $theme_name = '';
                        }
+                       else {
+                               $system_theme = ((isset($a->config['system']['mobile-theme'])) ? $a->config['system']['mobile-theme'] : '');
+                               $theme_name = ((isset($_SESSION) && x($_SESSION,'mobile-theme')) ? $_SESSION['mobile-theme'] : $system_theme);
+
+                               if($theme_name === '---') {
+                                       // user has selected to have the mobile theme be the same as the normal one
+                                       $system_theme = '';
+                                       $theme_name = '';
+                               }
+                       }
                }
                if(!$is_mobile || ($system_theme === '' && $theme_name === '')) {
                        $system_theme = ((isset($a->config['system']['theme'])) ? $a->config['system']['theme'] : '');
@@ -1760,3 +1766,20 @@ function build_querystring($params, $name=null) {
     } 
     return $ret;    
 }
+
+/**
+* Returns the complete URL of the current page, e.g.: http(s)://something.com/network
+*
+* Taken from http://webcheatsheet.com/php/get_current_page_url.php
+*/
+function curPageURL() {
+       $pageURL = 'http';
+       if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
+       $pageURL .= "://";
+       if ($_SERVER["SERVER_PORT"] != "80" && $_SERVER["SERVER_PORT"] != "443") {
+               $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
+       } else {
+               $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
+       }
+       return $pageURL;
+}
diff --git a/mod/toggle_mobile.php b/mod/toggle_mobile.php
new file mode 100644 (file)
index 0000000..00991e4
--- /dev/null
@@ -0,0 +1,17 @@
+<?php
+
+function toggle_mobile_init(&$a) {
+
+       if(isset($_GET['off']))
+               $_SESSION['show-mobile'] = false;
+       else
+               $_SESSION['show-mobile'] = true;
+
+       if(isset($_GET['address']))
+               $address = $_GET['address'];
+       else
+               $address = $a->get_baseurl();
+
+       goaway($address);
+}
+
index d076c10f07d4d90880dfa5679ca1f02095d161f6..c2a20255f6f2e8650bc8cf2b6933668a8066e43f 100644 (file)
@@ -21,6 +21,9 @@
        <section><?php if(x($page,'content')) echo $page['content']; ?>\r
        </section>\r
        </div>\r
+       <footer>\r
+       <a href="<?php echo $a->get_baseurl() ?>/toggle_mobile?off=1&address=<?php echo curPageURL() ?>">toggle mobile</a>\r
+       </footer>\r
 \r
        <?php } else { ?>\r
        <div class='main-container'>\r
                </div>\r
                <right_aside><?php if(x($page,'right_aside')) echo $page['right_aside']; ?></right_aside>\r
                <?php if( ($a->module === 'contacts') && x($page,'aside')) echo $page['aside']; ?>\r
-               <footer><?php if(x($page,'footer')) echo $page['footer']; ?></footer>\r
+               <footer>\r
+               <a href="<?php echo $a->get_baseurl() ?>/toggle_mobile?off=1&address=<?php echo curPageURL() ?>">toggle mobile</a>\r
+               <?php if(x($page,'footer')) echo $page['footer']; ?>\r
+               </footer>\r
 <!--           </div>-->\r
        </div>\r
        <?php } ?>\r
index 5c07aba77222008280030daf43b3ec687485960d..37661cfbc7df08b5afa6cd59441111ca288fd600 100644 (file)
@@ -152,3 +152,9 @@ div.section-wrapper {
 #login-submit-wrapper {
        text-align: center;
 }
+
+footer {
+       text-align: center;
+       padding-top: 3em;
+       padding-bottom: 1em;
+}
index ef08bcb3f19fe4d13e11f813470877ecc7f381a2..c58a32df669a3a62eb6a28ab52e72a521d604854 100644 (file)
@@ -393,8 +393,8 @@ section {
 \r
 /* footer */\r
 footer {\r
-    display: none;\r
-\r
+       text-align: center;\r
+       padding-bottom: 1em;\r
 }\r
 \r
 .birthday-today, .event-today {\r