* 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

This commit is contained in:
Klaus Leithoff 2014-03-24 16:00:18 +00:00
parent 8406dfca06
commit 69b7e3cf70
2 changed files with 18 additions and 8 deletions

View File

@ -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
{

View File

@ -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','<input type="radio" name="vacationStatus" value="by_date" id="status_by_date" '.
($vacation['status']=='by_date'?' checked':'').' /> <label for="status_by_date">'.lang('by date').'</label>: '.
$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','<br />'.lang('You can use %1 for the above start-date and %2 for the end-date.','$$start$$','$$end$$'));
}
$this->t->pfp('out','vacation');