Code

Added links to action texts
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 26 Mar 2007 09:09:46 +0000 (09:09 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 26 Mar 2007 09:09:46 +0000 (09:09 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@5883 594d385d-05f5-0310-b6e9-bd551577e9d8

include/sieve/class_My_Tree.inc
include/sieve/class_sieveManagement.inc
include/sieve/templates/object_container.tpl

index 839f82e5fe6742d561f1cf267ab4eb1ee8a2b709..eec29858a5dc324ed794c5adceead5466973fbd7 100644 (file)
@@ -238,6 +238,11 @@ class My_Tree extends Tree
       return;
     }
 
+    if(!isset($this->pap[$key_id])){
+      trigger_error(_("Can't remove element with object_id=".$key_id.", there is no object with this identifier. Remove aborted."));
+      return(false);
+    }
+
     $class = get_class($this->pap[$key_id]);
     if(in_array($class,array("sieve_if","sieve_elsif","sieve_else"))){
       $block_start= $key_id;
index da9a10978ede1fb058ddd512db582640f9d5b743..37dd2ec3101eb54fb26c24bf3fb8589abaf915b8 100644 (file)
@@ -779,6 +779,55 @@ class sieveManagement extends plugin
   {
     if($this->current_handler){
 
+      if(isset($_GET['Add_Object_Top_ID'])){
+        $this->add_new_element    = TRUE;
+        $this->add_new_id         = $_GET['Add_Object_Top_ID'];
+        $this->add_above_below    = "above";
+      }  
+
+      if(isset($_GET['Add_Object_Bottom_ID'])){
+        $this->add_new_element    = TRUE;
+        $this->add_new_id         = $_GET['Add_Object_Bottom_ID'];
+        $this->add_above_below    = "below";
+      }  
+
+      if(isset($_GET['Remove_Object_ID'])){
+        $found_id = -1;
+        foreach($this->current_handler->tree_->pap as $key => $element){
+          if($element->object_id == $_GET['Remove_Object_ID']){
+            $found_id = $key;
+          }
+        }
+        if($found_id != -1 ){
+          $this->current_handler->tree_->remove_object($found_id);  
+        }
+      }  
+      if(isset($_GET['Move_Up_Object_ID'])){
+        $found_id = -1;
+        foreach($this->current_handler->tree_->pap as $key => $element){
+          if($element->object_id == $_GET['Move_Up_Object_ID']){
+            $found_id = $key;
+          }
+        }
+        if($found_id != -1 ){
+          $this->current_handler->tree_->move_up_down($found_id,"up");
+        }
+      }  
+      if(isset($_GET['Move_Down_Object_ID'])){
+        $found_id = -1;
+        foreach($this->current_handler->tree_->pap as $key => $element){
+          if($element->object_id == $_GET['Move_Down_Object_ID']){
+            $found_id = $key;
+          }
+        }
+        if($found_id != -1 ){
+          $this->current_handler->tree_->move_up_down($found_id,"down");
+        }
+      }  
+  
+
       /* Check if there is an add object requested 
        */
       $data = $this->current_handler->tree_->pap;
index 71b68806a671793cba1932155f5c2345307bd7ba..f9ddb0fe9a06973b53513032f14a545e87470957 100644 (file)
@@ -6,19 +6,23 @@
                <td class='object_container_cell_top_right'>
                        <input type='image' src='images/sieve_move_object_down.png' name='Move_Down_Object_{$ID}' 
                                title='{t}Move this object one position down{/t}' alt='{t}Down{/t}' class='center'>
-                       {t}Move down{/t}
+                       <a href='{$plug}&amp;Move_Down_Object_ID={$ID}'>{t}Move down{/t}</a>
+
                        <input type='image' src='images/sieve_move_object_up.png' name='Move_Up_Object_{$ID}' 
                                title='{t}Move this object one position up{/t}' alt='{t}Up{/t}' class='center'>
-                       {t}Move up{/t}
+                       <a href='{$plug}&amp;Move_Up_Object_ID={$ID}'>{t}Move up{/t}</a>
+
                        <input type='image' src='images/sieve_del_object.png' name='Remove_Object_{$ID}' 
                                title='{t}Remove this object{/t}' alt='R' class='center'>
-                       {t}Remove this element{/t}
+                       <a href='{$plug}&amp;Remove_Object_ID={$ID}'>{t}Remove this element{/t}</a>
+
                        <input type='image' src='images/sieve_add_new_top.png' name='Add_Object_Top_{$ID}'
                                alt='{t}Add new{/t}' title='{t}Add a new new object on top of this one.{/t}' class='center'>
-                       {t}Add a new element above{/t}
+                       <a href='{$plug}&amp;Add_Object_Top_ID={$ID}'>{t}Add a new element above{/t}</a>
+
                        <input type='image' src='images/sieve_add_new_bottom.png' name='Add_Object_Bottom_{$ID}'
                                alt='{t}Add new{/t}' title='{t}Add a new new object at the bottom of this one.{/t}' class='center'>     
-                       {t}Add a new element below{/t}
+                       <a href='{$plug}&amp;Add_Object_Bottom_ID={$ID}'>{t}Add a new element below{/t}</a>
                </td>
        </tr>
        <tr>