X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=plugins%2Fadmin%2Fgroups%2Fclass_groupMail.inc;h=fd9df5eec1534820afd8a6baed5194933db0faab;hb=b5454c5f9b567b6a6ab29089563a77d00f5db194;hp=f898fb4c3cc2c3a555766fc4d444fb88b44d1a96;hpb=377572f9043fa43841314e751e8e4b12ef6f99f7;p=gosa.git diff --git a/plugins/admin/groups/class_groupMail.inc b/plugins/admin/groups/class_groupMail.inc index f898fb4c3..fd9df5eec 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(); @@ -55,11 +56,11 @@ 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); /* Set mailMethod to the one defined in gosa.conf */ @@ -112,10 +113,7 @@ class mailgroup extends plugin $method= new $this->method($this->config); if ($method->connect($this->attrs["gosaMailServer"][0])){ - - /* get Quota - */ - $quota= $method->getQuota($this->uid); + /* Maybe the entry is not saved in new style, get permissions from IMAP and convert them to acl attributes */ @@ -154,21 +152,30 @@ class mailgroup extends plugin } } // ENDE ! isset ($this->attrs['acl']) + + /* Adapt attributes if needed */ + $method->fixAttributesOnLoad($this); + + /* get Quota */ + $quota= $method->getQuota($this->uid); /* Update quota values */ - if ($quota['gosaMailQuota'] == 2147483647){ - $this->quotaUsage= ""; - $this->gosaMailQuota= ""; - } else { - $this->quotaUsage= $quota['quotaUsage']; - $this->gosaMailQuota= $quota['gosaMailQuota']; + if(is_array($quota)){ + if ($quota['gosaMailQuota'] == 2147483647){ + $this->quotaUsage= ""; + $this->gosaMailQuota= ""; + } else { + $this->quotaUsage= $quota['quotaUsage']; + $this->gosaMailQuota= $quota['gosaMailQuota']; + } + }else{ + $this->quotaUsage = ""; + $this->gosaMailQuota = ""; +// print_red(sprintf(_("Can't get quota information for '%s'."),$this->uid)); } $method->disconnect(); } // ENDE $method->connect($this->attrs["gosaMailServer"][0])){ - /* Adapt attributes if needed */ - $method->fixAttributesOnLoad($this); - } // ENDE gosaMailServer } // ENDE dn != "new" @@ -289,6 +296,7 @@ class mailgroup extends plugin /* Load templating engine */ $smarty= get_smarty(); + $display = ""; if ($_SESSION['js']==FALSE){ $smarty->assign("javascript", "false"); } else { @@ -302,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); } @@ -314,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 after saving this account"); + } + return ($display); } } @@ -465,7 +489,8 @@ class mailgroup extends plugin } $acl= array($this->config->current['BASE'] => ":all"); - $res= get_list($acl, "(&(objectClass=gosaMailAccount)$filter)", TRUE, $gmailfilter['depselect'], array("sn", "mail", "givenName"), TRUE); + $res= get_list("(&(objectClass=gosaMailAccount)$filter)", $acl, $gmailfilter['depselect'], + array("sn", "mail", "givenName"), GL_SUBSEARCH | GL_SIZELIMIT); $ldap->cd($gmailfilter['depselect']); $ldap->search ("(&(objectClass=gosaMailAccount)$filter)", array("sn", "mail", "givenName")); error_reporting (0); @@ -589,22 +614,22 @@ 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()); + show_ldap_error($ldap->get_error(), _("Removing group mail settings failed")); /* Optionally execute a command after we're done */ $this->handle_post_events("remove"); @@ -614,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 @@ -690,15 +725,7 @@ I: Only insider delivery */ /* Save arrays */ $this->attrs['gosaMailAlternateAddress'] = $this->gosaMailAlternateAddress; $this->attrs['gosaMailForwardingAddress'] = $this->gosaMailForwardingAddress; - - /* Save shared folder target */ - if(preg_match("/kolab/i",$this->mmethod)){ - /* Kolab style */ - $this->attrs['gosaSharedFolderTarget']= "kolab+shared.".$this->uid; - }else { - /* GOsa style */ - $this->attrs['gosaSharedFolderTarget']= "share+".$this->uid; - } + $this->attrs['gosaSharedFolderTarget'] = "share+".$this->uid; if(preg_match("/kolab/i",$this->mmethod)){ /* Save acl's */ @@ -776,13 +803,12 @@ I: Only insider delivery */ $ldap->cd($this->dn); $this->cleanup(); $ldap->modify ($this->attrs); - - show_ldap_error($ldap->get_error()); + show_ldap_error($ldap->get_error(), _("Saving group mail settings failed")); /* Optionally execute a command after we're done */ if ($this->initially_was_account == $this->is_account){ if ($this->is_modified){ - $this->handle_post_events("mofify"); + $this->handle_post_events("modify"); } } else { $this->handle_post_events("add"); @@ -794,7 +820,9 @@ I: Only insider delivery */ { $ldap= $this->config->get_ldap_link(); - $message= array(); + /* Call common method to give check the hook */ + $message= plugin::check(); + if(!$this->is_account) return array(); //$message[] = $str; @@ -973,8 +1001,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: ?>