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" => false,
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 "snmpcommunity" => "goto",
41 "debuglevel" => 0,
42 "session_lifetime" => 7200,
43 "max_ldap_query_time" => "5.0",
44 "max_ldap_query_time_active" => FALSE,
46 "mailQueueScriptPath" => "/usr/bin/sudo /usr/local/sbin/mailqueue %action %id %server",
47 "mailQueueScriptPath_active" => FALSE,
49 "auto_network_hook" => "/usr/bin/net-resolver.sh",
50 "auto_network_hook_active" => FALSE,
52 "notifydir" => "",
53 "notifydir_active" => FALSE,
55 "kioskpath" => "/var/spool/kiosk",
56 "kioskpath_active" => FALSE,
58 "gotomasses_file" => "/etc/gosa/gotomasses",
59 "gotomasses_active" => FALSE,
61 "noprimarygroup" => FALSE);
63 var $attributes = array("errorlvl");
65 function Step_Config3()
66 {
67 $this->update_strings();
68 }
71 function update_strings()
72 {
73 $this->s_title = _("GOsa settings 3/3");
74 $this->s_title_long = _("GOsa settings 3/3");
75 $this->s_info = _("Tweak some GOsa core behaviour");
76 }
79 function execute()
80 {
81 $smarty = get_smarty();
82 $smarty->assign("bool",array(FALSE => _("No"), TRUE => _("Yes")));
83 $smarty->assign("optional", $this->optional);
84 foreach($this->attributes as $attr){
85 $smarty->assign($attr,$this->$attr);
86 }
87 return($smarty -> fetch (get_template_path("../setup/setup_config3.tpl")));
88 }
91 function save_object()
92 {
93 if(isset($_POST['step6a_posted'])){
95 /* Get attributes */
96 foreach($this->attributes as $attr){
97 if(isset($_POST[$attr])){
98 $this->$attr = validate(get_post($attr));
99 }
100 }
102 foreach(array("list_summary","strict_units","noprimarygroup","forceglobals","forcessl","ldapstats","user_filter_cookie","warnssl","compile","debuglevel","session_lifetime") as $name){
103 if(isset($_POST[$name])){
104 $this->optional[$name] = get_post($name);
105 }
106 }
108 if(isset($_POST['ppd_path_active'])){
109 $this->optional['ppd_path_active'] = TRUE;
110 if(isset($_POST['ppd_path'])){
111 $this->optional['ppd_path'] = get_post('ppd_path');
112 }
113 }else{
114 $this->optional['ppd_path_active'] = FALSE;
115 }
117 if(isset($_POST['max_ldap_query_time_active'])){
118 $this->optional['max_ldap_query_time_active'] = TRUE;
119 if(isset($_POST['max_ldap_query_time'])){
120 $this->optional['max_ldap_query_time'] = get_post('max_ldap_query_time');
121 }
122 }else{
123 $this->optional['max_ldap_query_time_active'] = FALSE;
124 }
126 if(isset($_POST['mailQueueScriptPath_active'])){
127 $this->optional['mailQueueScriptPath_active'] = TRUE;
128 if(isset($_POST['mailQueueScriptPath'])){
129 $this->optional['mailQueueScriptPath'] = get_post('mailQueueScriptPath');
130 }
131 }else{
132 $this->optional['mailQueueScriptPath_active'] = FALSE;
133 }
135 if(isset($_POST['kioskpath_active'])){
136 $this->optional['kioskpath_active'] = TRUE;
137 if(isset($_POST['kioskpath'])){
138 $this->optional['kioskpath'] = get_post('kioskpath');
139 }
140 }else{
141 $this->optional['kioskpath_active'] = FALSE;
142 }
144 if(isset($_POST['gotomasses_active'])){
145 $this->optional['gotomasses_active'] = TRUE;
146 if(isset($_POST['gotomasses_file'])){
147 $this->optional['gotomasses_file'] = get_post('gotomasses_file');
148 }
149 }else{
150 $this->optional['gotomasses_active'] = FALSE;
151 }
153 if(isset($_POST['auto_network_hook_active'])){
154 $this->optional['auto_network_hook_active'] = TRUE;
155 if(isset($_POST['auto_network_hook'])){
156 $this->optional['auto_network_hook'] = get_post('auto_network_hook');
157 }
158 }else{
159 $this->optional['auto_network_hook_active'] = FALSE;
160 }
162 if(isset($_POST['notifydir_active'])){
163 $this->optional['notifydir_active'] = TRUE;
164 if(isset($_POST['notifydir'])){
165 $this->optional['notifydir'] = get_post('notifydir');
166 }
167 }else{
168 $this->optional['notifydir_active'] = FALSE;
169 }
170 }
172 $tmp = $this->check();
173 if(count($tmp) == 0){
174 $this->is_completed = TRUE;
175 }else{
176 $this->is_completed = FALSE;
177 }
178 }
181 function check()
182 {
183 $message = array();
185 if(!is_numeric( $this->optional['session_lifetime'])){
186 $message[] = _("Session lifetime must be a numeric value.");
187 }
189 if(!is_numeric( $this->optional['max_ldap_query_time'])){
190 $message[] = _("Maximal ldap query time must be a numeric value. ");
191 }
193 return($message);
194 }
197 /* Attributes that are interesting for configuration generation */
198 function get_attributes()
199 {
200 $tmp = setup_step::get_attributes();
201 foreach(array("optional") as $attr){
202 $tmp[$attr]= $this->$attr;
203 }
204 return($tmp);
205 }
207 }
209 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
210 ?>