From 820e199526b753ca364af5afe5c74b542670b39f Mon Sep 17 00:00:00 2001 From: hickert Date: Thu, 10 Aug 2006 07:02:36 +0000 Subject: [PATCH] Fixed kolabAccount (Connectivity) - Deleigations are only available if the user has already a valid kolabAccount Fixed mailAccount - If there are kolabDelegations configured you can't remove the mailAcoount until the delegations are removed. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@4457 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../connectivity/class_kolabAccount.inc | 9 ++++--- plugins/personal/connectivity/kolab.tpl | 2 +- plugins/personal/mail/class_mailAccount.inc | 26 +++++++++++++++++-- 3 files changed, 31 insertions(+), 6 deletions(-) diff --git a/plugins/personal/connectivity/class_kolabAccount.inc b/plugins/personal/connectivity/class_kolabAccount.inc index 30f696def..6a5895863 100644 --- a/plugins/personal/connectivity/class_kolabAccount.inc +++ b/plugins/personal/connectivity/class_kolabAccount.inc @@ -13,7 +13,7 @@ class kolabAccount extends plugin var $kolabDelegate = array(); /* attribute list for save action */ - var $attributes = array("kolabFreeBusyFuture", "unrestrictedMailSize", "calFBURL","kolabDelegate"); + var $attributes = array("kolabFreeBusyFuture", "unrestrictedMailSize", "calFBURL","kolabDelegate","kolabInvitationPolicy"); var $objectclasses = array("kolabInetOrgPerson"); /* Helper */ @@ -55,8 +55,11 @@ class kolabAccount extends plugin /* Transfer account states for this union */ if (isset($this->parent) && $this->parent->by_object['mailAccount']->is_account){ $this->mail_Account = true; - } elseif($this-> initially_was_account && (isset($this->attrs['objectClass']) && (in_array("kolabInetOrgPerson",$this->attrs['objectClass'])))){ - $this->mail_Account = true; + }elseif( isset($this->attrs) && isset($this->attrs['kolabHomeServer'])){ + $this->mail_Account= true; + }else{ + $this->is_account = false; + $this->mail_Account = false; } } diff --git a/plugins/personal/connectivity/kolab.tpl b/plugins/personal/connectivity/kolab.tpl index 97c63d905..8b7bd6ed1 100644 --- a/plugins/personal/connectivity/kolab.tpl +++ b/plugins/personal/connectivity/kolab.tpl @@ -1,5 +1,5 @@ -{if $mail_account ne 'true'} +{if !$mail_account}

{t}Kolab account{/t}

{t}The kolab account is currently disabled. It's features can be adjusted if you add a mail account.{/t} {else} diff --git a/plugins/personal/mail/class_mailAccount.inc b/plugins/personal/mail/class_mailAccount.inc index a8a201e39..570d6227c 100644 --- a/plugins/personal/mail/class_mailAccount.inc +++ b/plugins/personal/mail/class_mailAccount.inc @@ -258,8 +258,13 @@ class mailAccount extends plugin /* Show tab dialog headers */ if ($this->parent != NULL){ if ($this->is_account){ - $display= $this->show_disable_header(_("Remove mail account"), - _("This account has mail features enabled. You can disable them by clicking below.")); + if($this->accountDelegationsConfigured()){ + $display= $this->show_disable_header(_("Remove mail account"), + _("This account can't be removed while there are delegations configured. Remove those delegations first."),TRUE,TRUE); + }else{ + $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"), _("This account has mail features disabled. You can enable them by clicking below.")); return ($display); @@ -607,6 +612,23 @@ class mailAccount extends plugin $this->handle_post_events("remove"); } + + /* check if we have some delegations configured, those delegations must be removed first */ + function accountDelegationsConfigured() + { + /* We are in administrational edit mode. + Check tab configurations directly */ + if(isset($this->attrs)){ + $checkArray = array("kolabInvitationPolicy","unrestrictedMailSize", "calFBURL","kolabDelegate","kolabFreeBusyFuture"); + foreach($checkArray as $index){ + if(isset($this->attrs[$index])){ + return(true); + } + } + } + return(false); + } + /* Save data to object */ function save_object() -- 2.30.2