From e52f80ad8bda6bd6ddeb965d7344aeb44f853de5 Mon Sep 17 00:00:00 2001 From: hickert Date: Wed, 29 Sep 2010 15:30:05 +0000 Subject: [PATCH] Fixed editing of items git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@19858 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../goto/Config/class_DeviceConfig.inc | 40 ++++++++----------- .../goto/admin/systems/goto/Config/puppet.tpl | 1 + 2 files changed, 18 insertions(+), 23 deletions(-) diff --git a/gosa-plugins/goto/admin/systems/goto/Config/class_DeviceConfig.inc b/gosa-plugins/goto/admin/systems/goto/Config/class_DeviceConfig.inc index 52417e985..cc38bd090 100644 --- a/gosa-plugins/goto/admin/systems/goto/Config/class_DeviceConfig.inc +++ b/gosa-plugins/goto/admin/systems/goto/Config/class_DeviceConfig.inc @@ -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 diff --git a/gosa-plugins/goto/admin/systems/goto/Config/puppet.tpl b/gosa-plugins/goto/admin/systems/goto/Config/puppet.tpl index b35cd385a..067afd91a 100644 --- a/gosa-plugins/goto/admin/systems/goto/Config/puppet.tpl +++ b/gosa-plugins/goto/admin/systems/goto/Config/puppet.tpl @@ -36,4 +36,5 @@ {$data} + {/if} -- 2.30.2