Code

(groupware) added feature mailLimit - boundaries for send/receive messages.
authorhzerres <hzerres@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 21 Oct 2010 14:57:34 +0000 (14:57 +0000)
committerhzerres <hzerres@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 21 Oct 2010 14:57:34 +0000 (14:57 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@20117 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/groupware/personal/groupware/class_Groupware.inc
gosa-plugins/groupware/personal/groupware/class_GroupwareDao.inc
gosa-plugins/groupware/personal/groupware/generic.tpl

index 9d6310caca7503a49030b4683cc8fbf085e859e8..de109fc09f0ca312b7cda2fe7a3be8f7c23c7148 100644 (file)
@@ -27,8 +27,8 @@ class Groupware extends plugin
     // Folder related attributes, will be moved into a speperate widget late on
     var $currentSelectedFolder = "";     
 
-    var $plHeadline     = "Groupware";
-    var $plDescription  = "GOsa groupware extension.";
+    var $plHeadline = "Groupware";
+    var $plDescription = "GOsa groupware extension.";
     var $pathTitle = "GOsa groupware extension.";
     var $view_logged = FALSE;
 
@@ -44,13 +44,14 @@ class Groupware extends plugin
             "vacationMessage", "mailBoxWarnLimitEnabled", "mailBoxWarnLimitValue",
             "mailBoxSendSizelimitEnabled", "mailBoxSendSizelimitValue", "mailBoxHardSizelimitEnabled",
             "mailBoxHardSizelimitValue", "mailBoxAutomaticRemovalEnabled", "mailBoxAutomaticRemovalValue",
-            "localDeliveryOnly", "dropOwnMails", "mailFolder");
-
+            "localDeliveryOnly", "dropOwnMails", "mailFolder", "mailLimitReceiveValue", "mailLimitSendValue",
+                       "mailLimitReceiveEnabled", "mailLimitSendEnabled");
 
     var $enabledFeatures = array();
 
     var $flagAttributes = array("vacationEnabled","mailBoxWarnLimitEnabled","mailBoxSendSizelimitEnabled",
-            "mailBoxHardSizelimitEnabled","mailBoxAutomaticRemovalEnabled","localDeliveryOnly","dropOwnMails");
+            "mailBoxHardSizelimitEnabled","mailBoxAutomaticRemovalEnabled","localDeliveryOnly","dropOwnMails", 
+                       "mailLimitReceiveEnabled", "mailLimitSendEnabled");
 
     var $mailAddressSelectDialog = NULL;
     var $filterManager = NULL;
@@ -82,6 +83,12 @@ class Groupware extends plugin
     var $mailBoxAutomaticRemovalValue = 100;
     var $localDeliveryOnly = FALSE;
     var $dropOwnMails = FALSE;
+       var $mailLimitReceiveEnabled = FALSE;
+       var $mailLimitReceiveValue = 0;
+       var $mailLimitSendEnabled = FALSE;
+       var $mailLimitSendValue = 0;
+       
+       
     var $groupwareDao = null;
 
     // Used in the folder editor as the starting folder, usually user/username
@@ -169,7 +176,7 @@ class Groupware extends plugin
                 "forwardingAddresses"       => array(
                     'acctAddMailForwardAddress','acctDelMailForwardAddress',
                     'acctGetMailForwardAddresses','acctSetMailForwardAddresses'),
-                "vacationMessage"           => array("_off",
+                "vacationMessage"           => array(
                     'acctDelFilter','acctGetFilters','acctSetFilters','acctSetFilters'),
                 "mailBoxWarnLimit"          => array(
                     'acctSetQuota','acctGetQuota'),
@@ -185,7 +192,9 @@ class Groupware extends plugin
                 "dropOwnMails"              => array( "_off",
                         'acctDelFilter','acctGetFilters','acctSetFilters','acctSetFilters'),
                                "mailFolder"                            => array(
-                                               'folderList','folderDel','folderAdd')
+                                               'folderList','folderDel','folderAdd'),
+                               "mailLimit"                     => array(
+                                               'acctGetMailLimit', 'acctSetMailLimit')
                                );
 
         // Check if all required methods can be called! 
