From: hickert Date: Fri, 23 Mar 2007 14:08:21 +0000 (+0000) Subject: Re-imlemented default sieve settings. X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=c7ea92877c47d6761cbb2732bb8d7c233b08a485;p=gosa.git Re-imlemented default sieve settings. Added js disable/enable if user_own_script is set. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@5874 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/plugins/personal/mail/class_mailAccount.inc b/plugins/personal/mail/class_mailAccount.inc index 8112406bd..b5ce37d8c 100644 --- a/plugins/personal/mail/class_mailAccount.inc +++ b/plugins/personal/mail/class_mailAccount.inc @@ -239,7 +239,7 @@ class mailAccount extends plugin /* * Sieve Management */ - if(isset($_POST['sieveManagement'])) { + if(isset($_POST['sieveManagement']) && !preg_match("/C/",$this->gosaMailDeliveryMode)) { $this->dialog = new sieveManagement($this->config,$this->dn,$this); } @@ -672,56 +672,68 @@ class mailAccount extends plugin function save_object() { if (isset($_POST['mailTab'])){ + /* Save ldap attributes */ plugin::save_object(); - /* 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 - we're in some other dialog. - Example for gosaMailDeliveryMode [LR ] - L: Local delivery - R: Reject when exceeding mailsize limit - S: Use spam filter - V: Use vacation message - C: Use custm sieve script - I: Only insider delivery */ + if(isset($_POST['own_script'])){ + + if(!preg_match("/C/",$this->gosaMailDeliveryMode)){ + $str= preg_replace("/[\[\]]/","",$this->gosaMailDeliveryMode); + $this->gosaMailDeliveryMode = "[".$str."C]"; + } + + }else{ + + /* 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 + we're in some other dialog. + + Example for gosaMailDeliveryMode [LR ] + L: Local delivery + R: Reject when exceeding mailsize limit + S: Use spam filter + V: Use vacation message + C: Use custm sieve script + I: Only insider delivery */ - $tmp= preg_replace("/[^a-z]/i","",$this->gosaMailDeliveryMode); + $tmp= preg_replace("/[^a-z]/i","",$this->gosaMailDeliveryMode); - /* Handle delivery flags */ - if($this->acl_is_writeable("gosaMailDeliveryModeL")){ - if(!preg_match("/L/",$tmp) && !isset($_POST['only_local'])){ - $tmp.="L"; - }elseif(preg_match("/L/",$tmp) && isset($_POST['only_local'])){ - $tmp = preg_replace("/L/","",$tmp); + /* Handle delivery flags */ + if($this->acl_is_writeable("gosaMailDeliveryModeL")){ + if(!preg_match("/L/",$tmp) && !isset($_POST['only_local'])){ + $tmp.="L"; + }elseif(preg_match("/L/",$tmp) && isset($_POST['only_local'])){ + $tmp = preg_replace("/L/","",$tmp); + } } - } - $opts = array( - "R" => "use_mailsize_limit", - "S" => "use_spam_filter", - "V" => "use_vacation", - "C" => "own_script", - "I" => "drop_own_mails"); - - foreach($opts as $flag => $post){ - if($this->acl_is_writeable("gosaMailDeliveryMode".$flag)){ - if(!preg_match("/".$flag."/",$tmp) && isset($_POST[$post])){ - $tmp.= $flag; - }elseif(preg_match("/".$flag."/",$tmp) && !isset($_POST[$post])){ - $tmp = preg_replace("/".$flag."/","",$tmp); + $opts = array( + "R" => "use_mailsize_limit", + "S" => "use_spam_filter", + "V" => "use_vacation", + "C" => "own_script", + "I" => "drop_own_mails"); + + foreach($opts as $flag => $post){ + if($this->acl_is_writeable("gosaMailDeliveryMode".$flag)){ + if(!preg_match("/".$flag."/",$tmp) && isset($_POST[$post])){ + $tmp.= $flag; + }elseif(preg_match("/".$flag."/",$tmp) && !isset($_POST[$post])){ + $tmp = preg_replace("/".$flag."/","",$tmp); + } } } - } - $tmp= "[$tmp]"; - if ($this->gosaMailDeliveryMode != $tmp){ - $this->is_modified= TRUE; + $tmp= "[$tmp]"; + if ($this->gosaMailDeliveryMode != $tmp){ + $this->is_modified= TRUE; + } + $this->gosaMailDeliveryMode= $tmp; } - $this->gosaMailDeliveryMode= $tmp; } } diff --git a/plugins/personal/mail/generic.tpl b/plugins/personal/mail/generic.tpl index 1116201be..238e3628d 100644 --- a/plugins/personal/mail/generic.tpl +++ b/plugins/personal/mail/generic.tpl @@ -75,25 +75,55 @@ - +

 

 {t}Mail options{/t}

- +
+ + +
+{render acl=$gosaMailDeliveryModeCACL} + {t}Use custom sieve script{/t} ({t}disables all Mail options!{/t}) +{/render} +
- +
+ + +

 

@@ -133,19 +163,19 @@

{render acl=$gosaVacationMessageACL} - + {/render}
{if $show_templates eq "true"} {render acl=$gosaVacationMessageACL} - {html_options options=$vacationtemplates selected=$template} {/render} {render acl=$gosaVacationMessageACL} - + {/render} {/if} @@ -154,23 +184,23 @@

{render acl=$gosaMailForwardingAddressACL} - {html_options values=$gosaMailForwardingAddress output=$gosaMailForwardingAddress selected=$template} {/render}
{render acl=$gosaMailForwardingAddressACL} - + {/render} {render acl=$gosaMailForwardingAddressACL} -   +   {/render} {render acl=$gosaMailForwardingAddressACL} -   +   {/render} {render acl=$gosaMailForwardingAddressACL} - + {/render} @@ -183,19 +213,13 @@ -
{render acl=$gosaMailDeliveryModeIACL} - {t}No delivery to own mailbox{/t} + {t}No delivery to own mailbox{/t} {/render}
{render acl=$gosaMailDeliveryModeVACL} - {t}Activate vacation message{/t} + {t}Activate vacation message{/t} {/render}
@@ -101,29 +131,29 @@ {render acl=$gosaMailDeliveryModeSACL} - + {/render} {render acl=$gosaSpamSortLevelACL} - {html_options values=$spamlevel output=$spamlevel selected=$gosaSpamSortLevel} {/render} {render acl=$gosaSpamMailboxACL} - {html_options values=$spambox output=$spambox selected=$gosaSpamMailbox} {/render}
{render acl=$gosaMailDeliveryModeRACL} - + {/render} {render acl=$gosaMailMaxSizeACL} - {t}MB{/t} + {t}MB{/t} {/render}
{render acl=$gosaMailDeliveryModeLACL} - + {/render} {t}User is only allowed to send and receive local mails{/t}   - -{render acl=$gosaMailDeliveryModeCACL} - {t}Use custom sieve script{/t} ({t}disables all Mail options!{/t}) -{/render} -