From 2874db256e9a767e332ceb2187b9ec84f7d1fc3f Mon Sep 17 00:00:00 2001 From: hickert Date: Thu, 5 Apr 2007 07:01:21 +0000 Subject: [PATCH] Updated sieve storage mechanism. Will save sieve script when user is saved. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@5988 594d385d-05f5-0310-b6e9-bd551577e9d8 --- include/sieve/class_sieveManagement.inc | 1 + include/sieve/templates/management.tpl | 15 +------------- plugins/personal/mail/class_mailAccount.inc | 22 +++++++++++---------- 3 files changed, 14 insertions(+), 24 deletions(-) diff --git a/include/sieve/class_sieveManagement.inc b/include/sieve/class_sieveManagement.inc index 04a1f9081..e382838df 100644 --- a/include/sieve/class_sieveManagement.inc +++ b/include/sieve/class_sieveManagement.inc @@ -953,6 +953,7 @@ class sieveManagement extends plugin sprintf( _("Can't log into SIEVE server. Server says '%s'."), to_string($this->Sieve_Error))); + return; } $everything_went_fine = TRUE; diff --git a/include/sieve/templates/management.tpl b/include/sieve/templates/management.tpl index f49a8ee4e..43aebef3b 100644 --- a/include/sieve/templates/management.tpl +++ b/include/sieve/templates/management.tpl @@ -7,11 +7,6 @@

- {$List} - -

- -

{elseif $Sieve_Error != ""} {t}Connection to sieve could not be established.{/t}
@@ -20,14 +15,7 @@ {t}Possibly the sieve account was not created yet.{/t}

- - {$List} - -

- -

- -{else} +{/if} {t}Be careful. All your changes will be saved directly to sieve, if you use the save button below.{/t}
@@ -37,4 +25,3 @@  

-{/if} diff --git a/plugins/personal/mail/class_mailAccount.inc b/plugins/personal/mail/class_mailAccount.inc index e6c11cf38..77e85bd1e 100644 --- a/plugins/personal/mail/class_mailAccount.inc +++ b/plugins/personal/mail/class_mailAccount.inc @@ -61,6 +61,8 @@ class mailAccount extends plugin var $objectclasses= array("gosaMailAccount"); var $uid; + var $sieve_management = NULL; + /* constructor, if 'dn' is set, the node loads the given 'dn' from LDAP */ function mailAccount ($config, $dn= NULL) @@ -182,8 +184,10 @@ class mailAccount extends plugin } } - - /* Create filter */ + /* Create sieve management class */ + $method = new $this->method($this->config); + $id = $method->uattrib; + $this->sieve_management = new sieveManagement($this->config,$this->dn,$this,$id); /* Get global filter config */ if (!is_global("mailfilter")){ @@ -242,10 +246,7 @@ class mailAccount extends plugin && preg_match("/C/",$this->gosaMailDeliveryMode) && $this->acl_is_writeable("sieveManagement")) { - $method = new $this->method($this->config); - $id = $method->uattrib; - - $this->dialog = new sieveManagement($this->config,$this->dn,$this,$id); + $this->dialog = $this->sieve_management; } /* Cancel sieve edit */ @@ -255,9 +256,8 @@ class mailAccount extends plugin /* Save sieve changes */ if(isset($_POST['sieve_finish'])){ - if($this->dialog->save()){ - $this->dialog = NULL; - } + $this->sieve_management = $this->dialog; + $this->dialog = NULL; } if(is_object($this->dialog)){ @@ -844,7 +844,7 @@ class mailAccount extends plugin $method->disconnect(); /* Ensure that this is an existing account */ - if($this->initially_was_account){ + if(1==1 || $this->initially_was_account){ /* Write sieve information only if not in C mode */ if (!is_integer(strpos($this->gosaMailDeliveryMode, "C"))){ @@ -856,6 +856,8 @@ class mailAccount extends plugin $this->gosaSpamMailbox, $this->gosaSpamSortLevel, $this->gosaVacationMessage); + }else{ + $this->sieve_management->save(); } } } -- 2.30.2