Ticket #696: wifidog-iphone.patch

File wifidog-iphone.patch, 2.8 KB (added by wlach, 23 months ago)

Patch to conditionally replace CSS for iPhone/iPod devices

  • wifidog/media/base_theme/stylesheet-mobile.css

     
     1#left_area { 
     2        width: 100%; 
     3        position: static; 
     4        float: none; 
     5} 
     6 
     7#left_area_top { 
     8        position: static; 
     9        float: none; 
     10} 
     11 
     12#left_area_middle { 
     13        position: static; 
     14        float: none; 
     15} 
     16 
     17form.language { 
     18        text-align: center; 
     19} 
     20 
     21#main_area { 
     22        width: 100%; 
     23        float: none; 
     24} 
     25 
     26#main_area_top { 
     27        float: left; 
     28} 
     29 
     30#main_area_middle { 
     31        position: relative; 
     32        float: left; 
     33} 
     34 
     35#login_form { 
     36        float: none; 
     37} 
     38 
  • wifidog/config.php

     
    212212// Filenames and directories 
    213213define('NETWORK_THEME_PACKS_DIR', 'media/network_theme_packs/'); 
    214214define('STYLESHEET_NAME', 'stylesheet.css'); 
     215define('STYLESHEET_MOBILE_NAME', 'stylesheet-mobile.css'); 
    215216define('PRINT_STYLESHEET_NAME', 'printer.css'); 
    216217define('LOGIN_PAGE_NAME', 'login.html'); 
    217218define('HOTSPOT_STATUS_PAGE', 'hotspot_status.php'); 
  • wifidog/classes/MainUI.php

     
    575575        if ($networkThemePack) { 
    576576            $this->appendStylesheetURL($networkThemePack->getStylesheetUrl()); 
    577577        } 
     578        // if we're an iPhone... 
     579        if(empty($agent)) $agent = $_SERVER['HTTP_USER_AGENT']; 
     580        if(stristr($agent,'iphone') or stristr($agent,'ipod')) { 
     581            $this->smarty->assign('iPhoneUI', true); 
     582            $this->appendStylesheetURL(BASE_THEME_URL . STYLESHEET_MOBILE_NAME); 
     583        } 
    578584        // Checks to see if the theme file exists and if so, checks whether it should always show the page header. 
    579585        if (defined('ALWAYS_SHOW_HEADER') && ALWAYS_SHOW_HEADER == true) { 
    580586            $this->smarty->assign('alwaysShowHeader', true); 
  • wifidog/templates/classes/MainUI_Display.tpl

     
    5151        <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> 
    5252        <meta http-equiv="Pragma" content="no-cache"> 
    5353        <meta http-equiv="Expires" content="-1"> 
     54        {if $iPhoneUI} 
     55                <meta name="viewport" content="initial-scale=1.0; maximum-scale=1.0; user-scalable=no; width=device-width" /> 
     56        {/if} 
    5457        {$htmlHeaders} 
    5558        <title>{$title}</title> 
    5659        {foreach from=$stylesheetUrlArray item=stylesheetUrl}