X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=plugins%2Fadmin%2Ffai%2Fclass_faiPackageConfiguration.inc;h=63c2f90d5ad9d52d1a1c220e26526f718765489d;hb=90cb0cbd940168e234d506e42644e52fc7af5c4d;hp=ddf7577eaaa80ff39b9cd788d9a8bb098ee4f141;hpb=84d2c065af9ce3f287fef380606a593a0cda5a81;p=gosa.git diff --git a/plugins/admin/fai/class_faiPackageConfiguration.inc b/plugins/admin/fai/class_faiPackageConfiguration.inc index ddf7577ea..63c2f90d5 100644 --- a/plugins/admin/fai/class_faiPackageConfiguration.inc +++ b/plugins/admin/fai/class_faiPackageConfiguration.inc @@ -12,22 +12,42 @@ class faiPackageConfiguration extends plugin var $attributes = array(); var $objectclasses = array(); + var $Debconf_handle = NULL; + var $pkg_config ; var $obj; - function faiPackageConfiguration ($config, $dn= NULL,$obj) + function faiPackageConfiguration ($config, $dn= NULL,$obj,$path,$pkg_config) { plugin::plugin ($config, $dn); $this->obj = $obj; + $this->Debconf_handle = new debconf(); + $this->Debconf_handle->set_template_directory($path); + $this->Debconf_handle->set_package($this->obj); + $this->Debconf_handle->set_language(preg_replace('/_.*$/', '', get_browser_language())); + + if( $this->Debconf_handle->load() ) { + $this->pkg_config = $pkg_config; + + foreach($this->pkg_config as $var){ + $this->Debconf_handle->SetDefault($var['Name'],$var['Value']); + } + } } function execute() { - /* Call parent execute */ - plugin::execute(); + /* Call parent execute */ + plugin::execute(); /* Fill templating stuff */ $smarty = get_smarty(); $display = ""; + $smarty->assign("headline", sprintf(_("Debconf information for package '%s'"), $this->obj)); + + $this->Debconf_handle->PostCheck(); + + $smarty->assign("Config",$this->Debconf_handle->get_dialog()); + $display.= $smarty->fetch(get_template_path('faiPackageConfiguration.tpl', TRUE)); return($display); } @@ -40,12 +60,24 @@ class faiPackageConfiguration extends plugin /* Check supplied data */ function check() { - $message= array(); + /* Call common method to give check the hook */ + $message= plugin::check(); + return ($message); } function save() { + $this->Debconf_handle->PostCheck(); + $pkgs = $this->Debconf_handle->template; + + $tmp = array(); + foreach($pkgs as $pkg){ + $tmp[$this->obj][$pkg['Name']]['Value']= $pkg['Default']; + $tmp[$this->obj][$pkg['Name']]['Name'] = $pkg['Name']; + $tmp[$this->obj][$pkg['Name']]['Type'] = $pkg['Type']; + } + return($tmp); } } // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: