Code

Add vacation message stuff
authorcajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 23 Mar 2007 14:09:59 +0000 (14:09 +0000)
committercajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 23 Mar 2007 14:09:59 +0000 (14:09 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.5@5875 594d385d-05f5-0310-b6e9-bd551577e9d8

Changelog
html/include/calendar.js
plugins/personal/mail/class_mailAccount.inc
plugins/personal/mail/generic.tpl
plugins/personal/mail/sieve-vacation.txt

index 896a6230065b1d9caf835053a22e3f6ff6f1306e..1357f2195430e5fa8377a6012a002a0eabc1317d 100644 (file)
--- 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
index 7852d9ba2d834b1f1776387cf7e77e55ecc9e2ce..1cf4287e7f3cfda4ae4500c868735213e0b87dca 100644 (file)
                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);
+       }
+
index 20a2eaed3bd098beda7900da78ddd9e7e9c5ec52..e49f408f3b7fc9e470d920dca0773bc32b4b8b06 100644 (file)
@@ -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);
   }
 
index 10d1d07e64bc9525a2c430b622d7cc8bebf5dcfd..c486940178f34082ca5c8c99ec5847b2e4d6d5f9 100644 (file)
        {$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}
    <br>
    <input type=checkbox name="use_vacation" value="1" {$use_vacation}
-       {$gosaVacationMessageACL} title="{t}Select to automatically response with the vacation message defined below{/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}
    <br>
    <div style="padding-left:22px;">
-     <input type=checkbox name="use_vacation_interval" value="1" {$use_vacation_interval}
-       {$gosaVacationMessageACL} title="{t}Only respond within the selected interval{/t}"> {t}Use vacation interval{/t}<br>
-
        <table>
          <tr>
           <td>
-       {t}From{/t}
+       {t}from{/t}
           </td>
           <td>
-       <select name=day onChange="createResult(this.form,this.form.gosaVacationStart);" {$gosaVacationMessageACL}>
+       <select name=day id="day" onChange="createResult(this.form,this.form.gosaVacationStart);" {$gosaVacationMessageACL} {$rangeEnabled}>
                {html_options values=$days output=$days selected=$start_day}
        </select>
-       <select name=month onChange="populate(this.form,this.form.gosaVacationStart);" {$gosaVacationMessageACL}>
+       <select name=month id="month" onChange="populate(this.form,this.form.gosaVacationStart);" {$gosaVacationMessageACL} {$rangeEnabled}>
                {html_options options=$months selected=$start_month}
        </select>
-       <select name=year onChange="populate(this.form,this.form.gosaVacationStart);" {$gosaVacationMessageACL}>
+       <select name=year id="year" onChange="populate(this.form,this.form.gosaVacationStart);" {$gosaVacationMessageACL} {$rangeEnabled}>
                {html_options values=$years output=$years selected=$start_year}
        </select>
        <input type="hidden" name="gosaVacationStart" value="{$gosaVacationStart}">
        {t}till{/t}
           </td>
           <td>
-       <select name=day onChange="createResult(this.form,this.form.gosaVacationStop);" {$gosaVacationMessageACL}>
+       <select name=sday id="sday" onChange="createResult2(this.form,this.form.gosaVacationStop);" {$gosaVacationMessageACL} {$rangeEnabled}>
                {html_options values=$days output=$days selected=$end_day}
        </select>
-       <select name=month onChange="populate(this.form,this.form.gosaVacationStop);" {$gosaVacationMessageACL}>
+       <select name=smonth id="smonth" onChange="populate2(this.form,this.form.gosaVacationStop);" {$gosaVacationMessageACL} {$rangeEnabled}>
                {html_options options=$months selected=$end_month}
        </select>
-       <select name=year onChange="populate(this.form,this.form.gosaVacationStop);" {$gosaVacationMessageACL}>
+       <select name=syear id="syear" onChange="populate2(this.form,this.form.gosaVacationStop);" {$gosaVacationMessageACL} {$rangeEnabled}>
                {html_options values=$years output=$years selected=$end_year}
        </select>
        <input type="hidden" name="gosaVacationStop" value="{$gosaVacationStop}">
index 3aed3a9165e60d25e8b23d0ef134f1b2163fe5b4..221fad33f6317f2035d2559f1015adf2e5b39bd6 100644 (file)
@@ -1,4 +1,2 @@
-# Vacation message
-vacation :addresses [$addrlist]
-"$vacmsg" ;
+# Vacation is disabled, take a look at the contributed cron-job