Code

Prepared mailAccount for new acls
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 21 Jul 2006 11:41:25 +0000 (11:41 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 21 Jul 2006 11:41:25 +0000 (11:41 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@4274 594d385d-05f5-0310-b6e9-bd551577e9d8

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

index c901295d85f1298f22cbe73dbb47b14e7479f5f3..c24707e8e180609735fe70d52273b6a0fb9633fc 100644 (file)
@@ -280,8 +280,8 @@ class mailAccount extends plugin
 
     /* Finished adding of locals? */
     if (isset($_POST['add_locals_finish'])){
-      if (count ($_POST['local_list']) &&
-          chkacl ($this->acl, "gosaMailForwardingAddress") == ""){
+
+      echo "CHECK ME LOCAL ADD ACLS";
 
         /* Walk through list of forwarders, ignore own addresses */
         foreach ($_POST['local_list'] as $val){
@@ -291,8 +291,6 @@ class mailAccount extends plugin
             $this->addForwarder($val);
             $this->is_modified= TRUE;
           }
-        }
-      }
       $this->forward_dialog= FALSE;
       $this->dialog= FALSE;
     }
@@ -323,10 +321,11 @@ class mailAccount extends plugin
 
         if ($valid){
           /* Add it */
-          if (chkacl ($this->acl, "gosaMailForwardingAddress") == ""){
-            $this->addForwarder ($address);
-            $this->is_modified= TRUE;
-          }
+
+          echo "CHECK ME ADD CHECK FOR gosaMailForwardingAddress ACLS BLAA";
+
+          $this->addForwarder ($address);
+          $this->is_modified= TRUE;
 
         }
       }
@@ -334,11 +333,10 @@ class mailAccount extends plugin
 
     /* Delete forward email addresses */
     if (isset($_POST['delete_forwarder'])){
-      if (count($_POST['forwarder_list']) 
-          && chkacl ($this->acl, "gosaMailForwardingAddress") == ""){
-
+        
+        echo "ADD CHECK for GOSA forwarder address";
+    
         $this->delForwarder ($_POST['forwarder_list']);
-      }
     }
 
     
@@ -346,8 +344,8 @@ class mailAccount extends plugin
 
     /* Add alternate email addresses */
     if (isset($_POST['add_alternate'])){
-      if ($_POST['alternate_address'] != "" &&
-          chkacl ($this->acl, "gosaMailAlternateAddress") == ""){
+
+        echo "CHECK ME add check for alternative mail address add";
 
         $valid= FALSE;
         if (!is_email($_POST['alternate_address'])){
@@ -375,12 +373,11 @@ class mailAccount extends plugin
     }
 
     /* Delete alternate email addresses */
-    if (isset($_POST['delete_alternate']) && isset ($_POST['alternates_list'])){
-      if (count($_POST['alternates_list']) &&
-          chkacl ($this->acl, "gosaMailAlternateAddress") == ""){
+    if (isset($_POST['delete_alternate']) && isset($_POST['alternates_list'])){
 
+      echo "CHECK ME remove alternate mail addresses ";
+  
         $this->delAlternate ($_POST['alternates_list']);
-      }
     }
 
   
@@ -496,13 +493,17 @@ class mailAccount extends plugin
     /* Display mail account tab */
 
     $smarty->assign("mailServers", $mailserver);
+
+    $tmp  = $this->plInfo();
+    foreach($tmp['plProvidedAcls'] as $name => $transl){
+      $smarty->assign("$name"."ACL", $this->getacl($name));
+    }
+
     foreach(array("gosaMailServer", "gosaMailQuota", "perms", "mail",
           "gosaMailAlternateAddress", "gosaMailForwardingAddress",
           "gosaVacationMessage", "gosaMailDeliveryMode",
           "gosaMailMaxSize", "gosaSpamSortLevel", "gosaSpamMailbox") as $val){
-
       $smarty->assign("$val", $this->$val);
-      $smarty->assign("$val"."ACL", chkacl($this->acl, "$val"));
     }
 
     if (is_numeric($this->gosaMailQuota) && $this->gosaMailQuota != 0){
@@ -586,8 +587,6 @@ class mailAccount extends plugin
     }
     $smarty->assign("spamlevel", $spamlevel);
     $smarty->assign("spambox", $this->mailboxList);
-    $smarty->assign("custom_sieveACL", chkacl($this->acl, "custom_sieve"));    
-    $smarty->assign("only_localACL", chkacl($this->acl, "only_local"));        
 
     $display.= $smarty->fetch (get_template_path('generic.tpl', TRUE, dirname(__FILE__)));
     return ($display);
@@ -681,12 +680,10 @@ class mailAccount extends plugin
       }
       $tmp= "[$tmp]";
 
-      if (chkacl ($this->acl, "gosaMailDeliveryMode") == ""){
-        if ($this->gosaMailDeliveryMode != $tmp){
-          $this->is_modified= TRUE;
-        }
-        $this->gosaMailDeliveryMode= $tmp;
+      if ($this->gosaMailDeliveryMode != $tmp){
+        $this->is_modified= TRUE;
       }
+      $this->gosaMailDeliveryMode= $tmp;
     }
   }
 
@@ -796,7 +793,7 @@ class mailAccount extends plugin
     }
 
     /* Check quota */
