X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=include%2Fsieve%2Fclass_My_Tree.inc;h=ee1276a36ac3c1aba3c85281c0f2aa6b0bd2696b;hb=4ef5a0ec2c799536446dd29d5d828488cc14608f;hp=942f64e4c03fb970a2fb94195e09dc87775a5adf;hpb=fa5d4f7116f6592143cf24fbea8eb4d342ef368d;p=gosa.git diff --git a/include/sieve/class_My_Tree.inc b/include/sieve/class_My_Tree.inc index 942f64e4c..ee1276a36 100644 --- a/include/sieve/class_My_Tree.inc +++ b/include/sieve/class_My_Tree.inc @@ -15,13 +15,26 @@ class My_Tree extends Tree var $mode_stack = array(); var $pap = array(); + var $parent = NULL; + function My_Tree(&$root,$parent) + { + $this->parent = $parent; + $this->_construct($root); + } + + function execute() + { + return($this->dump()); + } /* Create a html interface for the current sieve filter */ function dump() { - error_reporting(E_ALL); + /************** + * Handle new elements + **************/ /* Only parse the tokens once */ if(!count($this->pap)){ @@ -29,17 +42,52 @@ class My_Tree extends Tree $this->mode_stack = array(); $this->pap = array(); $this->doDump_(0, '', true); + + /* Add left elements */ + if(count($this->mode_stack)){ + foreach($this->mode_stack as $element){ + $this->handle_elements( $element,preg_replace("/[^0-9]/","",microtime())); + } + } } /* Create html results */ - $this->dump_ ="
";
- foreach($this->pap as $object){
+ $smarty = get_smarty();
+
+ $block_indent_start = $smarty->fetch(get_template_path("templates/block_indent_start.tpl",TRUE,dirname(__FILE__)));
+ $block_indent_stop = $smarty->fetch(get_template_path("templates/block_indent_stop.tpl",TRUE,dirname(__FILE__)));
+
+ $this -> dump_ = "";
+ $ends = array();
+ $ends_complete_block = array();
+
+ foreach($this->pap as $key => $object){
if(is_object($object)){
+
+ $end = $this->get_block_end($key,false);
+ $end2 = $this->get_block_end($key);
+ if($end != $key && in_array(get_class($object),array("sieve_if"))){
+ $ends_complete_block[$end2] = $end2;
+ $this->dump_ .= "";
+ $this->dump_ .= " ";
+ }
+ if(isset($ends[$key])){
+ $this->dump_ .= $block_indent_stop;
+ }
$this->dump_ .= preg_replace("/>/",">\n",$object->execute());
+ if($end != $key && in_array(get_class($object),array("sieve_if","sieve_else","sieve_elsif"))) {
+ $ends[$end] = $end;
+ $this->dump_ .= $block_indent_start;
+ }
+
+ if(isset($ends_complete_block[$key])){
+ $this->dump_ .= " ";
+ $this->dump_ .= "";
+ }
}
}
- $this->dump_ .= " |