From dde3924ad704b01fcc1fe5ed5dc0ad6e49deda59 Mon Sep 17 00:00:00 2001 From: hickert Date: Fri, 9 Mar 2007 13:09:50 +0000 Subject: [PATCH] Fixed object up/down method git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@5763 594d385d-05f5-0310-b6e9-bd551577e9d8 --- include/sieve/class_My_Tree.inc | 45 +++++++++++++++------------------ 1 file changed, 21 insertions(+), 24 deletions(-) diff --git a/include/sieve/class_My_Tree.inc b/include/sieve/class_My_Tree.inc index a8321a450..c7d08c8a7 100644 --- a/include/sieve/class_My_Tree.inc +++ b/include/sieve/class_My_Tree.inc @@ -202,26 +202,20 @@ class My_Tree extends Tree function move_single_element_to($from,$to) { - if($from == $to) return; + if($from == $to) { + return; + } $ret = array(); - - $tmp = $this->pap; -# $tmp = array(); - # foreach($this->pap as $class){ - # $tmp[] = get_class($class); - # } + $begin = array(); + $middle = array(); + $end = array(); + $element = $this->pap[$from]; if($from > $to ){ - $element = $this->pap[$from]; - - $begin = array(); - $middle = array(); - $end = array(); - /* Get all element in fron to element to move */ if($from != 0){ $begin = array_slice($tmp,0,$to); @@ -243,19 +237,10 @@ class My_Tree extends Tree foreach($end as $data){ $ret[] = $data; } - -# print_a(array("Anfang" => $begin ,$element, "middle" => $middle, "end" => $end)); - $this->pap = $ret; } if($from < $to ){ - $element = $this->pap[$from]; - - $begin = array(); - $middle = array(); - $end = array(); - /* Get all element in fron to element to move */ if($from != 0){ $begin = array_slice($tmp,0,$from); @@ -295,7 +280,19 @@ class My_Tree extends Tree "sieve_fileinto", "sieve_redirect", "sieve_discard", - "sieve_block_end"); + "sieve_block_start" + ); + + $allowed_to_add_before = array("sieve_keep", + "sieve_require", + "sieve_stop", + "sieve_reject", + "sieve_fileinto", + "sieve_redirect", + "sieve_discard", + "sieve_if", + "sieve_block_end" + ); if($direction == "down"){ $test = $this->pap; @@ -322,7 +319,7 @@ class My_Tree extends Tree while($key_id >=0 ){ $current_class = get_class($test[$key_id]); - if(in_array($current_class, $allowed_to_add_after)){ + if(in_array($current_class, $allowed_to_add_before)){ return($key_id); } $key_id --; -- 2.30.2