-    if ($this->gosaMailQuota != '' && chkacl ($this->acl, "gosaMailQuota") == ""){
+    if ($this->gosaMailQuota != '' && $this->acl_is_writeable("gosaMailQuota")){
       if (!is_numeric($this->gosaMailQuota)) {
         $message[]= _("Value in 'Quota size' is not valid.");
       } else {
@@ -805,7 +802,7 @@ class mailAccount extends plugin
     }
 
     /* Check rejectsize for integer */
-    if ($this->gosaMailMaxSize != '' && chkacl ($this->acl, "gosaMailQuota") == ""){
+    if ($this->gosaMailMaxSize != '' && $this->acl_is_writeable("gosaMailMaxSize")){
       if (!is_numeric($this->gosaMailMaxSize)){
         $message[]= _("Please specify a vaild mail size for mails to be rejected.");
       } else {
@@ -992,20 +989,24 @@ class mailAccount extends plugin
             "mail"                      =>  _("Mail address"),
             "gosaMailServer"            =>  _("Mail server"),
             "gosaMailQuota"             =>  _("Quota size"),
-            "gosaMailMaxSize"           =>  _("Mail max size"),
-            "gosaMailForwardingAddress" =>  _("Forwarding address"),
-            "gosaMailDeliveryMode_L"    =>  "FIXME"._("Local delivery"),            // This is flag of gosaMailDeliveryMode
-            "gosaMailDeliveryMode_R"    =>  "FIXME"._("Reject due to mailsize"),    // This is flag of gosaMailDeliveryMode
-            "gosaMailDeliveryMode_s"    =>  "FIXME"._("Use spam filter"),           // This is flag of gosaMailDeliveryMode
-            "gosaMailDeliveryMode_V"    =>  "FIXME"._("Add vacation information"),  // This is flag of gosaMailDeliveryMode
-            "gosaMailDeliveryMode_C"    =>  "FIXME"._("Use custom sieve script"),   // This is flag of gosaMailDeliveryMode
-            "gosaMailDeliveryMode_I"    =>  "FIXME"._("Only insider delivery"),     // This is flag of gosaMailDeliveryMode
+
+            "gosaMailDeliveryModeV"     =>  _("Add vacation information"),  // This is flag of gosaMailDeliveryMode
+            "gosaVacationMessage"       =>  _("Vacation message"),
+
+            "gosaMailDeliveryModes"     =>  _("Use spam filter"),           // This is flag of gosaMailDeliveryMode
             "gosaSpamSortLevel"         =>  _("Spam level"),
             "gosaSpamMailbox"           =>  _("Spam mail box"),
+
+            "gosaMailDeliveryModeR"     =>  _("Reject due to mailsize"),    // This is flag of gosaMailDeliveryMode
+            "gosaMailMaxSize"           =>  _("Mail max size"),
+
+            "gosaMailForwardingAddress" =>  _("Forwarding address"),
+            "gosaMailDeliveryModeL"     =>  _("Local delivery"),            // This is flag of gosaMailDeliveryMode
+            "gosaMailDeliveryModeI"     =>  _("Only insider delivery"),     // This is flag of gosaMailDeliveryMode
             "gosaMailAlternateAddress"  =>  _("Mail alternative addresses"),
 
-            "gosaVacationMessage"       =>  _("Vacation message"),
-            "gosaMailForwardingAddress" =>  _("Forwarding address"))
+            "gosaMailForwardingAddress" =>  _("Forwarding address"),
+            "gosaMailDeliveryModeC"     =>  _("Use custom sieve script"))   // This is flag of gosaMailDeliveryMode
         ));
   }
 }
