From: hickert Date: Wed, 23 Nov 2005 09:08:54 +0000 (+0000) Subject: Added priority to FAIclass selection X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=475588d03afa8401cf37d95a69262f82ba66197c;p=gosa.git Added priority to FAIclass selection git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@2015 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/plugins/admin/systems/class_workstationStartup.inc b/plugins/admin/systems/class_workstationStartup.inc index c5ca3cced..4bc1a46c0 100644 --- a/plugins/admin/systems/class_workstationStartup.inc +++ b/plugins/admin/systems/class_workstationStartup.inc @@ -254,6 +254,71 @@ class workstartup extends plugin } } + $sort = false; + foreach($_POST as $name => $val){ + + $sort_type = false; + if((preg_match("/sort_up/",$name))&&(!$sort)){ + $sort_type = "sort_up_"; + } + if((preg_match("/sort_down/",$name))&&(!$sort)){ + $sort_type = "sort_down_"; + } + + if(($sort_type)&&(!$sort)){ + $value = preg_replace("/_.*$/i","",preg_replace("/".$sort_type."/i","",$name)); + $sort = true; + + $last = -1; + $change_down = -1; + + /* Create array with numeric index */ + $tmp = array(); + foreach($this->FAIclass as $class){ + $tmp [] = $class; + } + + /* Walk trough array */ + foreach($tmp as $key => $faiName){ + if($faiName == $value){ + if($sort_type == "sort_up_"){ + if($last != -1){ + $change_down= $last; + } + }else{ + if(isset($tmp[$key+1])){ + $change_down = $key; + } + } + } + $last = $key; + } + + $tmp2 = array(); + $skip = false; + + foreach($tmp as $ky => $vl){ + + if($ky == $change_down){ + $skip = $vl; + }else{ + $tmp2[$vl] = $vl; + } + if(($skip != false)&&($ky != $change_down)){ + $tmp2[$skip] = $skip; + $skip =false; + } + } + $this->FAIclass = $tmp2; + } + + + if(preg_match("/fai_remove/i",$name)){ + $value = preg_replace("/_.*$/i","",preg_replace("/fai_remove_/i","",$name)); + unset($this->FAIclass[$value]); + } + } + /* Delete selected class from our list */ if((isset($_POST['DelClass']))&&(isset($_POST['FAIclassSel']))){ if(isset($this->FAIclass[$_POST['FAIclassSel']])){ @@ -310,7 +375,34 @@ class workstartup extends plugin $smarty->assign($val, $this->$val); $smarty->assign($val."ACL", chkacl($this->acl, $val)); } - + + $div = new divSelectBox("WSFAIscriptClasses"); + + $div -> SetHeight("110"); + + $str_up = "  "; + $str_down = "  "; + $str_remove = "  "; + $str_empty = "  "; + + $i = 1; + foreach($this->FAIclass as $class){ + if($i==1){ + $str = $str_down.$str_empty.$str_remove; + }elseif($i == count($this->FAIclass)){ + $str = $str_empty.$str_up.$str_remove; + }else{ + $str = $str_up.$str_down.$str_remove; + } + $i ++ ; + + $div->AddEntry(array( + array("string"=>$class), + array("string"=>preg_replace("/\%s/",$class,$str),"attach"=>"style='width:50px;border-right:none;'") + )); + } + + $smarty->assign("FAIScriptlist",$div->DrawList()); $smarty->assign("FAIdebianMirrors",$this->FAIdebianMirrors); $smarty->assign("FAIclasses",$this->selectFriendlyClasses()); $smarty->assign("FAIclassesKeys",array_flip($this->selectFriendlyClasses())); diff --git a/plugins/admin/systems/workstationStartup.tpl b/plugins/admin/systems/workstationStartup.tpl index a898c13fc..eef5aa03a 100644 --- a/plugins/admin/systems/workstationStartup.tpl +++ b/plugins/admin/systems/workstationStartup.tpl @@ -37,13 +37,10 @@ +

 {t}Assigned FAI classes{/t}

- + {$FAIScriptlist}