@@ -287,8 +296,13 @@ class Groupware extends plugin
             $this->dialog = TRUE;
             return($this->filterManager->execute());
         }
+               /****************
+                       MailLimits
+               ****************/
+               
 
-
+               
+               
         /****************
           Folder editor
          ****************/
@@ -321,7 +335,6 @@ class Groupware extends plugin
             $this->dialog = TRUE;
             return($this->FolderWidget->execute());
         }
-   
 
         /****************
           Account status
@@ -364,7 +377,6 @@ class Groupware extends plugin
             $this->dialog= TRUE;
         }
                
-
         // Close dialogs, action was canceled 
         if (isset($_POST['mailAddressSelect_cancel'])){
             $this->mailAddressSelectDialog= FALSE;
@@ -477,6 +489,7 @@ class Groupware extends plugin
 
         $smarty = get_smarty();
         foreach($this->attributes as $attr){
+                       print
             $smarty->assign($attr, $this->$attr);
         }
 
@@ -542,7 +555,7 @@ class Groupware extends plugin
 
             // Detect checkbox states 
             $checkAttrs = array("mailBoxWarnLimit","mailBoxSendSizelimit",
-                    "mailBoxHardSizelimit","mailBoxAutomaticRemoval");
+                    "mailBoxHardSizelimit","mailBoxAutomaticRemoval", "mailLimitReceive", "mailLimitSend");
             foreach($checkAttrs as $boxname){
                 if($this->acl_is_writeable($boxname)){
                     $v = $boxname."Value"; 
@@ -800,7 +813,6 @@ class Groupware extends plugin
                                        $fw[$this->forwardingAddresses[0]] = true;
                                        $this->groupwareDao->save("forwardingAddresses", $this->uid, array($fw));
                        }
-                       
                }
                //Save quota - it consists of four values... 
                if( ($this->isFeatureEnabled("mailBoxWarnLimit") ||
@@ -839,6 +851,12 @@ class Groupware extends plugin
                //checks for feature "dropOwnMails"              
                if($this->isFeatureEnabled("dropOwnMails") && $this->hasFeaturebeenChanged("dropOwnMails")){}
                
+               
+               //checks for feature "mailLimit"              
+               if($this->isFeatureEnabled("mailLimit") && $this->hasFeaturebeenChanged("mailLimit")){
+                       $this->groupwareDao->save("mailLimit", $this->uid, array("receive"=>$this->mailLimitReceiveValue, "send"=>$this->mailLimitSendValue,));
+               }
+               
                //checks for feature "quotaUsage"                
                //not to be saved
     }
@@ -908,6 +926,9 @@ class Groupware extends plugin
                                }
                        }        
                }
+               //checks for feature "mailLimit"
+               if ($this->isFeatureEnabled("mailLimit")){}
+               
                //checks for feature "mailBoxWarnLimit"          
                if ($this->isFeatureEnabled("mailBoxWarnLimit")){}
                
@@ -965,7 +986,9 @@ class Groupware extends plugin
                         "mailBoxHardSizelimit"          => _("Hard sizelimit"),
                         "mailBoxAutomaticRemoval"       => _("Automatic mail removal"),
                         "localDeliveryOnly"             => _("Local delivery only"),
-                        "dropOwnMails"                  => _("Drop own mails")
+                        "dropOwnMails"                  => _("Drop own mails"),
+                                               "mailLimitSend"                 => _("mail Limit send"),
+                                               "mailLimitReceive"              => _("mail Limit receive")
                         )
                         ));
     }
@@ -999,7 +1022,12 @@ class Groupware extends plugin
                 "mailBoxAutomaticRemovalEnabled" => "mailBoxAutomaticRemovalEnabled",
                 "mailBoxAutomaticRemovalValue" => "mailBoxAutomaticRemovalValue",
                 "localDeliveryOnly" => "localDeliveryOnly",
-                "dropOwnMails" => "dropOwnMails");
+                "dropOwnMails" => "dropOwnMails",
+                               "mailLimitReceiveValue" => "mailLimitReceiveValue",
+                               "mailLimitSendValue" => "mailLimitSendValue",
+                               "mailLimitReceiveEnabled" => "mailLimitReceiveEnabled",
+                               "mailLimitSendEnabled" => "mailLimitSendEnabled"
+                               );
 
         // Map values from source array to class members
         foreach($map as $target => $source){
@@ -1036,4 +1064,4 @@ class Groupware extends plugin
 }
 
 
-?>
+?>
\ No newline at end of file
index 606bab0f4f752fbc53a824ddeb651981a6815105..dd8773374c0b293d2c2fa1a333b68403020f362c 100644 (file)
@@ -57,7 +57,9 @@ class GroupwareDao{
                     "delete"=>"gwFolderDel"),
                        "private_folderACLS" => array("get"=>"gwFolderGetMembers",
                     "save"=>"gwFolderSetMembers",
-                    "delete"=>"gwFolderDelMember")
+                    "delete"=>"gwFolderDelMember"),
+                       "mailLimit" => array("get"=>"gwAcctGetMailLimit",
+                    "save"=>"gwAcctSetMailLimit")
                 );
                        
 
@@ -236,7 +238,25 @@ class GroupwareDao{
             }
                        
         }
-
+               //get the current MailLimits ... if this feature is enabled.
+               if($this->groupwarePluginRef->isFeatureEnabled("mailLimit")){
+                       $mailLimits = $this->get("mailLimit", array($uid));
+                       
+                       if($mailLimits["receive"] > 0){
+                $resultArr["mailLimitReceiveEnabled"] = true;
+                $resultArr["mailLimitReceiveValue"] = $mailLimits["receive"];
+            }else{
+                $resultArr["mailLimitReceiveEnabled"] = false;
+                $resultArr["mailLimitReceiveValue"] = 0;
+            }
+            if($mailLimits["send"] > 0){
+                $resultArr["mailLimitSendEnabled"] = true;
+                $resultArr["mailLimitSendValue"] = $mailLimits["send"];
+            }else{
+                $resultArr["mailLimitSendEnabled"] = false;
+                $resultArr["mailLimitSendValue"] = 0;  
+            }
+               }               
         //this function seems to be broken on the server.
         //addding dummy
 
index 1e0c6d4b9c6720ba13e230a48619e94a6e6795e6..7893edd83aab4376b4d9bcb9cad0d01105f2e6a6 100644 (file)
@@ -78,7 +78,6 @@
                 </tr>
                 {/if}
             </table>
-
         </td>
         
         {if !$alternateAddresses_isActive}
         </td>
     </tr>
     {/if}
+       {if $mailLimit_isActive}
+    <tr>
+        <td>
+                        <input id='mailLimitReceiveEnabled' value='1' name="mailLimitReceiveEnabled" value="1" 
+                    {if $mailLimitReceiveEnabled} checked {/if} class="center" type='checkbox'>
+            <label for="mailLimit">{t}Mailbox size limits receiving mails{/t}</label>
+                       <input id="mailLimitReceiveValue" name="mailLimitReceiveValue" 
+                    size="6" align="middle" type='text' value="{$mailLimitReceiveValue}"  class="center"> {t}kbyte{/t}
+                </td>
+    </tr>
+       <tr>
+        <td>
+                       <input id='mailLimitSendEnabled' value='1' name="mailLimitSendEnabled" value="1" 
+                    {if $mailLimitSendEnabled} checked {/if} class="center" type='checkbox'>
+                       <label for="mailLimit">{t}Mailbox size limits sending mails{/t}</label>
+                       <input id="mailLimitSendValue" name="mailLimitSendValue" 
+                    size="6" align="middle" type='text' value="{$mailLimitSendValue}"  class="center"> {t}kbyte{/t}
+        </td>
+    </tr>
+       {/if}
     {if $localDeliveryOnly_isActive}
     <tr>
         <td>