From: hickert Date: Wed, 27 Apr 2011 09:34:56 +0000 (+0000) Subject: Fixed saving of config items X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=e5ca65e1d64447094e5885e8a7caf7ed157e3245;p=gosa.git Fixed saving of config items git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@20774 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 3af2a457d..48d81fba3 100644 --- a/gosa-plugins/goto-ng/admin/newConfigManagement/class_newConfigManagement.inc +++ b/gosa-plugins/goto-ng/admin/newConfigManagement/class_newConfigManagement.inc @@ -737,7 +737,7 @@ class newConfigManagement extends plugin } if(in_array($values['name'],$usedNames)){ $msgs[] = msgPool::duplicated(_("Name")); - }elseif(preg_match("/[^a-z0-9]/",$values['name'])){ + }elseif(preg_match("/[^a-z0-9]/i",$values['name'])){ $msgs[] = msgPool::invalid(_("Name"), $values['name'], '/[a-z0-9]/'); } } @@ -761,43 +761,44 @@ class newConfigManagement extends plugin msg_dialog::displayChecks(array("Distributions cannot be renamed!")); return; } - $name = $values['name']; - $itype = $values['installation_type']; - $imethod = $values['installation_method']; - $origin = $values['origin']; - // 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{ + // Create a new distribution + if(!$item){ + $name = $values['name']; + $itype = $values['installation_type']; + $imethod = $values['installation_method']; + $origin = $values['origin']; - // 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); + // Initiate the rpc request. + $rpc = $this->config->getRpcHandle(); + $res = $rpc->createDistribution($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); + $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'],$values, '-' ); + // Collect distribution properties + $data = array(); + $data['distribution'] = $values['name']; + $data['arch'] = $values['architectures']; + $data['component'] = $values['components']; + $data['mirror_sources'] = $values['mirror_sources']; - // Finally - close the dialog. - $this->listing->clearDialogObject(); + // Set distribution properties + $rpc = $this->config->getRpcHandle(); + $rpc->setDistribution($data); + if(!$rpc->success()){ + msg_dialog::display(_("Error"), sprintf(_("Failed to save distribution properties: %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'],$values, '-' ); + + // Finally - close the dialog. $this->listing->clearDialogObject(); }elseif($type == 'Release'){