Code

Load mailFolder entries on demand.
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 18 Nov 2010 14:08:45 +0000 (14:08 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 18 Nov 2010 14:08:45 +0000 (14:08 +0000)
-This increases the speed in which a user can be openend.

git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@20271 594d385d-05f5-0310-b6e9-bd551577e9d8

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

index f61a6b4b5898a8cf6546b2ce2aed50a9b42d0466..0db7a70f0d2c6522e6a0213f13dfb670155bb261 100644 (file)
@@ -61,7 +61,7 @@ class Groupware extends plugin
 
     var $mailAddress = "";
     var $mailLocation = "";
-    var $mailFolder = array();
+    var $mailFolder = NULL;
     var $quotaUsage = 0;
     var $quotaSize = 0;
     var $alternateAddresses = array();
@@ -324,7 +324,16 @@ class Groupware extends plugin
                 $this->FolderWidget = NULL;
             }
         }
+
+        // Act on requests to edit mailFolder entries.
         if(isset($_POST['configureFolder'])){
+
+            // Load mail folder entries on demand, this will increase the account 
+            //  instantiation a lot.
+            if($this->mailFolder === NULL){
+                $this->mailFolder = $this->GroupwareDao->getListOfMailFolders();
+            }
+
             $folders = $this->mailFolder;
             if(!isset($folders[$this->folderPrefix])){
                 $folders[$this->folderPrefix] = array('name' => $this->uid,'status' => 'added','acls' => array());
@@ -856,7 +865,7 @@ class Groupware extends plugin
         }
 
         // Save account folders
-        if($this->isFeatureEnabled("mailFolder") && $this->hasFeaturebeenChanged("mailFolder")){
+        if($this->mailFolder !== NULL && $this->isFeatureEnabled("mailFolder") && $this->hasFeaturebeenChanged("mailFolder")){
             $res = $this->saveFoldersAndAcls($this->uid, $this->mailFolder);
             if($res === NULL){
                 $message = _("Saving mail folder failed!");
index 3ce6f8a39407cdad2baab79be1db4cc98c1fe891..635843d499604bd0fb8db2cea8d0998435a31dfb 100644 (file)
@@ -198,16 +198,22 @@ class GroupwareDao{
                $resultArr["mailLimitSendValue"] = $comp["mailLimits"]["send"];
 
                $resultArr["vacationMessage"] = $comp["vacation"]["message"];
-               
-               //Folder Stuff
+
+               return $resultArr;
+       }       
+
+
+    /* \brief   Returns a list of mail folders for the current folderPrefix. 
+     *          Acl entries will be returned the GOsa-usable way.
+     * @return  Array   A list of mail folder entries.
+     */   
+    function getListOfMailFolders()
+    { 
         $prefix = $this->groupwarePluginRef->folderPrefix;
                $compFolders = $this->get("folderListWithMembers", array($prefix));
-               //ausgelagerte Funktion..
-               $resultArr["mailFolder"] = $this->translateGwAclsToGosaAcls($compFolders);
-       
-               return $resultArr;
-               
+               return($this->translateGwAclsToGosaAcls($compFolders));
        }
+
        
        private function getComprehensiverUserSeparate($uid){
         if($this->groupwarePluginRef->isFeatureEnabled("primaryMail")){