From 2afcf8589962585199a123e6715a8195f48d41bc Mon Sep 17 00:00:00 2001 From: cajus Date: Fri, 23 Mar 2007 14:09:59 +0000 Subject: [PATCH] Add vacation message stuff git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.5@5875 594d385d-05f5-0310-b6e9-bd551577e9d8 --- Changelog | 1 + html/include/calendar.js | 49 +++++++++++++++++++++ plugins/personal/mail/class_mailAccount.inc | 18 ++++++-- plugins/personal/mail/generic.tpl | 19 ++++---- plugins/personal/mail/sieve-vacation.txt | 4 +- 5 files changed, 73 insertions(+), 18 deletions(-) diff --git a/Changelog b/Changelog index 896a62300..1357f2195 100644 --- a/Changelog +++ b/Changelog @@ -3,6 +3,7 @@ GOsa2 changelog * gosa 2.5.10 - Included hook to make use of dynamic uid-bases + - Included vacation date range specification * gosa 2.5.9 - Fixed ldap tls connections when schema check was being used diff --git a/html/include/calendar.js b/html/include/calendar.js index 7852d9ba2..1cf4287e7 100644 --- a/html/include/calendar.js +++ b/html/include/calendar.js @@ -171,3 +171,52 @@ selectedDate= new Date(yearSel,monthSel,daySel); saveResult(selectedDate,resultForm); } + + + function populate2(objForm,resultForm) { + if(objForm.syear) { + yearSel=objForm.syear.options[objForm.syear.selectedIndex].text; + + monthIx=objForm.smonth.selectedIndex; + nextMonthIx=0; + if(monthIx!=11) { + nextMonthIx=monthIx+1; + } + + nextMonthSel=objForm.smonth.options[nextMonthIx].value; + monthSel=objForm.smonth.options[monthIx].value; + + daySel=1; + if(objForm.sday.selectedIndex!=-1) { + daySel=objForm.sday.options[objForm.sday.selectedIndex].text; + } + + timeOfDayOne = new Date(yearSel, nextMonthSel, 1); + timeDifference = timeOfDayOne - 86400000; + timeOfLastDay = new Date(timeDifference); + + var daysInMonth = timeOfLastDay.getDate(); + + if(daySel>daysInMonth) daySel=daysInMonth; + + selectedDate= new Date(yearSel,monthSel,daySel); + for (var i = 0; i < objForm.sday.length; i++) { + objForm.sday.options[0] = null; + } + for (var i = 0; i < daysInMonth; i++) { + objForm.sday.options[i] = new Option(i+1); + } + objForm.sday.selectedIndex=daySel-1; + saveResult(selectedDate,resultForm); + } + } + + function createResult2(objForm,resultForm){ + yearSel=objForm.syear.options[objForm.syear.selectedIndex].text; + monthIx=objForm.smonth.selectedIndex; + monthSel=objForm.smonth.options[monthIx].value; + daySel=objForm.sday.options[objForm.sday.selectedIndex].value; + selectedDate= new Date(yearSel,monthSel,daySel); + saveResult(selectedDate,resultForm); + } + diff --git a/plugins/personal/mail/class_mailAccount.inc b/plugins/personal/mail/class_mailAccount.inc index 20a2eaed3..e49f408f3 100644 --- a/plugins/personal/mail/class_mailAccount.inc +++ b/plugins/personal/mail/class_mailAccount.inc @@ -543,7 +543,6 @@ class mailAccount extends plugin $smarty->assign("end_month", $date["mon"]-1); $smarty->assign("end_year", $date["year"]); - $smarty->assign("mailServers", $mailserver); foreach(array( "gosaMailServer", @@ -569,10 +568,10 @@ class mailAccount extends plugin $smarty->assign("$val"."ACL", chkacl($this->acl, "$val")); } - if (isset($this->gosaVacationStart)){ - $smarty->assign("use_vacation_interval", 1); + if (preg_match('/V/', $this->gosaMailDeliveryMode)){ + $smarty->assign('rangeEnabled', ""); } else { - $smarty->assign("use_vacation_interval", 0); + $smarty->assign('rangeEnabled', "disabled"); } if (is_numeric($this->gosaMailQuota) && $this->gosaMailQuota != 0){ @@ -804,6 +803,7 @@ class mailAccount extends plugin } $this->gosaMailDeliveryMode= $tmp; } + } @@ -836,6 +836,12 @@ class mailAccount extends plugin $this->attrs['mail'] = strtolower($this->attrs['mail']); + /* Remove attributes - if not needed */ + if (!preg_match('/V/', $this->gosaMailDeliveryMode)){ + unset($this->attrs['gosaVacationStart']); + unset($this->attrs['gosaVacationStop']); + } + /* Save data to LDAP */ $ldap->cd($this->dn); $this->cleanup(); @@ -944,6 +950,10 @@ class mailAccount extends plugin $message[]= _("You specified Spam settings, but there is no Folder specified."); } + if (preg_match('/V/', $this->gosaMailDeliveryMode) && $this->gosaVacationStart >= $this->gosaVacationStop){ + $message[]= _("Time interval to show vacation message is not valid."); + } + return ($message); } diff --git a/plugins/personal/mail/generic.tpl b/plugins/personal/mail/generic.tpl index 10d1d07e6..c48694017 100644 --- a/plugins/personal/mail/generic.tpl +++ b/plugins/personal/mail/generic.tpl @@ -72,25 +72,22 @@ {$drop_own_mailsACL} title="{t}Select if you want to forward mails without getting own copies of them{/t}"> {t}No delivery to own mailbox{/t}
{t}Activate vacation message{/t} + {$gosaVacationMessageACL} title="{t}Select to automatically response with the vacation message defined below{/t}" onclick="changeState('day'); changeState('month'); changeState('year'); changeState('sday'); changeState('smonth'); changeState('syear');"> {t}Activate vacation message{/t}
- {t}Use vacation interval{/t}
-
- {t}From{/t} + {t}from{/t} - {html_options values=$days output=$days selected=$start_day} - {html_options options=$months selected=$start_month} - {html_options values=$years output=$years selected=$start_year} @@ -101,13 +98,13 @@ {t}till{/t} - {html_options values=$days output=$days selected=$end_day} - {html_options options=$months selected=$end_month} - {html_options values=$years output=$years selected=$end_year} diff --git a/plugins/personal/mail/sieve-vacation.txt b/plugins/personal/mail/sieve-vacation.txt index 3aed3a916..221fad33f 100644 --- a/plugins/personal/mail/sieve-vacation.txt +++ b/plugins/personal/mail/sieve-vacation.txt @@ -1,4 +1,2 @@ -# Vacation message -vacation :addresses [$addrlist] -"$vacmsg" ; +# Vacation is disabled, take a look at the contributed cron-job -- 2.30.2