Code

Updated groupMail account.
[gosa.git] / gosa-core / 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   = TRUE;
29   var $login_attributes = array("uid"       => "uid", 
30                                 "mail"      => "mail",
31                                 "uid,mail"  => "both");
32   var $optional = array(
33               "login_attribute" => "uid",
34               "strict_units" => false,
35               "list_summary" => false,
36               "forceglobals" => true,
37               "forcessl" => false,
38               "ldapstats" => false,
39               "warnssl" => true,
40               "user_filter_cookie" => true,
41               "ppd_path" => "/var/spool/ppd/",
42               "ppd_path_active" => FALSE,
43               "compile" =>  "/var/spool/gosa",
44               "snmpcommunity" =>  "goto",
45               "debuglevel" => 0,
46               "session_lifetime" => 7200,
47               "max_ldap_query_time" => "5.0",
48               "max_ldap_query_time_active" => FALSE,
50               "mailQueueScriptPath" => "/usr/bin/sudo /usr/local/sbin/mailqueue %action %id %server",
51               "mailQueueScriptPath_active" => FALSE,
53               "auto_network_hook" => "/usr/bin/net-resolver.sh",
54               "auto_network_hook_active" => FALSE,
56               "notifydir" => "",
57               "notifydir_active" => FALSE,
59               "uniq_identifier" => "entryCSN",
60               "uniq_identifier_active" => TRUE,
62               "kioskpath" => "/var/spool/kiosk",
63               "kioskpath_active" => FALSE,
65               "gotomasses_file"   => "/etc/gosa/gotomasses",
66               "gotomasses_active" => FALSE,
68               "noprimarygroup"  => FALSE);
70   var $attributes = array("errorlvl");
72   function Step_Config3()
73   {
74     $this->update_strings();
75   }
78   function update_strings()
79   {
80     $this->s_title      = _("GOsa settings 3/3");
81     $this->s_title_long = _("GOsa settings 3/3");
82     $this->s_info       = _("Tweak some GOsa core behaviour");
83   }
84   
86   function execute()
87   {
88     $smarty = get_smarty();
89     $smarty->assign("bool",array(FALSE => _("No"), TRUE => _("Yes")));
90     $smarty->assign("uniq_identifiers",array( "entryCNS" => "entryCSN",
91                                               "contextCSN"=>"contextCSN" ));
92     $smarty->assign("optional", $this->optional);
93     foreach($this->attributes as $attr){
94       $smarty->assign($attr,$this->$attr);
95     }
96     $smarty->assign("login_attributes",$this->login_attributes);
97     return($smarty -> fetch (get_template_path("../setup/setup_config3.tpl")));
98   }
101   function save_object()
102   {
103     if(isset($_POST['step6a_posted'])){
105       /* Get attributes */
106       foreach($this->attributes as $attr){
107         if(isset($_POST[$attr])){
108           $this->$attr = validate(get_post($attr));
109         }
110       }
111       
112       foreach(array("login_attribute","list_summary","strict_units","snmpcommunity","noprimarygroup","forceglobals","forcessl","ldapstats","user_filter_cookie","warnssl","compile","debuglevel","session_lifetime") as $name){
113         if(isset($_POST[$name])){
114           $this->optional[$name] = get_post($name);
115         }
116       } 
118       if(isset($_POST['ppd_path_active'])){
119         $this->optional['ppd_path_active'] = TRUE;
120         if(isset($_POST['ppd_path'])){
121           $this->optional['ppd_path'] = get_post('ppd_path');
122         }
123       }else{
124         $this->optional['ppd_path_active'] = FALSE;
125       }
127       if(isset($_POST['max_ldap_query_time_active'])){
128         $this->optional['max_ldap_query_time_active'] = TRUE;
129         if(isset($_POST['max_ldap_query_time'])){
130           $this->optional['max_ldap_query_time'] = get_post('max_ldap_query_time');
131         }
132       }else{
133         $this->optional['max_ldap_query_time_active'] = FALSE;
134       }
136       if(isset($_POST['mailQueueScriptPath_active'])){
137         $this->optional['mailQueueScriptPath_active'] = TRUE;
138         if(isset($_POST['mailQueueScriptPath'])){
139           $this->optional['mailQueueScriptPath'] = get_post('mailQueueScriptPath');
140         }
141       }else{
142         $this->optional['mailQueueScriptPath_active'] = FALSE;
143       }
145       if(isset($_POST['kioskpath_active'])){
146         $this->optional['kioskpath_active'] = TRUE;
147         if(isset($_POST['kioskpath'])){
148           $this->optional['kioskpath'] = get_post('kioskpath');
149         }
150       }else{
151         $this->optional['kioskpath_active'] = FALSE;
152       }
154       if(isset($_POST['gotomasses_active'])){
155         $this->optional['gotomasses_active'] = TRUE;
156         if(isset($_POST['gotomasses_file'])){
157           $this->optional['gotomasses_file'] = get_post('gotomasses_file');
158         }
159       }else{
160         $this->optional['gotomasses_active'] = FALSE;
161       }
163       if(isset($_POST['auto_network_hook_active'])){
164         $this->optional['auto_network_hook_active'] = TRUE;
165         if(isset($_POST['auto_network_hook'])){
166           $this->optional['auto_network_hook'] = get_post('auto_network_hook');
167         }
168       }else{
169         $this->optional['auto_network_hook_active'] = FALSE;
170       }
172       if(isset($_POST['notifydir_active'])){
173         $this->optional['notifydir_active'] = TRUE;
174         if(isset($_POST['notifydir'])){
175           $this->optional['notifydir'] = get_post('notifydir');
176         }
177       }else{
178         $this->optional['notifydir_active'] = FALSE;
179       }
181       if(isset($_POST['uniq_identifier_active'])){
182         $this->optional['uniq_identifier_active'] = TRUE;
183         if(isset($_POST['uniq_identifier'])){
184           $this->optional['uniq_identifier'] = get_post('uniq_identifier');
185         }
186       }else{
187         $this->optional['uniq_identifier_active'] = FALSE;
188       }
189     }
191     $tmp = $this->check();
192     if(count($tmp) == 0){
193       $this->is_completed = TRUE;
194     }else{
195       $this->is_completed = FALSE;
196     }
197   }
200   function check()
201   {
202     $message = array();
204     if(!is_numeric( $this->optional['session_lifetime'])){
205       $message[] = _("Session lifetime must be a numeric value.");
206     }
208     if(!is_numeric( $this->optional['max_ldap_query_time'])){
209       $message[] = _("Maximal ldap query time must be a numeric value. ");
210     }
211   
212     return($message);
213   }
214   
216   /* Attributes that are interesting for configuration generation */
217   function get_attributes()
218   {
219     $tmp = setup_step::get_attributes();
220     foreach(array("optional") as $attr){
221       $tmp[$attr]= $this->$attr;
222     }
223     return($tmp);
224   }
228 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
229 ?>