Code

Added clock image
[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               "notifydir" => "",
55               "notifydir_active" => FALSE,
57               "uniq_identifier" => "entryCSN",
58               "uniq_identifier_active" => TRUE,
60               "kioskpath" => "/var/spool/kiosk",
61               "kioskpath_active" => FALSE,
63               "gotomasses_file"   => "/etc/gosa/gotomasses",
64               "gotomasses_active" => FALSE,
66               "noprimarygroup"  => FALSE);
68   var $attributes = array("errorlvl");
70   function Step_Config3()
71   {
72     $this->update_strings();
73   }
76   function update_strings()
77   {
78     $this->s_title      = _("GOsa settings 3/3");
79     $this->s_title_long = _("GOsa settings 3/3");
80     $this->s_info       = _("Tweak some GOsa core behaviour");
81   }
82   
84   function execute()
85   {
86     $smarty = get_smarty();
87     $smarty->assign("bool",array(FALSE => _("No"), TRUE => _("Yes")));
88     $smarty->assign("uniq_identifiers",array( "entryCNS" => "entryCSN",
89                                               "contextCSN"=>"contextCSN" ));
90     $smarty->assign("optional", $this->optional);
91     foreach($this->attributes as $attr){
92       $smarty->assign($attr,$this->$attr);
93     }
94     $smarty->assign("login_attributes",$this->login_attributes);
95     return($smarty -> fetch (get_template_path("../setup/setup_config3.tpl")));
96   }
99   function save_object()
100   {
101     if(isset($_POST['step6a_posted'])){
103       /* Get attributes */
104       foreach($this->attributes as $attr){
105         if(isset($_POST[$attr])){
106           $this->$attr = validate(get_post($attr));
107         }
108       }
109       
110       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){
111         if(isset($_POST[$name])){
112           $this->optional[$name] = get_post($name);
113         }
114       } 
116       if(isset($_POST['ppd_path_active'])){
117         $this->optional['ppd_path_active'] = TRUE;
118         if(isset($_POST['ppd_path'])){
119           $this->optional['ppd_path'] = get_post('ppd_path');
120         }
121       }else{
122         $this->optional['ppd_path_active'] = FALSE;
123       }
125       if(isset($_POST['max_ldap_query_time_active'])){
126         $this->optional['max_ldap_query_time_active'] = TRUE;
127         if(isset($_POST['max_ldap_query_time'])){
128           $this->optional['max_ldap_query_time'] = get_post('max_ldap_query_time');
129         }
130       }else{
131         $this->optional['max_ldap_query_time_active'] = FALSE;
132       }
134       if(isset($_POST['mailQueueScriptPath_active'])){
135         $this->optional['mailQueueScriptPath_active'] = TRUE;
136         if(isset($_POST['mailQueueScriptPath'])){
137           $this->optional['mailQueueScriptPath'] = get_post('mailQueueScriptPath');
138         }
139       }else{
140         $this->optional['mailQueueScriptPath_active'] = FALSE;
141       }
143       if(isset($_POST['kioskpath_active'])){
144         $this->optional['kioskpath_active'] = TRUE;
145         if(isset($_POST['kioskpath'])){
146           $this->optional['kioskpath'] = get_post('kioskpath');
147         }
148       }else{
149         $this->optional['kioskpath_active'] = FALSE;
150       }
152       if(isset($_POST['gotomasses_active'])){
153         $this->optional['gotomasses_active'] = TRUE;
154         if(isset($_POST['gotomasses_file'])){
155           $this->optional['gotomasses_file'] = get_post('gotomasses_file');
156         }
157       }else{
158         $this->optional['gotomasses_active'] = FALSE;
159       }
161       if(isset($_POST['notifydir_active'])){
162         $this->optional['notifydir_active'] = TRUE;
163         if(isset($_POST['notifydir'])){
164           $this->optional['notifydir'] = get_post('notifydir');
165         }
166       }else{
167         $this->optional['notifydir_active'] = FALSE;
168       }
170       if(isset($_POST['uniq_identifier_active'])){
171         $this->optional['uniq_identifier_active'] = TRUE;
172         if(isset($_POST['uniq_identifier'])){
173           $this->optional['uniq_identifier'] = get_post('uniq_identifier');
174         }
175       }else{
176         $this->optional['uniq_identifier_active'] = FALSE;
177       }
178     }
180     $tmp = $this->check();
181     if(count($tmp) == 0){
182       $this->is_completed = TRUE;
183     }else{
184       $this->is_completed = FALSE;
185     }
186   }
189   function check()
190   {
191     $message = array();
193     if(!is_numeric( $this->optional['session_lifetime'])){
194       $message[] = _("Session lifetime must be a numeric value.");
195     }
197     if(!is_numeric( $this->optional['max_ldap_query_time'])){
198       $message[] = _("Maximal ldap query time must be a numeric value. ");
199     }
200   
201     return($message);
202   }
203   
205   /* Attributes that are interesting for configuration generation */
206   function get_attributes()
207   {
208     $tmp = setup_step::get_attributes();
209     foreach(array("optional") as $attr){
210       $tmp[$attr]= $this->$attr;
211     }
212     return($tmp);
213   }
217 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
218 ?>