diff --git a/plugins/admin/systems/class_workstationStartup.inc b/plugins/admin/systems/class_workstationStartup.inc
index 2c553a5d616b71b28ad84b15e4993baba4fbfed5..f33fcae8f012307850614a0158dbb820a67efdbd 100644 (file)
/* Generic terminal attributes */
var $bootmode = "G";
- var $goLdapServerList = array("default");
+ var $goLdapServerList = array();
var $gotoBootKernel = "default";
var $gotoKernelParameters = "";
- var $gotoLdapServer = "";
+ var $gotoLdapServer = "default";
var $gotoModules = array();
var $gotoAutoFs = array();
var $gotoFilesystem = array();
var $gotoTerminalPath = "";
var $FAIstatus = "";
-
+ var $gotoBootKernels = array();
/* attribute list for save action */
var $attributes = array("gotoLdapServer", "gotoBootKernel", "gotoKernelParameters", "FAIclass", "FAIstatus", "gotoShare","FAIdebianMirror", "FAIrelease");
*/
$ldap = $this->config->get_ldap_link();
$ldap->cd($this->config->current['BASE']);
-
+
+ $this->goLdapServerList = array("default" =>"["._("inherited")."]");
+
$_SESSION['getAvailableClassesForThisRelease_CACHE'] = array();
$_SESSION['getAvailableClassesForThisRelease_CACHED_CLASSES'] = array();
}
$this->orig_dn= $this->dn;
+
+ /* Handle inheritance value "default" */
+ $this->gotoBootKernels= array("%default%" => '['._("inherited").']');
+
+ /* Get list of boot kernels */
+ if (isset($this->config->data['TABS'])){
+ $command= search_config($this->config->data['TABS'], get_class($this), "KERNELS");
+
+ if (!check_command($command)){
+ $message[]= sprintf(_("Command '%s', specified as KERNELS hook for plugin '%s' doesn't seem to exist."), $command,
+ get_class($this));
+ } else {
+ $fh= popen($command, "r");
+ while (!feof($fh)) {
+ $buffer= trim(fgets($fh, 256));
+
+ if ($buffer != ""){
+ $this->gotoBootKernels[preg_replace('/:.*$/', '', $buffer)]= $buffer;
+ }
+ }
+ pclose($fh);
+ ksort($this->gotoBootKernels);
+ }
+
+ }
+
}
function check()
{
$messages = array();
+
+ /* Call common method to give check the hook */
+ $messages= plugin::check();
+
/* If there are packages selected, but no mirror show error */
if(($this->FAIdebianMirror == "none")&&(count($this->FAIclass)>0)){
$messages[]=_("Please select a 'FAI server' or remove the 'FAI classes'.");
}
+
return($messages);
}
function execute()
{
+
/* Call parent execute */
plugin::execute();
$smarty->assign("gotoShares",$this->printOutAssignedShares());
$smarty->assign("gotoShareKeys",array_flip($this->printOutAssignedShares()));
+ $smarty->assign("gotoBootKernels",$this->gotoBootKernels);
/* Arrays */
-
$tmp = $this->config->data['SERVERS']['LDAP'];
- $smarty->assign("ldapserverKeys", $tmp);
-
-// foreach($tmp as $key => $server){
-// if(strlen($server)> 51){
-// $tmp[$key] = substr($server,0,48)."...";
-// }
-// }
- $smarty->assign("ldapservers", $tmp);
- $smarty->assign("gotoLdapServer_select", $this->gotoLdapServer);
-
+ /* Create divSelectBox for ldap server selection
+ */
$SelectBoxLdapServer = new divSelectBox("LdapServer");
- $SelectBoxLdapServer->SetHeight(80);
- $tmp[] = "server2:o=testersrv,dc=de";
- $tmp[] = "server3:o=testersrv2,dc=de";
- $tmp[] = "server4:o=testersrv2,dc=de";
+ $SelectBoxLdapServer->SetHeight(130);
+
+ /* Set first entry as selected, if $this->gotoLdapServer is empty
+ * or given entry is no longer available ...
+ */
+ $found = false;
foreach($tmp as $server){
+ if($this->gotoLdapServer==$server){
+ $found = true;
+ }
+ }
+ /* Add Entries
+ */
+ foreach($tmp as $server){
$use ="";
- if($this->gotoLdapServer == $server) {
+ if(($this->gotoLdapServer == $server) || ($found == false)) {
+ $found = true;
$use = " checked ";
};
+ if($server == "default"){
+ $display = "["._("inherited")."]";
+ }else{
+ $display = $server;
+ }
+
$SelectBoxLdapServer->AddEntry(
array(
- array("string"=>$server),
+ array("string"=>$display),
array("string"=>"<input type='radio' name='gotoLdapServer' value='".$server."' ".$use.">",
"attach"=>"style='border-right:0px;'")
));
* if we are currently editing from ogroup menu we use (array("gotWorkstationTemplate","GOhard", "FAIobject"))
*/
if(isset($this->parent->by_object['ogroup'])){
- $this->objectclasses = array("gotoWorkstationTemplate","GOhard", "FAIobject");
+ $this->objectclasses = array("gotoWorkstationTemplate", "FAIobject");
}elseif(isset($this->parent->by_object['workgeneric'])){
$this->objectclasses = array("GOhard", "FAIobject");
+ }elseif(isset($this->parent->by_object['servgeneric'])){
+ $this->objectclasses = array("GOhard", "FAIobject");
}else{
print "Object Type Configuration : unknown";
exit();
$tmp= preg_replace ("/^[^,]+,/", "", $tmp);
$ldap->cat("cn=default,ou=terminals,ou=systems,$tmp".
- $this->config->current['BASE']);
+ $this->config->current['BASE'], array('gotoTerminalPath'));
$attrs= $ldap->fetch();
if (isset($attrs['gotoTerminalPath'])){
$this->gotoTerminalPath= $attrs['gotoTerminalPath'][0];
/* Add semi automatic values */
// FIXME: LDAP Server may not be set here...
- $this->gotoKernelParameters= "root=/dev/nfs nfsroot=".
- $this->gotoTerminalPath.
- ",ro,hard,nolock,fg,rsize=8192 ".
- "ip=::::::dhcp ldap=".base64_encode($this->gotoLdapServer);
+ $this->gotoKernelParameters= "ldap=".base64_encode($this->gotoLdapServer);
switch ($this->bootmode){
case "D":
}
/* Strip out 'default' values */
if ($this->attrs['gotoLdapServer'] == "default"){
- unset ($this->attrs['gotoLdapServer']);
+ $this->attrs['gotoLdapServer']= array();
+ }
+
+ if ($this->attrs['gotoBootKernel'] == "%default%" || $this->attrs['gotoBootKernel'] == "default"){
+ $this->attrs['gotoBootKernel']= array();
}
/* if mirror == none stop saving this attribute */
if($this->FAIdebianMirror == "none"){
$this->FAIdebianMirror = "";
}
-
- if((count($this->attrs['FAIclass'])==0)&&(empty($this->FAIdebianMirror))){
+
+ /* Remove FAI objects if no FAI class is selected */
+ if(count($this->FAIclass)==0){
$tmp = array();
foreach($this->attrs['objectClass'] as $class){
if($class != "FAIobject"){
$ldap= $this->config->get_ldap_link();
$ldap->cd($this->dn);
$this->cleanup();
-$ldap->modify ($this->attrs);
+ $ldap->modify ($this->attrs);
- show_ldap_error($ldap->get_error());
+ show_ldap_error($ldap->get_error(), _("Saving workstation startup settings failed"));
$this->handle_post_events("modify");
}