From 5572cf067eccd40c9c5dc6101411f3fca984cd9b Mon Sep 17 00:00:00 2001 From: cajus Date: Mon, 20 Feb 2006 13:06:32 +0000 Subject: [PATCH] Added release patch from glg. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@2705 594d385d-05f5-0310-b6e9-bd551577e9d8 --- debian/gosa.conffiles | 1 + plugins/admin/groups/class_groupAcl.inc | 15 +++--- .../systems/class_workstationStartup.inc | 54 +++++++++++++++---- plugins/admin/systems/workstationStartup.tpl | 16 +++++- 4 files changed, 67 insertions(+), 19 deletions(-) diff --git a/debian/gosa.conffiles b/debian/gosa.conffiles index e70f8de40..54d090bdd 100644 --- a/debian/gosa.conffiles +++ b/debian/gosa.conffiles @@ -1,2 +1,3 @@ /etc/gosa/gosa.conf /etc/gosa/apache.conf +/etc/gosa/encodings diff --git a/plugins/admin/groups/class_groupAcl.inc b/plugins/admin/groups/class_groupAcl.inc index 5ce1d5390..bfbb2a519 100644 --- a/plugins/admin/groups/class_groupAcl.inc +++ b/plugins/admin/groups/class_groupAcl.inc @@ -20,7 +20,7 @@ class acl extends plugin var $current_acl= ""; var $selfflag= FALSE; - var $gosaSubtreeACL; + var $gosaSubtreeACL; /* attribute list for save action */ var $attributes= array("gosaSubtreeACL"); @@ -96,7 +96,7 @@ class acl extends plugin $ldap= $this->config->get_ldap_link(); $ldap->cd($this->dn); $this->cleanup(); -$ldap->modify ($this->attrs); + $ldap->modify ($this->attrs); show_ldap_error($ldap->get_error()); } @@ -115,7 +115,7 @@ $ldap->modify ($this->attrs); if ($this->object == "all"){ $this->current_acl= preg_replace ( "/[,]?all[,]?/", "", $this->current_acl); } - $this->current_acl= preg_replace ( "/[^a-z0-9A-Z]$this->object#[^,]*[,]?/", "", $this->current_acl); + $this->current_acl= preg_replace ( "/(^|[^a-z0-9A-Z])$this->object#[^,]*[,]?/", "", $this->current_acl); /* assemble new attributes */ $attrs= ""; @@ -136,13 +136,13 @@ $ldap->modify ($this->attrs); } /* append information */ - if ($this->current_acl != "" && $attrs != ""){ - $this->current_acl.= ","; - } if ($attrs != ""){ $tmp= $this->object; $attrs= $tmp.$attrs; } + if ($this->current_acl != "" && $attrs != ""){ + $this->current_acl.= ","; + } $this->current_acl.= $attrs; if (preg_match("/all#all/", $this->current_acl)){ $this->current_acl= "all"; @@ -160,7 +160,6 @@ $ldap->modify ($this->attrs); } else { $this->selfflag= FALSE; } - } @@ -193,7 +192,7 @@ $ldap->modify ($this->attrs); /* Modify class */ $ldap->cd($this->dn); $this->cleanup(); -$ldap->modify ($this->attrs); + $ldap->modify ($this->attrs); show_ldap_error($ldap->get_error()); } diff --git a/plugins/admin/systems/class_workstationStartup.inc b/plugins/admin/systems/class_workstationStartup.inc index afb5e9e7c..29246952e 100644 --- a/plugins/admin/systems/class_workstationStartup.inc +++ b/plugins/admin/systems/class_workstationStartup.inc @@ -24,7 +24,7 @@ class workstartup extends plugin /* attribute list for save action */ - var $attributes = array("gotoLdapServer", "gotoBootKernel", "gotoKernelParameters", "FAIclass", "FAIstatus", "gotoShare","FAIdebianMirror"); + var $attributes = array("gotoLdapServer", "gotoBootKernel", "gotoKernelParameters", "FAIclass", "FAIstatus", "gotoShare","FAIdebianMirror", "FAIrelease"); var $objectclasses = array("GOhard", "FAIobject"); /* Share */ @@ -38,6 +38,8 @@ class workstartup extends plugin var $orig_dn = ""; var $ignore_account = TRUE; var $FAIdebianMirrors = array(); + var $FAIrelease = ""; + var $FAIreleases = array(); function workstartup ($config, $dn= NULL) { @@ -47,12 +49,15 @@ class workstartup extends plugin * none will not be saved to ldap. */ $this->FAIdebianMirrors = array(); + $this->FAIreleases = array(); + $ldap = $this->config->get_ldap_link(); $ldap->cd($this->config->current['BASE']); $ldap->search("(objectClass=FAIrepositoryServer)",array("FAIrepository")); /* attach all attributes with "index => cn" to avoid multiple entries */ $ret = array(); + $rels = array(); while($attr = $ldap->fetch()){ if(isset($attr['FAIrepository'])){ @@ -65,12 +70,20 @@ class workstartup extends plugin $sections = split(",",$tmp[3]); $str = $tmp[0]; $ret[$str]=$sections; + if( array_key_exists( $str, $rels ) ) { + if( "" == $this->FAIrelease ) + $this->FAIrelease = $tmp[2]; + array_push( $rels[$str], $tmp[2] ); + } + else $rels[$str] = array( $tmp[2] ); } } } } ksort($ret); + ksort($rels); $this->FAIdebianMirrors = $ret; + $this->FAIreleases = $rels; /* Get arrays */ foreach (array("gotoModules", "gotoAutoFs", "gotoFilesystem") as $val){ @@ -179,7 +192,11 @@ class workstartup extends plugin $tmp2 =array(); foreach($tmp as $class){ - $tmp2[$class] = $class; + if( ":" == $class[0] ) { + $this->FAIrelease = substr( $class, 1 ); + } + else + $tmp2[$class] = $class; } $this->FAIclass = $tmp2; } @@ -220,8 +237,8 @@ class workstartup extends plugin function execute() { - /* Call parent execute */ - plugin::execute(); + /* Call parent execute */ + plugin::execute(); /* Do we need to flip is_account state? */ if (isset($_POST['modify_state'])){ @@ -331,7 +348,6 @@ class workstartup extends plugin $this->FAIclass = $tmp2; } - if(preg_match("/fai_remove/i",$name)){ $value = base64_decode(preg_replace("/_.*$/i","",preg_replace("/fai_remove_/i","",$name))); unset($this->FAIclass[$value]); @@ -390,7 +406,7 @@ class workstartup extends plugin } /* Values */ - foreach(array("gotoBootKernel", "customParameters", "gotoShare","FAIclasses","FAIclass","FAIdebianMirror") as $val){ + foreach(array("gotoBootKernel", "customParameters", "gotoShare","FAIclasses","FAIclass","FAIdebianMirror","FAIrelease") as $val){ $smarty->assign($val, $this->$val); $smarty->assign($val."ACL", chkacl($this->acl, $val)); } @@ -417,13 +433,15 @@ class workstartup extends plugin $i ++ ; $div->AddEntry(array( - array("string"=>$class), - array("string"=>preg_replace("/\%s/",base64_encode($class),$str),"attach"=>"style='width:50px;border-right:none;'") - )); + array("string"=>$class), + array("string"=>preg_replace("/\%s/",base64_encode($class),$str),"attach"=>"style='width:50px;border-right:none;'") + )); } $smarty->assign("FAIScriptlist",$div->DrawList()); $smarty->assign("FAIdebianMirrors",$this->getFAIdebianMirrors()); + $smarty->assign("FAIreleases",$this->getFAIreleases()); + $smarty->assign("FAIrelease",$this->FAIrelease); $smarty->assign("FAIclasses",$this->selectFriendlyClasses()); $smarty->assign("FAIclassesKeys",array_flip($this->selectFriendlyClasses())); $smarty->assign("FAIclassKeys",$this->FAIclass); @@ -495,6 +513,21 @@ class workstartup extends plugin return($ret); } + function getFAIreleases() + { + $ret = array(); + if(is_array($this->FAIreleases)) { + foreach($this->FAIreleases as $mirr=>$releases){ + if( $this->FAIdebianMirror == $mirr ) { + foreach ($releases as $release) + $ret[$release] = $release; + return($ret); + } + } + } + return($ret); + } + /* Save data to object */ function save_object() { @@ -580,11 +613,14 @@ class workstartup extends plugin } plugin::save(); + + unset( $this->attrs['FAIrelease'] ); $str = ""; foreach($this->FAIclass as $class){ $str .= $class." "; } + $str .= ":" . $this->FAIrelease; $this->attrs['FAIclass']= ""; $this->attrs['FAIclass']= trim($str); diff --git a/plugins/admin/systems/workstationStartup.tpl b/plugins/admin/systems/workstationStartup.tpl index 6556a926f..3f2ebecb5 100644 --- a/plugins/admin/systems/workstationStartup.tpl +++ b/plugins/admin/systems/workstationStartup.tpl @@ -32,13 +32,25 @@ -

 {t}FAI server{/t}

+ + + + + +
+

 {t}FAI server{/t}

+

 {t}Release{/t}

- {html_options options=$FAIdebianMirrors output=$FAIdebianMirrors selected=$FAIdebianMirror} + + +

 {t}Assigned FAI classes{/t}

{$FAIScriptlist} -- 2.30.2