Code

Some sieve update
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 12 Mar 2007 13:55:02 +0000 (13:55 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 12 Mar 2007 13:55:02 +0000 (13:55 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@5767 594d385d-05f5-0310-b6e9-bd551577e9d8

16 files changed:
include/sieve/class_My_Tree.inc
include/sieve/class_sieveElements.inc
include/sieve/templates/element_block_end.tpl
include/sieve/templates/element_block_start.tpl
include/sieve/templates/element_comment.tpl
include/sieve/templates/element_discard.tpl
include/sieve/templates/element_else.tpl
include/sieve/templates/element_fileinto.tpl
include/sieve/templates/element_if_else.tpl
include/sieve/templates/element_keep.tpl
include/sieve/templates/element_redirect.tpl
include/sieve/templates/element_reject.tpl
include/sieve/templates/element_require.tpl
include/sieve/templates/element_stop.tpl
include/sieve/templates/object_container.tpl
include/sieve/templates/object_container_clear.tpl

index cb18851b9b8fca3224e9e9b27597d13b1aeb7ae8..78522ba2a12de05f8eeda9dd45857b10476ff84a 100644 (file)
@@ -143,10 +143,15 @@ class My_Tree extends Tree
 
   function save_object()
   {
+    reset($this->pap);
     foreach($this->pap as $key => $obj){
 
       if(in_array(get_class($obj),array("sieve_if","sieve_elsif","sieve_vacation","sieve_comment","sieve_reject","sieve_fileinto","sieve_require","sieve_redirect"))){
-        $this->pap[$key]->save_object();
+
+
+        if(isset($this->pap[$key]) && method_exists($this->pap[$key],"save_object")){
+          $this->pap[$key]->save_object();
+        }
       }
 
       $once = TRUE;
@@ -169,8 +174,29 @@ class My_Tree extends Tree
   }
 
 
-  function remove_object($key_id){
-    unset($this->pap[$key_id]);
+  function remove_object($key_id)
+  {
+    
+    $class = get_class($this->pap[$key_id]);
+
+    if(in_array($class,array("sieve_if"))){
+   
+      $block_start= $key_id;
+      $block_end  = $this->get_block_end($key_id);
+      for($i = $block_start ; $i <= $block_end ; $i ++ ){
+        unset($this->pap[$i]);
+      }
+
+    }else{
+      unset($this->pap[$key_id]);
+    }
+
+    $tmp = array();
+    foreach($this->pap as $element){
+      $tmp[] = $element;
+    }
+    $this->pap = $tmp;
   }
 
 
index 3c133fdf128e10f4a4295de37fbbe3526e82a436..511e836c9207212628fe1d66fc70a11fecf5990a 100644 (file)
@@ -132,11 +132,14 @@ class sieve_require
       $Require .= $key.", ";
     }
     $Require = preg_replace("/,$/","",trim($Require));
-  
+
     $smarty = get_smarty();
     $smarty->assign("Require",$Require);
-    $smarty->assign("ID",$this->object_id);
-    return($smarty->fetch(get_template_path("templates/element_require.tpl",TRUE,dirname(__FILE__))));
+    $smarty->assign("ID", $this->object_id);
+    $object_container = $smarty->fetch(get_template_path("templates/object_container_clear.tpl",TRUE,dirname(__FILE__)));
+    $object= $smarty->fetch(get_template_path("templates/element_require.tpl",TRUE,dirname(__FILE__)));
+    $str = preg_replace("/%%OBJECT_CONTENT%%/",$object,$object_container);
+    return($str);
   }
 }
 
@@ -220,10 +223,13 @@ class sieve_reject
     $Multiline = preg_match("/\n/",$this->data);
 
     $smarty = get_smarty();
-    $smarty->assign("ID",$this->object_id);
-    $smarty->assign("Multiline",$Multiline);
+    $smarty->assign("ID", $this->object_id);
     $smarty->assign("Message",$this->data);
-    return($smarty->fetch(get_template_path("templates/element_reject.tpl",TRUE,dirname(__FILE__))));    
+    $smarty->assign("Multiline",$Multiline);
+    $object_container = $smarty->fetch(get_template_path("templates/object_container.tpl",TRUE,dirname(__FILE__)));
+    $object= $smarty->fetch(get_template_path("templates/element_reject.tpl",TRUE,dirname(__FILE__)));
+    $str = preg_replace("/%%OBJECT_CONTENT%%/",$object,$object_container);
+    return($str);
   }
 }
 
@@ -278,9 +284,12 @@ class sieve_redirect
     $values = preg_replace("/,$/","",trim($values));
 
     $smarty = get_smarty();
+    $smarty->assign("ID", $this->object_id);
     $smarty->assign("Destinations" , $values);
