Code

First step to get start/stop for vacation messages inside
authorcajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 22 Mar 2007 16:53:17 +0000 (16:53 +0000)
committercajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 22 Mar 2007 16:53:17 +0000 (16:53 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.5@5866 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/personal/mail/class_mailAccount.inc
plugins/personal/mail/generic.tpl

index d4d239903055d3bf4e85a3b3e2b3b5a38516c5c7..20a2eaed3bd098beda7900da78ddd9e7e9c5ec52 100644 (file)
@@ -33,6 +33,8 @@ class mailAccount extends plugin
   var $gosaMailQuota                      = "";
   var $gosaMailMaxSize                    = "";
   var $gosaVacationMessage                = "";
+  var $gosaVacationStart                  = NULL;
+  var $gosaVacationStop                   = NULL;
   var $gosaSpamSortLevel                  = "";
   var $gosaSpamMailbox                    = "";
 
@@ -54,7 +56,7 @@ class mailAccount extends plugin
   /* attribute list for save action */
   var $attributes= array("mail", "gosaMailServer", "gosaMailQuota", "gosaMailMaxSize","gosaMailForwardingAddress",
       "gosaMailDeliveryMode", "gosaSpamSortLevel", "gosaSpamMailbox","gosaMailAlternateAddress",
-      "gosaVacationMessage", "gosaMailAlternateAddress", "gosaMailForwardingAddress");
+      "gosaVacationMessage", "gosaMailAlternateAddress", "gosaMailForwardingAddress", "gosaVacationStart", "gosaVacationStop");
   var $objectclasses= array("gosaMailAccount");
 
 
@@ -508,6 +510,39 @@ class mailAccount extends plugin
     }
 
     /* Display mail account tab */
+    if(empty($this->gosaVacationStart)){
+      $date= getdate(time());
+    }else{
+      $date= getdate($this->gosaVacationStart);
+    }
+    $days= array();
+    for($d= 1; $d<32; $d++){
+      $days[$d]= $d;
+    }
+    $years= array();
+    for($y= $date['year']-10; $y<$date['year']+10; $y++){
+      $years[]= $y;
+    }
+    $months= array(_("January"), _("February"), _("March"), _("April"),
+        _("May"), _("June"), _("July"), _("August"), _("September"),
+        _("October"), _("November"), _("December"));
+    $smarty->assign("start_day", $date["mday"]);
+    $smarty->assign("days", $days);
+    $smarty->assign("months", $months);
+    $smarty->assign("start_month", $date["mon"]-1);
+    $smarty->assign("years", $years);
+    $smarty->assign("start_year", $date["year"]);
+
+    if(empty($this->gosaVacationStop)){
+      $date= getdate(time());
+      $date["mday"]++;
+    }else{
+      $date= getdate($this->gosaVacationStop);
+    }
+    $smarty->assign("end_day", $date["mday"]);
+    $smarty->assign("end_month", $date["mon"]-1);
+    $smarty->assign("end_year", $date["year"]);
+
 
     $smarty->assign("mailServers", $mailserver);
     foreach(array(
@@ -523,6 +558,8 @@ class mailAccount extends plugin
           "gosaMailMaxSize",                      // Enable - Drop mails > max size
           "gosaSpamSortLevel", "gosaSpamMailbox", // Enable - Spam sort options
           "gosaVacationMessage",                  // Enable - Vacation message      
+          "gosaVacationStart",
+          "gosaVacationStop",
           "custom_sieve",                         // Use custom sieve script
           "only_local"                            // Send/receive local mails 
                                         ) as $val){
@@ -532,6 +569,12 @@ class mailAccount extends plugin
       $smarty->assign("$val"."ACL", chkacl($this->acl, "$val"));
     }
 
+    if (isset($this->gosaVacationStart)){
+      $smarty->assign("use_vacation_interval", 1);
+    } else {
+      $smarty->assign("use_vacation_interval", 0);
+    }
+
     if (is_numeric($this->gosaMailQuota) && $this->gosaMailQuota != 0){
       $smarty->assign("quotausage", progressbar(round(($this->quotaUsage * 100)/ $this->gosaMailQuota),100,15,true));
       $smarty->assign("quotadefined", "true");
index d22cdd5482d84077ba4c8cb01fd410776c90ae7c..10d1d07e64bc9525a2c430b622d7cc8bebf5dcfd 100644 (file)
    <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}
+   <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}
+          </td>
+          <td>
+       <select name=day onChange="createResult(this.form,this.form.gosaVacationStart);" {$gosaVacationMessageACL}>
+               {html_options values=$days output=$days selected=$start_day}
+       </select>
+       <select name=month onChange="populate(this.form,this.form.gosaVacationStart);" {$gosaVacationMessageACL}>
+               {html_options options=$months selected=$start_month}
+       </select>
+       <select name=year onChange="populate(this.form,this.form.gosaVacationStart);" {$gosaVacationMessageACL}>
+               {html_options values=$years output=$years selected=$start_year}
+       </select>
+       <input type="hidden" name="gosaVacationStart" value="{$gosaVacationStart}">
+          </td>
+         </tr>
+         <tr>
+          <td>
+       {t}till{/t}
+          </td>
+          <td>
+       <select name=day onChange="createResult(this.form,this.form.gosaVacationStop);" {$gosaVacationMessageACL}>
+               {html_options values=$days output=$days selected=$end_day}
+       </select>
+       <select name=month onChange="populate(this.form,this.form.gosaVacationStop);" {$gosaVacationMessageACL}>
+               {html_options options=$months selected=$end_month}
+       </select>
+       <select name=year onChange="populate(this.form,this.form.gosaVacationStop);" {$gosaVacationMessageACL}>
+               {html_options values=$years output=$years selected=$end_year}
+       </select>
+       <input type="hidden" name="gosaVacationStop" value="{$gosaVacationStop}">
+          </td>
+         </tr>
+        </table>
+
+   </div>
   </td>
    <td rowspan=2 style="border-left:1px solid #A0A0A0">
    &nbsp;
    <input type="submit" value="{t}Import{/t}" name="import_vacation"
        {$gosaVacationMessageACL}>
    {/if}
+   <br>
   </td>
   <td>
    <p style="margin-bottom:0px;">