X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=plugins%2Fadmin%2Fsystems%2Fclass_servGeneric.inc;h=d9e946a14cbf8b60c4fe7c1fcf8a35114b8371e4;hb=8edf1b0390149b39682c7e02c394fec56940874d;hp=92e5b46be38e4bc256a7986cfe3b7f767274c7b0;hpb=3fbe198215517d9246de12d4c6649f9c1434daa0;p=gosa.git diff --git a/plugins/admin/systems/class_servGeneric.inc b/plugins/admin/systems/class_servGeneric.inc index 92e5b46be..d9e946a14 100644 --- a/plugins/admin/systems/class_servGeneric.inc +++ b/plugins/admin/systems/class_servGeneric.inc @@ -28,14 +28,20 @@ class servgeneric extends plugin var $netConfigDNS; var $modes = array(); - function servgeneric ($config, $dn= NULL) + var $mapActions = array("reboot" => "", + "instant_update" => "softupdate", + "update" => "sceduledupdate", + "reinstall" => "install", + "rescan" => "", + "memcheck" => "memcheck", + "sysinfo" => "sysinfo"); + + function servgeneric ($config, $dn= NULL, $parent= NULL) { - plugin::plugin ($config, $dn); + plugin::plugin ($config, $dn, $parent); $this->modes["active"]= _("Activated"); $this->modes["locked"]= _("Locked"); - $this->modes["memcheck"]= _("Memory test"); - $this->modes["sysinfo"]= _("System analysis"); /* Set base */ if ($this->dn == "new"){ @@ -68,11 +74,41 @@ class servgeneric extends plugin if ($cmd == ""){ print_red(_("No ACTIONCMD definition found in your gosa.conf")); } else { + exec ($cmd." ".$this->netConfigDNS->macAddress." ".escapeshellarg($_POST['saction']), $dummy, $retval); if ($retval != 0){ print_red(sprintf(_("Execution of '%s' failed!"), $cmd)); } else { $this->didAction= TRUE; + + /* Set FAIstate */ + $ldap = $this->config->get_ldap_link(); + $ldap->cd($this->config->current['BASE']); + $ldap->cat($this->dn,array("objectClass")); + $res = $ldap->fetch(); + + $attrs = array(); + $attrs['FAIstate'] = ""; + if(isset($this->mapActions[$_POST['saction']])){ + $attrs['FAIstate'] = $this->mapActions[$_POST ['saction']]; + } + + for($i = 0; $i < $res['objectClass']['count'] ; $i ++){ + $attrs['objectClass'][] = $res['objectClass'][$i]; + } + + if(($attrs['FAIstate'] != "") && (!in_array("FAIobject",$attrs['objectClass']))){ + $attrs['objectClass'][] = "FAIobject"; + } + + if($attrs['FAIstate'] == ""){ + #FIXME we should check if FAIobject is used anymore + $attrs['FAIstate'] = array(); + } + + $ldap->cd($this->dn); + $ldap->modify($attrs); + show_ldap_error($ldap->get_error()); } } } @@ -126,11 +162,15 @@ class servgeneric extends plugin "instant_update" => _("Instant update"), "update" => _("Scheduled update"), "reinstall" => _("Reinstall"), - "rescan" => _("Rescan hardware"))); + "rescan" => _("Rescan hardware"), + "memcheck" => _("Memory test"), + "sysinfo" => _("System analysis"))); } else { $smarty->assign("actions", array("wake" => _("Wake up"), "reinstall" => _("Reinstall"), - "update" => _("Scheduled update"))); + "update" => _("Scheduled update"), + "memcheck" => _("Memory test"), + "sysinfo" => _("System analysis"))); } /* Show main page */ @@ -257,9 +297,9 @@ class servgeneric extends plugin $mode= "modify"; } + show_ldap_error($ldap->get_error(), _("Saving server failed")); $this->netConfigDNS->cn = $this->cn; $this->netConfigDNS->save($this->dn); - show_ldap_error($ldap->get_error(), _("Saving server failed")); /* Optionally execute a command after we're done */ if(!$this->didAction){