Code

Added connection setup fix.
[gosa.git] / setup / class_setupStep_Config3.inc
1 <?php
3 /*
4    This code is part of GOsa (https://gosa.gonicus.de)
5    Copyright (C) 2007 Fabian Hickert
7    This program is free software; you can redistribute it and/or modify
8    it under the terms of the GNU General Public License as published by
9    the Free Software Foundation; either version 2 of the License, or
10    (at your option) any later version.
12    This program is distributed in the hope that it will be useful,
13    but WITHOUT ANY WARRANTY; without even the implied warranty of
14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15    GNU General Public License for more details.
17    You should have received a copy of the GNU General Public License
18    along with this program; if not, write to the Free Software
19    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
20 */
23 class Step_Config3 extends setup_step
24 {
25   var $header_image= "images/ldapserver.png";
27   var $errorlvl   = FALSE;
29   var $optional = array(
30               "strict_units" => false,
31               "forceglobals" => true,
32               "forcessl" => false,
33               "ldapstats" => false,
34               "warnssl" => true,
35               "ppd_path" => "/var/spool/ppd/",
36               "ppd_path_active" => FALSE,
37               "compile" =>  "/var/spool/gosa",
38               "debuglevel" => 0,
39               "session_lifetime" => 7200,
40               "max_ldap_query_time" => "5.0",
41               "max_ldap_query_time_active" => FALSE,
43               "mailQueueScriptPath" => "/usr/bin/sudo /usr/local/sbin/mailqueue %action %id %server",
44               "mailQueueScriptPath_active" => FALSE,
46               "auto_network_hook" => "/etc/gosa/net-resolv.sh",
47               "auto_network_hook_active" => FALSE,
49               "notifydir" => "",
50               "notifydir_active" => FALSE,
52               "kioskpath" => "/var/spool/kiosk",
53               "kioskpath_active" => FALSE,
55               "noprimarygroup"  => FALSE);
57   var $attributes = array("errorlvl");
59   function Step_Config3()
60   {
61     $this->update_strings();
62   }
65   function update_strings()
66   {
67     $this->s_title      = _("GOsa settings 3/3");
68     $this->s_title_long = _("GOsa settings 3/3");
69     $this->s_info       = _("Tweak some GOsa core behaviour");
70   }
71   
73   function execute()
74   {
75     $smarty = get_smarty();
76     $smarty->assign("bool",array(FALSE => _("No"), TRUE => _("Yes")));
77     $smarty->assign("optional", $this->optional);
78     foreach($this->attributes as $attr){
79       $smarty->assign($attr,$this->$attr);
80     }
81     return($smarty -> fetch (get_template_path("../setup/setup_config3.tpl")));
82   }
85   function save_object()
86   {
87     if(isset($_POST['step6a_posted'])){
89       /* Get attributes */
90       foreach($this->attributes as $attr){
91         if(isset($_POST[$attr])){
92           $this->$attr = validate(get_post($attr));
93         }
94       }
95       
96       foreach(array("strict_units","noprimarygroup","forceglobals","forcessl","ldapstats","warnssl","compile","debuglevel","session_lifetime") as $name){
97         if(isset($_POST[$name])){
98           $this->optional[$name] = get_post($name);
99         }
100       } 
102       if(isset($_POST['ppd_path_active'])){
103         $this->optional['ppd_path_active'] = TRUE;
104         if(isset($_POST['ppd_path'])){
105           $this->optional['ppd_path'] = get_post('ppd_path');
106         }
107       }else{
108         $this->optional['ppd_path_active'] = FALSE;
109       }
111       if(isset($_POST['max_ldap_query_time_active'])){
112         $this->optional['max_ldap_query_time_active'] = TRUE;
113         if(isset($_POST['max_ldap_query_time'])){
114           $this->optional['max_ldap_query_time'] = get_post('max_ldap_query_time');
115         }
116       }else{
117         $this->optional['max_ldap_query_time_active'] = FALSE;
118       }
120       if(isset($_POST['mailQueueScriptPath_active'])){
121         $this->optional['mailQueueScriptPath_active'] = TRUE;
122         if(isset($_POST['mailQueueScriptPath'])){
123           $this->optional['mailQueueScriptPath'] = get_post('mailQueueScriptPath');
124         }
125       }else{
126         $this->optional['mailQueueScriptPath_active'] = FALSE;
127       }
129       if(isset($_POST['kioskpath_active'])){
130         $this->optional['kioskpath_active'] = TRUE;
131         if(isset($_POST['kioskpath'])){
132           $this->optional['kioskpath'] = get_post('kioskpath');
133         }
134       }else{
135         $this->optional['kioskpath_active'] = FALSE;
136       }
138       if(isset($_POST['auto_network_hook_active'])){
139         $this->optional['auto_network_hook_active'] = TRUE;
140         if(isset($_POST['auto_network_hook'])){
141           $this->optional['auto_network_hook'] = get_post('auto_network_hook');
142         }
143       }else{
144         $this->optional['auto_network_hook_active'] = FALSE;
145       }
147       if(isset($_POST['notifydir_active'])){
148         $this->optional['notifydir_active'] = TRUE;
149         if(isset($_POST['notifydir'])){
150           $this->optional['notifydir'] = get_post('notifydir');
151         }
152       }else{
153         $this->optional['notifydir_active'] = FALSE;
154       }
155     }
157     $tmp = $this->check();
158     if(count($tmp) == 0){
159       $this->is_completed = TRUE;
160     }else{
161       $this->is_completed = FALSE;
162     }
163   }
166   function check()
167   {
168     $message = array();
170     if(!is_numeric( $this->optional['session_lifetime'])){
171       $message[] = _("Session lifetime must be a numeric value.");
172     }
174     if(!is_numeric( $this->optional['max_ldap_query_time'])){
175       $message[] = _("Maximal ldap query time must be a numeric value. ");
176     }
177   
178     return($message);
179   }
180   
182   /* Attributes that are interesting for configuration generation */
183   function get_attributes()
184   {
185     $tmp = setup_step::get_attributes();
186     foreach(array("optional") as $attr){
187       $tmp[$attr]= $this->$attr;
188     }
189     return($tmp);
190   }
194 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
195 ?>