Code

(groupware) mailboxLocations switchable.
authorhzerres <hzerres@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 20 Oct 2010 11:57:02 +0000 (11:57 +0000)
committerhzerres <hzerres@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 20 Oct 2010 11:57:02 +0000 (11:57 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@20102 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 bd5c624cd5ba9ac04c3854dd880b3984bb6b053d..ec1fe43e8b28d1e237cfbbc82afdd9b3b2f72398 100644 (file)
@@ -159,7 +159,7 @@ class Groupware extends plugin
                     'acctGetQuota'),
                 "quotaSize"                 => array(
                     'acctSetQuota','acctGetQuota'),
-                "mailLocations"                                => array(
+                "mailLocations"                                => array("_off",
                     'getMailboxLocations'),
                 "mailFilter"                => array("_off",
                     'acctDelFilter','acctGetFilters','acctSetFilters','acctSetFilters'),
@@ -169,7 +169,7 @@ class Groupware extends plugin
                 "forwardingAddresses"       => array(
                     'acctAddMailForwardAddress','acctDelMailForwardAddress',
                     'acctGetMailForwardAddresses','acctSetMailForwardAddresses'),
-                "vacationMessage"           => array(
+                "vacationMessage"           => array("_off",
                     'acctDelFilter','acctGetFilters','acctSetFilters','acctSetFilters'),
                 "mailBoxWarnLimit"          => array(
                     'acctSetQuota','acctGetQuota'),
@@ -199,7 +199,9 @@ class Groupware extends plugin
 
         // If this is a new user, then do not try to check account status 
         //  the account cannot exists.                 
-        $this->mailLocations = $this->groupwareDao->get('mailLocations', array());
+               if ($this->isFeatureEnabled("mailLocations")){
+                       $this->mailLocations = $this->groupwareDao->get('mailLocations', array());
+               }
         if($this->dn == "new"){
             $this->initially_was_account = $this->is_account = FALSE;
             $this->accountInitialized = TRUE;
@@ -758,7 +760,7 @@ class Groupware extends plugin
      */
     function save()
     {
-        // Get rpc handle to create or update the account
+         // Get rpc handle to create or update the account
         if(!$this->initially_was_account){
             $this->rpcExec('gwAcctAdd', $this->uid, $this->mailAddress);
             if($this->rpcError){
@@ -767,7 +769,7 @@ class Groupware extends plugin
             }
         }
                if($this->isFeatureEnabled("mailFolder") && $this->hasFeaturebeenChanged("mailFolder")){
-                       $this->groupwareDao->saveFoldersAndAcls($this->uid, $this->mailFolder);
+                       $this->saveFoldersAndAcls($this->uid, $this->mailFolder);
                }
 
         // Save the primary Email Address.
@@ -791,8 +793,7 @@ class Groupware extends plugin
                        if(empty($this->forwardingAddresses)){
                                $this->groupwareDao->save("forwardingAddresses", $this->uid, array(array()));
                        }
-                       if(             isset($this->forwardingAddresses) 
-                                       && is_array($this->forwardingAddresses)){
+                       if(is_array($this->forwardingAddresses) && isset($this->forwardingAddresses[0])){
                                        
                                        // Only the first Address will be set as forward Address.
                                        $fw = array();
@@ -801,7 +802,7 @@ class Groupware extends plugin
                        }
                        
                }
-               //Save quota
+               //Save quota - it consists of four values... 
                if( ($this->isFeatureEnabled("mailBoxWarnLimit") ||
                        $this->isFeatureEnabled("mailBoxSendSizelimit") ||
                        $this->isFeatureEnabled("quotaSize") ||
@@ -817,7 +818,29 @@ class Groupware extends plugin
 
                        $this->groupwareDao->save("quotaSize", $this->uid, $quota);
                }
-               // TODO: save Mailbox location
+
+               // Todo: checks for feature "mailLocations"                             
+               if($this->isFeatureEnabled("mailLocations") && $this->hasFeaturebeenChanged("mailLocations")){
+                       //$this->groupwareDao->save("mailLocations", $this->uid, $this->mailLocations);
+               }
+               
+               //checks for feature "mailFilter"                 
+               if($this->isFeatureEnabled("mailFilter") && $this->hasFeaturebeenChanged("mailFilter")){}
+               
+               //checks for feature "vacationMessage"             
+               if($this->isFeatureEnabled("vacationMessage") && $this->hasFeaturebeenChanged("vacationMessage")){}
+               
+               //checks for feature "mailBoxAutomaticRemoval"   
+               if($this->isFeatureEnabled("mailBoxAutomaticRemoval") && $this->hasFeaturebeenChanged("mailBoxAutomaticRemoval")){}
+               
+               //checks for feature "localDeliveryOnly"         
+               if($this->isFeatureEnabled("localDeliveryOnly") && $this->hasFeaturebeenChanged("localDeliveryOnly")){}
+               
+               //checks for feature "dropOwnMails"              
+               if($this->isFeatureEnabled("dropOwnMails") && $this->hasFeaturebeenChanged("dropOwnMails")){}
+               
+               //checks for feature "quotaUsage"                
+               //not to be saved
     }
 
 
@@ -825,55 +848,88 @@ class Groupware extends plugin
      */
     function check()
     {
-               //checked only if features are enabled.
+               //checke features only if they are enabled.
         $messages = plugin::check();
-        
-        //required vacationEnabled
-        if($this->vacationEnabled){
-            if(!tests::is_date($this->vacationStart)){
-                $messages[] = msgPool::invalid(_("Vacation start date"),$this->vacationStart , "", "01.03.2010");
-            }
-            if(!tests::is_date($this->vacationStop)){
-                $messages[] = msgPool::invalid(_("Vacation stop date"),$this->vacationStop , "", "01.03.2010");
-            }
-            $diff = tests::compareDate($this->vacationStart, $this->vacationStop);
+     
+               //checks for feature "primaryMail" 
+               if ($this->isFeatureEnabled("mailBoxWarnLimit")){               
+                       if(!tests::is_email ($this->mailAddress)){
+                               $messages[] = msgPool::invalid(_("Mail address"),$this->mailAddress , "", "user@exdom.intranet.gonicus.de knibbel");
+                       }
+               }
+               //checks for feature "quotaUsage"                
+               if ($this->isFeatureEnabled("quotaUsage")){}
+               
+               //checks for feature "quotaSize"                 
+               if ($this->isFeatureEnabled("quotaSize")){}
+               
+               //checks for feature "mailLocations"                            
+               if ($this->isFeatureEnabled("mailLocations")){}
+               
+               //checks for feature "mailFilter"                
+               if ($this->isFeatureEnabled("mailFilter")){}
+               
+               //checks for feature "alternateAddresses"        
+               if ($this->isFeatureEnabled("alternateAddresses")){}
+               
+               //checks for feature "forwardingAddresses" 
+               if ($this->isFeatureEnabled("forwardingAddresses")){            
+                       if(isset($this->forwardingAddresses) && is_array($this->forwardingAddresses)){
+                               foreach($this->forwardingAddresses as $fAddress){
+                                       if(!tests::is_email ($fAddress)){
+                                               $messages[] = msgPool::invalid(_("Forwarding address"),$fAddress, "", 
+                                                               "user@exdom.intranet.gonicus.de");
+                                       }
+                                       //Check if the address is a valid address on the Groupwareserver
+                                       $isMailAvailabel = $this->rpcExec("gwMailAddressExists", $fAddress);
+                                       if(empty($isMailAvailabel)){
+                                               $messages[] = _("This email address is not available as forwarding recipient in your groupware.");
+                                       }
+                                       if($fAddress == $this->mailAddress){
+                                               $messages[] = _("The primary address cannot be used as forwarding address!");
+                                       }
+                               }
+                       }       
+               }                       
+
+               //checks for feature "vacationMessage"   
+               if ($this->isFeatureEnabled("vacationMessage")){                
+                       if($this->vacationEnabled){
+                               if(!tests::is_date($this->vacationStart)){
+                                       $messages[] = msgPool::invalid(_("Vacation start date"),$this->vacationStart , "", "01.03.2010");
+                               }
+                               if(!tests::is_date($this->vacationStop)){
+                                       $messages[] = msgPool::invalid(_("Vacation stop date"),$this->vacationStop , "", "01.03.2010");
+                               }
+                               $diff = tests::compareDate($this->vacationStart, $this->vacationStop);
 
-            if($diff>=0){
-                $messages[] = msgPool::invalid(_("Vacation dates"));
-            }
-        }
-        if(!tests::is_email ($this->mailAddress)){
-            $messages[] = msgPool::invalid(_("Mail address"),$this->mailAddress , "", "user@exdom.intranet.gonicus.de knibbel");
-        }
-        if(isset($this->forwardingAddresses) && is_array($this->forwardingAddresses)){
-            foreach($this->forwardingAddresses as $fAddress){
-                if(!tests::is_email ($fAddress)){
-                    $messages[] = msgPool::invalid(_("Forwarding address"),$fAddress, "", 
-                            "user@exdom.intranet.gonicus.de");
-                }
-                               //Check if the address is a valid address on the Groupwareserver
-                               $isMailAvailabel = $this->rpcExec("gwMailAddressExists", $fAddress);
-                               if(empty($isMailAvailabel)){
-                                       $messages[] = _("This email address is not available as forwarding recipient in your groupware.");
+                               if($diff>=0){
+                                       $messages[] = msgPool::invalid(_("Vacation dates"));
                                }
-                if($fAddress == $this->mailAddress){
-                    $messages[] = _("The primary address cannot be used as forwarding address!");
-                }
-            }
-        }
-        if(isset($this->alternateAddresses) && is_array($this->alternateAddresses)){
+                       }        
+               }
+               //checks for feature "mailBoxWarnLimit"          
+               if ($this->isFeatureEnabled("mailBoxWarnLimit")){}
                
-            foreach($this->alternateAddresses as $fAddress){
-                if(!tests::is_email ($fAddress)){
-                    $messages[] = msgPool::invalid(_("Alternate address"),$fAddress, "", "user@excom.intranet.gonicus.de");
-                }
-                if($fAddress == $this->mailAddress){
-                    $messages[] = _("The primary address cannot be used as alternate address!");
-                }
-            }
-        }
-        
-        // TODO: Checks for quota and Locations?
+               
+               //checks for feature "mailBoxSendSizelimit"      
+               if ($this->isFeatureEnabled("mailBoxSendSizelimit")){}
+               
+               //checks for feature "mailBoxHardSizelimit"
+               if ($this->isFeatureEnabled("mailBoxHardSizelimit")){}
+
+               //checks for feature "mailBoxAutomaticRemoval"   
+               if ($this->isFeatureEnabled("mailBoxAutomaticRemoval")){}
+
+               //checks for feature "localDeliveryOnly"  
+               if ($this->isFeatureEnabled("localDeliveryOnly")){}     
+
+               //checks for feature "dropOwnMails"
+               if ($this->isFeatureEnabled("dropOwnMails")){}
+
+               //checks for feature "mailFolder"       
+               if ($this->isFeatureEnabled("mailFolder")){}
+       
         return($messages);
     }
 
@@ -952,6 +1008,31 @@ class Groupware extends plugin
             }
         }
     }
+       
+       
+       /*! \brief  This is a feature with many datasets inside which should be 
+        *                      cut in slices and saved separately.
+     */
+       //
+       function saveFoldersAndAcls($id, $mailFolder)
+    {
+               // In the tests with the exchange server groupware setting acls is very
+               // slow. So this function has got to be checked for modifications.
+               foreach($mailFolder as $key => $val)
+               {
+                       if(!empty($val["status"])){
+                               switch($val["status"]){
+                                       case "add":
+                                               $this->groupwareDao->save("mailFolder", $id, $key);
+                                               break;
+                                       case "del":
+                                               $this->groupwareDao->delete("mailFolder", $id, $key);
+                                               break;
+                               }
+                       }
+                       $this->save("private_folderACLS", $id, $val["acls"]);
+               }
+       }
 }
 
 
index 0ad4a0e4aa3c0d7096acd0d36e68389d5e62bb3a..606bab0f4f752fbc53a824ddeb651981a6815105 100644 (file)
@@ -104,8 +104,7 @@ class GroupwareDao{
      *                 which are the available features.
      */
     public function get($feature, $valueArray)
-    {
-        // TODO: Check if feture available ? get and return the result.
+    {          
         $function = GroupwareDao::$gwFeatures[$feature]["get"];
         if(is_array($valueArray)){
             $valueArray = array_merge(array($function), $valueArray);
@@ -125,7 +124,6 @@ class GroupwareDao{
      */
     public function del($feature, $valueArray)
     {
-        // TODO: check if feture available del and return the result.
         
         echo "deletion of values is not implemented yet";
         /*
@@ -209,8 +207,6 @@ class GroupwareDao{
                 $this->groupwarePluginRef->isFeatureEnabled("mailBoxWarnLimit") || 
                 $this->groupwarePluginRef->isFeatureEnabled("mailBoxSendSizelimit") || 
                 $this->groupwarePluginRef->isFeatureEnabled("mailBoxHardSizelimit")){
-
-            // Usage is a Mapi function which is not yet 
             
             // example Array for Quota
             $quota = $this->get("quotaSize", array($uid));
@@ -251,43 +247,5 @@ class GroupwareDao{
         }   
         return $resultArr;
     }
-       
-       //TODO: move this function into the groupwareplugin.
-       //This is a feature with many datasets inside which should be cut in slices and saved separately.
-       //Since the knowledge about the feature is only known in the plugin this has got to be moved.
-       
-       function saveFoldersAndAcls($id, $mailFolder)
-    {
-               /*
-                'user/wiwu/Aufgaben' => array( 
-                        "name" =>"Aufgaben",
-                        "acls"=> array(        
-                            array(
-                                "name" => "wiwu",
-                                "acl"  => RIGHTS_ALL, 
-                                "type"=>"user"),
-                            array(
-                                "name" => "2a",
-                                "acl" => RIGHTS_ALL, 
-                                "type"=>"user"))), 
-               */
-               foreach($mailFolder as $key => $val)
-               {
-                       if(!empty($val["status"])){
-                               switch($val["status"]){
-                                       case "add":
-                                               $this->save("mailFolder", $id, $key);
-                                               break;
-                                       case "del":
-                                               $this->delete("mailFolder", $id, $key);
-                                               break;
-                               }
-                       }
-                       $this->save("private_folderACLS", $id, $val["acls"]);
-                       //otherwise nothing happened with the entry - no action should be performed.
-                       //TODO: Save the acls: $this->save("folderSetMembers", id, array);
-               }
-       
-       }
 }
 ?>
index 9f99c2fd8579bb1042e8f220995c825e5fb3c85a..1e0c6d4b9c6720ba13e230a48619e94a6e6795e6 100644 (file)
@@ -19,6 +19,7 @@
                         {/render}
                     </td>
                 </tr>
+                               {if $mailLocations_isActive}
                 <tr>
                     <td><label for="mailLocation">{t}Account location{/t}</label></td>
                     <td>
@@ -31,6 +32,7 @@
                         {/render}
                     </td>
                 </tr>
+                               {/if}
                 {if $mailFolder_isActive}
                 <tr>
                     <td><label for="mailFolder">{t}Mail folder{/t}</label></td>