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 $Debconf_handle = NULL;
16 var $pkg_config ;
17 var $obj;
19 function faiPackageConfiguration ($config, $dn= NULL,$obj,$path,$pkg_config)
20 {
21 plugin::plugin ($config, $dn);
22 $this->obj = $obj;
23 $this->Debconf_handle = new debconf();
24 $this->Debconf_handle->set_template_directory($path);
25 $this->Debconf_handle->set_package($this->obj);
26 $this->Debconf_handle->set_language(preg_replace('/_.*$/', '', get_browser_language()));
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->PostCheck();
67 $pkgs = $this->Debconf_handle->template;
69 $tmp = array();
70 foreach($pkgs as $pkg){
71 $tmp[$this->obj][$pkg['Name']]['Value']= $pkg['Default'];
72 $tmp[$this->obj][$pkg['Name']]['Name'] = $pkg['Name'];
73 $tmp[$this->obj][$pkg['Name']]['Type'] = $pkg['Type'];
74 }
75 return($tmp);
76 }
77 }
78 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
79 ?>