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;
13 var $release;
15 function faiPackageConfiguration (&$config, $dn= NULL,$obj,$release,$pkg_config)
16 {
17 plugin::plugin ($config, $dn);
18 $this->obj = $obj;
19 $this->release = $release;
22 # $this->Debconf_handle = new debconf();
23 # $this->Debconf_handle->set_template_directory($path);
24 # $this->Debconf_handle->set_package($this->obj);
25 # $this->Debconf_handle->set_language(preg_replace('/_.*$/', '', get_browser_language()));
26 #
27 # if( $this->Debconf_handle->load() ) {
28 # $this->pkg_config = $pkg_config;
29 #
30 # foreach($this->pkg_config as $var){
31 # $this->Debconf_handle->SetDefault($var['Name'],$var['Value']);
32 # }
33 # }
34 }
36 function execute()
37 {
38 /* Call parent execute */
39 plugin::execute();
41 $q = new gosaSupportDaemon();
42 $ret = $q->FAI_get_packages($this->release,$this->obj);
43 print_a($ret);
46 return("Not implemented yet<input type='submit' name='CancelObjectConfig' value='back'>");
48 /* Fill templating stuff */
49 $smarty = get_smarty();
50 $display = "";
51 $smarty->assign("headline", sprintf(_("Debconf information for package '%s'"), $this->obj));
53 $this->Debconf_handle->PostCheck();
55 $smarty->assign("Config",$this->Debconf_handle->get_dialog());
57 $display.= $smarty->fetch(get_template_path('faiPackageConfiguration.tpl', TRUE));
58 return($display);
59 }
61 /* Save data to object */
62 function save_object()
63 {
64 }
66 /* Check supplied data */
67 function check()
68 {
69 /* Call common method to give check the hook */
70 $message= plugin::check();
72 return ($message);
73 }
75 function save()
76 {
77 $this->Debconf_handle->PostCheck();
78 $pkgs = $this->Debconf_handle->template;
80 $tmp = array();
81 foreach($pkgs as $pkg){
82 $tmp[$this->obj][$pkg['Name']]['Value']= $pkg['Default'];
83 $tmp[$this->obj][$pkg['Name']]['Name'] = $pkg['Name'];
84 $tmp[$this->obj][$pkg['Name']]['Type'] = $pkg['Type'];
85 }
86 return($tmp);
87 }
88 }
89 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
90 ?>