if (empty($conf['user']['force_view'])) {
if (empty($conf['user']['select_view']) ||
empty($sess['cache']['select_view'])) {
- $sess['view'] = $GLOBALS['browser']->isMobile()
+ $view = $GLOBALS['browser']->isMobile()
? 'mimp'
: ($GLOBALS['prefs']->getValue('dynamic_view') ? 'dimp' : 'imp');
} else {
$setcookie = true;
- $sess['view'] = $sess['cache']['select_view'];
+ $view = $sess['cache']['select_view'];
}
} else {
- $sess['view'] = $conf['user']['force_view'];
+ $view = $conf['user']['force_view'];
}
- /* Enforce minimum browser standards for DIMP. */
- if (($sess['view'] == 'dimp') && !Horde::ajaxAvailable()) {
- $sess['view'] = 'imp';
- $GLOBALS['notification']->push(_("Your browser is too old to display the dynamic mode. Using traditional mode instead."), 'horde.warning');
- }
+ self::setViewMode($view);
if ($setcookie) {
setcookie('default_imp_view', $sess['view'], time() + 30 * 86400, $conf['cookie']['path'], $conf['cookie']['domain']);
self::_logMessage('login', 'NOTICE');
}
+ /**
+ * Sets the current view mode.
+ *
+ * @return string Either 'dimp', 'imp', or 'mimp'.
+ */
+ 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');
+ }
+
+ $_SESSION['imp']['view'] = $view;
+ }
+
}
}
break;
+ case 'dimp':
+ if (!empty($conf['user']['force_view'])) {
+ $ui->suppress[] = 'dynamic_view';
+ }
+ break;
+
case 'display':
/* Set the timezone on this page so the 'time_format' output uses
* the configured time zone's time, not the system's time zone. */
}
break;
+ case 'dimp':
+ if ($prefs->isDirty('dynamic_view')) {
+ $_SESSION['imp']['view'] = $prefs->getValue('dynamic_view')
+ ? 'dimp'
+ : ($GLOBALS['browser']->isMobile() ? 'mimp' : 'imp');
+ }
+ break;
+
case 'display':
if ($prefs->isDirty('tree_view')) {
$GLOBALS['registry']->getApiInstance('imp', 'application')->mailboxesChanged();