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 $optional = array(
30 "strict_units" => false,
31 "list_summary" => true,
32 "forceglobals" => true,
33 "forcessl" => false,
34 "ldapstats" => false,
35 "warnssl" => true,
36 "user_filter_cookie" => true,
37 "ppd_path" => "/var/spool/ppd/",
38 "ppd_path_active" => FALSE,
39 "compile" => "/var/spool/gosa",
40 "debuglevel" => 0,
41 "session_lifetime" => 7200,
42 "max_ldap_query_time" => "5.0",
43 "max_ldap_query_time_active" => FALSE,
45 "mailQueueScriptPath" => "/usr/bin/sudo /usr/local/sbin/mailqueue %action %id %server",
46 "mailQueueScriptPath_active" => FALSE,
48 "auto_network_hook" => "/usr/bin/net-resolver.sh",
49 "auto_network_hook_active" => FALSE,
51 "notifydir" => "",
52 "notifydir_active" => FALSE,
54 "kioskpath" => "/var/spool/kiosk",
55 "kioskpath_active" => FALSE,
57 "gotomasses_file" => "/etc/gosa/gotomasses",
58 "gotomasses_active" => FALSE,
60 "noprimarygroup" => FALSE);
62 var $attributes = array("errorlvl");
64 function Step_Config3()
65 {
66 $this->update_strings();
67 }
70 function update_strings()
71 {
72 $this->s_title = _("GOsa settings 3/3");
73 $this->s_title_long = _("GOsa settings 3/3");
74 $this->s_info = _("Tweak some GOsa core behaviour");
75 }
78 function execute()
79 {
80 $smarty = get_smarty();
81 $smarty->assign("bool",array(FALSE => _("No"), TRUE => _("Yes")));
82 $smarty->assign("optional", $this->optional);
83 foreach($this->attributes as $attr){
84 $smarty->assign($attr,$this->$attr);
85 }
86 return($smarty -> fetch (get_template_path("../setup/setup_config3.tpl")));
87 }
90 function save_object()
91 {
92 if(isset($_POST['step6a_posted'])){
94 /* Get attributes */
95 foreach($this->attributes as $attr){
96 if(isset($_POST[$attr])){
97 $this->$attr = validate(get_post($attr));
98 }
99 }
101 foreach(array("list_summary","strict_units","noprimarygroup","forceglobals","forcessl","ldapstats","user_filter_cookie","warnssl","compile","debuglevel","session_lifetime") as $name){
102 if(isset($_POST[$name])){
103 $this->optional[$name] = get_post($name);
104 }
105 }
107 if(isset($_POST['ppd_path_active'])){
108 $this->optional['ppd_path_active'] = TRUE;
109 if(isset($_POST['ppd_path'])){
110 $this->optional['ppd_path'] = get_post('ppd_path');
111 }
112 }else{
113 $this->optional['ppd_path_active'] = FALSE;
114 }
116 if(isset($_POST['max_ldap_query_time_active'])){
117 $this->optional['max_ldap_query_time_active'] = TRUE;
118 if(isset($_POST['max_ldap_query_time'])){
119 $this->optional['max_ldap_query_time'] = get_post('max_ldap_query_time');
120 }
121 }else{
122 $this->optional['max_ldap_query_time_active'] = FALSE;
123 }
125 if(isset($_POST['mailQueueScriptPath_active'])){
126 $this->optional['mailQueueScriptPath_active'] = TRUE;
127 if(isset($_POST['mailQueueScriptPath'])){
128 $this->optional['mailQueueScriptPath'] = get_post('mailQueueScriptPath');
129 }
130 }else{
131 $this->optional['mailQueueScriptPath_active'] = FALSE;
132 }
134 if(isset($_POST['kioskpath_active'])){
135 $this->optional['kioskpath_active'] = TRUE;
136 if(isset($_POST['kioskpath'])){
137 $this->optional['kioskpath'] = get_post('kioskpath');
138 }
139 }else{
140 $this->optional['kioskpath_active'] = FALSE;
141 }
143 if(isset($_POST['gotomasses_active'])){
144 $this->optional['gotomasses_active'] = TRUE;
145 if(isset($_POST['gotomasses_file'])){
146 $this->optional['gotomasses_file'] = get_post('gotomasses_file');
147 }
148 }else{
149 $this->optional['gotomasses_active'] = FALSE;
150 }
152 if(isset($_POST['auto_network_hook_active'])){
153 $this->optional['auto_network_hook_active'] = TRUE;
154 if(isset($_POST['auto_network_hook'])){
155 $this->optional['auto_network_hook'] = get_post('auto_network_hook');
156 }
157 }else{
158 $this->optional['auto_network_hook_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 }
169 }
171 $tmp = $this->check();
172 if(count($tmp) == 0){
173 $this->is_completed = TRUE;
174 }else{
175 $this->is_completed = FALSE;
176 }
177 }
180 function check()
181 {
182 $message = array();
184 if(!is_numeric( $this->optional['session_lifetime'])){
185 $message[] = _("Session lifetime must be a numeric value.");
186 }
188 if(!is_numeric( $this->optional['max_ldap_query_time'])){
189 $message[] = _("Maximal ldap query time must be a numeric value. ");
190 }
192 return($message);
193 }
196 /* Attributes that are interesting for configuration generation */
197 function get_attributes()
198 {
199 $tmp = setup_step::get_attributes();
200 foreach(array("optional") as $attr){
201 $tmp[$attr]= $this->$attr;
202 }
203 return($tmp);
204 }
206 }
208 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
209 ?>