index 56bd1e9a58484d46e6538ab7fb7573d9fda4c70d..646ae9d74fabfce4a419cf91f70c97913d010ee0 100644 (file)
@@ -5,16 +5,21 @@
    <table summary="">
     <tr>
      <td><label for="mail">{t}Primary address{/t}</label>{$must}</td>
-     <td><input id="mail" name="mail" size=35 maxlength=65 {$mailACL} value="{$mail}"></td>
+     <td>
+{render acl=$mailACL}
+       <input id="mail" name="mail" size=35 maxlength=65 value="{$mail}">
+{/render}
+     </td>
     </tr>
     <tr>
      <td><label for="gosaMailServer">{t}Server{/t}</label></td>
      <td>
-      <select size="1" id="gosaMailServer" name="gosaMailServer" {$gosaMailServerACL} 
-                       title="{t}Specify the mail server where the user will be hosted on{/t}">
-                   {html_options values=$mailServers output=$mailServers selected=$gosaMailServer}
-                       <option disabled>&nbsp;</option>
+{render acl=$gosaMailServerACL}
+      <select size="1" id="gosaMailServer" name="gosaMailServer" title="{t}Specify the mail server where the user will be hosted on{/t}">
+       {html_options values=$mailServers output=$mailServers selected=$gosaMailServer}
+       <option disabled>&nbsp;</option>
       </select>
+{/render}
      </td>
     </tr>
     <tr>
     <tr>
      <td><label for="gosaMailQuota">{t}Quota size{/t}</label></td>
      <td>
+{render acl=$gosaMailQuotaACL}
       <input id="gosaMailQuota" name="gosaMailQuota" size="6" align="middle" maxlength="60" {$gosaMailQuotaACL}
                value="{$gosaMailQuota}"> MB
+{/render}
      </td>
     </tr>
    </table>
 
   <td style="vertical-align:top;">
    <h2><img class="center" alt="" align="middle" src="images/alternatemail.png" /><label for="alternates_list"> {t}Alternative addresses{/t}</label></h2>
-   <select id="alternates_list" style="width:100%;height:100px;" name="alternates_list[]" size="15"
-                multiple title="{t}List of alternative mail addresses{/t}" {$gosaMailAlternateAddressACL}>
-            {html_options values=$gosaMailAlternateAddress output=$gosaMailAlternateAddress}
-                       <option disabled>&nbsp;</option>
+{render acl=$gosaMailAlternateAddressACL}
+   <select id="alternates_list" style="width:100%;height:100px;" name="alternates_list[]" size="15" multiple 
+       title="{t}List of alternative mail addresses{/t}">
+       {html_options values=$gosaMailAlternateAddress output=$gosaMailAlternateAddress}
+       <option disabled>&nbsp;</option>
+{/render}
    </select>
    <br />
