Code

Added dgroup mail fixes
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 23 Oct 2006 03:59:55 +0000 (03:59 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 23 Oct 2006 03:59:55 +0000 (03:59 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@4914 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/admin/groups/class_groupMail.inc
plugins/admin/groups/tabs_group.inc

index ce5ec423e47a96e40de78dac34a4cd192e3d14f7..13b378c3c2921ce70a42683ed5669132a354d7a3 100644 (file)
@@ -40,7 +40,8 @@ class mailgroup extends plugin
   var $perms                      = array();
   var $gosaMailDeliveryMode       = "[L        ]";   // 
   var $gosaMailMaxSize            = "";       // 
-
+  
+  var $remove_folder_from_imap    = true;
 
   /* Helper */
   var $indexed_acl= array();
@@ -317,10 +318,12 @@ class mailgroup extends plugin
       }
     }
 
+    $display = "";
 
     /* Do we represent a valid account? */
     if (!$this->is_account && $this->parent == NULL){
-      $display= "<img alt=\"\" src=\"images/stop.png\" align=middle>&nbsp;<b>".
+
+      $display.= "<img alt=\"\" src=\"images/stop.png\" align=middle>&nbsp;<b>".
         _("This 'dn' has no valid mail extensions.")."</b>";
       return ($display);
     }
@@ -329,11 +332,23 @@ class mailgroup extends plugin
     $display= "";
     if ($this->parent != NULL){
       if ($this->is_account){
-        $display= $this->show_disable_header(_("Remove mail account"),
+        $display.= $this->show_disable_header(_("Remove mail account"),
             _("This account has mail features enabled. You can disable them by clicking below."));
       } else {
-        $display= $this->show_enable_header(_("Create mail account"),
+        $display.= $this->show_enable_header(_("Create mail account"),
             _("This account has mail features disabled. You can enable them by clicking below."));
+  
+        /* Show checkbox that allows us to remove imap entry too*/
+        if($this->initially_was_account){
+          $c = "";
+          if($this->remove_folder_from_imap){
+            $c= " checked ";
+          }
+          $display .= "<h2>Shared folder delete options</h2>
+                       <input class='center' type='checkbox' name='remove_folder_from_imap' value='1' ".$c."
+                          title='"._("Remove shared folder from mail server database")."'>";
+          $display .= _("Remove the shared folder and all its contents from mail server.");
+        }
         return ($display);
       }
     }
@@ -636,18 +651,19 @@ class mailgroup extends plugin
 
     /* Connect to IMAP server for account deletion */
     if ($this->initially_was_account){
       $method= new $this->method($this->config);
-      if ($method->connect($this->gosaMailServer)){
+      $method->fixAttributesOnRemove($this);
+      if ($method->connect($this->gosaMailServer) && $this->remove_folder_from_imap){
+
         /* Remove account from IMAP server */
         $method->deleteMailbox($this->uid);
         $method->disconnect();
       }
-      $method->fixAttributesOnRemove($this);
     }
     /* Keep uid */
     unset ($this->attrs['uid']);
 
-
     $ldap->cd($this->dn);
     $ldap->modify ($this->attrs); 
     show_ldap_error($ldap->get_error(), sprintf(_("Removing of groups/mail with dn '%s' failed."),$this->dn));
@@ -660,6 +676,16 @@ class mailgroup extends plugin
   /* Save data to object */
   function save_object()
   {
+
+    /* Check if user wants to remove the shared folder from imap too */
+    if($this->initially_was_account && !$this->is_account){
+      if(isset($_POST['remove_folder_from_imap'])){
+        $this->remove_folder_from_imap = true;
+      }else{
+        $this->remove_folder_from_imap = false;
+      }
+    }
+
     /* Assemble mail delivery mode
        The mode field in ldap consists of values between braces, this must
        be called when 'mail' is set, because checkboxes may not be set when
index 7ae739b5c934c2e6b0248ad35324a438533c730a..6fa256f5daa85b560bd60c3a63c82ba3c141ef2f 100644 (file)
@@ -33,6 +33,16 @@ class grouptabs extends tabs
                }
        }
 
+       function delete()
+       {
+               /* Put baseobjects 'cn' to mailobjects 'uid' */
+               $baseobject= $this->by_object['group'];
+               if (isset($this->by_object['mailgroup'])){
+                       $this->by_object['mailgroup']->uid= $baseobject->cn;
+               }
+               tabs::delete();
+       }
+
        function save()
        {
                $baseobject= $this->by_object['group'];