From: Michael M Slusarz Date: Mon, 30 Aug 2010 21:51:55 +0000 (-0600) Subject: Request #9203: Change cached imp view on dynamic_view pref change X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=fa2962a8d2508b82a41f06bb50ca4e08491cf9ad;p=horde.git Request #9203: Change cached imp view on dynamic_view pref change --- diff --git a/imp/lib/Auth.php b/imp/lib/Auth.php index e7646f880..6e54b95f9 100644 --- a/imp/lib/Auth.php +++ b/imp/lib/Auth.php @@ -465,22 +465,18 @@ class IMP_Auth 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']); @@ -509,4 +505,20 @@ class IMP_Auth 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; + } + } diff --git a/imp/lib/Prefs/Ui.php b/imp/lib/Prefs/Ui.php index d177d3b04..db12f5cdd 100644 --- a/imp/lib/Prefs/Ui.php +++ b/imp/lib/Prefs/Ui.php @@ -131,6 +131,12 @@ class IMP_Prefs_Ui } 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. */ @@ -533,6 +539,14 @@ class IMP_Prefs_Ui } 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();