Code

Fixed editing of items
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 29 Sep 2010 15:30:05 +0000 (15:30 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 29 Sep 2010 15:30:05 +0000 (15:30 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@19858 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/goto/admin/systems/goto/Config/class_DeviceConfig.inc
gosa-plugins/goto/admin/systems/goto/Config/puppet.tpl

index 52417e9858a445a4ea825022e6519f1365300ded..cc38bd09000e7cc8b69b279b3c63a11d25248ade 100644 (file)
@@ -109,7 +109,7 @@ class DeviceConfig extends management
 
     function openEntry($action="",$target=array(),$all=array(), $altTabClass ="", $altTabType = "", $altAclCategory="")
     {
-        $this->setCurrentItem($target[0]);
+        $this->base = $this->currentItemValues[$target[0]]['base'];
     }
 
 
@@ -241,6 +241,19 @@ class DeviceConfig extends management
         $current['children'][$name] = &$this->currentItemValues[$name];
     }
 
+    
+    function saveItemChanges()
+    {
+
+        // Save eventually changed values
+        if($this->currentItem){
+            foreach($this->TemplateEngine->getWidgets() as $widget){
+                $this->currentItem['values'][$widget->getName()] = $widget->getValue();
+            }
+        }
+        $this->closeDialogs();
+    }
+    
 
     /*! \brief      Selects an item as active and takes care 
      *               of required post/get handling. 
@@ -249,29 +262,17 @@ class DeviceConfig extends management
      */
     function setCurrentItem($item)
     {
-        // Do nothing if we're already where we wanted to switch to.
-        if($this->currentItemName == $item) return;
-
         if(!isset($this->currentItemValues[$item])){
             echo "Invalid item name {$name}! Skipping selection!";
             return;
         }
 
-        // Save eventually changed values
-        if($this->currentItem){
-            foreach($this->TemplateEngine->getWidgets() as $widget){
-                $this->currentItem['values'][$widget->getName()] = $widget->getValue();
-            }
-        }
-
         // Set the new item info.
         $this->currentItemName = $item;
         $this->currentItem = &$this->currentItemValues[$item];
         $this->currentItemType = $this->currentItem['type'];
         $this->currentItemDescriptor =&$this->itemConfig[$this->currentItem['type']];
 
-        $this->base = $this->currentItem['base'];
-
         // Update the template engine to use another type of item and 
         //  some other values.
         $this->TemplateEngine->setValues($this->currentItemType,$this->currentItem['values']);
@@ -305,7 +306,9 @@ class DeviceConfig extends management
      */
     function save_object()
     {
-        $this->TemplateEngine->save_object();
+        if($this->dialogObject){
+            $this->TemplateEngine->save_object();
+        }
 
         // Add sub-module requested.
         if(isset($_POST['addSubModule']) && isset($_POST['subModule'])){
@@ -321,21 +324,12 @@ class DeviceConfig extends management
                 }
                 $name = 'test'.rand(0,99999);
                 $this->addItem($sub,$name,$values);
-                $this->setCurrentItem($name);
             }
         }
 
         // Get selected Items
         $this->itemContainerSelector->update();
         $this->base = $this->itemContainerSelector->getBase();
-        $itemName = ""; 
-        foreach($this->currentItemValues as $item){
-            if($item['base'] == $this->base){
-                $this->setCurrentItem($item['name']);
-                break;
-            }
-        }
-
     }
 
     /*! \brief    Forward plugin acls
index b35cd385aa15b28d487c97d9a095c4dd6c6782ed..067afd91affd081858b50b4b4fdc38116c3d6369 100644 (file)
@@ -36,4 +36,5 @@
             <td>{$data}</td>
         </tr>
     </table>
+    <input type='submit'>    
 {/if}