From d8bd71573b5ae86231752038a33f5275dc719ca9 Mon Sep 17 00:00:00 2001 From: hickert Date: Thu, 15 Sep 2011 09:02:21 +0000 Subject: [PATCH] Backport from trunk -Fixed problem with selecting forward addresses in mailAccount plugin git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.7@21001 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../mail/personal/mail/class_mail-methods.inc | 2 +- .../mail/personal/mail/class_mailAccount.inc | 16 ++++++++-------- gosa-plugins/mail/personal/mail/generic.tpl | 4 ++-- .../class_mailAddressSelect.inc | 10 ++++++++++ .../selectMailAddress-filter.xml | 2 +- .../mailAddressSelect/selectMailAddress-list.xml | 3 ++- 6 files changed, 24 insertions(+), 13 deletions(-) diff --git a/gosa-plugins/mail/personal/mail/class_mail-methods.inc b/gosa-plugins/mail/personal/mail/class_mail-methods.inc index f75e0e006..18f2ccfd2 100644 --- a/gosa-plugins/mail/personal/mail/class_mail-methods.inc +++ b/gosa-plugins/mail/personal/mail/class_mail-methods.inc @@ -805,7 +805,7 @@ class mailMethod{ return("  "._("Unlimited")); }else{ $usage =round(($use/$quota) * 100); - return(""); + return(progressbar($usage,100,15,true)); } } diff --git a/gosa-plugins/mail/personal/mail/class_mailAccount.inc b/gosa-plugins/mail/personal/mail/class_mailAccount.inc index ba6b720d0..1d3993a1d 100644 --- a/gosa-plugins/mail/personal/mail/class_mailAccount.inc +++ b/gosa-plugins/mail/personal/mail/class_mailAccount.inc @@ -154,7 +154,7 @@ class mailAccount extends plugin /* Initialize configured values */ - if($this->is_account){ + if($this->is_account && !$this->is_template){ if($this->mailMethod->connect() && $this->mailMethod->account_exists()){ @@ -314,7 +314,7 @@ class mailAccount extends plugin $list = $this->mailAddressSelect->save(); foreach ($list as $entry){ $val = $entry['mail'][0]; - if (!in_array ($val, $this->gosaMailAlternateAddress) && $val != $this->mail){ + if (!in_array_strict($val, $this->gosaMailAlternateAddress) && $val != $this->mail){ $this->addForwarder($val); $this->is_modified= TRUE; } @@ -337,8 +337,8 @@ class mailAccount extends plugin return($this->mailAddressSelect->execute()); } - if (isset($_POST['add_forwarder'])){ - if ($_POST['forward_address'] != ""){ + if (isset($_POST['add_forwarder']) && isset($_POST['forward_address'])){ + if (!empty($_POST['forward_address'])){ $address= get_post('forward_address'); $valid= FALSE; if (!tests::is_email($address)){ @@ -364,7 +364,7 @@ class mailAccount extends plugin } } } - if (isset($_POST['delete_forwarder'])){ + if (isset($_POST['delete_forwarder']) && isset($_POST['forwarder_list'])){ $this->delForwarder ($_POST['forwarder_list']); } if ($this->mailAddressSelect instanceOf mailAddressSelect){ @@ -497,7 +497,7 @@ class mailAccount extends plugin */ $smarty->assign("spamlevel", $this->SpamLevels); $smarty->assign("spambox" , $this->MailBoxes); - + $smarty->assign("is_template", $this->is_template); $smarty->assign("multiple_support",$this->multiple_support_active); return($display.$smarty->fetch(get_template_path("generic.tpl",TRUE,dirname(__FILE__)))); } @@ -514,11 +514,11 @@ class mailAccount extends plugin $server = $this->gosaMailServer; plugin::save_object(); - if(!$this->mailMethod->isModifyableServer() && $this->initially_was_account){ + if(!$this->mailMethod->isModifyableServer() && $this->initially_was_account && !$this->is_template){ $this->gosaMailServer = $server; } - if(!$this->mailMethod->isModifyableMail() && $this->initially_was_account){ + if(!$this->mailMethod->isModifyableMail() && $this->initially_was_account && !$this->is_template){ $this->mail = $mail; }else{ diff --git a/gosa-plugins/mail/personal/mail/generic.tpl b/gosa-plugins/mail/personal/mail/generic.tpl index 82724c1f1..423a9aae5 100644 --- a/gosa-plugins/mail/personal/mail/generic.tpl +++ b/gosa-plugins/mail/personal/mail/generic.tpl @@ -9,7 +9,7 @@ {$must} - {if !$isModifyableMail && $initially_was_account} + {if !$isModifyableMail && $initially_was_account && !$is_template} {else} {if $domainSelectionEnabled} @@ -30,7 +30,7 @@ - {if !$isModifyableServer && $initially_was_account} + {if !$isModifyableServer && $initially_was_account && !$is_template} {else} diff --git a/gosa-plugins/mail/personal/mail/mailAddressSelect/class_mailAddressSelect.inc b/gosa-plugins/mail/personal/mail/mailAddressSelect/class_mailAddressSelect.inc index 849276a49..f46159aad 100644 --- a/gosa-plugins/mail/personal/mail/mailAddressSelect/class_mailAddressSelect.inc +++ b/gosa-plugins/mail/personal/mail/mailAddressSelect/class_mailAddressSelect.inc @@ -47,9 +47,19 @@ class mailAddressSelect extends management // Build headpage $headpage = new listing(get_template_path("selectMailAddress-list.xml", true, dirname(__FILE__))); $headpage->setFilter($filter); + $headpage->registerElementFilter("objectName", "mailAddressSelect::objectNameFilter"); parent::__construct($config, $ui, "mail", $headpage); } + static function objectNameFilter($id,$dn,$cn,$sn=NULL,$givenName=NULL) + { + if($sn){ + return("{$sn[0]}, {$givenName[0]}"); + }else{ + return("{$cn[0]}"); + } + } + function save() { $act = $this->detectPostActions(); diff --git a/gosa-plugins/mail/personal/mail/mailAddressSelect/selectMailAddress-filter.xml b/gosa-plugins/mail/personal/mail/mailAddressSelect/selectMailAddress-filter.xml index 05501beb9..647adfe66 100644 --- a/gosa-plugins/mail/personal/mail/mailAddressSelect/selectMailAddress-filter.xml +++ b/gosa-plugins/mail/personal/mail/mailAddressSelect/selectMailAddress-filter.xml @@ -21,7 +21,7 @@ default - LDAPBlacklist + NOACL (&(objectClass=gosaMailAccount)(mail=$)) diff --git a/gosa-plugins/mail/personal/mail/mailAddressSelect/selectMailAddress-list.xml b/gosa-plugins/mail/personal/mail/mailAddressSelect/selectMailAddress-list.xml index 1527f0569..f869fd9b3 100644 --- a/gosa-plugins/mail/personal/mail/mailAddressSelect/selectMailAddress-list.xml +++ b/gosa-plugins/mail/personal/mail/mailAddressSelect/selectMailAddress-list.xml @@ -9,6 +9,7 @@ 1 + true @@ -48,7 +49,7 @@ cn string - %{cn} + %{filter:objectName(row,dn,cn,sn,givenName)} true -- 2.30.2