-   <input name="alternate_address" size="30" align="middle" maxlength="65" {$gosaMailAlternateAddressACL} value="">
-   <input type=submit value="{t}Add{/t}" name="add_alternate"
-       {$gosaMailAlternateAddressACL}>&nbsp;
-   <input type=submit value="{t}Delete{/t}" name="delete_alternate"
-       {$gosaMailAlternateAddressACL}>
+{render acl=$gosaMailAlternateAddressACL}
+   <input name="alternate_address" size="30" align="middle" maxlength="65" value="">
+{/render}
+{render acl=$gosaMailAlternateAddressACL}
+   <input type=submit value="{t}Add{/t}" name="add_alternate">
+{/render}
+{render acl=$gosaMailAlternateAddressACL}
+   <input type=submit value="{t}Delete{/t}" name="delete_alternate">
+{/render}
   </td>
  </tr>
 </table>
 <table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding=4 border=0>
  <tr style="padding-bottom:0px;">
   <td style="width:50%">
+{render acl=$gosaMailDeliveryModeIACL}
    <input type=checkbox name="drop_own_mails" value="1" {$drop_own_mails}
-       {$gosaMailDeliveryModeACL} title="{t}Select if you want to forward mails without getting own copies of them{/t}"> {t}No delivery to own mailbox{/t}
+       title="{t}Select if you want to forward mails without getting own copies of them{/t}"> {t}No delivery to own mailbox{/t}
+{/render}
    <br>
+{render acl=$gosaMailDeliveryModeVACL}
    <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}
+       title="{t}Select to automatically response with the vacation message defined below{/t}"> {t}Activate vacation message{/t}
+{/render}
   </td>
    <td rowspan=2 style="border-left:1px solid #A0A0A0">
    &nbsp;
   </td>
   <td style="vertical-align:top;">
-   <input type=checkbox name="use_spam_filter" value="1" {$use_spam_filter}
-       {$gosaSpamSortLevelACL} title="{t}Select if you want to filter this mails through spamassassin{/t}"> <label for="gosaSpamSortLevel">{t}Move mails tagged with spam level greater than{/t}</label>
+{render acl=gosaMailDeliveryModesACL}
+   <input type=checkbox name="use_spam_filter" value="1" {$use_spam_filter} title="{t}Select if you want to filter this mails through spamassassin{/t}">
+{/render}
+ <label for="gosaSpamSortLevel">{t}Move mails tagged with spam level greater than{/t}</label>
        
-   <select id="gosaSpamSortLevel" size="1" name="gosaSpamSortLevel" {$gosaSpamSortLevelACL} title="{t}Choose spam level - smaller values are more sensitive{/t}">
+{render acl=$gosaSpamSortLevelACL}
+   <select id="gosaSpamSortLevel" size="1" name="gosaSpamSortLevel" title="{t}Choose spam level - smaller values are more sensitive{/t}">
         {html_options values=$spamlevel output=$spamlevel selected=$gosaSpamSortLevel}
    </select>
+{/render}
    <label for="gosaSpamMailbox">{t}to folder{/t}</label>
-   <select size="1" id="gosaSpamMailbox" name="gosaSpamMailbox" {$gosaSpamMailboxACL}>
+{render acl=$gosaSpamMailboxACL}
+   <select size="1" id="gosaSpamMailbox" name="gosaSpamMailbox">
                {html_options values=$spambox output=$spambox selected=$gosaSpamMailbox}
                        <option disabled>&nbsp;</option>
    </select>
+{/render}
    <br>
+{render acl=$gosaMailDeliveryModeRACL}
    <input type=checkbox name="use_mailsize_limit" value="1" {$use_mailsize_limit}
-       {$gosaMailMaxSizeACL}> <label for="gosaMailMaxSize">{t}Reject mails bigger than{/t}</label> 
+       <label for="gosaMailMaxSize">{t}Reject mails bigger than{/t}</label> 
+{/render}
+{render acl=$gosaMailMaxSizeACL}
    <input id="gosaMailMaxSize" name="gosaMailMaxSize" size="6" align="middle" maxlength="30" {$gosaMailMaxSizeACL}
        value="{$gosaMailMaxSize}"> {t}MB{/t}
