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 "ppd_path" => "/var/spool/ppd/",
37 "ppd_path_active" => FALSE,
38 "compile" => "/var/spool/gosa",
39 "debuglevel" => 0,
40 "session_lifetime" => 7200,
41 "max_ldap_query_time" => "5.0",
42 "max_ldap_query_time_active" => FALSE,
44 "mailQueueScriptPath" => "/usr/bin/sudo /usr/local/sbin/mailqueue %action %id %server",
45 "mailQueueScriptPath_active" => FALSE,
47 "auto_network_hook" => "/usr/bin/net-resolver.sh",
48 "auto_network_hook_active" => FALSE,
50 "notifydir" => "",
51 "notifydir_active" => FALSE,
53 "kioskpath" => "/var/spool/kiosk",
54 "kioskpath_active" => FALSE,
56 "gotomasses_file" => "/etc/gosa/gotomasses",
57 "gotomasses_active" => FALSE,
59 "noprimarygroup" => FALSE);
61 var $attributes = array("errorlvl");
63 function Step_Config3()
64 {
65 $this->update_strings();
66 }
69 function update_strings()
70 {
71 $this->s_title = _("GOsa settings 3/3");
72 $this->s_title_long = _("GOsa settings 3/3");
73 $this->s_info = _("Tweak some GOsa core behaviour");
74 }
77 function execute()
78 {
79 $smarty = get_smarty();
80 $smarty->assign("bool",array(FALSE => _("No"), TRUE => _("Yes")));
81 $smarty->assign("optional", $this->optional);
82 foreach($this->attributes as $attr){
83 $smarty->assign($attr,$this->$attr);
84 }
85 return($smarty -> fetch (get_template_path("../setup/setup_config3.tpl")));
86 }
89 function save_object()
90 {
91 if(isset($_POST['step6a_posted'])){
93 /* Get attributes */
94 foreach($this->attributes as $attr){
95 if(isset($_POST[$attr])){
96 $this->$attr = validate(get_post($attr));
97 }
98 }
100 foreach(array("list_summary","strict_units","noprimarygroup","forceglobals","forcessl","ldapstats","warnssl","compile","debuglevel","session_lifetime") as $name){
101 if(isset($_POST[$name])){
102 $this->optional[$name] = get_post($name);
103 }
104 }
106 if(isset($_POST['ppd_path_active'])){
107 $this->optional['ppd_path_active'] = TRUE;
108 if(isset($_POST['ppd_path'])){
109 $this->optional['ppd_path'] = get_post('ppd_path');
110 }
111 }else{
112 $this->optional['ppd_path_active'] = FALSE;
113 }
115 if(isset($_POST['max_ldap_query_time_active'])){
116 $this->optional['max_ldap_query_time_active'] = TRUE;
117 if(isset($_POST['max_ldap_query_time'])){
118 $this->optional['max_ldap_query_time'] = get_post('max_ldap_query_time');
119 }
120 }else{
121 $this->optional['max_ldap_query_time_active'] = FALSE;
122 }
124 if(isset($_POST['mailQueueScriptPath_active'])){
125 $this->optional['mailQueueScriptPath_active'] = TRUE;
126 if(isset($_POST['mailQueueScriptPath'])){
127 $this->optional['mailQueueScriptPath'] = get_post('mailQueueScriptPath');
128 }
129 }else{
130 $this->optional['mailQueueScriptPath_active'] = FALSE;
131 }
133 if(isset($_POST['kioskpath_active'])){
134 $this->optional['kioskpath_active'] = TRUE;
135 if(isset($_POST['kioskpath'])){
136 $this->optional['kioskpath'] = get_post('kioskpath');
137 }
138 }else{
139 $this->optional['kioskpath_active'] = FALSE;
140 }
142 if(isset($_POST['gotomasses_active'])){
143 $this->optional['gotomasses_active'] = TRUE;
144 if(isset($_POST['gotomasses_file'])){
145 $this->optional['gotomasses_file'] = get_post('gotomasses_file');
146 }
147 }else{
148 $this->optional['gotomasses_active'] = FALSE;
149 }
151 if(isset($_POST['auto_network_hook_active'])){
152 $this->optional['auto_network_hook_active'] = TRUE;
153 if(isset($_POST['auto_network_hook'])){
154 $this->optional['auto_network_hook'] = get_post('auto_network_hook');
155 }
156 }else{
157 $this->optional['auto_network_hook_active'] = FALSE;
158 }
160 if(isset($_POST['notifydir_active'])){
161 $this->optional['notifydir_active'] = TRUE;
162 if(isset($_POST['notifydir'])){
163 $this->optional['notifydir'] = get_post('notifydir');
164 }
165 }else{
166 $this->optional['notifydir_active'] = FALSE;
167 }
168 }
170 $tmp = $this->check();
171 if(count($tmp) == 0){
172 $this->is_completed = TRUE;
173 }else{
174 $this->is_completed = FALSE;
175 }
176 }
179 function check()
180 {
181 $message = array();
183 if(!is_numeric( $this->optional['session_lifetime'])){
184 $message[] = _("Session lifetime must be a numeric value.");
185 }
187 if(!is_numeric( $this->optional['max_ldap_query_time'])){
188 $message[] = _("Maximal ldap query time must be a numeric value. ");
189 }
191 return($message);
192 }
195 /* Attributes that are interesting for configuration generation */
196 function get_attributes()
197 {
198 $tmp = setup_step::get_attributes();
199 foreach(array("optional") as $attr){
200 $tmp[$attr]= $this->$attr;
201 }
202 return($tmp);
203 }
205 }
207 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
208 ?>