From 69b7e3cf702b8f3ee4226fd00efd975e9b3b025e Mon Sep 17 00:00:00 2001 From: Klaus Leithoff Date: Mon, 24 Mar 2014 16:00:18 +0000 Subject: [PATCH] * eMail: give user feedback when setting/applying timed vacation; do display of dates regarding user time zone settings; improve information when a vacation is set for a given time-range --- felamimail/inc/class.uifelamimail.inc.php | 4 ++-- felamimail/inc/class.uisieve.inc.php | 22 ++++++++++++++++------ 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/felamimail/inc/class.uifelamimail.inc.php b/felamimail/inc/class.uifelamimail.inc.php index eb48c906d0..fe47bd0112 100644 --- a/felamimail/inc/class.uifelamimail.inc.php +++ b/felamimail/inc/class.uifelamimail.inc.php @@ -518,9 +518,9 @@ } if(is_array($vacation) && ($vacation['status'] == 'on' || $vacation['status']=='by_date')) { - $dtfrmt = $GLOBALS['egw_info']['user']['preferences']['common']['dateformat']; + $dtfrmt = $GLOBALS['egw_info']['user']['preferences']['common']['dateformat']/*.' '.($GLOBALS['egw_info']['user']['preferences']['common']['timeformat']!='24'?'h:i a':'H:i')*/; $this->t->set_var('vacation_warning', - html::image('phpgwapi','dialog_warning',false,'style="vertical-align: middle; width: 16px;"').lang('Vacation notice is active').($vacation['status']=='by_date'? ' '.common::show_date($vacation['start_date'],$dtfrmt,true).'->'.common::show_date($vacation['end_date'],$dtfrmt,true):'')); + html::image('phpgwapi','dialog_warning',false,'style="vertical-align: middle; width: 16px;"').lang('Vacation notice is active').($vacation['status']=='by_date'? ' '.common::show_date($vacation['start_date'],$dtfrmt,true).($vacation['end_date']>$vacation['start_date']?'->'.common::show_date($vacation['end_date']+ 24*3600-1,$dtfrmt,true):''):'')); } else { diff --git a/felamimail/inc/class.uisieve.inc.php b/felamimail/inc/class.uisieve.inc.php index 5f7ebd034a..c6411b8d91 100644 --- a/felamimail/inc/class.uisieve.inc.php +++ b/felamimail/inc/class.uisieve.inc.php @@ -580,12 +580,20 @@ $newVacation['forwards'] = get_var('vacation_forwards',array('POST')); } if (!in_array($newVacation['status'],array('on','off','by_date'))) $newVacation['status'] = 'off'; - if ($this->timed_vacation) + if ($this->timed_vacation||isset($_POST['start_date']) || isset($_POST['end_date'])) { - $date = $jscal->input2date($_POST['start_date']); - if ($date['raw']) $newVacation['start_date'] = $date['raw']-12*3600; - $date = $jscal->input2date($_POST['end_date']); - if ($date['raw']) $newVacation['end_date'] = $date['raw']-12*3600; + if (isset($_POST['start_date'])) + { + //input2date returns a timestap for the day selected at noon if nothing else is specified + $date = $jscal->input2date($_POST['start_date']); + if ($date['raw']) $newVacation['start_date'] = egw_time::user2server($date['raw']-12*3600,'ts'); + } + if (isset($_POST['end_date'])) + { + //input2date returns a timestap for the day selected at noon if nothing else is specified + $date = $jscal->input2date($_POST['end_date']); + if ($date['raw']) $newVacation['end_date'] = egw_time::user2server($date['raw']-12*3600,'ts'); + } } if(isset($_POST['save']) || isset($_POST['apply'])) { @@ -698,9 +706,11 @@ if ($this->timed_vacation) { + $dtfrmt = $GLOBALS['egw_info']['user']['preferences']['common']['dateformat'].' '.($GLOBALS['egw_info']['user']['preferences']['common']['timeformat']!='24'?'h:i a':'H:i'); $this->t->set_var('by_date',' : '. - $jscal->input('start_date',$vacation['start_date']).' - '.$jscal->input('end_date',$vacation['end_date'])); + $jscal->input('start_date',egw_time::server2user($vacation['start_date'],'ts')).' - '.$jscal->input('end_date',egw_time::server2user($vacation['end_date'],'ts')).' '. + ($vacation['status']=='by_date'?lang('Vacation notice is active').($vacation['status']=='by_date'? ' '.common::show_date($vacation['start_date'],$dtfrmt,true).'->'.common::show_date($vacation['end_date']+ 24*3600-1,$dtfrmt,true):''):'')); $this->t->set_var('lang_help_start_end_replacement','
'.lang('You can use %1 for the above start-date and %2 for the end-date.','$$start$$','$$end$$')); } $this->t->pfp('out','vacation');