Code

Updated style and moved smbhash to samba
[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";
26   var $optional = array(
27               "strict_units" => false,
28               "forceglobals" => true,
29               "forcessl" => false,
30               "warnssl" => true,
31               "ppd_path" => "/var/spool/ppd/",
32               "ppd_path_active" => FALSE,
33               "compile" =>  "/var/spool/gosa",
34               "debuglevel" => 0,
35               "session_lifetime" => 7200,
36               "max_ldap_query_time" => "5.0",
37               "max_ldap_query_time_active" => FALSE,
39               "mailQueueScriptPath" => "/usr/bin/sudo /usr/local/sbin/mailqueue %action %id %server",
40               "mailQueueScriptPath_active" => FALSE,
42               "auto_network_hook" => "/etc/gosa/net-resolv.sh",
43               "auto_network_hook_active" => FALSE,
45               "notifydir" => "",
46               "notifydir_active" => FALSE,
48               "kioskpath" => "/var/spool/kiosk",
49               "kioskpath_active" => FALSE,
51               "noprimarygroup"  => FALSE);
54   function Step_Config3()
55   {
56     $this->update_strings();
57   }
60   function update_strings()
61   {
62     $this->s_title      = _("GOsa settings 3/3");
63     $this->s_title_long = _("GOsa settings 3/3");
64     $this->s_info       = _("Tweak some GOsa core behaviour");
65   }
66   
68   function execute()
69   {
70     $smarty = get_smarty();
71     $smarty->assign("bool",array(FALSE => _("No"), TRUE => _("Yes")));
72     $smarty->assign("optional", $this->optional);
73     foreach($this->attributes as $attr){
74       $smarty->assign($attr,$this->$attr);
75     }
76     return($smarty -> fetch (get_template_path("../setup/setup_config3.tpl")));
77   }
80   function save_object()
81   {
82     if(isset($_POST['step6a_posted'])){
84       /* Get attributes */
85       foreach($this->attributes as $attr){
86         if(isset($_POST[$attr])){
87           $this->$attr = validate($_POST[$attr]);
88         }
89       }
90       
91       foreach(array("strict_units","noprimarygroup","forceglobals","forcessl","warnssl","compile","debuglevel","session_lifetime") as $name){
92         if(isset($_POST[$name])){
93           $this->optional[$name] = stripslashes($_POST[$name]);
94         }
95       } 
97       if(isset($_POST['ppd_path_active'])){
98         $this->optional['ppd_path_active'] = TRUE;
99         if(isset($_POST['ppd_path'])){
100           $this->optional['ppd_path'] = $_POST['ppd_path'];
101         }
102       }else{
103         $this->optional['ppd_path_active'] = FALSE;
104       }
106       if(isset($_POST['max_ldap_query_time_active'])){
107         $this->optional['max_ldap_query_time_active'] = TRUE;
108         if(isset($_POST['max_ldap_query_time'])){
109           $this->optional['max_ldap_query_time'] = $_POST['max_ldap_query_time'];
110         }
111       }else{
112         $this->optional['max_ldap_query_time_active'] = FALSE;
113       }
115       if(isset($_POST['mailQueueScriptPath_active'])){
116         $this->optional['mailQueueScriptPath_active'] = TRUE;
117         if(isset($_POST['mailQueueScriptPath'])){
118           $this->optional['mailQueueScriptPath'] = $_POST['mailQueueScriptPath'];
119         }
120       }else{
121         $this->optional['mailQueueScriptPath_active'] = FALSE;
122       }
124       if(isset($_POST['kioskpath_active'])){
125         $this->optional['kioskpath_active'] = TRUE;
126         if(isset($_POST['kioskpath'])){
127           $this->optional['kioskpath'] = $_POST['kioskpath'];
128         }
129       }else{
130         $this->optional['kioskpath_active'] = FALSE;
131       }
133       if(isset($_POST['auto_network_hook_active'])){
134         $this->optional['auto_network_hook_active'] = TRUE;
135         if(isset($_POST['auto_network_hook'])){
136           $this->optional['auto_network_hook'] = $_POST['auto_network_hook'];
137         }
138       }else{
139         $this->optional['auto_network_hook_active'] = FALSE;
140       }
142       if(isset($_POST['notifydir_active'])){
143         $this->optional['notifydir_active'] = TRUE;
144         if(isset($_POST['notifydir'])){
145           $this->optional['notifydir'] = $_POST['notifydir'];
146         }
147       }else{
148         $this->optional['notifydir_active'] = FALSE;
149       }
150     }
152     $tmp = $this->check();
153     if(count($tmp) == 0){
154       $this->is_completed = TRUE;
155     }else{
156       $this->is_completed = FALSE;
157     }
158   }
161   function check()
162   {
163     $message = array();
165     if(!is_numeric( $this->optional['session_lifetime'])){
166       $message[] = _("Session lifetime must be a numeric value.");
167     }
169     if(!is_numeric( $this->optional['max_ldap_query_time'])){
170       $message[] = _("Maximal ldap query time must be a numeric value. ");
171     }
172   
173     return($message);
174   }
175   
177   /* Attributes that are interesting for configuration generation */
178   function get_attributes()
179   {
180     $tmp = setup_step::get_attributes();
181     foreach(array("optional") as $attr){
182       $tmp[$attr]= $this->$attr;
183     }
184     return($tmp);
185   }
189 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
190 ?>