From c6f03516d30bf1c806d97541e1729bc57573c5cd Mon Sep 17 00:00:00 2001 From: hickert Date: Tue, 22 Nov 2005 12:45:55 +0000 Subject: [PATCH] Some fixes git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@2007 594d385d-05f5-0310-b6e9-bd551577e9d8 --- include/class_debconfTemplate.inc | 30 +++++++++---------- plugins/admin/fai/class_faiPackage.inc | 40 ++++++++++++++------------ 2 files changed, 36 insertions(+), 34 deletions(-) diff --git a/include/class_debconfTemplate.inc b/include/class_debconfTemplate.inc index 6e96574c6..7438df7ca 100644 --- a/include/class_debconfTemplate.inc +++ b/include/class_debconfTemplate.inc @@ -54,10 +54,11 @@ class debconf $this->template= array(); /* Read template array */ - $post_name= 0; - $langcode= $this->language.".UTF-8"; - $in_description= FALSE; + $post_name = 0; + $langcode = $this->language.".UTF-8"; + $in_description = FALSE; $got_local_description= FALSE; + $fh= fopen($filename, 'r'); while (!feof($fh)){ @@ -71,9 +72,7 @@ class debconf /* Template header */ if (preg_match("/^Template: /", $line)){ $post_name ++; - $name= trim(preg_replace("/^Template: (.*)$/", "\\1", $line)); - $this->template[$post_name]['Name'] = $name; $this->template[$post_name]['Default'] =""; @@ -168,10 +167,16 @@ class debconf } + /* Check if some fields are posted */ function PostCheck() { + /* Walk through all template variables */ foreach($this->template as $post_name => $entry){ + + /* Check if this var is set*/ if(isset($_POST[$entry['post_name']])){ + + /* special handling for arrays */ if(is_array($_POST[$entry['post_name']])){ $str = ""; foreach($_POST[$entry['post_name']] as $val){ @@ -187,6 +192,8 @@ class debconf } + + /* This funtion sets the defualt value */ function SetDefault($var,$val) { if($this->has_template){ @@ -198,6 +205,8 @@ class debconf } } + + /* Display all possible options in html*/ function get_dialog() { if ($this->has_template){ @@ -411,17 +420,6 @@ class debconf return (""); } - - function get_template_packages() - { - } - - - function set_default($default) - { - } - - } # Example: diff --git a/plugins/admin/fai/class_faiPackage.inc b/plugins/admin/fai/class_faiPackage.inc index 2c78f60ac..a0be45fcb 100644 --- a/plugins/admin/fai/class_faiPackage.inc +++ b/plugins/admin/fai/class_faiPackage.inc @@ -451,14 +451,28 @@ class faiPackage extends plugin $this->attrs['FAIdebianSection'][] = $sec; } - /* Save Package configurations */ + $ldap->cat($this->dn); + if($ldap->count()!=0){ + /* Write FAIscript to ldap*/ + $ldap->cd($this->dn); + $ldap->modify($this->attrs); + }else{ + /* Write FAIscript to ldap*/ + $ldap->cd($this->config->current['BASE']); + $ldap->create_missing_trees(preg_replace('/^[^,]+,/', '', $this->dn)); + $ldap->cd($this->dn); + $ldap->add($this->attrs); + } + show_ldap_error($ldap->get_error()); + + /* Save Package configurations */ foreach($this->ConfiguredPackages as $pkgname => $attrs){ foreach($attrs as $name => $attr){ foreach($attr as $n=>$v){ if(empty($v)) $v = array(); } - + /* Set attributes */ $pkgattrs['objectClass'] = "FAIdebconfInfo"; $pkgattrs['FAIpackage'] = $pkgname; @@ -466,8 +480,8 @@ class faiPackage extends plugin $pkgattrs['FAIvariableType'] = $attr['Type']; $pkgattrs['FAIvariableContent'] = $attr['Value']; $pkgdn = "FAIvariable=".$name.",".$this->dn; - - /* cehck if object already exists */ + + /* cehck if object already exists */ $ldap->cat($pkgdn); if($ldap->count()!=0){ $ldap->cd($pkgdn); @@ -479,22 +493,12 @@ class faiPackage extends plugin $ldap->add($pkgattrs); } show_ldap_error($ldap->get_error()); - } + } } - $ldap->cat($this->dn); - if($ldap->count()!=0){ - /* Write FAIscript to ldap*/ - $ldap->cd($this->dn); - $ldap->modify($this->attrs); - }else{ - /* Write FAIscript to ldap*/ - $ldap->cd($this->config->current['BASE']); - $ldap->create_missing_trees(preg_replace('/^[^,]+,/', '', $this->dn)); - $ldap->cd($this->dn); - $ldap->add($this->attrs); - } - show_ldap_error($ldap->get_error()); + + + } } -- 2.30.2