1 <?php
3 class faiPackageConfiguration extends plugin
4 {
5 /* CLI vars */
6 var $cli_summary = "Manage server basic objects";
7 var $cli_description = "Some longer text\nfor help";
8 var $cli_parameters = array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
10 /* attribute list for save action */
11 var $ignore_account = TRUE;
12 var $attributes = array();
13 var $objectclasses = array();
15 var $path;
17 var $Debconf_handle = NULL;
18 var $pkg_config ;
19 var $obj;
21 function faiPackageConfiguration ($config, $dn= NULL,$obj,$path,$pkg_config)
22 {
23 plugin::plugin ($config, $dn);
24 $this->obj = $obj;
25 $this->Debconf_handle = new debconf($this->obj, "de");
26 $this->Debconf_handle->set_template_directory($this->path);
27 $this->pkg_config = $pkg_config;
29 foreach($this->pkg_config as $var){
30 $this->Debconf_handle->SetDefault($var['Name'],$var['Value']);
31 }
32 }
34 function execute()
35 {
36 /* Call parent execute */
37 plugin::execute();
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 $message= array();
61 return ($message);
62 }
64 function save()
65 {
66 $this->Debconf_handle->set_template_directory($this->path);
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 ?>