Code

Some changes.
[gosa.git] / include / sieve / class_sieveElement_If.inc
index 0b8c5caadfc8f68d4c91e397148b2b5794b442f5..4c61ca676729c75536d519f266aef809938c5fac 100644 (file)
@@ -144,7 +144,7 @@ class sieve_if
 
           /* Add special match type for count and value */
           if(in_array($data['Match_type'], array(":value",":count")) && !empty($data['Match_type_value'])) {
-            $script .= $data['Match_type_value']." ";
+            $script .= sieve_create_strings($data['Match_type_value'])." ";
           }
 
           $script .= sieve_create_strings($data['Key_List']);
@@ -189,7 +189,7 @@ class sieve_if
 
           /* Add special match type for count and value */
           if(in_array($data['Match_type'], array(":value",":count")) && !empty($data['Match_type_value'])) {
-            $script .= $data['Match_type_value']." ";
+            $script .= sieve_create_strings($data['Match_type_value'])." ";
           }
 
           $script .= sieve_create_strings($data['Key_List']);
@@ -235,7 +235,7 @@ class sieve_if
 
           /* Add special match type for count and value */
           if(in_array($data['Match_type'], array(":value",":count")) && !empty($data['Match_type_value'])) {
-            $script .= $data['Match_type_value']." ";
+            $script .= sieve_create_strings($data['Match_type_value'])." ";
           }
 
           $script .= sieve_create_strings($data['Key_List']);
@@ -487,6 +487,11 @@ class sieve_if
 
         case "exists" :
         {
+          /* Toggle Inverse ? */
+          if(isset($_POST['toggle_inverse_'.$element_id])){
+            $parsed[$key]['Inverse'] = !$parsed[$key]['Inverse'];
+          }
+
           /* get list of match values */
           if(isset($_POST['Values_'.$element_id])){
             $vls = stripslashes($_POST['Values_'.$element_id]);
@@ -609,15 +614,25 @@ class sieve_if
       $name .= " - "._("Else");
     }
 
-    /* Create new html block */
-    $str  ="<table cellspacing=0 width='100%'>
-              <tr>
-                <td style='width:100%;background-color:#DDDDDD; padding:5px; border: solid 2px #AAAAAA;'>".
-                  $name;
-    $str .= $this->get_as_html();  
-    $str .= "   </td>
-              </tr>
-            </table>";
+    $smarty = get_smarty();
+    $smarty->assign("ID", $this->id);
+
+    /* Only display navigation elements if necessary */
+    if($this->TYPE == "if"){
+      $object_container = $smarty->fetch(get_template_path("templates/object_container.tpl",TRUE,dirname(__FILE__)));
+    }else{
+      $object_container = $smarty->fetch(get_template_path("templates/object_container_clear.tpl",TRUE,dirname(__FILE__)));
+    }
+
+    $smarty->assign("Name", $name);
+    $smarty->assign("Contents", $this->get_as_html());
+    $object = $smarty->fetch(get_template_path("templates/element_if_else.tpl",TRUE,dirname(__FILE__)));
+
+
+
+    $str = preg_replace("/%%OBJECT_CONTENT%%/",$object,$object_container);
+   
+
     return($str);
   }