From 10fc8679748838ef8de6f90b53d106c61a96d83c Mon Sep 17 00:00:00 2001 From: hickert Date: Fri, 6 May 2011 14:48:19 +0000 Subject: [PATCH] Comments clenaup git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@20786 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../goto/Device/class_InstallRecipe.inc | 49 +++++++++++++------ 1 file changed, 33 insertions(+), 16 deletions(-) diff --git a/gosa-plugins/goto/admin/systems/goto/Device/class_InstallRecipe.inc b/gosa-plugins/goto/admin/systems/goto/Device/class_InstallRecipe.inc index 9ed86671d..56f709013 100644 --- a/gosa-plugins/goto/admin/systems/goto/Device/class_InstallRecipe.inc +++ b/gosa-plugins/goto/admin/systems/goto/Device/class_InstallRecipe.inc @@ -4,6 +4,7 @@ class InstallRecipe extends plugin { public $rpcErrorMessage = ""; + public $uuid = ""; // Template options public $installTemplate = ""; @@ -84,6 +85,9 @@ class InstallRecipe extends plugin foreach($tmp['name'] as $name){ $this->hashes[$name] = $name; } + + print "Hard coded uuid!"; + $this->uuid = "a0d17918-cfb2-11df-acbd-5452005f1250"; // Init the object values. $this->init_static_info(); @@ -102,30 +106,47 @@ class InstallRecipe extends plugin $this->installTemplate = key($this->installationTemplates); $this->installRelease = key($this->templateToRelease[$this->installTemplate]); }else{ + if(!isset($this->installationTemplates[$this->installTemplate])){ - print "
Invalid template selected {$this->installTemplate}"; - $this->installTemplate = key($this->installationTemplates); + + // The selected template is no longer available, select the next selectable template. + $new = key($this->installationTemplates); + $message = sprintf(_("The selected template '%s' is no longer available. Selecting '%s' as replacement!"), + $this->installTemplate, $new); + msg_dialog::display(_("Warning"), $message, WARNING_DIALOG); + $this->installTemplate = $new; + $installRelease = key($this->templateToRelease[$this->installTemplate]); + }elseif(!isset($this->installationTemplates[$this->installTemplate]['method'])){ - print "
No bootstrap method found!"; - + + // Not necessary to warn the user here, the input fields will be empty and thus + // avoid saving. + }elseif(!in_array($this->installRelease, $this->templateToRelease[$this->installTemplate])){ - print "
Invalid release selected {$this->installRelease}"; - $this->installRelease = key($this->templateToRelease[$this->installTemplate]); + + // The selected release is no longer available for the current template + // Warn the user and select the next selectable release. + $new = key($this->templateToRelease[$this->installTemplate]); + $message = sprintf(_("The selected release '%s' is no longer available. Selecting '%s' as replacement!"), + $this->installRelease, $new); + $this->installRelease = $new; + msg_dialog::display(_("Warning"), $message, WARNING_DIALOG); } } + + // Update selectable items like kernels and mirrors depending on the current setup (relase) $this->installBootstrapMethod = $this->installationTemplates[$this->installTemplate]['method']; $this->reloadInstallationKernelPackages(); $this->reloadInstallationMirrors(); } - /*! \brief Load attribute values from the GOsa-backend using jsonRPC + /*! \brief Loads client-information values from the GOsa-backend using jsonRPC */ function init_client_info() { - $uuid = "a0d17918-cfb2-11df-acbd-5452005f1250"; $rpc = $this->config->getRpcHandle(); - $res = $rpc->systemGetBaseInstallParameters($uuid); + $res = $rpc->systemGetBaseInstallParameters($this->uuid); // Failed to load backend values, keep reported error and return with FALSE; $this->rpcError = !$rpc->success(); @@ -350,15 +371,11 @@ class InstallRecipe extends plugin function save() { if(!$this->installRootEnabled) $this->installRootPasswordHash = ""; - - $uuid = "a0d17918-cfb2-11df-acbd-5452005f1250"; + + print "Save missing"; + return; $rpc = $this->config->getRpcHandle(); - - $data = array(); $res = $rpc->systemSetBaseInstallParameters($uuid, $data); - - - // Failed to load backend values, keep reported error and return with FALSE; $this->rpcError = !$rpc->success(); -- 2.30.2