From d336092be4b23dd01a7b22e6617eddc21e0b6c99 Mon Sep 17 00:00:00 2001 From: hickert Date: Wed, 17 Oct 2007 09:28:44 +0000 Subject: [PATCH] Updated FAI class selection in startup tab git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@7581 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../systems/class_workstationStartup.inc | 67 +++++++++++-------- plugins/admin/systems/workstationStartup.tpl | 21 ++++-- 2 files changed, 57 insertions(+), 31 deletions(-) diff --git a/plugins/admin/systems/class_workstationStartup.inc b/plugins/admin/systems/class_workstationStartup.inc index ff071fe40..78a3d73f8 100644 --- a/plugins/admin/systems/class_workstationStartup.inc +++ b/plugins/admin/systems/class_workstationStartup.inc @@ -450,8 +450,15 @@ class workstartup extends plugin else select the first one .. */ $tmp2 = $this->getFAIreleases(); - if(!in_array($this->FAIrelease, $tmp2)){ - $this->FAIrelease = key($tmp2); + if(!isset($tmp2[$this->FAIrelease]) || !$tmp2[$this->FAIrelease]['USE']){ + foreach($tmp2 as $key => $data){ + if($data['USE']){ + $this->FAIrelease = $key; + } + } + } + if(!in_array($this->FAIrelease, $tmp2)){ +# $this->FAIrelease = key($tmp2); } /* Get all Packages for this server/release combination @@ -911,10 +918,12 @@ class workstartup extends plugin /* Only add inherit option, if we are part in an object group */ if($this->member_of_ogroup) { - $ret['inherited']="["._("inherited")."]"; + $ret['inherited']['NAME']="["._("inherited")."]"; + $ret['inherited']['USE'] = TRUE; } - $ret['auto']=_("automatic"); + $ret['auto']['NAME']=_("automatic"); + $ret['auto']['use'] = TRUE; $secs = array(); /* Walk through all available servers @@ -922,16 +931,14 @@ class workstartup extends plugin if not, dont't add them to our list */ foreach($this->FAIServRepConfig as $mirror => $rest){ - $use = false; - if(count($this->FAIclass) == 0){ $use = true; }else{ $tmp = $this->getFAIreleases(); - foreach($tmp as $release){ + foreach($tmp as $release => $data){ if(isset($rest['RELEASE'][$release])){ - $use =true; + $use = $data['USE']; } } } @@ -939,9 +946,8 @@ class workstartup extends plugin /* If current server, doesn't support this class remove it from list */ - if($use){ - $ret[$mirror] = $mirror; - } + $ret[$mirror]['NAME'] = $mirror; + $ret[$mirror]['USE'] = $use; } return($ret); } @@ -958,29 +964,36 @@ class workstartup extends plugin $errorClasses = array(); - if(is_array($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'])){ + foreach($this->FAIServRepConfig as $mirror => $rest){ + if(isset($this->FAIServRepConfig[$mirror]['RELEASE'])){ + foreach($this->FAIServRepConfig[$mirror]['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($mirror != $this->FAIdebianMirror){ $use = false; - $errorClasses[$class] = $class; }else{ - if(isset($errorClasses[$class])){ - unset($errorClasses[$class]); - } + $use = true; } + $ret[$release]['NAME']=$release; + $ret[$release]['USE']=$use; } } - if($use){ - $ret[$release]=$release; - } - } } - if((count($ret) == 0 ) && ($this->FAIdebianMirror != "auto")){ + if((count($ret) == 0 ) && ($this->FAIdebianMirror != "auto")){ $eClasses = " "; foreach($errorClasses as $class){ $eClasses .= $class." "; diff --git a/plugins/admin/systems/workstationStartup.tpl b/plugins/admin/systems/workstationStartup.tpl index 5fa898f78..ca5739033 100644 --- a/plugins/admin/systems/workstationStartup.tpl +++ b/plugins/admin/systems/workstationStartup.tpl @@ -108,8 +108,15 @@ {render acl=$FAIdebianMirrorACL} - + {foreach from=$FAIdebianMirrors item=val key=key} + {if $val.USE} + + {else} + + {/if} + {/foreach} + {/render} {if $javascript eq 'false'} @@ -120,8 +127,14 @@ {render acl=$FAIreleaseACL} - + {foreach from=$FAIreleases item=val key=key} + {if $val.USE} + + {else} + + {/if} + {/foreach} {/render} -- 2.30.2