Code

Added helpdir structure for plugins.
[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               "sub_list_support" => false,
40               "warnssl" => true,
41               "user_filter_cookie" => true,
42               "ppd_path" => "/var/spool/ppd/",
43               "ppd_path_active" => FALSE,
44               "compile" =>  "/var/spool/gosa",
45               "snmpcommunity" =>  "goto",
46               "debuglevel" => 0,
47               "session_lifetime" => 7200,
48               "max_ldap_query_time" => "5.0",
49               "max_ldap_query_time_active" => FALSE,
51               "mailQueueScriptPath" => "/usr/bin/sudo /usr/local/sbin/mailqueue %action %id %server",
52               "mailQueueScriptPath_active" => FALSE,
54               "auto_network_hook" => "/usr/bin/net-resolver.sh",
55               "auto_network_hook_active" => FALSE,
57               "notifydir" => "",
58               "notifydir_active" => FALSE,
60               "uniq_identifier" => "entryCSN",
61               "uniq_identifier_active" => TRUE,
63               "kioskpath" => "/var/spool/kiosk",
64               "kioskpath_active" => FALSE,
66               "gotomasses_file"   => "/etc/gosa/gotomasses",
67               "gotomasses_active" => FALSE,
69               "noprimarygroup"  => FALSE);
71   var $attributes = array("errorlvl");
73   function Step_Config3()
74   {
75     $this->update_strings();
76   }
79   function update_strings()
80   {
81     $this->s_title      = _("GOsa settings 3/3");
82     $this->s_title_long = _("GOsa settings 3/3");
83     $this->s_info       = _("Tweak some GOsa core behaviour");
84   }
85   
87   function execute()
88   {
89     $smarty = get_smarty();
90     $smarty->assign("bool",array(FALSE => _("No"), TRUE => _("Yes")));
91     $smarty->assign("uniq_identifiers",array( "entryCNS" => "entryCSN",
92                                               "contextCSN"=>"contextCSN" ));
93     $smarty->assign("optional", $this->optional);
94     foreach($this->attributes as $attr){
95       $smarty->assign($attr,$this->$attr);
96     }
97     $smarty->assign("login_attributes",$this->login_attributes);
98     return($smarty -> fetch (get_template_path("../setup/setup_config3.tpl")));
99   }
102   function save_object()
103   {
104     if(isset($_POST['step6a_posted'])){
106       /* Get attributes */
107       foreach($this->attributes as $attr){
108         if(isset($_POST[$attr])){
109           $this->$attr = validate(get_post($attr));
110         }
111       }
112       
113       foreach(array("login_attribute","list_summary","strict_units","snmpcommunity","noprimarygroup","forceglobals","forcessl","ldapstats","user_filter_cookie","warnssl","compile","debuglevel","session_lifetime","sub_list_support") as $name){
114         if(isset($_POST[$name])){
115           $this->optional[$name] = get_post($name);
116         }
117       } 
119       if(isset($_POST['ppd_path_active'])){
120         $this->optional['ppd_path_active'] = TRUE;
121         if(isset($_POST['ppd_path'])){
122           $this->optional['ppd_path'] = get_post('ppd_path');
123         }
124       }else{
125         $this->optional['ppd_path_active'] = FALSE;
126       }
128       if(isset($_POST['max_ldap_query_time_active'])){
129         $this->optional['max_ldap_query_time_active'] = TRUE;
130         if(isset($_POST['max_ldap_query_time'])){
131           $this->optional['max_ldap_query_time'] = get_post('max_ldap_query_time');
132         }
133       }else{
134         $this->optional['max_ldap_query_time_active'] = FALSE;
135       }
137       if(isset($_POST['mailQueueScriptPath_active'])){
138         $this->optional['mailQueueScriptPath_active'] = TRUE;
139         if(isset($_POST['mailQueueScriptPath'])){
140           $this->optional['mailQueueScriptPath'] = get_post('mailQueueScriptPath');
141         }
142       }else{
143         $this->optional['mailQueueScriptPath_active'] = FALSE;
144       }
146       if(isset($_POST['kioskpath_active'])){
147         $this->optional['kioskpath_active'] = TRUE;
148         if(isset($_POST['kioskpath'])){
149           $this->optional['kioskpath'] = get_post('kioskpath');
150         }
151       }else{
152         $this->optional['kioskpath_active'] = FALSE;
153       }
155       if(isset($_POST['gotomasses_active'])){
156         $this->optional['gotomasses_active'] = TRUE;
157         if(isset($_POST['gotomasses_file'])){
158           $this->optional['gotomasses_file'] = get_post('gotomasses_file');
159         }
160       }else{
161         $this->optional['gotomasses_active'] = FALSE;
162       }
164       if(isset($_POST['auto_network_hook_active'])){
165         $this->optional['auto_network_hook_active'] = TRUE;
166         if(isset($_POST['auto_network_hook'])){
167           $this->optional['auto_network_hook'] = get_post('auto_network_hook');
168         }
169       }else{
170         $this->optional['auto_network_hook_active'] = FALSE;
171       }
173       if(isset($_POST['notifydir_active'])){
174         $this->optional['notifydir_active'] = TRUE;
175         if(isset($_POST['notifydir'])){
176           $this->optional['notifydir'] = get_post('notifydir');
177         }
178       }else{
179         $this->optional['notifydir_active'] = FALSE;
180       }
182       if(isset($_POST['uniq_identifier_active'])){
183         $this->optional['uniq_identifier_active'] = TRUE;
184         if(isset($_POST['uniq_identifier'])){
185           $this->optional['uniq_identifier'] = get_post('uniq_identifier');
186         }
187       }else{
188         $this->optional['uniq_identifier_active'] = FALSE;
189       }
190     }
192     $tmp = $this->check();
193     if(count($tmp) == 0){
194       $this->is_completed = TRUE;
195     }else{
196       $this->is_completed = FALSE;
197     }
198   }
201   function check()
202   {
203     $message = array();
205     if(!is_numeric( $this->optional['session_lifetime'])){
206       $message[] = _("Session lifetime must be a numeric value.");
207     }
209     if(!is_numeric( $this->optional['max_ldap_query_time'])){
210       $message[] = _("Maximal ldap query time must be a numeric value. ");
211     }
212   
213     return($message);
214   }
215   
217   /* Attributes that are interesting for configuration generation */
218   function get_attributes()
219   {
220     $tmp = setup_step::get_attributes();
221     foreach(array("optional") as $attr){
222       $tmp[$attr]= $this->$attr;
223     }
224     return($tmp);
225   }
229 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
230 ?>