From: hickert Date: Tue, 20 Mar 2007 08:53:25 +0000 (+0000) Subject: Fixed adding new elements X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=2d346b7195a5df0de845b75b32cb2190752f1c47;p=gosa.git Fixed adding new elements git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@5832 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/include/sieve/class_sieveManagement.inc b/include/sieve/class_sieveManagement.inc index 294b92e05..dff33d0fe 100644 --- a/include/sieve/class_sieveManagement.inc +++ b/include/sieve/class_sieveManagement.inc @@ -684,7 +684,27 @@ class sieveManagement extends plugin trigger_error("Can't add new element, there is no valid script editor opened."); return(FALSE); } - + + /* Create elements we should add + * -Some element require also surrounding block elements + */ + $parent = $this->current_handler->tree_; + if($this->add_element_type == "sieve_if"){ + $ele[] = new $this->add_element_type(NULL, preg_replace("/[^0-9]/","",microtime()),$parent); + $ele[] = new sieve_block_start(NULL,preg_replace("/[^0-9]/","",microtime()),$parent); + $ele[] = new sieve_block_end(NULL,preg_replace("/[^0-9]/","",microtime()),$parent); + }elseif($this->add_element_type == "sieve_else"){ + $ele[] = new sieve_block_end(NULL,preg_replace("/[^0-9]/","",microtime()),$parent); + $ele[] = new $this->add_element_type(NULL, preg_replace("/[^0-9]/","",microtime()),$parent); + $ele[] = new sieve_block_start(NULL,preg_replace("/[^0-9]/","",microtime()),$parent); + }elseif($this->add_element_type == "sieve_elsif"){ + $ele[] = new sieve_block_end(NULL,preg_replace("/[^0-9]/","",microtime()),$parent); + $ele[] = new $this->add_element_type(NULL, preg_replace("/[^0-9]/","",microtime()),$parent); + $ele[] = new sieve_block_start(NULL,preg_replace("/[^0-9]/","",microtime()),$parent); + }else{ + $ele[] = new $this->add_element_type(NULL, preg_replace("/[^0-9]/","",microtime()),$parent); + } + /* Get index of the element identified by object_id == $id; */ $index = -1; @@ -714,27 +734,6 @@ class sieveManagement extends plugin $direction = "down"; $next_free = $this->current_handler->tree_->_get_next_free_move_slot($index,$direction,TRUE); } - - /* Create elements we should add - * -Some element require also surrounding block elements - */ - $parent = $this->current_handler->tree_; - if($this->add_element_type == "sieve_if"){ - $ele[] = new $this->add_element_type(NULL, preg_replace("/[^0-9]/","",microtime()),$parent); - $ele[] = new sieve_block_start(NULL,preg_replace("/[^0-9]/","",microtime()),$parent); - $ele[] = new sieve_block_end(NULL,preg_replace("/[^0-9]/","",microtime()),$parent); - }elseif($this->add_element_type == "sieve_else"){ - $ele[] = new sieve_block_end(NULL,preg_replace("/[^0-9]/","",microtime()),$parent); - $ele[] = new $this->add_element_type(NULL, preg_replace("/[^0-9]/","",microtime()),$parent); - $ele[] = new sieve_block_start(NULL,preg_replace("/[^0-9]/","",microtime()),$parent); - }elseif($this->add_element_type == "sieve_elsif"){ - $ele[] = new sieve_block_end(NULL,preg_replace("/[^0-9]/","",microtime()),$parent); - $ele[] = new $this->add_element_type(NULL, preg_replace("/[^0-9]/","",microtime()),$parent); - $ele[] = new sieve_block_start(NULL,preg_replace("/[^0-9]/","",microtime()),$parent); - }else{ - $ele[] = new $this->add_element_type(NULL, preg_replace("/[^0-9]/","",microtime()),$parent); - } - /* This is extremly necessary, cause some objects * updates the tree objects ... Somehow i should change this ... */