+{/render}
   </td>
  </tr>
  <tr>
    <p style="margin-bottom:0px;">
     <b><label for="gosaVacationMessage">{t}Vacation message{/t}</label></b>
    </p>
+{render acl=$gosaVacationMessageACL}
    <textarea id="gosaVacationMessage" style="width:99%; height:100px;" name="gosaVacationMessage" rows="4" cols="512"
-       {$gosaVacationMessageACL}>{$gosaVacationMessage}</textarea>
+       >{$gosaVacationMessage}</textarea>
+{/render}
    <br>
+
    {if $show_templates eq "true"}
+{render acl=$gosaVacationMessageACL}
    <select name="vacation_template">
                {html_options options=$vacationtemplates selected=$template}
                <option disabled>&nbsp;</option>
    </select>
-   <input type="submit" value="{t}Import{/t}" name="import_vacation"
-       {$gosaVacationMessageACL}>
+{/render}
+{render acl=$gosaVacationMessageACL}
+   <input type="submit" value="{t}Import{/t}" name="import_vacation">
+{/render}
    {/if}
   </td>
   <td>
    <p style="margin-bottom:0px;">
     <b><label for="forwarder_list">{t}Forward messages to{/t}</label></b>
    </p>
-   <select id="gosaMailForwardingAddress" style="width:100%; height:100px;" name="forwarder_list[]" size=15 multiple {$gosaMailForwardingAddressACL}>
+{render acl=$gosaMailForwardingAddressACL}
+   <select id="gosaMailForwardingAddress" style="width:100%; height:100px;" name="forwarder_list[]" size=15 multiple >
                        {html_options values=$gosaMailForwardingAddress output=$gosaMailForwardingAddress selected=$template}        
                        <option disabled>&nbsp;</option>
    </select>
+{/render}
    <br>
-   <input name="forward_address" size=20 align="middle" maxlength=65
-       {$gosaMailForwardingAddressACL} value="">
-   <input type="submit" value="{t}Add{/t}" name="add_forwarder"
-       {$gosaMailForwardingAddressACL}>&nbsp;
-   <input type="submit" value="{t}Add local{/t}" name="add_local_forwarder"
-       {$gosaMailForwardingAddressACL}>&nbsp;
-   <input type="submit" value="{t}Delete{/t}" name="delete_forwarder"
-       {$gosaMailForwardingAddressACL}>
+{render acl=$gosaMailForwardingAddressACL}
+   <input name="forward_address" size=20 align="middle" maxlength=65 value="">
+{/render}
+{render acl=$gosaMailForwardingAddressACL}
+   <input type="submit" value="{t}Add{/t}" name="add_forwarder" >&nbsp;
+{/render}
+{render acl=$gosaMailForwardingAddressACL}
+   <input type="submit" value="{t}Add local{/t}" name="add_local_forwarder" >&nbsp;
+{/render}
+{render acl=$gosaMailForwardingAddressACL}
+   <input type="submit" value="{t}Delete{/t}" name="delete_forwarder">
+{/render}
   </td>
  </tr>
 </table>
 <table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding="4" border="0">
  <tr>
   <td>
-   <input type=checkbox name="only_local" value="1" {$only_local} {$only_localACL} title="{t}Select if user can only send and receive inside his own domain{/t}">
+{render acl=$gosaMailDeliveryModeLACL}
+   <input type=checkbox name="only_local" value="1" {$only_local} title="{t}Select if user can only send and receive inside his own domain{/t}">
+{/render}
    {t}User is only allowed to send and receive local mails{/t}
   </td>
   <td style="border-left:1px solid #A0A0A0">
    &nbsp;
   </td>
   <td>
-   <input type=checkbox name="own_script" value="1" {$own_script} {$custom_sieveACL}>
+
+{render acl=$gosaMailDeliveryModeCACL}
+   <input type=checkbox name="own_script" value="1" {$own_script}>
    {t}Use custom sieve script{/t} <b>({t}disables all Mail options!{/t})</b>
+{/render}
   </td>
  </tr>
 </table>