X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=plugins%2Fadmin%2Fgroups%2Fclass_groupMail.inc;h=b4bdc2962562fe5a5a8d1c9cd3ae86f04cccd983;hb=8d25a981707ac7e708aca0ed6216c5379a1228f8;hp=d42c233e8cd2292c55c2209def3b6a0600d23230;hpb=4ffada715db0731eba77babfc8c14bd3a14e6cb0;p=gosa.git
diff --git a/plugins/admin/groups/class_groupMail.inc b/plugins/admin/groups/class_groupMail.inc
index d42c233e8..b4bdc2962 100644
--- a/plugins/admin/groups/class_groupMail.inc
+++ b/plugins/admin/groups/class_groupMail.inc
@@ -9,6 +9,7 @@ class mailgroup extends plugin
var $uid = ""; // User id
var $cn = ""; // cn
+ var $orig_cn = ""; // cn
var $method = "mailMethod"; // Used Mail method
var $mmethod = ""; // Contains the gosa.conf MAILMETHOD
@@ -40,12 +41,16 @@ class mailgroup extends plugin
var $perms = array();
var $gosaMailDeliveryMode = "[L ]"; //
var $gosaMailMaxSize = ""; //
-
+
+ var $remove_folder_from_imap = true;
/* Helper */
var $indexed_acl= array();
var $indexed_user= array();
+ /* Copy & paste */
+ var $CopyPasteVars = array("quotaUsage","imapacl");
+
/* attribute list for save action */
var $attributes= array( "mail", "gosaMailServer", "gosaMailQuota", "gosaMailMaxSize",
"gosaMailAlternateAddress", "gosaMailForwardingAddress",
@@ -55,11 +60,14 @@ class mailgroup extends plugin
var $objectclasses= array("gosaMailAccount");
- function mailgroup ($config, $dn= NULL, $ui= NULL)
+ function mailgroup ($config, $dn= NULL, $parent= NULL)
{
/* Initialise all available attributes ... if possible
*/
- plugin::plugin($config, $dn);
+ plugin::plugin($config, $dn, $parent);
+
+ /* Save initial cn */
+ $this->orig_cn = $this->cn;
/* Set mailMethod to the one defined in gosa.conf
*/
@@ -295,6 +303,7 @@ class mailgroup extends plugin
/* Load templating engine */
$smarty= get_smarty();
+ $display = "";
if ($_SESSION['js']==FALSE){
$smarty->assign("javascript", "false");
} else {
@@ -308,7 +317,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 +330,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 after saving this account");
+ }
+
return ($display);
}
}
@@ -596,18 +621,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(), _("Removing group mail settings failed"));
@@ -620,6 +646,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
@@ -807,7 +843,7 @@ I: Only insider delivery */
}
$ldap->cd($this->config->current['BASE']);
$ldap->search ("(&(!(objectClass=gosaUserTemplate))(objectClass=gosaMailAccount)(|(mail=".$this->mail.")(gosaMailAlternateAddress=".
- $this->mail."))(!(uid=".$this->cn."))(!(cn=".$this->cn.")))");
+ $this->mail."))(!(uid=".$this->orig_cn."))(!(cn=".$this->orig_cn.")))");
if ($ldap->count() != 0){
$message[]= _("The primary address you've entered is already in use.");
}
@@ -972,8 +1008,13 @@ I: Only insider delivery */
}
}
+ function PrepareForCopyPaste($source)
+ {
+ plugin::PrepareForCopyPaste($source);
+ /* Reset alternate mail addresses */
+ $this->gosaMailAlternateAddress = array();
+ }
}
-
// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
?>