From 2ba4adb8b1b5a4c66ed3a7df8ea6b8e538a0d508 Mon Sep 17 00:00:00 2001 From: hickert Date: Wed, 20 Apr 2011 14:15:40 +0000 Subject: [PATCH] Added checks to avoid overwriting releases git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@20759 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../class_newConfigManagement.inc | 28 ++++++++++++++++++- .../newConfigManagement/goto/Config/root.tpl | 17 +++++------ 2 files changed, 36 insertions(+), 9 deletions(-) diff --git a/gosa-plugins/goto-ng/admin/newConfigManagement/class_newConfigManagement.inc b/gosa-plugins/goto-ng/admin/newConfigManagement/class_newConfigManagement.inc index b16916f93..7c38705c9 100644 --- a/gosa-plugins/goto-ng/admin/newConfigManagement/class_newConfigManagement.inc +++ b/gosa-plugins/goto-ng/admin/newConfigManagement/class_newConfigManagement.inc @@ -165,6 +165,7 @@ class newConfigManagement extends plugin // Load distributions $rpc = $this->config->getRpcHandle(); $res = $rpc->getDistributions(); + print_a($res); if(!$rpc->success()){ $this->errorMessage = sprintf(_("Failed to load distributions: %s"), $rpc->get_error()); return(FALSE); @@ -699,6 +700,12 @@ class newConfigManagement extends plugin // We've to create a new distribution if($type == 'Distribution'){ + + // Distributions cannot be renamed! + if(isset($item['name']) && $item['name'] != $values['name']){ + msg_dialog::displayChecks(array("Distributions cannot be renamed!")); + return; + } $name = $values['name']; $itype = $values['installation_type']; $imethod = $values['installation_method']; @@ -707,13 +714,27 @@ class newConfigManagement extends plugin // Initiate the rpc request. $rpc = $this->config->getRpcHandle(); $res = $rpc->createDistribution($name, $itype, array('mirror'=>$origin, 'install_method' => $imethod)); + print_a(array($name, $itype, array('mirror'=>$origin, 'install_method' => $imethod))); if(!$rpc->success()){ msg_dialog::display(_("Error"), sprintf(_("Failed to save distributions: %s"), $rpc->get_error()),ERROR_DIALOG); return(NULL); }else{ + // Set mirror properties + $data = array(); + $data['distribution'] = $name; + $data['arch'] = $values['architectures']; + $data['component'] = $values['components']; + $data['mirror_sources'] = $values['mirror_sources']; + $rpc->addMirrorProperty($data); + if(!$rpc->success()){ + msg_dialog::display(_("Error"), sprintf(_("Failed to save distributions: %s"), + $rpc->get_error()),ERROR_DIALOG); + return(NULL); + } + // We've successfully added the item, now add it to the tree. - $this->dataModel->addItem($type, $this->selectedContainer, $values['name'],array(), '-' ); + $this->dataModel->addItem($type, $this->selectedContainer, $values['name'],$values, '-' ); // Finally - close the dialog. $this->listing->clearDialogObject(); @@ -735,6 +756,11 @@ class newConfigManagement extends plugin $dist = $this->getDistributionPath($this->selectedContainer); $dist = preg_replace("#^/root/#", "", $dist); + if(isset($item['name']) && $item['name'] != $values['name']){ + echo "Implement rename for releases"; + return; + } + // Initiate the rpc request. $rpc = $this->config->getRpcHandle(); $res = $rpc->createRelease($dist, $newPath); diff --git a/gosa-plugins/goto-ng/admin/newConfigManagement/goto/Config/root.tpl b/gosa-plugins/goto-ng/admin/newConfigManagement/goto/Config/root.tpl index 0e0db6f4b..839a4c69b 100644 --- a/gosa-plugins/goto-ng/admin/newConfigManagement/goto/Config/root.tpl +++ b/gosa-plugins/goto-ng/admin/newConfigManagement/goto/Config/root.tpl @@ -1,6 +1,6 @@ {if $type == 'Distribution'} - +
- -- 2.30.2
@@ -8,6 +8,10 @@ + + + + @@ -17,12 +21,13 @@ - - + +
{$nameName} {$name}
{$originName}{$origin}
{$installation_typeName} {$installation_type}{$installation_method}
{$originName}{$origin}{$mirror_sourcesName}{$mirror_sources}
+ + @@ -32,10 +37,6 @@ - - - -
{$architecturesName}{$componentsName} {$components}
{$mirror_sourcesName}{$mirror_sources}