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 "noprimarygroup" => FALSE);
58 var $attributes = array("errorlvl");
60 function Step_Config3()
61 {
62 $this->update_strings();
63 }
66 function update_strings()
67 {
68 $this->s_title = _("GOsa settings 3/3");
69 $this->s_title_long = _("GOsa settings 3/3");
70 $this->s_info = _("Tweak some GOsa core behaviour");
71 }
74 function execute()
75 {
76 $smarty = get_smarty();
77 $smarty->assign("bool",array(FALSE => _("No"), TRUE => _("Yes")));
78 $smarty->assign("optional", $this->optional);
79 foreach($this->attributes as $attr){
80 $smarty->assign($attr,$this->$attr);
81 }
82 return($smarty -> fetch (get_template_path("../setup/setup_config3.tpl")));
83 }
86 function save_object()
87 {
88 if(isset($_POST['step6a_posted'])){
90 /* Get attributes */
91 foreach($this->attributes as $attr){
92 if(isset($_POST[$attr])){
93 $this->$attr = validate(get_post($attr));
94 }
95 }
97 foreach(array("list_summary","strict_units","noprimarygroup","forceglobals","forcessl","ldapstats","warnssl","compile","debuglevel","session_lifetime") as $name){
98 if(isset($_POST[$name])){
99 $this->optional[$name] = get_post($name);
100 }
101 }
103 if(isset($_POST['ppd_path_active'])){
104 $this->optional['ppd_path_active'] = TRUE;
105 if(isset($_POST['ppd_path'])){
106 $this->optional['ppd_path'] = get_post('ppd_path');
107 }
108 }else{
109 $this->optional['ppd_path_active'] = FALSE;
110 }
112 if(isset($_POST['max_ldap_query_time_active'])){
113 $this->optional['max_ldap_query_time_active'] = TRUE;
114 if(isset($_POST['max_ldap_query_time'])){
115 $this->optional['max_ldap_query_time'] = get_post('max_ldap_query_time');
116 }
117 }else{
118 $this->optional['max_ldap_query_time_active'] = FALSE;
119 }
121 if(isset($_POST['mailQueueScriptPath_active'])){
122 $this->optional['mailQueueScriptPath_active'] = TRUE;
123 if(isset($_POST['mailQueueScriptPath'])){
124 $this->optional['mailQueueScriptPath'] = get_post('mailQueueScriptPath');
125 }
126 }else{
127 $this->optional['mailQueueScriptPath_active'] = FALSE;
128 }
130 if(isset($_POST['kioskpath_active'])){
131 $this->optional['kioskpath_active'] = TRUE;
132 if(isset($_POST['kioskpath'])){
133 $this->optional['kioskpath'] = get_post('kioskpath');
134 }
135 }else{
136 $this->optional['kioskpath_active'] = FALSE;
137 }
139 if(isset($_POST['auto_network_hook_active'])){
140 $this->optional['auto_network_hook_active'] = TRUE;
141 if(isset($_POST['auto_network_hook'])){
142 $this->optional['auto_network_hook'] = get_post('auto_network_hook');
143 }
144 }else{
145 $this->optional['auto_network_hook_active'] = FALSE;
146 }
148 if(isset($_POST['notifydir_active'])){
149 $this->optional['notifydir_active'] = TRUE;
150 if(isset($_POST['notifydir'])){
151 $this->optional['notifydir'] = get_post('notifydir');
152 }
153 }else{
154 $this->optional['notifydir_active'] = FALSE;
155 }
156 }
158 $tmp = $this->check();
159 if(count($tmp) == 0){
160 $this->is_completed = TRUE;
161 }else{
162 $this->is_completed = FALSE;
163 }
164 }
167 function check()
168 {
169 $message = array();
171 if(!is_numeric( $this->optional['session_lifetime'])){
172 $message[] = _("Session lifetime must be a numeric value.");
173 }
175 if(!is_numeric( $this->optional['max_ldap_query_time'])){
176 $message[] = _("Maximal ldap query time must be a numeric value. ");
177 }
179 return($message);
180 }
183 /* Attributes that are interesting for configuration generation */
184 function get_attributes()
185 {
186 $tmp = setup_step::get_attributes();
187 foreach(array("optional") as $attr){
188 $tmp[$attr]= $this->$attr;
189 }
190 return($tmp);
191 }
193 }
195 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
196 ?>