Code

Udpated JS focus,
[gosa.git] / plugins / admin / fai / class_faiPackageConfiguration.inc
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()));
23     if( $this->Debconf_handle->load() ) {
24       $this->pkg_config = $pkg_config;
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     /* Fill templating stuff */
38     $smarty     = get_smarty();
39     $display = "";
40     $smarty->assign("headline", sprintf(_("Debconf information for package '%s'"), $this->obj));
42     $this->Debconf_handle->PostCheck();
44     $smarty->assign("Config",$this->Debconf_handle->get_dialog());
46     $display.= $smarty->fetch(get_template_path('faiPackageConfiguration.tpl', TRUE));
47     return($display);
48   }
50   /* Save data to object */
51   function save_object()
52   {
53   }
55   /* Check supplied data */
56   function check()
57   {
58     /* Call common method to give check the hook */
59     $message= plugin::check();
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 ?>