From 173fd5aeaef42d847817375d3ef1b9fc1bff09eb Mon Sep 17 00:00:00 2001 From: hickert Date: Tue, 18 Dec 2007 08:50:41 +0000 Subject: [PATCH] Added mail multiple edit git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@8137 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../personal/mail/class_mailAccount.inc | 82 ++++++++++++++++++- gosa-core/plugins/personal/mail/generic.tpl | 67 ++++++++++----- 2 files changed, 126 insertions(+), 23 deletions(-) diff --git a/gosa-core/plugins/personal/mail/class_mailAccount.inc b/gosa-core/plugins/personal/mail/class_mailAccount.inc index c98525c69..d9db8f209 100644 --- a/gosa-core/plugins/personal/mail/class_mailAccount.inc +++ b/gosa-core/plugins/personal/mail/class_mailAccount.inc @@ -656,6 +656,16 @@ class mailAccount extends plugin $smarty->assign("spamlevel", $spamlevel); $smarty->assign("spambox", $this->mailboxList); + foreach($this->attributes as $attr){ + $u_attr = "use_".$attr; + $smarty->assign($u_attr,in_array($attr,$this->multi_boxes)); + } + + foreach(array("only_local","gosaMailForwardingAddress","use_mailsize_limit","drop_own_mails","use_vacation","use_spam_filter") as $attr){ + $u_attr = "use_".$attr; + $smarty->assign($u_attr,in_array($attr,$this->multi_boxes)); + } + $smarty->assign("multiple_support",$this->multiple_support_active); $display.= $smarty->fetch (get_template_path('generic.tpl', TRUE, dirname(__FILE__))); return ($display); @@ -1211,8 +1221,10 @@ class mailAccount extends plugin function init_multiple_support($attrs,$all) { plugin::init_multiple_support($attrs,$all); - - + + if(isset($this->multi_attrs['gosaMailQuota'])){ + $this->gosaMailQuota = $this->multi_attrs['gosaMailQuota']; + } } function get_multi_init_values() @@ -1226,6 +1238,72 @@ class mailAccount extends plugin { return($this->execute()); } + + function multiple_save_object() + { + plugin::multiple_save_object(); + + $this->save_object(); + foreach(array("only_local","gosaMailForwardingAddress","use_mailsize_limit","drop_own_mails","use_vacation","use_spam_filter") as $attr){ + if(isset($_POST["use_".$attr])){ + $this->multi_boxes[] = $attr; + } + } + } + + function get_multi_edit_values() + { + $ret = plugin::get_multi_edit_values(); + + if(in_array("gosaMailQuota",$this->multi_boxes)){ + $ret['gosaMailQuota'] = $this->gosaMailQuota; + } + + $flag_add = $flag_remove = array(); + $tmp= preg_replace("/[^a-z]/i","",$this->gosaMailDeliveryMode); + $opts = array( + "R" => "use_mailsize_limit", + "S" => "use_spam_filter", + "L" => "only_local", + "V" => "use_vacation", + "C" => "own_script", + "I" => "drop_own_mails"); + + foreach($opts as $flag => $post){ + if(in_array($post, $this->multi_boxes)){ + if(preg_match("/".$flag."/",$tmp)){ + $flag_add[] = $flag; + }else{ + $flag_remove[] = $flag; + } + } + } + + $ret['flag_add'] = $flag_add; + $ret['flag_remove'] = $flag_remove; + return($ret); + } + + function set_multi_edit_values($values) + { + plugin::set_multi_edit_values($values); + $tmp= preg_replace("/[^a-z]/i","",$this->gosaMailDeliveryMode); + if(isset($values['flag_add'])){ + foreach($values['flag_add'] as $flag){ + if(!preg_match("/".$flag."/",$tmp)){ + $tmp .= $flag; + } + } + } + if(isset($values['flag_remove'])){ + foreach($values['flag_remove'] as $flag){ + if(preg_match("/".$flag."/",$tmp)){ + $tmp = preg_replace("/".$flag."/","",$tmp); + } + } + } + $this->gosaMailDeliveryMode = "[".$tmp."]"; + } } // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: diff --git a/gosa-core/plugins/personal/mail/generic.tpl b/gosa-core/plugins/personal/mail/generic.tpl index 785fd44f6..2c2d7305a 100644 --- a/gosa-core/plugins/personal/mail/generic.tpl +++ b/gosa-core/plugins/personal/mail/generic.tpl @@ -7,15 +7,19 @@ {$must} +{if $multiple_support} + +{else} {render acl=$mailACL} {/render} +{/if} -{render acl=$gosaMailServerACL} +{render acl=$gosaMailServerACL checkbox=$multiple_support checked=$use_gosaMailServer} MB {/render} @@ -49,6 +55,7 @@ +{if !$multiple_support}   @@ -73,16 +80,26 @@ {/render} + +{/if} + - + +{if $multiple_support} +

 

 {t}Mail options{/t}

+ +{else} + + +

 

{render acl=$gosaMailDeliveryModeCACL} -  

+{/if} + @@ -222,7 +240,7 @@ onclick="changeState('day'); changeState('month'); changeState('year'); changeSt

-{render acl=$gosaVacationMessageACL} +{render acl=$gosaVacationMessageACL checkbox=$multiple_support checked=$use_gosaVacationMessage} {/render}
@@ -243,8 +261,15 @@ onclick="changeState('day'); changeState('month'); changeState('year'); changeSt

+ +{if $multiple_support} + +{/if} + {render acl=$gosaMailForwardingAddressACL} - {html_options values=$gosaMailForwardingAddress output=$gosaMailForwardingAddress selected=$template} @@ -272,8 +297,8 @@ onclick="changeState('day'); changeState('month'); changeState('year'); changeSt
-{render acl=$gosaMailDeliveryModeIACL} - {t}No delivery to own mailbox{/t} +{render acl=$gosaMailDeliveryModeIACL checkbox=$multiple_support checked=$use_drop_own_mails} + {t}No delivery to own mailbox{/t} {/render}
-{render acl=$gosaMailDeliveryModeVACL} +{render acl=$gosaMailDeliveryModeVACL checkbox=$multiple_support checked=$use_use_vacation} {t}Activate vacation message{/t} {/render} @@ -190,30 +208,30 @@ onclick="changeState('day'); changeState('month'); changeState('year'); changeSt  
-{render acl=$gosaMailDeliveryModeSACL} - +{render acl=$gosaMailDeliveryModeSACL checkbox=$multiple_support checked=$use_use_spam_filter} + {/render} -{render acl=$gosaSpamSortLevelACL} +{render acl=$gosaSpamSortLevelACL checkbox=$multiple_support checked=$use_gosaSpamSortLevel} {/render} -{render acl=$gosaSpamMailboxACL} +{render acl=$gosaSpamMailboxACL checkbox=$multiple_support checked=$use_gosaSpamMailbox} {/render}
-{render acl=$gosaMailDeliveryModeRACL} - +{render acl=$gosaMailDeliveryModeRACL checkbox=$multiple_support checked=$use_use_mailsize_limit} + {/render} -{render acl=$gosaMailMaxSizeACL} - {t}MB{/t} +{render acl=$gosaMailMaxSizeACL checkbox=$multiple_support checked=$use_gosaMailMaxSize} + {t}MB{/t} {/render}
-- 2.30.2
-{render acl=$gosaMailDeliveryModeLACL} - +{render acl=$gosaMailDeliveryModeLACL checkbox=$multiple_support checked=$use_only_local} + {/render} {t}User is only allowed to send and receive local mails{/t}