diff options
Diffstat (limited to 'program/steps')
-rw-r--r-- | program/steps/settings/func.inc | 27 | ||||
-rw-r--r-- | program/steps/settings/save_prefs.inc | 8 |
2 files changed, 35 insertions, 0 deletions
diff --git a/program/steps/settings/func.inc b/program/steps/settings/func.inc index 9e6b601a1..e6fd9109d 100644 --- a/program/steps/settings/func.inc +++ b/program/steps/settings/func.inc @@ -237,6 +237,33 @@ function rcmail_user_prefs($current=null) ); } + // date/time formatting + if (!isset($no_override['time_format'])) { + $reftime = mktime(7,30,0); + $field_id = 'rcmfd_time_format'; + $select_time = new html_select(array('name' => '_time_format', 'id' => $field_id)); + foreach ((array)$RCMAIL->config->get('time_formats', array('G:i', 'H:i', 'g:i a', 'h:i A')) as $choice) + $select_time->add(date($choice, $reftime), $choice); + + $blocks['main']['options']['time_format'] = array( + 'title' => html::label($field_id, Q(rcube_label('timeformat'))), + 'content' => $select_time->show($RCMAIL->config->get('time_format')), + ); + } + + if (!isset($no_override['date_format'])) { + $refdate = mktime(12,30,0,7,24); + $field_id = 'rcmfd_date_format'; + $select_date = new html_select(array('name' => '_date_format', 'id' => $field_id)); + foreach ((array)$RCMAIL->config->get('date_formats', array('Y-m-d','d-m-Y','Y/m/d','m/d/Y','d/m/Y','d.m.Y','j.n.Y')) as $choice) + $select_date->add(date($choice, $refdate), $choice); + + $blocks['main']['options']['date_format'] = array( + 'title' => html::label($field_id, Q(rcube_label('dateformat'))), + 'content' => $select_date->show($config['date_format']), + ); + } + // MM: Show checkbox for toggling 'pretty dates' if (!isset($no_override['prettydate'])) { $field_id = 'rcmfd_prettydate'; diff --git a/program/steps/settings/save_prefs.inc b/program/steps/settings/save_prefs.inc index 7155575fc..a32f5948c 100644 --- a/program/steps/settings/save_prefs.inc +++ b/program/steps/settings/save_prefs.inc @@ -32,9 +32,17 @@ switch ($CURR_SECTION) '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'], + 'date_format' => isset($_POST['_date_format']) ? get_input_value('_date_format', RCUBE_INPUT_POST) : $CONFIG['date_format'], + 'time_format' => isset($_POST['_time_format']) ? get_input_value('_time_format', RCUBE_INPUT_POST) : ($CONFIG['time_format'] ? $CONFIG['time_format'] : 'H:i'), 'prettydate' => isset($_POST['_pretty_date']) ? TRUE : FALSE, 'skin' => isset($_POST['_skin']) ? get_input_value('_skin', RCUBE_INPUT_POST) : $CONFIG['skin'], ); + + // compose derived date/time format strings + if ((isset($_POST['_date_format']) || isset($_POST['_time_format'])) && $a_user_prefs['date_format'] && $a_user_prefs['time_format']) { + $a_user_prefs['date_short'] = 'D ' . $a_user_prefs['time_format']; + $a_user_prefs['date_long'] = $a_user_prefs['date_format'] . ' ' . $a_user_prefs['time_format']; + } break; |