Code

Fixed adding new elements
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 20 Mar 2007 08:53:25 +0000 (08:53 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 20 Mar 2007 08:53:25 +0000 (08:53 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@5832 594d385d-05f5-0310-b6e9-bd551577e9d8

include/sieve/class_sieveManagement.inc

index 294b92e05b7282df1fb50cc753dd4b32e61e75a8..dff33d0fe73af84007ef550afc1acd4feb39caf9 100644 (file)
@@ -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 ... 
      */