summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: c2f5058)
raw | patch | inline | side by side (parent: c2f5058)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Mon, 9 May 2011 11:12:58 +0000 (11:12 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Mon, 9 May 2011 11:12:58 +0000 (11:12 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@20790 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-plugins/goto/admin/systems/goto/Device/InstallRecipe.tpl | patch | blob | history | |
gosa-plugins/goto/admin/systems/goto/Device/class_InstallRecipe.inc | patch | blob | history |
diff --git a/gosa-plugins/goto/admin/systems/goto/Device/InstallRecipe.tpl b/gosa-plugins/goto/admin/systems/goto/Device/InstallRecipe.tpl
index aa8a1d15e8bc65aedb929841b45cea311679c8bc..5a5d43c80e6fd325f6977b6e768bc0a475624dab 100644 (file)
<td><LABEL for="installTimezone">{t}Timezone{/t}</LABEL></td>
<td>
<select size='1' name="installTimezone" id="installTimezone">
- {html_options values=$timezones options=$timezones selected=$installTimezone}
+ {html_options output=$timezones values=$timezones
+ selected=$installTimezone}
</select>
</td>
</tr>
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 8ff537efebd62223fd261e3458a4b860b78d5d44..139f80e084e001a05bd9c2ce0835811d0e233d81 100644 (file)
public $installKernelPackageList = array();
// System Locale
- public $installSystemLocale = "de_DE.UTF-8";
+ public $installSystemLocale = "";
public $installSystemLocaleList = array();
// Selected NTP Server
public $installPartitionTable = "";
// Keyboard-layout attribute
- public $installKeyboardlayout = "de";
+ public $installKeyboardlayout = "";
public $installKeyboardlayoutList = array();
// Mirror related attribute
msg_dialog::display(_("Error"), msgPool::rpcError($this->rpcErrorMessage), ERROR_DIALOG);
return(NULL);
}
-
+
// Apply received options
$this->is_account = $res == True;
if($this->is_account){
- $this->installNTPServer = $res['ntp-servers'];
- $this->installTemplate = $res['template'];
- $this->installRelease = $res['release'][0];
- $this->installTimezone = array_search($res['timezone'][0], $this->timezones);
- $this->installTimeUTC = $res['utc'][0];
- $this->installKernelPackage = $res['kernel'][0];;
- $this->installSystemLocale = $res['system-locale'][0];
- $this->installRootEnabled = $res['root-user'][0];
- $this->installRootPasswordHash = $res['root-hash'][0];
- $this->installPartitionTable = $res['disk-setup'][0];
- $this->installKeyboardlayout = $res['keyboard-layout'];
+
+ $map = array(
+ 'ntp-servers' => "installNTPServer",
+ 'template' => "installTemplate",
+ 'keyboard-layout' => "installKeyboardlayout");
+
+ // We receive an array for these attributes, but require a string instead
+ // we just use the first element of the array.
+ $mapArray = array(
+ 'release' => "installRelease",
+ 'timezone' => "installTimezone",
+ 'utc' => "installTimeUTC",
+ 'kernel' => "installKernelPackage",
+ 'system-locale' => "installSystemLocale",
+ 'root-user' => "installRootEnabled",
+ 'root-hash' => "installRootPasswordHash",
+ 'disk-setup' => "installPartitionTable");
+
+ foreach($res as $name => $data){
+ if(isset($map[$name])){
+ $target = $map[$name];
+ $value = $res[$name];
+ }elseif(isset($mapArray[$name])){
+ $target = $mapArray[$name];
+ $value = $res[$name][0];
+ }
+ $this->$target = $value;
+ }
+
+ // Convert Bool values to Bool.
+ $boolean = array("installRootEnabled", "installTimeUTC");
+ foreach($boolean as $attr){
+ $this->$attr = ($this->$attr != FALSE);
+ }
}
return;
function save()
{
-
if(!$this->installRootEnabled) $this->installRootPasswordHash = "";
-
+
$map = array(
"installNTPServer"=>'ntp-servers',
"installTemplate"=>'template',
"installRootEnabled"=>'root-user',
"installRootPasswordHash"=>'root-hash',
"installPartitionTable"=>'disk-setup',
- "installKeyboardlayout"=>'keyboard-layout');
+ "installKeyboardlayout"=>'keyboard-layout',
+ );
+ // Collect values to be saved.
$data = array();
foreach($map as $source => $dest){
- $data[$dest] = $this->$source;
+ if(!empty($this->$source)){
+ $data[$dest] = $this->$source;
+ }
}
- print_a($data);
- return;
+ // Enforce an array for ntp-servers
+ $data['ntp-servers'] = array_values($data['ntp-servers']);
+
+ // Save Boolean like a String
+ $boolean = array("root-user", "utc");
+ foreach($boolean as $attr){
+ $data[$attr] = ($data[$attr]) ? $data[$attr] = TRUE : $data[$attr] = FALSE;
+ }
+
$rpc = $this->config->getRpcHandle();
- $res = $rpc->systemSetBaseInstallParameters($deviceUUID, $data);
+ $res = $rpc->systemSetBaseInstallParameters($this->deviceUUID, $data);
// Failed to load backend values, keep reported error and return with FALSE;
$this->rpcError = !$rpc->success();
if(!$rpc->success()){
$this->rpcErrorMessage = $rpc->get_error();
+ msg_dialog::display(_("Error"), msgPool::rpcError($this->rpcErrorMessage), ERROR_DIALOG);
return(NULL);
}
- return($res);
}
$this->rpcError = !$rpc->success();
if(!$rpc->success()){
$this->rpcErrorMessage = $rpc->get_error();
+ msg_dialog::display(_("Error"), msgPool::rpcError($this->rpcErrorMessage), ERROR_DIALOG);
return(NULL);
}