-    $smarty->assign("ID" , $this->object_id);
-    return($smarty->fetch(get_template_path("templates/element_redirect.tpl",TRUE,dirname(__FILE__))));
+    $object_container = $smarty->fetch(get_template_path("templates/object_container.tpl",TRUE,dirname(__FILE__)));
+    $object= $smarty->fetch(get_template_path("templates/element_redirect.tpl",TRUE,dirname(__FILE__)));
+    $str = preg_replace("/%%OBJECT_CONTENT%%/",$object,$object_container);
+    return($str);
   }
 }
 
@@ -330,7 +339,10 @@ class sieve_fileinto
     $smarty->assign("Selected",$this->data[0]);
     $smarty->assign("Boxes", $this->get_mail_boxes());
     $smarty->assign("ID", $this->object_id);
-    return($smarty->fetch(get_template_path("templates/element_fileinto.tpl",TRUE,dirname(__FILE__))));
+    $object_container = $smarty->fetch(get_template_path("templates/object_container.tpl",TRUE,dirname(__FILE__)));
+    $object= $smarty->fetch(get_template_path("templates/element_fileinto.tpl",TRUE,dirname(__FILE__)));
+    $str = preg_replace("/%%OBJECT_CONTENT%%/",$object,$object_container);
+    return($str);
   }
 
   function get_mail_boxes()
index 52fbc8c5aa781b277388d65e8005c169e9a8b63d..b5af6fbdeb0bec1e4e0acc4f3b7ced293fd5d714 100644 (file)
@@ -1,16 +1,3 @@
            </td>
     </tr>
 </table>
-<table cellspacing=0 width='100%' style='background-color: #235464; border: solid 1px #346575;'>
-       <tr>
-       <td style='height:4px;width:100%; text-align:center;vertical-align:top; background-color: #000000;'>
-           </td>
-    </tr>
-</table>
-
-<table cellspacing=0 width='100%' style='background-color: #235464; border: solid 1px #346575;'>
-       <tr>
-       <td style='height:4px;width:100%; text-align:center;vertical-align:top; background-color: #FFFFFF;'>
-           </td>
-    </tr>
-</table>
index 8d30555498191edfdee56ce09b7c273ba16fa535..d79212f16e6edd8ce3ea9e18c6ef1f90c0671ad3 100644 (file)
@@ -1,21 +1,9 @@
 
-<table cellspacing=0 width='100%' style='background-color: #235464; border: solid 1px #346575;'>
+<table cellspacing=0 style='width:100%;background-color:#346575;border: solid 1px #BBB;346575;'>
        <tr>
-       <td style='height:4px;width:100%; text-align:center;vertical-align:top; background-color: #FFFFFF;'>
-           </td>
-    </tr>
-</table>
-<table cellspacing=0 width='100%' style='background-color: #235464; border: solid 1px #346575;'>
-       <tr>
-       <td style='height:4px;width:100%; text-align:center;vertical-align:top; background-color: #000000;'>
-           </td>
-    </tr>
-</table>
-<table cellspacing=0 width='100%' style='background-color: #235464; border: solid 1px #346575;'>
-       <tr>
-       <td style='width:25px; text-align:center;vertical-align:top; color: #FFFFFF;'>
+       <td style='width:30px; text-align:center;vertical-align:top; color: #FFFFFF;'>
                        <b>+</b>
         </td>
         <td style=' background-color:#BBBBBB;
-                    border: solid 1px #DDDDDD;
+                    border: solid 0px #DDDDDD;
                   '>
index d3094d85d8a22ee11ddf51450a82b62db6e096ec..6a52d04e98481b1ec341f52a7a9a1f9467d456e8 100644 (file)
@@ -1,4 +1,4 @@
-<table cellspacing=0 style='width:100%;background-color:#EEEEEE;'>
+<table cellspacing=0 style='width:100%;background-color:d8d8ff;'>
        <tr>
                <td>
                        <b>{t}Comment{/t}</b>
index 01a9e8cc5f317934bd76336e9e491401b833b334..a557876c80ac58062c3cb4a06f283bfbddcd2a4b 100644 (file)
@@ -1,6 +1,6 @@
 <table cellspacing=0 width='100%'>
        <tr>
-               <td style='width:100%;background-color:#ffcd77;'>
+               <td style='background-color:#ffeccc; height: 50px;'>
                        <b>{t}Discard message{/t}</b>
                </td>
        </tr>
index 86eb1f2cc257fd9bca30622f4773cda29917fbc2..d7cd58fe1a66d2bb750960d0d16c19265713135b 100644 (file)
@@ -1,4 +1,4 @@
-<table style='width:100%;background-color:#ffb23a; padding:3px;'>
+<table cellspacing=0 style='width:100%;background-color:#EEEEEE;border: solid 1px #BBB;346575;'>
        <tr>
                <td>
                        <b>{t}else{/t}</b>
index 1bd1d8453f537857f8c94a401aefdfba0edeac12..b73dc5a030a150d5af2c83a0f4e71c6adc42d39f 100644 (file)
@@ -1,6 +1,6 @@
 <table cellspacing=0 width='100%'>
        <tr>
