diff --git a/plugins/admin/systems/class_workstationStartup.inc b/plugins/admin/systems/class_workstationStartup.inc
index c5f1cd00cd6f06f1695867b83e23dd4c76718ffa..ef0244274ed5e61fb09bec445d83698d12d15889 100644 (file)
var $FAIrelease = "";
var $FAIdebianMirror = "auto";
+
+ /* FAI class selection */
+ var $InheritedFAIclass = array();
+ var $InheritedFAIrelease = "";
+ var $InheritedFAIdebianMirror = "auto";
+
/* Contains all possible server/release/class settings */
var $FAIServRepConfig = array();
$_SESSION['getAvailableClassesForThisRelease_CACHE'] = array();
$_SESSION['getAvailableClassesForThisRelease_CACHED_CLASSES'] = array();
- /* Search all FAI objects */
- $ldap->search("(|(objectClass=FAIpackageList)(objectClass=FAItemplate)(objectClass=FAIvariable)(objectClass=FAIscript)(objectClass=FAIhook)(objectClass=FAIprofile)(objectClass=FAIpartitionTable))",array("cn","objectClass","FAIdebianSection"));
- /* Sort all entries, and attach elementtype.
- * To be able to show the types in the listbox.
- */
- while($attr = $ldap->fetch()){
+ $ui = get_userinfo();
+ $res = get_list( "(|(objectClass=FAIpackageList)".
+ "(objectClass=FAItemplate)".
+ "(objectClass=FAIvariable)".
+ "(objectClass=FAIscript)".
+ "(objectClass=FAIhook)".
+ "(objectClass=FAIprofile)".
+ "(objectClass=FAIpartitionTable))",
+ $ui->subtreeACL,$this->config->current['BASE'],
+ array("cn","objectClass","FAIdebianSection"));
+
+ foreach($res as $attr){
$cn = $attr['cn'][0];
$_SESSION['getAvailableClassesForThisRelease_CACHED_CLASSES'][] = $attr;
natcasesort($this->FAIclasses);
}
- $this->FAIclassInfo = $tmp2;
-
+ if(isset($tmp2)){
+ $this->FAIclassInfo = $tmp2;
+ } else {
+ $this->FAIclassInfo = array();
+ }
/* Build up an array like this one :
[$url]['SERVER'] = 'srv1-002';
$ldap->cd($this->config->current['BASE']);
$ldap->search("(&(objectClass=gotoWorkstationTemplate)(member=".$this->dn."))");
if ($ldap->count() == 1){
- $map= array("gotoLdapServer","gotoBootKernel");
+ $map= array("gotoLdapServer","FAIclass","FAIdebianMirror");
$attrs= $ldap->fetch();
foreach ($map as $name){
$this->gotoBootKernels['%default%']= _("inherited").' ['.$attrs[$name][0].']' ;
break;
+ case 'FAIclass':
+ $str = split(":",$attrs[$name][0]);
+ $this->InheritedFAIclass = split("\ ",trim($str[0]));
+ $this->InheritedFAIrelease = trim($str[1]);
+ break;
+
+ case 'FAIdebianMirror':
+ $this->InheritedFAIdebianMirror = $attrs[$name][0];
+ break;
}
}
}
+
/* Get list of boot kernels */
if (isset($this->config->data['TABS'])){
$command= search_config($this->config->data['TABS'], get_class($this), "KERNELS");
}
}
-
+ if(count($this->FAIclass)==0 && $this->FAIrelease == ""){
+ $this->FAIdebianMirror = "inherited";
+ }
}
return($_SESSION['getAvailableClassesForThisRelease_CACHE'][$release]);
}
- /* Create cache with all classes
- */
- if((!isset($_SESSION['getAvailableClassesForThisRelease_CACHED_CLASSES'])) ||
- (!is_array($_SESSION['getAvailableClassesForThisRelease_CACHED_CLASSES'])) ||
- (count($_SESSION['getAvailableClassesForThisRelease_CACHED_CLASSES']) ==0 )){
-
- /* Get ldap connection */
- $ldap = $this->config->get_ldap_link();
- $ldap->cd($this->config->current['BASE']);
-
- /* Get possible classes ...
- This would be faste with some kind of caching ...
- */
- $ldap->search("(|(objectClass=FAIpackageList)(objectClass=FAItemplate)(objectClass=FAIvariable)(objectClass=FAIscript)(objectClass=FAIhook)(objectClass=FAIprofile)(objectClass=FAIpartitionTable))",array("cn"),true);
- /* Sort all entries, and attach elementtype.
- * To be able to show the types in the listbox.
- */
- while($attr = $ldap->fetch()){
- $_SESSION['getAvailableClassesForThisRelease_CACHED_CLASSES'][] = $attr;
- }
- }
-
/* Walk through cache and get out what we need.
*
* Function od : "$this->generateDNSyn($release)"
function selectFriendlyClasses(){
$tmp=array();
+ if($this->FAIdebianMirror == "inherited") return($tmp);
+
/* check if the current release exists,
else select the first one ..
*/
}
}
- /* Delete selected class from our list */
- if((isset($_POST['DelClass']))&&(isset($_POST['FAIclassSel']))){
- if(isset($this->FAIclass[$_POST['FAIclassSel']])){
- unset($this->FAIclass[$_POST['FAIclassSel']]);
- }
- }
-
/* Show main page */
$smarty= get_smarty();
$smarty->assign("SelectBoxLdapServer","");
if((!isset($_POST['gotoShareMountPoint']))||(empty($_POST['gotoShareMountPoint']))||(preg_match("/[\|]/i",$_POST['gotoShareMountPoint']))){
print_red(_("You must specify a valid mount point."));
}else{
- $a_share = $this->gotoAvailableShares[$_POST['gotoShareSelection']];
- $s_mount = $_POST['gotoShareMountPoint'];
- /* Preparing the new assignment */
- $this->gotoShares[$a_share['name']."|".$a_share['server']]=$a_share;
- $this->gotoShares[$a_share['name']."|".$a_share['server']]['mountPoint']=$s_mount;
+ if(count($this->gotoAvailableShares)){
+ $a_share = $this->gotoAvailableShares[$_POST['gotoShareSelection']];
+ $s_mount = $_POST['gotoShareMountPoint'];
+ /* Preparing the new assignment */
+ $this->gotoShares[$a_share['name']."|".$a_share['server']]=$a_share;
+ $this->gotoShares[$a_share['name']."|".$a_share['server']]['mountPoint']=$s_mount;
+ }
}
}
}
$smarty->assign("gotoShares",$this->printOutAssignedShares());
+ $smarty->assign("gotoSharesCount",count($this->printOutAssignedShares()));
$smarty->assign("gotoShareKeys",array_flip($this->printOutAssignedShares()));
$smarty->assign("gotoBootKernels",$this->gotoBootKernels);
$SelectBoxLdapServer->AddEntry(
array(
- array("string"=>$display),
array("string"=>"<input type='radio' name='gotoLdapServer' value='".$key."' ".$use.">",
- "attach"=>"style='border-right:0px;'")
+ "attach"=>"style='border-left:0px;'"),
+ array("string"=>$display)
));
}
$smarty->assign("FAIclasses",$this->selectFriendlyClasses());
$smarty->assign("FAIclassesKeys",array_flip($this->selectFriendlyClasses()));
$smarty->assign("FAIclassKeys",$this->FAIclass);
+ $smarty->assign("InheritedFAIrelease",$this->InheritedFAIrelease);
$div = new divSelectBox("WSFAIscriptClasses");
$div -> SetHeight("110");
$str_empty = " <img src='images/empty.png' alt=\"\" width='7'>";
$i = 1;
- foreach($this->FAIclass as $class){
- if($i==1){
- $str = $str_empty.$str_down.$str_remove;
- }elseif($i == count($this->FAIclass)){
- $str = $str_up.$str_empty.$str_remove;
+
+ if($this->FAIdebianMirror == "inherited"){
+ $tmp = $this->InheritedFAIclass;
+ }else{
+ $tmp = $this->FAIclass;
+ }
+
+ foreach($tmp as $class){
+
+ if($this->FAIdebianMirror == "inherited"){
+ $str = "";
}else{
- $str = $str_up.$str_down.$str_remove;
+ if($i==1){
+ $str = $str_empty.$str_down.$str_remove;
+ }elseif($i == count($this->FAIclass)){
+ $str = $str_up.$str_empty.$str_remove;
+ }else{
+ $str = $str_up.$str_down.$str_remove;
+ }
}
$i ++ ;
function getFAIdebianMirrors()
{
$ret = array();
+ $ret['inherited']="["._("inherited")."]";
$ret['auto']=_("automatic");
$secs = array();
{
$ret = array();
+ if($this->FAIdebianMirror == "inherited") return(array());
+
if(!isset($this->FAIServRepConfig[$this->FAIdebianMirror])){
$this->FAIdebianMirror = "auto";
}
if (chkacl ($this->acl, "gotoKernelParameters") == "" && isset($_POST["customParameters"])){
$this->customParameters= $_POST["customParameters"];
}
+
}
unset( $this->attrs['FAIrelease'] );
$str = "";
- foreach($this->FAIclass as $class){
- $str .= $class." ";
- }
- $str .= ":" . $this->FAIrelease;
- $this->attrs['FAIclass']= "";
- $this->attrs['FAIclass']= trim($str);
- if(empty($this->attrs['FAIclass'])){
- $this->attrs['FAIclass'] = array();
+ if($this->FAIdebianMirror == "inherited"){
+
+ $this->attrs['FAIclass'] = $this->attrs['FAIrelease'] = $this->attrs['FAIdebianMirror'] = array();
+
+ }else{
+
+ foreach($this->FAIclass as $class){
+ $str .= $class." ";
+ }
+ $str .= ":" . $this->FAIrelease;
+ $this->attrs['FAIclass']= "";
+ $this->attrs['FAIclass']= trim($str);
+
+ if(empty($this->attrs['FAIclass'])){
+ $this->attrs['FAIclass'] = array();
+ }
}
/* Add missing arrays */
$this->FAIdebianMirror = "";
}
+ /* Get FAIstate from object, the generic tab could have changed it during execute */
+ $ldap= $this->config->get_ldap_link();
+ $ldap->cd($this->dn);
+ $ldap->cat($this->dn,array("FAIstate"));
+ $checkFAIstate = $ldap->fetch();
+
/* Remove FAI objects if no FAI class is selected */
- if(count($this->FAIclass)==0){
+ if((count($this->FAIclass)==0) && (!isset($checkFAIstate['FAIstate']))){
$tmp = array();
foreach($this->attrs['objectClass'] as $class){
if($class != "FAIobject"){
}
$this->attrs['gotoShare']=$tmp;
- $ldap= $this->config->get_ldap_link();
- $ldap->cd($this->dn);
$this->cleanup();
$ldap->modify ($this->attrs);