X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=plugins%2Fadmin%2Fsystems%2Fclass_terminalStartup.inc;h=596cf2bafe009d239bcc8429f4c0a6ca0ea5b3b1;hb=8edf1b0390149b39682c7e02c394fec56940874d;hp=e4d3412abf273d1767415fc05ca4aaa01f406f39;hpb=29c7be344e1aaedca962d3f42fbe41024342f2fc;p=gosa.git diff --git a/plugins/admin/systems/class_terminalStartup.inc b/plugins/admin/systems/class_terminalStartup.inc index e4d3412ab..596cf2baf 100644 --- a/plugins/admin/systems/class_terminalStartup.inc +++ b/plugins/admin/systems/class_terminalStartup.inc @@ -32,11 +32,9 @@ class termstartup extends plugin var $orig_dn= ""; var $ignore_account= TRUE; - function termstartup ($config, $dn= NULL) + function termstartup ($config, $dn= NULL, $parent= NULL) { - plugin::plugin ($config, $dn); - - $this->gotoBootKernels = array("default"=>"["._("inherited")."]"); + plugin::plugin ($config, $dn, $parent); /* Get arrays */ foreach (array("gotoModules") as $val){ @@ -95,22 +93,60 @@ class termstartup extends plugin } else { $fh= popen($command, "r"); while (!feof($fh)) { - $buffer= fgets($fh, 256); - $this->gotoBootKernels[]= $buffer; + $buffer= trim(fgets($fh, 256)); + + if(!empty($buffer)){ + + $name=$value = $buffer; + + if(preg_match("/:/",$buffer)){ + $name = preg_replace("/:.*$/","",$buffer); + $value= preg_replace("/^.*:/","",$buffer); + $this->gotoBootKernels[$name]= $name.":".$value; + }else{ + $this->gotoBootKernels[$name]= $value; + } + if(empty($this->gotoBootKernel)){ + $this->gotoBootKernel = $name; + } + } } pclose($fh); - sort($this->gotoBootKernels); } } $tmp = $this->config->data['SERVERS']['LDAP']; foreach($tmp as $server){ $visible = $server; - if($server == "default"){ + if($server == "default-inherit"){ $visible = "["._("inherited")."]"; } $this->goLdapServerList[$server] = $visible; } + + /* Load hardware list */ + $ldap= $this->config->get_ldap_link(); + $ldap->cd($this->config->current['BASE']); + $ldap->search("(&(objectClass=gotoWorkstationTemplate)(member=".$this->dn."))"); + if ($ldap->count() == 1){ + $map= array("gotoLdapServer","gotoBootKernel"); + $attrs= $ldap->fetch(); + + foreach ($map as $name){ + if (!isset($attrs[$name][0])){ + continue; + } + + switch ($name){ + case 'gotoLdapServer': + $this->goLdapServerList= array_merge(array('default-inherit' => _("inherited").' ['.$attrs[$name][0].']' ), $this->goLdapServerList); + break; + case 'gotoBootKernel': + $this->gotoBootKernels= array_merge(array('default-inherit' => _("inherited").' ['.$attrs[$name][0].']' ), $this->gotoBootKernels); + break; + } + } + } } function execute() @@ -208,9 +244,9 @@ class termstartup extends plugin $SelectBoxLdapServer->AddEntry( array( - array("string"=>$visible), array("string"=>"", - "attach"=>"style='border-right:0px;'") + "attach"=>"style='border-left:0px;'"), + array("string"=>$visible) )); } @@ -282,7 +318,7 @@ class termstartup extends plugin /* Find proper terminal path for tftp configuration FIXME: This is suboptimal when the default has changed to another location! */ - if ($this->gotoTerminalPath == "default"){ + if ($this->gotoTerminalPath == "default-inherit"){ $ldap= $this->config->get_ldap_link(); /* Strip relevant part from dn, keep trailing ',' */ @@ -341,7 +377,7 @@ class termstartup extends plugin /* Strip out 'default' values */ foreach(array("gotoBootKernel","gotoLdapServer") as $value){ - if ($this->attrs[$value] == "default"){ + if (!isset($this->attrs[$value]) || $this->attrs[$value] == "default-inherit"){ $this->attrs[$value] = array(); } }