From c8ae2497b7e4c7393210ed186acd672a0040389f Mon Sep 17 00:00:00 2001 From: thomascube Date: Wed, 3 Sep 2008 16:03:19 +0000 Subject: Auto-detect client language and timezone if desired by config/prefs --- program/steps/settings/func.inc | 7 ++++--- program/steps/settings/save_prefs.inc | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) (limited to 'program/steps/settings') diff --git a/program/steps/settings/func.inc b/program/steps/settings/func.inc index 5b6e11308..ef3c24d26 100644 --- a/program/steps/settings/func.inc +++ b/program/steps/settings/func.inc @@ -49,14 +49,15 @@ function rcmail_user_prefs_form($attrib) $select_lang->add(array_values($a_lang), array_keys($a_lang)); $table->add('title', html::label($field_id, Q(rcube_label('language')))); - $table->add(null, $select_lang->show($_SESSION['language'])); + $table->add(null, $select_lang->show($config['language'])); } // show page size selection if (!isset($no_override['timezone'])) { $field_id = 'rcmfd_timezone'; - $select_timezone = new html_select(array('name' => '_timezone', 'id' => $field_id)); + $select_timezone = new html_select(array('name' => '_timezone', 'id' => $field_id, 'onchange' => "document.getElementById('rcmfd_dst').disabled=this.selectedIndex==0")); + $select_timezone->add(rcube_label('autodetect'), 'auto'); $select_timezone->add('(GMT -11:00) Midway Island, Samoa', '-11'); $select_timezone->add('(GMT -10:00) Hawaii', '-10'); $select_timezone->add('(GMT -9:30) Marquesas Islands', '-9.5'); @@ -104,7 +105,7 @@ function rcmail_user_prefs_form($attrib) // daylight savings if (!isset($no_override['dst_active'])) { $field_id = 'rcmfd_dst'; - $input_dst = new html_checkbox(array('name' => '_dst_active', 'id' => $field_id, 'value' => 1)); + $input_dst = new html_checkbox(array('name' => '_dst_active', 'id' => $field_id, 'value' => 1, 'disabled' => ($config['timezone'] == 'auto'))); $table->add('title', html::label($field_id, Q(rcube_label('dstactive')))); $table->add(null, $input_dst->show($config['dst_active'])); diff --git a/program/steps/settings/save_prefs.inc b/program/steps/settings/save_prefs.inc index 3bccffae2..edd184a52 100644 --- a/program/steps/settings/save_prefs.inc +++ b/program/steps/settings/save_prefs.inc @@ -20,7 +20,7 @@ */ $a_user_prefs = array( - 'timezone' => isset($_POST['_timezone']) ? floatval($_POST['_timezone']) : $CONFIG['timezone'], + 'timezone' => isset($_POST['_timezone']) ? (is_numeric($_POST['_timezone']) ? floatval($_POST['_timezone']) : get_input_value('_timezone', RCUBE_INPUT_POST)) : $CONFIG['timezone'], 'dst_active' => isset($_POST['_dst_active']) ? TRUE : FALSE, 'pagesize' => is_numeric($_POST['_pagesize']) ? max(2, intval($_POST['_pagesize'])) : $CONFIG['pagesize'], 'prettydate' => isset($_POST['_pretty_date']) ? TRUE : FALSE, -- cgit v1.2.3