Code

Backport from trunk
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 15 Sep 2011 09:02:21 +0000 (09:02 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 15 Sep 2011 09:02:21 +0000 (09:02 +0000)
-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

gosa-plugins/mail/personal/mail/class_mail-methods.inc
gosa-plugins/mail/personal/mail/class_mailAccount.inc
gosa-plugins/mail/personal/mail/generic.tpl
gosa-plugins/mail/personal/mail/mailAddressSelect/class_mailAddressSelect.inc
gosa-plugins/mail/personal/mail/mailAddressSelect/selectMailAddress-filter.xml
gosa-plugins/mail/personal/mail/mailAddressSelect/selectMailAddress-list.xml

index f75e0e0061ec00873a7f18c634e26574b0f55d10..18f2ccfd2995b90e1fed150892377c8f005c5f00 100644 (file)
@@ -805,7 +805,7 @@ class mailMethod{
       return("&nbsp;&nbsp;"._("Unlimited"));
     }else{
       $usage =round(($use/$quota) * 100);
-      return("<img src='progress.php?x=100&amp;y=17&amp;p=$usage'>");
+      return(progressbar($usage,100,15,true));
     }
   }
 
index ba6b720d023d41a59b628b335367aa6e545eca87..1d3993a1dca3468f42cd1e203e80e3ace9dc3d26 100644 (file)
@@ -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{
 
index 82724c1f1391757e1f4b226e3f4dc2e207cbf912..423a9aae53e3c03f42e0dbae35bc1e7a05711360 100644 (file)
@@ -9,7 +9,7 @@
     <tr>
      <td><label for="mail">{t}Primary address{/t}</label>{$must}</td>
      <td>
-      {if !$isModifyableMail && $initially_was_account}
+      {if !$isModifyableMail && $initially_was_account && !$is_template}
       <input type='text' disabled size=30 value="{$mail}">
       {else}
       {if $domainSelectionEnabled}
@@ -30,7 +30,7 @@
     <tr>
      <td><label for="gosaMailServer">{t}Server{/t}</label></td>
      <td>
-      {if !$isModifyableServer && $initially_was_account}
+      {if !$isModifyableServer && $initially_was_account && !$is_template}
       <input type='text' disabled size=30 value="{$gosaMailServer}">
       {else}
       
index 849276a49755336378354a6692119d7c16cc0a06..f46159aadf4b6b332503f622175f1df0055a90b9 100644 (file)
@@ -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();
index 05501beb96686fb2c808b02b94f82836833ded6a..647adfe6647512738d41751e867779471ed644ba 100644 (file)
@@ -21,7 +21,7 @@
     <tag>default</tag>
     <label>Default filter</label>
     <query>
-      <backend>LDAPBlacklist</backend>
+      <backend>NOACL</backend>
       <filter>(&amp;(objectClass=gosaMailAccount)(mail=$))</filter>
     </query>
     <autocomplete>
index 1527f056931f24acc5c235ebb9806f325421eef6..f869fd9b3a30ac5207842a71ee5855965ecb2260 100644 (file)
@@ -9,6 +9,7 @@
     <template>../plugins/personal/mail/mailAddressSelect/selectMailAddress-list.tpl</template>
     <label>Please select the desired entries</label>
     <defaultSortColumn>1</defaultSortColumn>
+    <noAclChecks>true</noAclChecks>
 
     <objectType>
       <label>User</label>
@@ -48,7 +49,7 @@
       <label>Name</label>
       <sortAttribute>cn</sortAttribute>
       <sortType>string</sortType>
-      <value>%{cn}</value>
+      <value>%{filter:objectName(row,dn,cn,sn,givenName)}</value>
       <export>true</export>
     </column>