Code

Updated Spamserver
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 12 Apr 2010 15:11:35 +0000 (15:11 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 12 Apr 2010 15:11:35 +0000 (15:11 +0000)
-No more divlists in here.

git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@17592 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/mail/admin/systems/services/spam/class_goSpamServer.inc
gosa-plugins/mail/admin/systems/services/spam/goSpamServer.tpl
gosa-plugins/mail/admin/systems/services/spam/goSpamServerRule.tpl

index d5e8b6fbe144c25ce64be5638cb81930e4320b80..41dedf6a193cb30880463f12ee424ce6a3301190 100644 (file)
@@ -73,6 +73,17 @@ class gospamserver extends goService{
         $this->Rules[ $name ] = $value;
       }
     }
+
+    // Prepare lists
+    $this->ruleList = new sortableListing();
+    $this->ruleList->setDeleteable(true);
+    $this->ruleList->setInstantDelete(true);
+    $this->ruleList->setEditable(true);
+    $this->ruleList->setWidth("100%");
+    $this->ruleList->setHeight("170px");
+    $this->ruleList->setHeader(array(_("Rule")));
+    $this->ruleList->setDefaultSortColumn(0);
+    $this->ruleList->setColspecs(array('*','40px'));
   }
 
 
@@ -119,21 +130,17 @@ class gospamserver extends goService{
 
     /* Handle post to delete rules */
     $once = true;
-    foreach($_POST as $name => $value){
-      if(preg_match("/^editRule_/",$name) && $once && $this->acl_is_readable("saRule")){
-        $once = false;
-        $entry = preg_replace("/^editRule_/","",$name);
-        $rule = $this->Rules[$entry];
-        $name = $entry;
-        $this->dialog = new goSpamServerRule($this->config,$this->dn,$name,$rule);
+    $this->ruleList->save_object();
+    $action = $this->ruleList->getAction();
+    if($action['action'] == 'delete'){
+        $this->Rules = $this->ruleList->getMaintainedData();
+    }
+    if($action['action'] == 'edit'){
+        $id = $this->ruleList->getKey($action['targets'][0]);
+        $rule = $this->Rules[$id];
+        $this->dialog = new goSpamServerRule($this->config,$this->dn,$id,$rule);
         $this->dialog->acl_base = $this->acl_base;
         $this->dialog->acl_category = $this->acl_category;
-      }
-      if(preg_match("/^delRule_/",$name) && $once && $this->acl_is_writeable("saRule")){
-        $once = false;
-        $entry = preg_replace("/^delRule_/","",$name);
-        unset($this->Rules[$entry]);
-      }
     }
 
     /* Save rules */
@@ -176,25 +183,15 @@ class gospamserver extends goService{
       }
     }
 
-    /* Create divlist */
-    $DivRules = new divSelectBox("SpamRules");
-    $DivRules->SetHeight(130);
-
-    if(!$this->acl_is_writeable("saTrustedNetworks")){
-      $actions = "";
-    }else{
-      $actions = image('images/lists/edit.png', 'editRule_%s');
-      if($this->acl_is_writeable("saRule")){
-        $actions.= image('images/lists/trash.png','delRule_%s');
-      }
-    }
-
+    $this->ruleList->setAcl($this->getacl('saRule'));
+    $data =$lData= array();
     foreach($this->Rules as $key => $net){
-      $field1 = array("string" => $key );
-      $field2 = array("string" => preg_replace("/%s/",$key,$actions) , "attach" => "style='border-right:0px;width:36px;'");
-      $DivRules->AddEntry(array($field1,$field2));
+      $lData[$key]=array('data'=> array($key));
     }
-    $smarty->assign("divRules",$DivRules->DrawList()); 
+    $this->ruleList->setListData($this->Rules, $lData);
+    $this->ruleList->update();
+
+    $smarty->assign("ruleList",$this->ruleList->render());
     $smarty->assign("TrustedNetworks",$this->TrustedNetworks); 
 
     /* Create Spam score select box entries */
index 9699efffbb639b6df98e8cd4bc302e48fea5cb74..a0a12a666abaaf7bf49f49a6b634de3cce3c34ad 100644 (file)
    <table width='100%' summary="{t}Rules{/t}">
     <tr>
      <td>
-      {$divRules}
+      {$ruleList}
       <br>
       {render acl=$saTrustedNetworksACL}
        <button type='submit' name='AddRule'>{msgPool type=addButton}</button>
index 4131b2729e0415b900fccc8301086c5fc79115d8..13a7511d42fcfbeacec0fd4e468e01a97c8e66e5 100644 (file)
@@ -6,7 +6,7 @@
 <hr>
 
 <h3>{t}Rule{/t}</h3>
-<textarea name='rule' style='width:100%;'>{$rule}</textarea>
+<textarea name='rule' style='height:400px;width:100%;'>{$rule}</textarea>
 
 <hr>
 <div style="width:100%; text-align:right;padding-top:10px;padding-bottom:3px;">