1 <?php
3 class faiPackageConfiguration extends plugin
4 {
5 /* attribute list for save action */
6 var $ignore_account = TRUE;
7 var $attributes = array();
8 var $objectclasses = array();
10 var $Debconf_handle = NULL;
11 var $pkg_config ;
12 var $obj;
14 function faiPackageConfiguration (&$config, $dn= NULL,$obj,$path,$pkg_config)
15 {
16 plugin::plugin ($config, $dn);
17 $this->obj = $obj;
18 # $this->Debconf_handle = new debconf();
19 # $this->Debconf_handle->set_template_directory($path);
20 # $this->Debconf_handle->set_package($this->obj);
21 # $this->Debconf_handle->set_language(preg_replace('/_.*$/', '', get_browser_language()));
22 #
23 # if( $this->Debconf_handle->load() ) {
24 # $this->pkg_config = $pkg_config;
25 #
26 # foreach($this->pkg_config as $var){
27 # $this->Debconf_handle->SetDefault($var['Name'],$var['Value']);
28 # }
29 # }
30 }
32 function execute()
33 {
34 /* Call parent execute */
35 plugin::execute();
37 return("Not implemented yet<input type='submit' name='CancelObjectConfig' value='back'>");
39 /* Fill templating stuff */
40 $smarty = get_smarty();
41 $display = "";
42 $smarty->assign("headline", sprintf(_("Debconf information for package '%s'"), $this->obj));
44 $this->Debconf_handle->PostCheck();
46 $smarty->assign("Config",$this->Debconf_handle->get_dialog());
48 $display.= $smarty->fetch(get_template_path('faiPackageConfiguration.tpl', TRUE));
49 return($display);
50 }
52 /* Save data to object */
53 function save_object()
54 {
55 }
57 /* Check supplied data */
58 function check()
59 {
60 /* Call common method to give check the hook */
61 $message= plugin::check();
63 return ($message);
64 }
66 function save()
67 {
68 $this->Debconf_handle->PostCheck();
69 $pkgs = $this->Debconf_handle->template;
71 $tmp = array();
72 foreach($pkgs as $pkg){
73 $tmp[$this->obj][$pkg['Name']]['Value']= $pkg['Default'];
74 $tmp[$this->obj][$pkg['Name']]['Name'] = $pkg['Name'];
75 $tmp[$this->obj][$pkg['Name']]['Type'] = $pkg['Type'];
76 }
77 return($tmp);
78 }
79 }
80 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
81 ?>