summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 7e25447)
raw | patch | inline | side by side (parent: 7e25447)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Fri, 6 May 2011 14:07:59 +0000 (14:07 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Fri, 6 May 2011 14:07:59 +0000 (14:07 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@20783 594d385d-05f5-0310-b6e9-bd551577e9d8
diff --git a/gosa-plugins/goto/admin/systems/goto/Device/InstallRecipe.tpl b/gosa-plugins/goto/admin/systems/goto/Device/InstallRecipe.tpl
index 38b99fbe77006eb243855ea77afbba576ad31788..d6d01de4939626bd3c9bec3cff6c613e89dc85dc 100644 (file)
<h3>{t}Installation type{/t}</h3>
<table>
<tr>
- <td><LABEL for="installBootstrapMethod">{t}Bootstrap method{/t}</LABEL></td>
+ <td><LABEL for="installTemplate">{t}Template{/t}</LABEL></td>
<td>
- <select name="installBootstrapMethod" size=1>
- {html_options options=$installBootstrapMethodList
- selected=$installBootstrapMethod}
+ <select name="installTemplate" size=1 onChange="document.mainform.submit();">
+ {html_options options=$installTemplateList
+ selected=$installTemplate}
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td><LABEL for="installRelease">{t}Release{/t}</LABEL></td>
+ <td>
+ <select name="installRelease" size=1 onChange="document.mainform.submit();">
+ {html_options options=$installReleaseList
+ selected=$installRelease}
</select>
</td>
</tr>
<tr>
<td><LABEL for="installConfigManagement">{t}Config management{/t}</LABEL></td>
<td>
- <select name="installConfigManagement" size=1
- onChange='document.mainform.submit();'>
+ <select nme="installConfigManagement" size=1 onChange='document.mainform.submit();'>
{html_options options=$installConfigManagementList
selected=$installConfigManagement}
</select>
</select>
</td>
</tr>
- <tr>
- <td><LABEL for="installTemplateDN">{t}Kickstart template{/t}</LABEL></td>
- <td>
- <select name="installTemplateDN" size=1>
- {html_options options=$installTemplateDNList
- selected=$installTemplateDN}
- </select>
- </td>
- </tr>
<tr>
<td><LABEL for="installKernelPackage">{t}Kernel package{/t}</LABEL></td>
<td>
<tr>
<td>
<input type='checkbox' value='1' {if $installRootEnabled} checked {/if}
- onClick="changeState('setKickstartRootPasswordHash');"
+ onClick="changeState('setPasswordHash');"
name="installRootEnabled" id="installRootEnabled"
>
<LABEL for="installRootEnabled">{t}Use root user{/t}</LABEL>
- <button name='setKickstartRootPasswordHash'
+ <button name='setPasswordHash'
{if !$installRootEnabled} disabled {/if}
- id="setKickstartRootPasswordHash">{t}Set password{/t}</button>
+ id="setPasswordHash">{t}Set password{/t}</button>
</td>
</tr>
</table>
<td><LABEL for="installKeyboardlayout">{t}Keyboard layout{/t}</LABEL></td>
<td>
<select name="installKeyboardlayout" size=1>
- {html_options values=$installKeyboardlayoutList output=$installKeyboardlayoutList
+ {html_options options=$installKeyboardlayoutList
selected=$installKeyboardlayout}
</select>
</td>
<td><LABEL for="installSystemLocale">{t}System locale{/t}</LABEL></td>
<td>
<select name="installSystemLocale" size=1>
- {html_options values=$installSystemLocaleList output=$installSystemLocaleList
+ {html_options options=$installSystemLocaleList
selected=$installSystemLocale}
</select>
</td>
diff --git a/gosa-plugins/goto/admin/systems/goto/Device/class_Device.inc b/gosa-plugins/goto/admin/systems/goto/Device/class_Device.inc
index 57cce66e6fc67fbc9f33a0d5c3a2102d360a2380..2d3dca35e0c77d2ef7212ca80d31e410f2cc2f3a 100644 (file)
*/
function save()
{
-
-
-
plugin::save();
// Append and remove dynmic object classes
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 a7a1e6f13c692e72103a84cf4a7cd825b7ba48f7..bd6a5c07570efde450808d7c08d459e4acc1d2d6 100644 (file)
class InstallRecipe extends plugin
{
- /* This has to be replaced by valid attributes, currently they are just
- * fake variables. #FIXME: I do not know the real attribute names yet.
- */
- public $installBootstrapMethod = '';
- public $installBootstrapMethodList = NULL;
-
- public $installConfigManagement = '';
- public $installConfigManagementList = NULL;
+ public $rpcErrorMessage = "";
/* Plugin attributes
*/
- public $installTemplateDN = "";
- public $installTemplateDNList = array();
-
- public $installMirrorDN = "";
- public $installMirrorDNList = array();
+ public $installTemplate = "";
+ public $installRelease = "";
+ public $installConfigManagement = '';
+ public $installConfigManagementList = NULL;
+ public $installBootstrapMethod = '';
+ public $installBootstrapMethodList = NULL;
+ public $installTimezone = "";
+ public $installTimeUTC = "";
public $installKernelPackage = "";
public $installKernelPackageList = array();
- public $installKeyboardlayout = "";
- public $installKeyboardlayoutList = array();
-
public $installSystemLocale = "";
public $installSystemLocaleList = array();
- public $installTimezone = "";
- public $installTimeUTC = "";
-
public $installNTPServer = array();
+ private $installNTPServerList = NULL;
+
public $installRootEnabled = "";
public $installRootPasswordHash = "";
+ public $setPasswordHash = FALSE;
- public $setKickstartRootPasswordHash = FALSE;
public $installPartitionTable = "";
- private $installNTPServerList = NULL;
- public $objectclasses = array('installRecipe');
- public $attributes = array("installTemplateDN","installKeyboardlayout","installSystemLocale",
+ public $installKeyboardlayout = "";
+ public $installKeyboardlayoutList = array();
+
+ public $installMirrorDN = "";
+ public $installMirrorDNList = array();
+
+ public $objectclasses = array();
+ public $attributes = array("installRelease", "installTemplate","installKeyboardlayout","installSystemLocale",
"installTimezone","installTimeUTC","installNTPServer","installMirrorDN",
"installRootEnabled","installRootPasswordHash","installKernelPackage",
"installPartitionTable","installConfigManagement","installBootstrapMethod");
- private $map = array('puppet' => array('objectClass' => 'puppetClient', 'type' => 'puppet', 'bootstrap' => 'preseed'));
/* Some plugin management related attributes
* See class plugin for details.
// Set default password hash
$this->hash = $this->config->get_cfg_value("core","passwordDefaultHash");
- // Prepare list of timezones
- $this->timezones = $this->getTimezones();
-
// Get list of password hashes
$tmp = passwordMethod::get_available_methods();
$this->hashes = array();
$this->hashes[$name] = $name;
}
+ // Init the object values.
+ $this->init_static_info();
+ $this->init_client_info();
+
// Prepare NTP servers list
$this->installNTPServerList= new sortableListing($this->installNTPServer);
$this->installNTPServerList->setDeleteable(true);
$this->installNTPServerList->setWidth("100%");
$this->installNTPServerList->setHeight("70px");
- // Init the object values.
- $this->init();
+ // Preset values for new devices
+ if(!$this->is_account){
+ $this->installTemplate = key($this->installationTemplates);
+ $this->installRelease = key($this->templateToRelease[$this->installTemplate]);
+ }else{
+ if(!isset($this->installationTemplates[$this->installTemplate])){
+ print "<br>Invalid template selected {$this->installTemplate}";
+ $this->installTemplate = key($this->installationTemplates);
+ }elseif(!isset($this->installationTemplates[$this->installTemplate]['method'])){
+ print "<br>No bootstrap method found!";
+
+ }elseif(!in_array($this->installRelease, $this->templateToRelease[$this->installTemplate])){
+ print "<br>Invalid release selected {$this->installRelease}";
+ $this->installRelease = key($this->templateToRelease[$this->installTemplate]);
+ }
+ }
+ $this->installBootstrapMethod = $this->installationTemplates[$this->installTemplate]['method'];
+ $this->reloadInstallationKernelPackages();
+ $this->reloadInstallationMirrors();
}
/*! \brief Load attribute values from the GOsa-backend using jsonRPC
*/
- function init()
+ function init_client_info()
{
- // Detect account status by checking the used objectClasses
- $this->is_account = FALSE;
- foreach($this->map as $type){
- if(isset($this->attrs['objectClass']) && in_array($type['objectClass'], $this->attrs['objectClass'])){
- $this->installBootstrapMethod = $type['bootstrap'];
- $this->installConfigManagement = $type['type'];
- $this->is_account = TRUE;
- }
- }
-
- // Start without error.
- $this->initFailed = FALSE;
-
- // Get list of NTP servers
- $this->installNTPServer = array();
- if(isset($this->attrs['installNTPServer']['count'])){
- for($i = 0; $i < $this->attrs['installNTPServer']['count']; $i++){
- $this->installNTPServer[] = $this->attrs['installNTPServer'][$i];
- }
- }
-
- // Load list of bootstrap methods.
- $res = $this->loadInstallationMethods();
- if($res == NULL){
- $this->initFailed = TRUE;
- msg_dialog(_("Error"), msgPool::rpcError($this->rpcErrorMessage), ERROR_DIALOG);
- return;
- }
- $this->installBootstrapMethodList = $res['installBootstrapMethodList'];
- $this->installConfigManagementList = $res['installConfigManagementList'];
-
-
- // Load system locales
- $locales = $this->getSystemLocales();
- if($locales == NULL){
- $this->initFailed = TRUE;
- msg_dialog(_("Error"), msgPool::rpcError($this->rpcErrorMessage), ERROR_DIALOG);
- return;
- }
- $this->installSystemLocaleList = $locales;
-
-
- // Load installation templates
- $res = $this->loadInstallationTemplates();
- if($res == NULL){
- $this->initFailed = TRUE;
- msg_dialog(_("Error"), msgPool::rpcError($this->rpcErrorMessage), ERROR_DIALOG);
- return;
- }
- $this->installTemplateDNList = $res;
-
-
- // Load installation keyboard layouts
- $res = $this->loadInstallationKeyboardLayouts();
- if($res == NULL){
- $this->initFailed = TRUE;
- msg_dialog(_("Error"), msgPool::rpcError($this->rpcErrorMessage), ERROR_DIALOG);
- return;
- }
- $this->installKeyboardlayoutList = $res;
-
-
- // Load kernel package list
- $res = $this->loadInstallationKernelPackages();
- if($res == NULL){
- $this->initFailed = TRUE;
- msg_dialog(_("Error"), msgPool::rpcError($this->rpcErrorMessage), ERROR_DIALOG);
- return;
- }
- $this->installKernelPackageList = $res;
-
-
- // Load installation mirrors
- $res = $this->loadInstallationMirrors();
- if($res == NULL){
- $this->initFailed = TRUE;
- msg_dialog(_("Error"), msgPool::rpcError($this->rpcErrorMessage), ERROR_DIALOG);
- return;
- }
- $this->installMirrorDNList = $res;
-
-
- // Preset some values for new accounts
- if(!$this->is_account){
-
- // Preset the device timezone
- $tz = timezone::get_default_timezone();
- $this->installTimezone = $tz['name'];
-
- // Set initial bootstrap and install method.
- $this->installBootstrapMethod = key($this->installBootstrapMethodList);
- $this->installConfigManagement = key($this->installConfigManagementList[$this->installBootstrapMethod]);
+ $uuid = "a0d17918-cfb2-11df-acbd-5452005f1250";
+ $rpc = $this->config->getRpcHandle();
+ $res = $rpc->systemGetBaseInstallParameters($uuid);
+
+ // Failed to load backend values, keep reported error and return with FALSE;
+ $this->rpcError = !$rpc->success();
+ if(!$rpc->success()){
+ $this->rpcErrorMessage = $rpc->get_error();
+ return(NULL);
}
-
- // Check if we've a valid bootstrap and configMangement method selected
- if(!isset($this->installConfigManagementList[$this->installBootstrapMethod])){
- $newMethod = key($this->installBootstrapMethodList);
- msg_dialog::display(_("Error"),
- sprintf(_("The selected bootstrap method %s is invalid. Using %s instead!"),
- bold($this->installBootstrapMethod), bold($newMethod)), ERROR_DIALOG);
- $this->installBootstrapMethod = $newMethod;
- }
- if(!isset($this->installConfigManagementList[$this->installBootstrapMethod][$this->installConfigManagement])){
- $newMethod = key($this->installConfigManagementList[$this->installBootstrapMethod]);
- msg_dialog::display(_("Error"),
- sprintf(_("The selected config management method %s is invalid. Using %s instead!"),
- bold($this->installConfigManagement),bold($newMethod)), ERROR_DIALOG);
- $this->installConfigManagement = $newMethod;
+ // 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'];
}
- }
-
- function getTimezones()
- {
- $tmp = timezone::_get_tz_zones();
- $list = array();
- foreach($tmp['TIMEZONES'] as $name => $offset){
- if($offset >= 0){
- $list[$name] = $name." ( + ".sprintf("%0.2f",$offset/(60*60))." "._("hours").")";
- }else{
- $offset = $offset * -1;
- $list[$name] = $name." ( - ".sprintf("%0.2f",($offset/(60*60)))." "._("hours").")";
- }
- }
- uksort($list, 'strnatcasecmp');
- return($list);
- }
-
-
- function loadInstallationKernelPackages()
- {
- return(array('kernel1','kk1'));
+ return;
}
-
- function loadInstallationMirrors()
- {
- $res = array(
- 'dc=intranet,dc=gonicus,dc=de' => 'Intranet',
- 'ou=systems,dc=intranet,dc=gonicus,dc=de' => 'System');
- return($res);
- }
-
- function loadInstallationTemplates()
- {
- $res = array(
- 'dc=intranet,dc=gonicus,dc=de' => 'Intranet-Tpl',
- 'ou=systems,dc=intranet,dc=gonicus,dc=de' => 'System-Tpl');
- return($res);
- }
- function loadInstallationKeyboardLayouts()
- {
- return(array('104','105'));
- }
-
- function getSystemLocales()
- {
- $locales = json_decode('{"hu_HU.UTF-8": "Hungarian",
- "es_DO.UTF-8": "Spanish (Dominican Republic)",
- "es_CL.UTF-8": "Spanish (Chile)"}');
-
- return($locales);
- }
-
-
- /*! \brief Try to load install and bootstrap methods from the GOsa-backend
- * This is done via jsonRPC, if calling the backend method fails,
- * this method returns FALSE, in case of success it return TRUE;
- */
- function loadInstallationMethods()
+ function init_static_info()
{
- $rpc = $this->config->getRpcHandle();
- $res = $rpc->getSupportedBaseInstallMethods();
-
- // Failed to load backend values, keep reported error and return with FALSE;
- $this->rpcError = !$rpc->success();
- if(!$rpc->success()){
- $this->rpcErrorMessage = $rpc->get_error();
- return(NULL);
+ // Load static values.
+ foreach(array(
+ "timeozones" => "getTimezones",
+ "distributions" => "loadDistributions",
+ "keyboardLayouts" => "loadInstallationKeyboardLayouts",
+ "installationTemplates" => "loadInstallationTemplates",
+ "installationMethods" => "loadInstallationMethods",
+ "locales" => "getSystemLocales" ) as $target => $func){
+ $$target = $this->$func();
+ if($$target == NULL){
+ $this->initFailed = TRUE;
+ msg_dialog::display(_("Error"), msgPool::rpcError($this->rpcErrorMessage), ERROR_DIALOG);
+ return;
+ }
}
- // Walk through result and set bootstrap methods.
- foreach($res as $name => $method){
- $res['installBootstrapMethodList'][$name] = $method['name'];
- foreach($method['methods'] as $m){
- $res['installConfigManagementList'][$name][$m] = $m;
+ // Assign fetchted values
+ $this->timezones = $timeozones;
+ $this->installBootstrapMethodList = $installationMethods['installBootstrapMethodList'];
+ $this->installConfigManagementList = $installationMethods['installConfigManagementList'];
+ $this->installSystemLocaleList = $locales;
+ $this->installKeyboardlayoutList = $keyboardLayouts;
+ $this->distributions = $distributions;
+
+ # Create template to relase map
+ $this->templateToRelease = array();
+
+ // Walk through installation templates and use the 'repositories' attribute
+ // to supported releases.
+ foreach($installationTemplates as $name => $tdata){
+
+ $mName = isset($this->installBootstrapMethodList[$tdata['method']]) ?
+ $this->installBootstrapMethodList[$tdata['method']]: $tdata['method'];
+
+ $this->installationTemplateNames[$name] = $tdata['description']." (".$mName.")";
+ $this->installationTemplates[$name] = $tdata;
+ $this->templateToRelease[$name] = array();
+
+ // Check if the 'repository'-category of the template can be found in any
+ // received release list.
+ if(isset($installationMethods[$tdata['method']]['repositories'])){
+ $repos = $installationMethods[$tdata['method']]['repositories'];
+ foreach($distributions as $dist){
+ if(in_array($dist['type']['name'],$repos) && isset($dist['releases'])){
+ foreach($dist['releases'] as $release){
+ $rname = $dist['name'].'/'.$release['name'];
+ $this->templateToRelease[$name][$rname] = $rname;
+ }
+ }
+ }
}
}
- return($res);
}
-
+
function execute()
{
// Log account access
Root password hash dialog
***************/
- if($this->setKickstartRootPasswordHash){
+ if($this->setPasswordHash){
$this->dialog = TRUE;
$smarty = get_smarty();
$smarty->assign('hashes', set_post($this->hashes));
plugin::execute();
$smarty = get_smarty();
+ $smarty->assign('installTemplateList', $this->installationTemplateNames);
+ $smarty->assign('installReleaseList', $this->templateToRelease[$this->installTemplate]);
+
+
$smarty->assign('timezones', $this->timezones);
$smarty->assign('installKeyboardlayoutList', $this->installKeyboardlayoutList);
$smarty->assign('installKernelPackageList', $this->installKernelPackageList);
- $smarty->assign('installTemplateDNList', $this->installTemplateDNList);
$smarty->assign('installMirrorDNList', $this->installMirrorDNList);
$smarty->assign('installSystemLocaleList', $this->installSystemLocaleList);
$smarty->assign('installNTPServerList', $this->installNTPServerList->render());
$smarty->assign('installBootstrapMethodList', $this->installBootstrapMethodList);
$smarty->assign('installConfigManagement', $this->installConfigManagement);
- $cfgList = $this->installConfigManagementList[$this->installBootstrapMethod];
- $smarty->assign('installConfigManagementList', $cfgList);
+ // Assign list of available config-management types.
+ if(isset($this->installConfigManagementList[$this->installBootstrapMethod])){
+ $smarty->assign('installConfigManagementList', $this->installConfigManagementList[$this->installBootstrapMethod]);
+ }else{
+ $smarty->assign('installConfigManagementList', array());
+ }
+
foreach($this->attributes as $attr){
$smarty->assign($attr, $this->$attr);
}
if(isset($_POST['InstallRecipePosted'])){
$currentInstallMethod = $this->installConfigManagement;
+
+ $oldRelease = $this->installRelease;
plugin::save_object();
$this->installRootEnabled = isset($_POST['installRootEnabled']);
$this->installTimeUTC = isset($_POST['installTimeUTC']);
- if(isset($_POST['setKickstartRootPasswordHash'])){
- $this->setKickstartRootPasswordHash = true;
+ if(isset($_POST['setPasswordHash'])){
+ $this->setPasswordHash = true;
}
$this->installNTPServerList->save_object();
}
}
$this->installNTPServerList->setListData($this->installNTPServer);
+ $this->installBootstrapMethod = $this->installationTemplates[$this->installTemplate]['method'];
+
+ // Reload list of kernel packages and mirrors
+ if($oldRelease != $this->installRelease){
+ $this->reloadInstallationKernelPackages();
+ $this->reloadInstallationMirrors();
+ }
}
- if(isset($_POST['cancelPassword'])) $this->setKickstartRootPasswordHash =false;
+
+ if(isset($_POST['cancelPassword'])) $this->setPasswordHash =false;
if(isset($_POST['setPassword'])) {
- $this->setKickstartRootPasswordHash =false;
+ $this->setPasswordHash =false;
$hash = get_post('passwordHash');
// Not sure, why this is here, but maybe some encryption methods require it.
$test = new $available[$hash]($this->config,$this->dn);
$this->installRootPasswordHash = @$test->generate_hash(get_post('rootPassword'));
}
-
}
function save()
{
- //
if(!$this->installRootEnabled) $this->installRootPasswordHash = "";
- $this->installRootEnabled = ($this->installRootEnabled)?'TRUE':'FALSE';
- $this->installTimeUTC = ($this->installTimeUTC)?'TRUE':'FALSE';
- plugin::save();
+ $uuid = "a0d17918-cfb2-11df-acbd-5452005f1250";
+ $rpc = $this->config->getRpcHandle();
- unset($this->attrs['installConfigManagement']);
- unset($this->attrs['installBootstrapMethod']);
- echo "Skipp saving of 'installConfigManagement' and 'installBootstrapMethod', i've no idea where to store them.";
+ $data = array();
+ $res = $rpc->systemSetBaseInstallParameters($uuid, $data);
- // Remove all objectClasses which belongs to a bootstrap method,
- // and then add the selected one.
- foreach($this->map as $type){
- $this->attrs['objectClass'] = array_remove_entries_ics(array($type['objectClass']), $this->attrs['objectClass']);
- }
- $this->attrs['objectClass'][] = $this->map[$this->installConfigManagement]['objectClass'];
- print_a($this->attrs);
-
- $this->cleanup();
- $ldap=$this->config->get_ldap_link();
- $ldap->cd($this->config->current['BASE']);
- $ldap->cd($this->dn);
- $ldap->modify($this->attrs);
- new log("modify","Device/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
- if (!$ldap->success()){
- msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $this->dn, LDAP_MOD, get_class()));
- }else{
- $this->handle_post_events("modify");
+
+
+ // Failed to load backend values, keep reported error and return with FALSE;
+ $this->rpcError = !$rpc->success();
+ if(!$rpc->success()){
+ $this->rpcErrorMessage = $rpc->get_error();
+ return(NULL);
}
+ return($res);
+
}
function remove_from_parent()
{
- plugin::remove_from_parent();
- unset($this->attrs['installConfigManagement']);
- unset($this->attrs['installBootstrapMethod']);
- echo "Skipp saving of 'installConfigManagement' and 'installBootstrapMethod', i've no idea where to store them.";
-
- $ldap=$this->config->get_ldap_link();
- $ldap->cd($this->config->current['BASE']);
- $ldap->cd($this->dn);
- $ldap->modify($this->attrs);
- new log("remove","Device/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
- if (!$ldap->success()){
- msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $this->dn, LDAP_DEL, get_class()));
+ print "Missing";
+ }
+
+
+ /*! \brief Refreshes the list of selectable kernel packages.
+ */
+ function reloadInstallationKernelPackages()
+ {
+ $rpc = $this->config->getRpcHandle();
+ $res = $rpc->getKernelPackages($this->installRelease);
+
+ // 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);
}else{
- $this->handle_post_events("remove");
+ $this->installKernelPackageList = array();
+ foreach($res as $name){
+ $this->installKernelPackageList[$name] = $name;
+ }
+
+ if(!isset($this->installKernelPackageList[$this->installKernelPackage])){
+ $new = key($this->installKernelPackageList);
+ msg_dialog::display(_("Warning"), sprintf(_("The selected kernel package '%s' is no longer available! The kernel package '%s' was selected as replacement!"), $this->installKernelPackage, $new), WARNING_DIALOG);
+ $this->installKernelPackage = $new;
+ }
}
-
+ }
+
+
+ /*! \brief Returns a list of distributions on success.
+ * In case of an error, it returns NULL.
+ */
+ function loadDistributions()
+ {
+ $rpc = $this->config->getRpcHandle();
+ $res = $rpc->getDistributions();
+
+ // Failed to load backend values, keep reported error and return with FALSE;
+ $this->rpcError = !$rpc->success();
+ if(!$rpc->success()){
+ $this->rpcErrorMessage = $rpc->get_error();
+ return(NULL);
+ }
+ return($res);
+ }
+
+
+ /*! \brief Returns a list of timezones on success.
+ * In case of an error, it returns NULL.
+ */
+ function getTimezones()
+ {
+ $rpc = $this->config->getRpcHandle();
+ $res = $rpc->getTimezones();
+
+ // Failed to load backend values, keep reported error and return with FALSE;
+ $this->rpcError = !$rpc->success();
+ if(!$rpc->success()){
+ $this->rpcErrorMessage = $rpc->get_error();
+ return(NULL);
+ }
+ return($res);
+ }
+
+
+ /*! \brief Returns a list of installation mirrors on success.
+ * In case of an error, it returns NULL.
+ */
+ function reloadInstallationMirrors()
+ {
+ $res = array(
+ 'dc=intranet,dc=gonicus,dc=de' => 'Intranet',
+ 'ou=systems,dc=intranet,dc=gonicus,dc=de' => 'System');
+ $this->installMirrorDNList =$res;
+ }
+
+
+ /*! \brief Returns a list of installation templates on success.
+ * In case of an error, it returns NULL.
+ */
+ function loadInstallationTemplates()
+ {
+ $rpc = $this->config->getRpcHandle();
+ $res = $rpc->installListTemplates();
+
+ // Failed to load backend values, keep reported error and return with FALSE;
+ $this->rpcError = !$rpc->success();
+ if(!$rpc->success()){
+ $this->rpcErrorMessage = $rpc->get_error();
+ return(NULL);
+ }
+ return($res);
+ }
+
+
+ /*! \brief Returns a list of keyboard layouts on success.
+ * In case of an error, it returns NULL.
+ */
+ function loadInstallationKeyboardLayouts()
+ {
+ $rpc = $this->config->getRpcHandle();
+ $res = $rpc->getKeyboardModels();
+
+ // Failed to load backend values, keep reported error and return with FALSE;
+ $this->rpcError = !$rpc->success();
+ if(!$rpc->success()){
+ $this->rpcErrorMessage = $rpc->get_error();
+ return(NULL);
+ }
+ $lay = array();
+ foreach($res as $key => $data){
+ $lay[$key] = "{$data[0]} - {$data[2]}";
+ }
+ asort($lay);
+ return($lay);
+ }
+
+
+ /*! \brief Returns a list of system locales on success.
+ * In case of an error, it returns NULL.
+ */
+ function getSystemLocales()
+ {
+ $rpc = $this->config->getRpcHandle();
+ $res = $rpc->getSystemLocales();
+
+ // Failed to load backend values, keep reported error and return with FALSE;
+ $this->rpcError = !$rpc->success();
+ if(!$rpc->success()){
+ $this->rpcErrorMessage = $rpc->get_error();
+ return(NULL);
+ }
+
+ return($res);
+ }
+
+
+ /*! \brief Try to load install and bootstrap methods from the GOsa-backend
+ * This is done via jsonRPC, if calling the backend method fails,
+ * this method returns FALSE, in case of success it return TRUE;
+ */
+ function loadInstallationMethods()
+ {
+ $rpc = $this->config->getRpcHandle();
+ $res = $rpc->getSupportedBaseInstallMethods();
+
+ // Failed to load backend values, keep reported error and return with FALSE;
+ $this->rpcError = !$rpc->success();
+ if(!$rpc->success()){
+ $this->rpcErrorMessage = $rpc->get_error();
+ return(NULL);
+ }
+
+ // Walk through result and set bootstrap methods.
+ foreach($res as $name => $method){
+ $res['installBootstrapMethodList'][$name] = $method['name'];
+ foreach($method['methods'] as $m){
+ $res['installConfigManagementList'][$name][$m] = $m;
+ }
+ }
+ return($res);
}
"plCategory" => array("Device"),
"plProvidedAcls" => array(
"member" => _("Member"),
- "installTemplateDN" => _("Template"),
+ "installTemplate" => _("Installation template"),
+ "installRelease" => _("Installation release"),
+
"installBootstrapMethod" => _("Bootstrap method"),
"installConfigManagement" => _("Config management"),
"installKeyboardlayout" => _("Keyboard layout"),
"installTimezone" => _("Timezone"),
"installTimeUTC" => _("Time"),
"installNTPServer" => _("NTP-Server"),
- "installMirrorDN" => _("Kickstart mirror"),
+ "installMirrorDN" => _("Mirror"),
"installRootEnabled" => _("Root login enabled"),
"installRootPasswordHash" => _("Root password hash"),
"installKernelPackage" => _("Kernel package"),
);
}
}
-
?>