-               <td style='width:100%;background-color: #99c2ff;'>
+               <td style='width:100%;background-color: #d8e1f2; height:50px;'>
                        {t}Move mail into folder{/t}
                        <select name='fileinto_{$ID}'>
                                {html_options options=$Boxes selected=$Selected}
index fa6772893de5eb092f96c1580f46576de5b84fdb..972aa39b654915c89973717a7ff0d6a8cec53a51 100644 (file)
@@ -1,6 +1,6 @@
 <table cellspacing=0 width='100%'>
        <tr>
-       <td style='width:100%;background-color:#ffb23a; padding:5px;'>
+       <td style='width:100%;background-color:#f2bf4c; padding:5px;'>
                        {$Name}
                        {$Contents}
        </td>
index eae62debdf05ec8bb8df3dc80b6554b42156de78..519f2e46821662de8b20c569f308f5e4f1f04def 100644 (file)
@@ -1,6 +1,6 @@
 <table cellspacing=0 width='100%'>
        <tr>
-               <td style='width:100%;background-color:#aeff80;'>
+               <td style='width:100%;background-color:#faffcd; height:50px;'>
                        <b>{t}Keep message{/t}</b>
                </td>
        </tr>
index 47bcbe2f221e5aa2b63b4172accb0d4ed7d67e9f..0cac45fe63af0a707f97b6509fd2092ca294a2dc 100644 (file)
@@ -1,8 +1,8 @@
-<table cellspacing=0 width='100%' style='background-color: #8cff80'>
+<table cellspacing=0 width='100%' style='background-color: #d1ffcc'>
        <tr>
                <td>
                        <b>{t}Redirect{/t}</b>
-                       {t}Redirect mail to following recipients{/t}<b>
+                       {t}Redirect mail to following recipients{/t}
                </td>
        </tr>
        <tr>
index f5cd572a66aa3920ab16481bf51d18a9fd602c63..6b9238dcc8daee84cd57d263916e5187d34def16 100644 (file)
@@ -12,7 +12,7 @@
        </tr>
        <tr>
                <td style='padding-left:20px;'>
-                       <textarea name='reject_message_{$ID}' style='width:100%;height:100px;' >{$Message}</textarea>
+                       <textarea name='reject_message_{$ID}' style='width:100%;height:40px;' >{$Message}</textarea>
                </td>
        </tr>
 </table>
index 0cde8e3fb70b33cc057d7a68e704b18ae0c2fc5c..761e636b046922dbc2d0a222f9461e9f78197ab5 100644 (file)
@@ -1,11 +1,11 @@
-<table cellspacing=0 style='width:100%;background-color:#abffab;'>
+<table cellspacing=0 style='width:100%;background-color:#e4ffc9;'>
        <tr>
-               <td>
+               <td style=''>
                        <b>{t}Require{/t}</b>
                </td>
        </tr>
        <tr>
-               <td style='padding-left:20px'>
+               <td style='padding-left:20px; height:50px;'>
                        <input type='text'  name='require_{$ID}' style='width:100%' value='{$Require}'>
                </td>
        </tr>
index 92a4c214b9b00a50a398d4db506a6cee89ececd6..8a617a65c17a05330e68b39c527faabc32da47e4 100644 (file)
@@ -1,6 +1,6 @@
 <table cellspacing=0 width='100%'>
        <tr>
-               <td style='width:100%;background-color:#ff9999;'>
+               <td style='width:100%;background-color:#ffc9c9; height:50px;'>
                        <b>{t}Stop{/t}</b><br>
                        {t}Stop execution here!{/t}
                </td>
index 5b8188123f3034b056bd42e95019417419306818..cbd6dd938e6df853b349608350a17dd6da45b494 100644 (file)
@@ -1,6 +1,6 @@
-<table cellspacing=0 style='width:100%;background-color:#EEEEEE;border: solid 1px #346575;'>
+<table cellspacing=0 style='width:100%;background-color:#EEEEEE;border: solid 1px #BBB;346575;'>
        <tr>
-               <td style='width:20px; background-color: #235464; border: solid 0px #346575;'>  
+               <td style='width:20px; background-color: #235464; text-align:center;'>  
                        <input type='image' src='images/sieve_del_object.png' name='Remove_Object_{$ID}' 
                                title='{t}Remove this object{/t}' alt='R'>
                        <input type='image' src='images/sieve_move_object_up.png' name='Move_Up_Object_{$ID}' 
index dfb8973572fd14e57652142ef81026b589e4439c..4791fa8c6797a3bebc296b1db9063061971a70e1 100644 (file)
@@ -1,6 +1,6 @@
-<table cellspacing=0 style='width:100%;background-color:#EEEEEE;border: solid 1px #346575;'>
+<table cellspacing=0 style='width:100%;background-color:#EEEEEE;border: solid 1px #BBB;346575;'>
        <tr>
-               <td style='width:20px; background-color: #235464; border: solid 0px #346575;'>  
+               <td style='width:20px; background-color: #235464;'>     
                </td>
                <td>
                        %%OBJECT_CONTENT%%