Code

Fixed adding test cases
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 14 Mar 2007 11:35:15 +0000 (11:35 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 14 Mar 2007 11:35:15 +0000 (11:35 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@5782 594d385d-05f5-0310-b6e9-bd551577e9d8

include/sieve/class_sieveElement_If.inc

index e9979a62aced383568b6ce1c7053298a21a59451..8f9a5ec404390c2ecb5ff013c360b2efe2331a86 100644 (file)
@@ -403,6 +403,7 @@ class sieve_if
         $values = array(        "Inverse"         => FALSE,
                                 "Comparator"      => "",
                                 "Expert"          => FALSE,
+                                "LastError"       => "",
                                 "Match_type"      => ":contains",
                                 "Match_type_value"=> "",
                                 "Key_List"        => array("emtpy"),
@@ -410,8 +411,16 @@ class sieve_if
         if($type == "address"){
           $values["Address_Part"]    = ":all";
         }
-        $data['address']=$values;
+        $data[$type]=$values;
+        break;
+      }
+      case "allof" :
+      case "anyof" :
+      {
+        $data[$type] = array("Inverse" => FALSE);
+        break;
       }
+  
     }
 
     return($data);
@@ -459,6 +468,12 @@ class sieve_if
           return(false); 
         }
       }
+
+      
+      if(isset($_POST['add_type']) && isset($_POST["test_type_to_add_".$element_id])){
+        $parsed[$key][] = $this->add_test(array(),$_POST["test_type_to_add_".$element_id]);
+      }
+
       /* Create elements */
       switch($key)
       {
@@ -1008,7 +1023,13 @@ class sieve_if
           $smarty->assign("Inverse",$Inverse);
           $smarty->assign("Contents",$Contents);
           $smarty->assign("ID"  , $element_id); 
-          $ret .= $smarty->fetch(get_template_path("templates/element_allof.tpl",TRUE,dirname(__FILE__)));
+          $tmp = $smarty->fetch(get_template_path("templates/element_allof.tpl",TRUE,dirname(__FILE__)));
+
+          $smarty->assign("DisplayAdd",TRUE);
+          $smarty->assign("DisplayDel",FALSE);
+          $str = $smarty->fetch(get_template_path("templates/object_test_container.tpl",TRUE,dirname(__FILE__)));
+          $ret .= preg_replace("/%%OBJECT_CONTENT%%/",$tmp,$str);
+
           break ;
         } 
 
@@ -1030,7 +1051,13 @@ class sieve_if
           $smarty->assign("Inverse",$Inverse);
           $smarty->assign("Contents",$Contents);
           $smarty->assign("ID"  , $element_id); 
-          $ret .= $smarty->fetch(get_template_path("templates/element_anyof.tpl",TRUE,dirname(__FILE__)));
+          $tmp = $smarty->fetch(get_template_path("templates/element_anyof.tpl",TRUE,dirname(__FILE__)));
+
+          $smarty->assign("DisplayAdd",TRUE);
+          $smarty->assign("DisplayDel",FALSE);
+          $str = $smarty->fetch(get_template_path("templates/object_test_container.tpl",TRUE,dirname(__FILE__)));
+          $ret .= preg_replace("/%%OBJECT_CONTENT%%/",$tmp,$str);
+
           break ;
         } 
         default : 
@@ -1049,6 +1076,8 @@ class sieve_if
     if(!isset($smarty)){
       $smarty =get_smarty();
     }
+
+    $smarty->assign("ID",$element_id);
     $smarty->assign("DisplayAdd",TRUE);
     $smarty->assign("DisplayDel",TRUE);
     $str = $smarty->fetch(get_template_path("templates/object_test_container.tpl",TRUE,dirname(__FILE__)));