Changeset 1cc9e21 in github


Ignore:
Timestamp:
Sep 12, 2011 3:56:12 PM (21 months ago)
Author:
thomascube <thomas@…>
Branches:
master, HEAD, courier-fix, dev-browser-capabilities, pdo, release-0.7, release-0.8
Children:
de36863
Parents:
891b3c1
Message:

Make date/time format user configurable; drop 'date_today' config option

Files:
8 edited

Legend:

Unmodified
Added
Removed
  • CHANGELOG

    r66a3b03 r1cc9e21  
    22=========================== 
    33 
     4- Make date/time format user configurable; drop 'date_today' config option 
    45- Fix handling of binary attachments encoded with quoted-printable (#1488065) 
    56- Fix text-overflow:ellipsis issues on messages list in FF7 and Webkit (#1488061) 
  • config/main.inc.php.dist

    r66df084 r1cc9e21  
    377377$rcmail_config['language'] = null; 
    378378 
    379 // use this format for short date display (date or strftime format) 
     379// use this format for date display (date or strftime format) 
     380$rcmail_config['date_format'] = 'Y-m-d'; 
     381 
     382// give this choice of date formats to the user to select from 
     383$rcmail_config['date_formats'] = array('Y-m-d', 'd-m-Y', 'Y/m/d', 'm/d/Y', 'd/m/Y', 'd.m.Y', 'j.n.Y'); 
     384 
     385// use this format for time display (date or strftime format) 
     386$rcmail_config['time_format'] = 'H:i'; 
     387 
     388// give this choice of time formats to the user to select from 
     389$rcmail_config['time_formats'] = array('G:i', 'H:i', 'g:i a', 'h:i A'); 
     390 
     391// use this format for short date display (derived from date_format and time_format) 
    380392$rcmail_config['date_short'] = 'D H:i'; 
    381393 
    382 // use this format for detailed date/time formatting (date or strftime format) 
    383 $rcmail_config['date_long'] = 'd.m.Y H:i'; 
    384  
    385 // use this format for today's date display (date or strftime format) 
    386 // Note: $ character will be replaced with 'Today' label 
    387 $rcmail_config['date_today'] = 'H:i'; 
    388  
    389 // use this format for date display without time (date or strftime format) 
    390 $rcmail_config['date_format'] = 'Y-m-d'; 
     394// use this format for detailed date/time formatting (derived from date_format and time_format) 
     395$rcmail_config['date_long'] = 'Y-m-d H:i'; 
    391396 
    392397// store draft message is this mailbox 
  • program/include/main.inc

    r8703b08 r1cc9e21  
    10561056  if (!$format) { 
    10571057    if ($CONFIG['prettydate'] && $timestamp > $today_limit && $timestamp < $now) { 
    1058       $format = $CONFIG['date_today'] ? $CONFIG['date_today'] : 'H:i'; 
     1058      $format = $RCMAIL->config->get('date_today', $RCMAIL->config->get('time_format', 'H:i')); 
    10591059      $today  = true; 
    10601060    } 
    10611061    else if ($CONFIG['prettydate'] && $timestamp > $week_limit && $timestamp < $now) 
    1062       $format = $CONFIG['date_short'] ? $CONFIG['date_short'] : 'D H:i'; 
     1062      $format = $RCMAIL->config->get('date_short', 'D H:i'); 
    10631063    else 
    1064       $format = $CONFIG['date_long'] ? $CONFIG['date_long'] : 'd.m.Y H:i'; 
     1064      $format = $RCMAIL->config->get('date_long', 'Y-m-d H:i'); 
    10651065  } 
    10661066 
  • program/localization/de_CH/labels.inc

    r84ae7d5 r1cc9e21  
    297297$labels['defaultcharset'] = 'Standard-Zeichensatz'; 
    298298$labels['htmlmessage'] = 'HTML Nachricht'; 
     299$labels['dateformat'] = 'Datumsformat'; 
     300$labels['timeformat'] = 'Zeitformat'; 
    299301$labels['prettydate'] = 'Kurze Datumsanzeige'; 
    300302$labels['setdefault'] = 'Als Standard'; 
  • program/localization/de_DE/labels.inc

    rf2ff370 r1cc9e21  
    280280$labels['defaultcharset'] = 'Standard Zeichensatz'; 
    281281$labels['htmlmessage'] = 'HTML-Nachricht'; 
     282$labels['dateformat'] = 'Datumsformatierung'; 
     283$labels['timeformat'] = 'Zeitformatierung'; 
    282284$labels['prettydate'] = 'Kurze Datumsanzeige'; 
    283285$labels['setdefault'] = 'Als Standard'; 
  • program/localization/en_US/labels.inc

    r2a76f8d r1cc9e21  
    358358$labels['defaultcharset'] = 'Default Character Set'; 
    359359$labels['htmlmessage'] = 'HTML Message'; 
     360$labels['dateformat'] = 'Date format'; 
     361$labels['timeformat'] = 'Time format'; 
    360362$labels['prettydate'] = 'Pretty dates'; 
    361363$labels['setdefault']  = 'Set default'; 
  • program/steps/settings/func.inc

    r66df084 r1cc9e21  
    238238    } 
    239239 
     240    // date/time formatting 
     241    if (!isset($no_override['time_format'])) { 
     242      $reftime = mktime(7,30,0); 
     243      $field_id = 'rcmfd_time_format'; 
     244      $select_time = new html_select(array('name' => '_time_format', 'id' => $field_id)); 
     245      foreach ((array)$RCMAIL->config->get('time_formats', array('G:i', 'H:i', 'g:i a', 'h:i A')) as $choice) 
     246        $select_time->add(date($choice, $reftime), $choice); 
     247 
     248      $blocks['main']['options']['time_format'] = array( 
     249        'title' => html::label($field_id, Q(rcube_label('timeformat'))), 
     250        'content' => $select_time->show($RCMAIL->config->get('time_format')), 
     251      ); 
     252    } 
     253 
     254    if (!isset($no_override['date_format'])) { 
     255      $refdate = mktime(12,30,0,7,24); 
     256      $field_id = 'rcmfd_date_format'; 
     257      $select_date = new html_select(array('name' => '_date_format', 'id' => $field_id)); 
     258      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) 
     259        $select_date->add(date($choice, $refdate), $choice); 
     260 
     261      $blocks['main']['options']['date_format'] = array( 
     262        'title' => html::label($field_id, Q(rcube_label('dateformat'))), 
     263        'content' => $select_date->show($config['date_format']), 
     264      ); 
     265    } 
     266 
    240267    // MM: Show checkbox for toggling 'pretty dates'  
    241268    if (!isset($no_override['prettydate'])) { 
  • program/steps/settings/save_prefs.inc

    r66df084 r1cc9e21  
    3333      'dst_active'   => isset($_POST['_dst_active']) ? TRUE : FALSE, 
    3434      'pagesize'     => is_numeric($_POST['_pagesize']) ? max(2, intval($_POST['_pagesize'])) : $CONFIG['pagesize'], 
     35      'date_format'  => isset($_POST['_date_format']) ? get_input_value('_date_format', RCUBE_INPUT_POST) : $CONFIG['date_format'], 
     36      'time_format'  => isset($_POST['_time_format']) ? get_input_value('_time_format', RCUBE_INPUT_POST) : ($CONFIG['time_format'] ? $CONFIG['time_format'] : 'H:i'), 
    3537      'prettydate'   => isset($_POST['_pretty_date']) ? TRUE : FALSE, 
    3638      'skin'         => isset($_POST['_skin']) ? get_input_value('_skin', RCUBE_INPUT_POST) : $CONFIG['skin'], 
    3739    ); 
     40     
     41    // compose derived date/time format strings 
     42    if ((isset($_POST['_date_format']) || isset($_POST['_time_format'])) && $a_user_prefs['date_format'] && $a_user_prefs['time_format']) { 
     43      $a_user_prefs['date_short'] = 'D ' . $a_user_prefs['time_format']; 
     44      $a_user_prefs['date_long'] = $a_user_prefs['date_format'] . ' ' . $a_user_prefs['time_format']; 
     45    } 
    3846 
    3947  break; 
Note: See TracChangeset for help on using the changeset viewer.