[horde] imp/mimp tweak?

Michael M Slusarz slusarz at horde.org
Tue Oct 28 20:52:24 UTC 2008


Quoting Kevin Konowalec <webadmin at ualberta.ca>:

> Hmmm.... from my tests so far I'd have to say "nuh uh!".  Looks to  
> me that it does detect the mobile browser and so you get the  
> stripped-down login page BUT you still get the option to change  
> modes and traditionalist seems to be the default... which is  
> counterintuative.  You'd think if it's gone to mobile mode you'd  
> want it to default to minimalist but still have the option for  
> traditional (hell I'd love to see an iphone app mode...).

Hmmm... this is the code I am talking about:

if (!empty($conf['user']['select_view'])) {
     $apps = $registry->listApps(null, true);
     $view_cookie = isset($_COOKIE['default_imp_view'])
         ? $_COOKIE['default_imp_view']
         : ($browser->isMobile() && isset($apps['mimp']) ? 'mimp' : 'imp');
     if (isset($apps['dimp']) || isset($apps['mimp'])) {
         $views[] = array('sel' => $view_cookie == 'imp',
                          'val' => 'imp', 'name' => _("Traditional"));
         if (isset($apps['dimp'])) {
             $views[] = array('sel' => $view_cookie == 'dimp',
                              'val' => 'dimp', 'name' => _("Dynamic"));
         }
         if (isset($apps['mimp'])) {
             $views[] = array('sel' => $view_cookie == 'mimp',
                              'val' => 'mimp', 'name' => _("Minimalist"));
         }
     }
}

That code will set $view_cookie to 'mimp' if there is not a cookie  
already set, the browser is mobile, and mimp is available.  Then when  
creating the drop-down list, the 'mimp' entry should be selected  
(because 'sel' is set to true - this causes a selected="selected" to  
be added to the HTML <option> output).

michael

-- 
___________________________________
Michael Slusarz [slusarz at horde.org]



More information about the horde mailing list