From 9ba09dbf6346c443b3ca8a43895ac9b80aa55419 Mon Sep 17 00:00:00 2001 From: hickert Date: Fri, 20 Oct 2006 04:20:55 +0000 Subject: [PATCH] Added checkbox to be able to keep a shared folder in imap database, when a mail account is removed from ldap. git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.5@4903 594d385d-05f5-0310-b6e9-bd551577e9d8 --- plugins/admin/groups/class_groupMail.inc | 39 +++++++++++++++++++++--- 1 file changed, 34 insertions(+), 5 deletions(-) diff --git a/plugins/admin/groups/class_groupMail.inc b/plugins/admin/groups/class_groupMail.inc index 31557a6c4..20a421455 100644 --- a/plugins/admin/groups/class_groupMail.inc +++ b/plugins/admin/groups/class_groupMail.inc @@ -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(); @@ -295,6 +296,7 @@ class mailgroup extends plugin /* Load templating engine */ $smarty= get_smarty(); + $display = ""; if ($_SESSION['js']==FALSE){ $smarty->assign("javascript", "false"); } else { @@ -308,7 +310,8 @@ class mailgroup extends plugin /* Do we represent a valid account? */ if (!$this->is_account && $this->parent == NULL){ - $display= "\"\" ". + + $display.= "\"\" ". _("This 'dn' has no valid mail extensions.").""; return ($display); } @@ -320,8 +323,23 @@ class mailgroup extends plugin $display= $this->show_header(_("Remove mail account"), _("This account has mail features enabled. You can disable them by clicking below.")); } else { - $display= $this->show_header(_("Create mail account"), + $display.= $this->show_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 .= "

Shared folder delete options

+ "; + $display .= _("Remove the shared folder and all its contents from mail server."); + } + return ($display); } } @@ -596,8 +614,10 @@ 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)){ + if ($method->connect($this->gosaMailServer) && $this->remove_folder_from_imap){ + /* Remove account from IMAP server */ $method->deleteMailbox($this->uid); $method->disconnect(); @@ -607,7 +627,6 @@ class mailgroup extends plugin /* Keep uid */ unset ($this->attrs['uid']); - $ldap->cd($this->dn); $ldap->modify ($this->attrs); show_ldap_error($ldap->get_error(), _("Removing group mail settings failed")); @@ -620,6 +639,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 -- 2.30.2