diff --git a/plugins/admin/systems/class_workstationStartup.inc b/plugins/admin/systems/class_workstationStartup.inc
index ef0244274ed5e61fb09bec445d83698d12d15889..3d4d1300dbe8a2c6d3fff8f8c13efbf8f4539f2d 100644 (file)
<?php
<?php
+
class workstartup extends plugin
{
/* CLI vars */
class workstartup extends plugin
{
/* CLI vars */
/* Generic terminal attributes */
var $bootmode = "G";
var $goLdapServerList = array();
/* Generic terminal attributes */
var $bootmode = "G";
var $goLdapServerList = array();
- var $gotoBootKernel = "default";
+ var $gotoBootKernel = "default-inherited";
var $gotoKernelParameters = "";
var $gotoKernelParameters = "";
- var $gotoLdapServer = "default";
+ var $gotoLdapServer = "default-inherited";
var $gotoModules = array();
var $gotoAutoFs = array();
var $gotoFilesystem = array();
var $gotoModules = array();
var $gotoAutoFs = array();
var $gotoFilesystem = array();
var $FAIrelease = "";
var $FAIdebianMirror = "auto";
var $FAIrelease = "";
var $FAIdebianMirror = "auto";
+ var $unresolved_classes = array();
/* FAI class selection */
var $InheritedFAIclass = array();
/* FAI class selection */
var $InheritedFAIclass = array();
/* Contains all possible server/release/class settings */
var $FAIServRepConfig = array();
/* Contains all possible server/release/class settings */
var $FAIServRepConfig = array();
- function workstartup ($config, $dn= NULL)
+ function workstartup ($config, $dn= NULL, $parent= NULL)
{
{
- plugin::plugin ($config, $dn);
+ plugin::plugin ($config, $dn, $parent);
/* Creating a list of valid Mirrors
* none will not be saved to ldap.
/* Creating a list of valid Mirrors
* none will not be saved to ldap.
$this->orig_dn= $this->dn;
/* Handle inheritance value "default" */
$this->orig_dn= $this->dn;
/* Handle inheritance value "default" */
- $this->gotoBootKernels= array("%default%" => '['._("inherited").']');
+ $this->gotoBootKernels= array();
/* Load hardware list */
/* Load hardware list */
$ldap->cd($this->config->current['BASE']);
$ldap->search("(&(objectClass=gotoWorkstationTemplate)(member=".$this->dn."))");
if ($ldap->count() == 1){
$ldap->cd($this->config->current['BASE']);
$ldap->search("(&(objectClass=gotoWorkstationTemplate)(member=".$this->dn."))");
if ($ldap->count() == 1){
- $map= array("gotoLdapServer","FAIclass","FAIdebianMirror");
+ $map= array("gotoLdapServer","FAIclass","FAIdebianMirror","gotoBootKernel");
$attrs= $ldap->fetch();
foreach ($map as $name){
$attrs= $ldap->fetch();
foreach ($map as $name){
switch ($name){
case 'gotoLdapServer':
switch ($name){
case 'gotoLdapServer':
- $this->goLdapServerList= array_merge(array('default' => _("inherited").' ['.$attrs[$name][0].']' ), $this->goLdapServerList);
+ $this->goLdapServerList= array_merge(array('default-inherited' => _("inherited").' ['.$attrs[$name][0].']' ), $this->goLdapServerList);
break;
case 'gotoBootKernel':
break;
case 'gotoBootKernel':
- $this->gotoBootKernels['%default%']= _("inherited").' ['.$attrs[$name][0].']' ;
+ $this->gotoBootKernels['default-inherited']= _("inherited").' ['.$attrs[$name][0].']' ;
break;
case 'FAIclass':
break;
case 'FAIclass':
get_class($this));
} else {
get_class($this));
} else {
+ $first = false;
$fh= popen($command, "r");
while (!feof($fh)) {
$buffer= trim(fgets($fh, 256));
$fh= popen($command, "r");
while (!feof($fh)) {
$buffer= trim(fgets($fh, 256));
- if ($buffer != ""){
- $this->gotoBootKernels[preg_replace('/:.*$/', '', $buffer)]= $buffer;
+
+ 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($this->gotoBootKernel =="" ){
+ $this->gotoBootKernel = $name;
+ }
+
}
}
pclose($fh);
}
}
}
}
pclose($fh);
}
}
+ /* Turn to default, if we've nothing to inherit */
+ if (!isset($this->gotoBootKernels['default-inherited']) && $this->gotoBootKernel == "default-inherited"){
+ $this->gotoBootKernel= "default";
+ }
+
if(count($this->FAIclass)==0 && $this->FAIrelease == ""){
$this->FAIdebianMirror = "inherited";
}
if(count($this->FAIclass)==0 && $this->FAIrelease == ""){
$this->FAIdebianMirror = "inherited";
}
}
$smarty->assign("FAIdebianMirrors",$this->getFAIdebianMirrors());
}
$smarty->assign("FAIdebianMirrors",$this->getFAIdebianMirrors());
+ $smarty->assign("FAIdebianMirror",$this->FAIdebianMirror);
$smarty->assign("FAIreleases",$this->getFAIreleases());
$smarty->assign("FAIrelease",$this->FAIrelease);
$smarty->assign("FAIclasses",$this->selectFriendlyClasses());
$smarty->assign("FAIreleases",$this->getFAIreleases());
$smarty->assign("FAIrelease",$this->FAIrelease);
$smarty->assign("FAIclasses",$this->selectFriendlyClasses());
foreach($tmp as $class){
foreach($tmp as $class){
+ $marker = "";
+ if(in_array_ics($class,$this->unresolved_classes)){
+ $marker = " <font color='red'>("._("Not available in current setup").")</font>";
+ }
+
if($this->FAIdebianMirror == "inherited"){
$str = "";
}else{
if($this->FAIdebianMirror == "inherited"){
$str = "";
}else{
$i ++ ;
$div->AddEntry(array(
$i ++ ;
$div->AddEntry(array(
- array("string"=>$class),
+ array("string"=>$class.$marker),
array("string"=>preg_replace("/\%s/",base64_encode($class),$str),"attach"=>"style='width:50px;border-right:none;'")
));
}
array("string"=>preg_replace("/\%s/",base64_encode($class),$str),"attach"=>"style='width:50px;border-right:none;'")
));
}
$this->FAIdebianMirror = "auto";
}
$this->FAIdebianMirror = "auto";
}
- $errorClasses = "";
-
- foreach($this->FAIServRepConfig[$this->FAIdebianMirror]['RELEASE'] as $release => $sections){
- $use = true;
-
- if(!count($this->FAIclass) == 0){
- foreach($this->FAIclass as $class){
- if(!in_array($class, $sections['PACKAGES'])){
- $use = false;
- $errorClasses[$class] = $class;
- }else{
- if(isset($errorClasses[$class])){
- unset($errorClasses[$class]);
+ $errorClasses = array();
+ if(isset($this->FAIServRepConfig[$this->FAIdebianMirror]['RELEASE'])) {
+ foreach($this->FAIServRepConfig[$this->FAIdebianMirror]['RELEASE'] as $release => $sections){
+ $use = true;
+
+ if(!count($this->FAIclass) == 0){
+ foreach($this->FAIclass as $class){
+ if(!in_array($class, $sections['PACKAGES'])){
+ $use = false;
+ $errorClasses[$class] = $class;
+ }else{
+ if(isset($errorClasses[$class])){
+ unset($errorClasses[$class]);
+ }
}
}
}
}
}
}
- }
- if($use){
- $ret[$release]=$release;
+ if($use){
+ $ret[$release]=$release;
+ }
}
}
if((count($ret) == 0 ) && ($this->FAIdebianMirror != "auto")){
}
}
if((count($ret) == 0 ) && ($this->FAIdebianMirror != "auto")){
$eClasses .= $class." ";
}
$eClasses .= $class." ";
}
- $this->FAIclass= array();
- print_red(sprintf(_("Can't resolve the given FAIclass(es) [%s] anyway, please check your FAI configurations, possibly some classes where deleted or renamed. !All classes have been removed from this account, press cancel if you don't want this to be saved."),$eClasses));
+ $this->unresolved_classes = $errorClasses;
+ $this->FAIdebianMirror = "auto";
+ //$this->FAIclass= array();
+ print_red(sprintf(_("Can't resolve the given FAIclass(es) [%s] anyway, please check your FAI configurations, possibly some classes where deleted or renamed. Server was reset to 'auto'."),$eClasses));
}
return($ret);
}
}
return($ret);
}
}
/* Strip out 'default' values */
}
/* Strip out 'default' values */
- if ($this->attrs['gotoLdapServer'] == "default"){
+ if ($this->attrs['gotoLdapServer'] == "default-inherited"){
$this->attrs['gotoLdapServer']= array();
}
$this->attrs['gotoLdapServer']= array();
}
- if (($this->attrs['gotoBootKernel'] == "default") || ($this->attrs['gotoBootKernel'] == "%default%")){
+ if (($this->attrs['gotoBootKernel'] == "default-inherited") || ($this->attrs['gotoBootKernel'] == "%default%")){
$this->attrs['gotoBootKernel']= array();
}
$this->attrs['gotoBootKernel']= array();
}
/* Remove FAI objects if no FAI class is selected */
if((count($this->FAIclass)==0) && (!isset($checkFAIstate['FAIstate']))){
/* Remove FAI objects if no FAI class is selected */
if((count($this->FAIclass)==0) && (!isset($checkFAIstate['FAIstate']))){
- $tmp = array();
- foreach($this->attrs['objectClass'] as $class){
- if($class != "FAIobject"){
- $tmp[] = $class;
- }
- }
- $this->attrs['objectClass'] = $tmp;
$this->attrs['FAIclass'] = array();
$this->attrs['FAIdebianMirror'] = array();
}
$this->attrs['FAIclass'] = array();
$this->attrs['FAIdebianMirror'] = array();
}