From: hickert Date: Fri, 8 Apr 2011 14:56:08 +0000 (+0000) Subject: Updated config management X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=3cf9eb71dbd0d61608f04751276ce09b4be30783;p=gosa.git Updated config management git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@20668 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-plugins/goto-ng/admin/newConfigManagement/class_newConfigManagement.inc b/gosa-plugins/goto-ng/admin/newConfigManagement/class_newConfigManagement.inc index 5b6365b1f..3f1dac386 100644 --- a/gosa-plugins/goto-ng/admin/newConfigManagement/class_newConfigManagement.inc +++ b/gosa-plugins/goto-ng/admin/newConfigManagement/class_newConfigManagement.inc @@ -504,48 +504,66 @@ class newConfigManagement extends plugin function saveItemChanges() { $item = $this->currentObject; - + + // Null means a new object has to be added. if($item == NULL){ + + // Save template engine modifications $this->TemplateEngine->save_object(); $release = preg_replace("/^.*\//","", $this->getReleasePath($this->selectedContainer)); $type = $this->TemplateEngine->getItemType(); + + // Collect modified values $values = array(); foreach($this->TemplateEngine->getWidgets() as $w){ $values[$w->getName()] = $w->getValue(); } - + + // Create the elements target path $path = $this->getItemPath($this->selectedContainer)."/".$values['name']; + + // Add the new item $rpc = $this->config->getRpcHandle(); $res = $rpc->setConfigItem($release, $path, $type, $values); if(!$rpc->success()){ msg_dialog::display(_("Error"), sprintf(_("Failed to load distributions: %s"), $rpc->get_error()),ERROR_DIALOG); return(NULL); }else{ + + // We've successfully added the item, now add it to the tree. $this->dataModel->addItem($type, $this->selectedContainer, $values['name'], array( '__editable' => TRUE, '__removeable' => TRUE, '__path' => $path, '__release' => $this->getReleasePath($this->selectedContainer) - ), '-' ); + ), '-' ); + + // Finally - close the dialog. $this->listing->clearDialogObject(); } }else{ + + // Collect modified values. $this->TemplateEngine->save_object(); $values = array(); foreach($this->TemplateEngine->getWidgets() as $w){ $values[$w->getName()] = $w->getValue(); } + + // Get the items release & path info $release = preg_replace("/^.*\//","",$item['values']['__release']); $path = $item['values']['__path']; - $method = $this->cfgItemMap[$item['type']]; - + + // Write the modifications back to the server. $rpc = $this->config->getRpcHandle(); $res = $rpc->setConfigItem($release, $path, $item['type'], $values); if(!$rpc->success()){ msg_dialog::display(_("Error"), sprintf(_("Failed to load distributions: %s"), $rpc->get_error()),ERROR_DIALOG); return(NULL); }else{ + + // Update the data model $item['values']['itemValues'] = $values; $this->dataModel->setItemValues($item['path'], $item['values']); $this->listing->clearDialogObject();