summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: fd4b9a5)
raw | patch | inline | side by side (parent: fd4b9a5)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Mon, 12 Mar 2007 10:43:42 +0000 (10:43 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Mon, 12 Mar 2007 10:43:42 +0000 (10:43 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@5765 594d385d-05f5-0310-b6e9-bd551577e9d8
include/functions_debug.inc | patch | blob | history | |
include/sieve/class_My_Tree.inc | patch | blob | history | |
include/sieve/class_sieveElement_If.inc | patch | blob | history |
index 24fd84275107b00870c12eb0463af764d2417665..5e5c84f6ea9fe75306edacd177e3c1f1db11b00a 100644 (file)
if( $this->show_object_vars ) {
$this->print_a( get_object_vars( $value ), TRUE, $key_bg_color );
} else {
- $this->output .= '<div style="'.$value_style.'">OBJECT</div>';
+ $this->output .= '<div style="'.$value_style.'">OBJECT - '.get_class($value).'</div>';
}
} else {
$this->output .= '<div style="'.$value_style.'" title="'.$type.'">'.$value.'</div>';
index be103e1c2b4a915c43c3beaba4fe69ab55cb8733..40f59fdf1a1666daa8ca4cab24f95affb3f30286 100644 (file)
}
}
-
/* Create html results */
$smarty = get_smarty();
$smarty->assign("Contents",$this->dump_);
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();
+ #$this->pap[$key]->save_object();
}
$once = TRUE;
/* Get the current element to decide what to move. */
$e_class = get_class($this->pap[$key_id]);
-
if(in_array($e_class,array("sieve_if"))){
- echo "move block";
+ $block_start= $key_id;
+ $block_end = $this->get_block_end($key_id);
+
+ /* Depending on the direction move up down */
+ if($direction == "down"){
+ $next_free = $this->_get_next_free_move_slot($block_end,$direction);
+ }else{
+ $next_free = $this->_get_next_free_move_slot($block_start,$direction);
+ }
+
+ /* Move the given block */
+ $this->move_multiple_elements($block_start,$block_end,$next_free);
}
if(in_array($e_class,array( "sieve_stop",
}
}
+
+ /* Move the given block to position */
+ function move_multiple_elements($start,$end,$to)
+ {
+ /* Use class names for testing */
+ $data = $this->pap;
+
+ /* Get block to move */
+ $block_to_move = array_slice($data,$start, ($end - $start +1));
+
+ /* We want do move this block up */
+ if($end > $to){
+
+ /* Get start block */
+ $start_block = array_slice($data,0,$to);
+
+ /* Get Get all elements between the block to move
+ * and next free position
+ */
+ $block_to_free = array_slice($data,$to ,$start - $to );
+ $block_to_end = array_slice($data,$end+1);
+ $new = array();
+ foreach($start_block as $block){
+ $new[] = $block;
+ }
+ foreach($block_to_move as $block){
+ $new[] = $block;
+ }
+ foreach($block_to_free as $block){
+ $new[] = $block;
+ }
+ foreach($block_to_end as $block){
+ $new[] = $block;
+ }
+ $old = $this->pap;
+ $this->pap = $new;
+ }
+
+
+ /* We want to move this block down. */
+ if($to > $end){
+
+ /* Get start block */
+ $start_block = array_slice($data,0,$start);
+
+ /* Get Get all elements between the block to move
+ * and next free position
+ */
+ $block_to_free = array_slice($data,$end +1,($to - $end ));
+
+ /* Get the rest
+ */
+ $block_to_end = array_slice($data,$to+1);
+
+ $new = array();
+ foreach($start_block as $block){
+ $new[] = $block;
+ }
+ foreach($block_to_free as $block){
+ $new[] = $block;
+ }
+ foreach($block_to_move as $block){
+ $new[] = $block;
+ }
+ foreach($block_to_end as $block){
+ $new[] = $block;
+ }
+ $old = $this->pap;
+ $this->pap = $new;
+ }
+ }
+
+
+ /* This function returns the id of the element
+ * where the current block ends
+ */
+ function get_block_end($start)
+ {
+ /* Only execute if this is a really a block element.
+ * Block elements is only sieve_if
+ */
+ if(in_array(get_class($this->pap[$start]),array("sieve_if"))){
+
+ $class = get_class($this->pap[$start]);
+ $next_class = get_class($this->pap[$start+1]);
+ $block_depth = 0;
+
+ $end = FALSE;
+
+ while(!$end && $start < count($this->pap)){
+
+ if($class == "sieve_block_start"){
+ $block_depth ++;
+ }
+
+ if($class == "sieve_block_end"){
+ $block_depth --;
+ }
+
+ if( $block_depth == 0 &&
+ $class == "sieve_block_end" &&
+ !in_array($next_class,array("sieve_else","sieve_elsif"))){
+ $end = TRUE;
+ $start --;
+ }
+ $start ++;
+ $class = get_class($this->pap[$start]);
+ $next_class = get_class($this->pap[$start+1]);
+ }
+ }
+ return($start);
+ }
+
/* This function moves the single element at
* position $from to position $to.
"sieve_fileinto",
"sieve_redirect",
"sieve_discard",
+ "sieve_comment",
"sieve_block_start"
);
"sieve_stop",
"sieve_reject",
"sieve_fileinto",
+ "sieve_comment",
"sieve_redirect",
"sieve_discard",
"sieve_if",
if($direction == "down"){
- /* Get free position before $key_id */
$test = $this->pap;
while($key_id < count($test)){
if(($key_id+1) == count($test)) {
if(in_array($current_class, $allowed_to_add_after)){
return($key_id);
}
- }
+ }
}else{
- /* Get next free position */
$test = $this->pap;
if($key_id == 0) {
return($key_id);
}
$key_id --;
}
+ return(0);
}
}
index 4c61ca676729c75536d519f266aef809938c5fac..6d06ddf0bfa9a85d284c3d0ee6d877a11b6dafc2 100644 (file)
{
var $_parsed = array();
var $TYPE = "if";
- var $id = -1;
+ var $object_id = -1;
var $address_parts = array();
var $comparators = array();
"gt" => _("greater than"),
"ne" => _("not equal"));
- $this->id = $object_id;
+ $this->object_id = $object_id;
$this->elements = $elements;
$this->_parsed = $this->_parse($elements['ELEMENTS'],1);
}
foreach($parsed as $key => $data){
/* Id used to have unique html names */
- $element_id = $this->id."_".$id."_".$obj_id;
+ $element_id = $this->object_id."_".$id."_".$obj_id;
/* Create elements */
switch($key)
}
$smarty = get_smarty();
- $smarty->assign("ID", $this->id);
+ $smarty->assign("ID", $this->object_id);
/* Only display navigation elements if necessary */
if($this->TYPE == "if"){
}
/* Id used to have unique html names */
- $element_id = $this->id."_".$id."_".$obj_id;
+ $element_id = $this->object_id."_".$id."_".$obj_id;
/* Create elements */
switch($key)