var s = $('imp_select_view');
if (s) {
s.down('option[value=dimp]').show();
- if (this.dimp_sel) {
- s.selectedIndex = s.down('option[value=dimp]').index;
+ s.down('option[value=mobile]').show();
+ if (this.pre_sel) {
+ s.selectedIndex = s.down('option[value=' + this.pre_sel + ']').index;
}
}
}
if (!($view_cookie = Horde_Util::getFormData('imp_select_view'))) {
$view_cookie = isset($_COOKIE['default_imp_view'])
? $_COOKIE['default_imp_view']
- : ($GLOBALS['browser']->isMobile() ? 'mimp' : 'imp');
+ : ($GLOBALS['browser']->isMobile()
+ ? ($GLOBALS['browser']->getBrowser() == 'webkit'
+ ? 'mimp'
+ : 'mobile')
+ : 'imp');
}
- $js_code['-ImpLogin.dimp_sel'] = intval($view_cookie == 'dimp');
+ $js_code['ImpLogin.pre_sel'] = $view_cookie;
$params['imp_select_view'] = array(
'label' => _("Mode"),
'dimp' => array(
'hidden' => true,
'name' => _("Dynamic")
- // Dimp selected is handled by javascript (dimp_sel)
+ ),
+ 'mobile' => array(
+ 'hidden' => true,
+ 'name' => _("Mobile (Smartphone)")
),
'mimp' => array(
'name' => _("Mobile"),
static public function setViewMode($view)
{
/* Enforce minimum browser standards for DIMP. */
- if (($view == 'dimp') && !Horde::ajaxAvailable()) {
- $view = 'imp';
- $GLOBALS['notification']->push(_("Your browser is too old to display the dynamic mode. Using traditional mode instead."), 'horde.warning');
+ if (($view == 'dimp' || $view == 'mobile') && !Horde::ajaxAvailable()) {
+ if ($view == 'dimp') {
+ $view = 'imp';
+ $GLOBALS['notification']->push(_("Your browser is too old to display the dynamic mode. Using traditional mode instead."), 'horde.warning');
+ } else {
+ $view = 'mimp';
+ $GLOBALS['notification']->push(_("Your browser is too old to display the smartphone mode. Using mobile mode instead."), 'horde.warning');
+ }
}
$GLOBALS['session']->set('imp', 'view', $view);