diff --git a/plugins/admin/systems/class_workstationGeneric.inc b/plugins/admin/systems/class_workstationGeneric.inc
index 0330d015e3443af3949ddf272230a2ca545aad1f..4604c98a77c16c7965795458e083127982d3c129 100644 (file)
"gotoFloppyEnable", "gotoCdromEnable", "cn", "gotoSndModule",
"ghCpuType", "ghMemSize", "ghUsbSupport",
"ghGfxAdapter", "ghSoundAdapter", "gotoLastUser", "l","FAIscript");
"gotoFloppyEnable", "gotoCdromEnable", "cn", "gotoSndModule",
"ghCpuType", "ghMemSize", "ghUsbSupport",
"ghGfxAdapter", "ghSoundAdapter", "gotoLastUser", "l","FAIscript");
- var $objectclasses= array("top", "gotoWorkstation", "GOhard","FAIobject");
+ var $objectclasses= array("top", "gotoWorkstation", "GOhard");
var $mapActions = array("reboot" => "localboot",
var $mapActions = array("reboot" => "localboot",
+ "localboot" => "localboot",
"instant_update" => "softupdate",
"update" => "sceduledupdate",
"reinstall" => "install",
"instant_update" => "softupdate",
"update" => "sceduledupdate",
"reinstall" => "install",
"memcheck" => "memcheck",
"sysinfo" => "sysinfo");
"memcheck" => "memcheck",
"sysinfo" => "sysinfo");
-
+
+ var $fai_activated = FALSE;
function workgeneric ($config, $dn= NULL, $parent= NULL)
{
function workgeneric ($config, $dn= NULL, $parent= NULL)
{
+ $tmp = search_config($config->data,"faiManagement","CLASS");
+ if(!empty($tmp)){
+ $this->fai_activated = TRUE;
+ }
+
plugin::plugin ($config, $dn, $parent);
$this->netConfigDNS = new termDNS($this->config,$this->dn,$this->objectclasses);
plugin::plugin ($config, $dn, $parent);
$this->netConfigDNS = new termDNS($this->config,$this->dn,$this->objectclasses);
$this->gotoSyslogServers[$server] = $visible;
}
$this->gotoSyslogServers[$server] = $visible;
}
+ if($this->is_account){
+ @log::log("view","workstation/".get_class($this),$this->dn);
+ }
+
/* Save 'dn' for later referal */
$this->orig_dn= $this->dn;
}
/* Save 'dn' for later referal */
$this->orig_dn= $this->dn;
}
} elseif ($_POST['saction'] != "wake") {
/* Set FAIstate */
} elseif ($_POST['saction'] != "wake") {
/* 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']];
- }
+ if($this->fai_activated && $this->dn != "new"){
+ $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];
- }
+ 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'] != "") && (!in_array("FAIobject",$attrs['objectClass']))){
+ $attrs['objectClass'][] = "FAIobject";
+ }
- if($attrs['FAIstate'] == ""){
- #FIXME we should check if FAIobject is used anymore
- $attrs['FAIstate'] = array();
- }
+ if($attrs['FAIstate'] == ""){
+#FIXME we should check if FAIobject is not used anymore
+ $attrs['FAIstate'] = array();
+ }
+
+ $ldap->cd($this->dn);
+ $ldap->modify($attrs);
+ show_ldap_error($ldap->get_error(), sprintf(_("Saving of system workstation/generic (FAIstate) with dn '%s' failed."),$this->dn));
- $ldap->cd($this->dn);
- $ldap->modify($attrs);
- show_ldap_error($ldap->get_error(), sprintf(_("Saving of system workstation/generic (FAIstate) with dn '%s' failed."),$this->dn));
-
+ }
$this->didAction= TRUE;
}
}
$this->didAction= TRUE;
}
}
"reinstall" => _("Reinstall"),
"rescan" => _("Rescan hardware"),
"memcheck" => _("Memory test"),
"reinstall" => _("Reinstall"),
"rescan" => _("Rescan hardware"),
"memcheck" => _("Memory test"),
+ "localboot" => _("Force localboot"),
"sysinfo" => _("System analysis")));
} else {
$smarty->assign("actions", array("wake" => _("Wake up"),
"reinstall" => _("Reinstall"),
"update" => _("Scheduled update"),
"memcheck" => _("Memory test"),
"sysinfo" => _("System analysis")));
} else {
$smarty->assign("actions", array("wake" => _("Wake up"),
"reinstall" => _("Reinstall"),
"update" => _("Scheduled update"),
"memcheck" => _("Memory test"),
+ "localboot" => _("Force localboot"),
"sysinfo" => _("System analysis")));
}
/* Arrays */
$smarty->assign("modes", $this->modes);
$smarty->assign("nfsservers", $this->config->data['SERVERS']['NFS']);
$smarty->assign("syslogservers", $this->gotoSyslogServers);
"sysinfo" => _("System analysis")));
}
/* Arrays */
$smarty->assign("modes", $this->modes);
$smarty->assign("nfsservers", $this->config->data['SERVERS']['NFS']);
$smarty->assign("syslogservers", $this->gotoSyslogServers);
+ $smarty->assign("fai_activated",$this->fai_activated);
$ntpser = array();
foreach($this->gotoNtpServers as $server){
$ntpser = array();
foreach($this->gotoNtpServers as $server){
$this->netConfigDNS->remove_from_parent();
$ldap= $this->config->get_ldap_link();
$ldap->rmdir($this->dn);
$this->netConfigDNS->remove_from_parent();
$ldap= $this->config->get_ldap_link();
$ldap->rmdir($this->dn);
+ @log::log("remove","workstation/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
show_ldap_error($ldap->get_error(), sprintf(_("Removing of system workstation/generic with dn '%s' failed."),$this->dn));
/* Optionally execute a command after we're done */
show_ldap_error($ldap->get_error(), sprintf(_("Removing of system workstation/generic with dn '%s' failed."),$this->dn));
/* Optionally execute a command after we're done */
- $this->handle_post_events("remove", array("macAddress" => $this->netConfigDNS->macAddress));
+ $this->handle_post_events("remove", array("macAddress" => $this->netConfigDNS->macAddress,"ipHostNumber" => $this->netConfigDNS-ipHostNumber));
/* Delete references to object groups */
$ldap->cd ($this->config->current['BASE']);
/* Delete references to object groups */
$ldap->cd ($this->config->current['BASE']);
/* Strip out 'default' values */
foreach (array("gotoSyslogServer") as $val){
/* Strip out 'default' values */
foreach (array("gotoSyslogServer") as $val){
- if ($this->attrs[$val] == "default"){
+ if (isset($this->attrs[$val]) && $this->attrs[$val] == "default"){
$this->attrs[$val]= array();
}
}
$this->attrs[$val]= array();
}
}
$ldap->create_missing_trees(preg_replace('/^[^,]+,/', '', $this->dn));
$ldap->cd($this->dn);
$ldap->add($this->attrs);
$ldap->create_missing_trees(preg_replace('/^[^,]+,/', '', $this->dn));
$ldap->cd($this->dn);
$ldap->add($this->attrs);
+ @log::log("create","workstation/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
show_ldap_error($ldap->get_error(), sprintf(_("Saving of system workstation/generic with dn '%s' failed."),$this->dn));
if(!$this->didAction){
show_ldap_error($ldap->get_error(), sprintf(_("Saving of system workstation/generic with dn '%s' failed."),$this->dn));
if(!$this->didAction){
- $this->handle_post_events("add");
+ $this->handle_post_events("add",array("macAddress" => $this->netConfigDNS->macAddress,"ipHostNumber" => $this->netConfigDNS->ipHostNumber));
}
} else {
if ($this->orig_dn != $this->dn){
}
} else {
if ($this->orig_dn != $this->dn){
$ldap->cd($this->dn);
$this->cleanup();
$ldap->modify ($this->attrs);
$ldap->cd($this->dn);
$this->cleanup();
$ldap->modify ($this->attrs);
+ @log::log("modify","workstation/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
if(!$this->didAction){
if(!$this->didAction){
- $this->handle_post_events("modify");
+ $this->handle_post_events("modify",array("macAddress" => $this->netConfigDNS->macAddress,"ipHostNumber" => $this->netConfigDNS->ipHostNumber));
}
}
}
}