Code

Updated kolab service
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 9 Dec 2008 13:51:28 +0000 (13:51 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 9 Dec 2008 13:51:28 +0000 (13:51 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@13205 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/kolab/admin/systems/services/kolab/class_servKolab.inc
gosa-plugins/kolab/admin/systems/services/kolab/servkolab.tpl

index 8bb7999db7e0b95e2975da9b4df8d9eb4c11a02e..f1e8b04c705fe8bde510909b5c32f5258af25888 100644 (file)
@@ -3,7 +3,7 @@
 class servkolab extends goService {
   var $postfix_mydomain                 = "";
   var $cyrus_admins                     = "";
-  var $postfix_mydestination            = "";
+  var $postfix_mydestination            = array();
   var $postfix_mynetworks               = "127.0.0.1/8";
   var $postfix_enable_virus_scan        = "TRUE";
   var $postfix_relayhost                = "";
@@ -69,7 +69,16 @@ class servkolab extends goService {
         $this->is_account            = true;
         $this->initially_was_account = true;
       }
-    } 
+    }
+
+    /* Get list of configured domains 
+     */ 
+    $this->postfix_mydestination = array();
+    if(isset($this->attrs['postfix-mydestination'])){
+      for($i=0; $i < $this->attrs['postfix-mydestination']['count']; $i++){
+        $this->postfix_mydestination[] = $this->attrs['postfix-mydestination'][$i];
+      }
+    }
   }
 
 
@@ -134,6 +143,20 @@ class servkolab extends goService {
     $smarty->assign("fbfuture", $fbfuture);
     $smarty->assign("quotastr", $quotastr);
 
+    /* Create mail domain divlist  (postfix_mydestination)
+     */
+    $divlist = new divSelectBox("fuse");
+    $divlist->setHeight(100);
+    foreach($this->postfix_mydestination as $key => $domain){
+      $f1 = array("string" => $domain);
+      $f2 = array("string" => "<input type='image' src='images/lists/trash.png' 
+                                  name='remove_domain_".$key."'
+                                  title='"._("Remove")."' alt='"._("Remove")."'>", 
+                  "attach" => "style='border-right:0px; width: 20px;'");
+      $divlist->AddEntry(array($f1,$f2));
+    }
+    $smarty->assign("mdDiv",$divlist->DrawList());
+
     /* Load Template */
     $display.=$smarty->fetch(get_template_path('servkolab.tpl', TRUE,dirname(__FILE__)));
     return ($display);
@@ -223,7 +246,26 @@ class servkolab extends goService {
     if (isset($_POST['kolabtab'])){
       plugin::save_object();
 
+      /* Domain name added/removed 
+       */
+      foreach($_POST as $name => $value){
+        if(preg_match("/^remove_domain_/",$name)){
+          $id = preg_replace("/^remove_domain_([0-9]*)_.*$/","\\1",$name);
+          if(isset($this->postfix_mydestination[$id])){
+            unset($this->postfix_mydestination[$id]);
+          }
+          break;
+        }
+      }
+      if(isset($_POST['add_domain_name']) && isset($_POST['new_domain_name'])){
+        $new_domain = trim(get_post('new_domain_name'));
+        if(!empty($new_domain) && tests::is_domain($new_domain)){
+          $this->postfix_mydestination[] = $new_domain;
+        }
+      }
 
+      /* Map attrinutes 
+       */
       foreach($this->attributes as $attr){
         if(($this->acl_is_writeable(preg_replace("/_/","",$attr))) && (isset($_POST[$attr]))){
           $this->$attr = $_POST[$attr];
@@ -277,6 +319,10 @@ class servkolab extends goService {
       $message[] = msgPool::required(_("Privileged networks"));
     }
 
+    if(!count($this->postfix_mydestination)){
+      $message[] = msgPool::required(_("Mail domains")." (postfix-mydestination)" );
+    }
+
     return ($message);
   }
 
index 055b0d401d8cbc983042a98b9106cb6e4e6aa181..834a943dd98997a9e67fc3e8e59fb5191c0ef424 100644 (file)
@@ -1,7 +1,7 @@
 <table summary="" style="width:100%">
  <tr>
   <td style="vertical-align:top; border-right:1px solid #A0A0A0; padding-right:5px;" width="50%">
-   <table summary="">
+   <table summary="" width="100%">
     <tr>
         <td colspan="2"><b>{t}Generic{/t}</b></td>
        </tr>
                </td>
        </tr>
        <tr>
-               <td>{t}Postfix mydestination{/t}
+               <td>{t}Cyrus admins{/t}
                </td>
                <td>
-{render acl=$postfixmydestinationACL}
-                       <input type="text" name="postfix_mydestination" value="{$postfix_mydestination}">
+{render acl=$cyrusadminsACL}
+                       <input type="text" name="cyrus_admins" value="{$cyrus_admins}">
 {/render}
                </td>
        </tr>
        <tr>
-               <td>{t}Cyrus admins{/t}
-               </td>
-               <td>
-{render acl=$cyrusadminsACL}
-                       <input type="text" name="cyrus_admins" value="{$cyrus_admins}">
+               <td colspan="2">{t}Mail domains{/t}&nbsp;({t}Postfix mydestination{/t})<br>
+{render acl=$postfixmydestinationACL}
+               {$mdDiv}
+{/render}
+{render acl=$postfixmydestinationACL}
+               <input size="30" type='text' name='new_domain_name' value=''>
+{/render}
+{render acl=$postfixmydestinationACL}
+               <input type='submit' name='add_domain_name' value='{msgPool type=addButton}'>
 {/render}
                </td>
        </tr>