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 setup_step_6 extends setup_step
24 {
25 var $strict = TRUE;
26 var $governmentmode = FALSE;
27 var $sambaidmapping = FALSE;
28 var $minid = 100;
29 var $account_expiration =FALSE;
31 var $generic_settings = array( "idgen" => "{%sn}-{%givenName[2-4]}",
32 "idgen_active" => FALSE,
33 "minid" => "100",
34 "minid_active" => FALSE,
35 "wws_ou" => "ou=winstations",
36 "wws_ou_active" => FALSE,
37 "snapshot_active"=> FALSE,
38 "snapshot_base" => "ou=snapshots,dc=server,dc=de",
39 "snapshot_user" => "cn=ldapadmin,dc=server,dc=de",
40 "snapshot_password" => "",
41 "snapshot_server" => "ldap://localhost:386");
43 var $samba_settings = array( "samba_sid" => "0-815-4711",
44 "samba_sid_active" => FALSE,
45 "samba_rid" => 1000,
46 "samba_rid_active" => FALSE);
47 var $attributes = array("strict","governmentmode","sambaidmapping","minid","account_expiration");
49 function setup_step_6()
50 {
51 $this->s_title = _("GOsa settings 2/2");
52 $this->s_title_long = _("GOsa generic settings, page 2/2");
53 $this->s_info = _("This dialog allows you to setup GOsa behaviour");
54 }
57 function execute()
58 {
59 $smarty = get_smarty();
60 $smarty->assign("generic_settings",$this->generic_settings);
61 $smarty->assign("samba_settings",$this->samba_settings);
62 $smarty->assign("bool",array(FALSE => _("No"), TRUE => _("Yes")));
63 foreach($this->attributes as $attr){
64 $smarty->assign($attr,$this->$attr);
65 }
66 return($smarty -> fetch (get_template_path("../setup/setup_step6.tpl")));
67 }
69 function save_object()
70 {
71 if(isset($_POST['step6_posted'])){
73 /* Get attributes */
74 foreach($this->attributes as $attr){
75 if(isset($_POST[$attr])){
76 $this->$attr = validate($_POST[$attr]);
77 }
78 }
80 /* Generic settings */
81 if(isset($_POST['idgen_active'])){
82 $this->generic_settings['idgen_active'] = TRUE;
83 if(isset($_POST['idgen'])){
84 $this->generic_settings['idgen'] = $_POST['idgen'];
85 }
86 }else{
87 $this->generic_settings['idgen_active'] = FALSE;
88 }
89 if(isset($_POST['snapshot_active'])){
90 $this->generic_settings['snapshot_active'] = TRUE;
91 if(isset($_POST['snapshot_base'])){
92 $this->generic_settings['snapshot_base'] = $_POST['snapshot_base'];
93 }
94 if(isset($_POST['snapshot_user'])){
95 $this->generic_settings['snapshot_user'] = $_POST['snapshot_user'];
96 }
97 if(isset($_POST['snapshot_password'])){
98 $this->generic_settings['snapshot_password'] = $_POST['snapshot_password'];
99 }
100 if(isset($_POST['snapshot_server'])){
101 $this->generic_settings['snapshot_server'] = $_POST['snapshot_server'];
102 }
103 }else{
104 $this->generic_settings['snapshot_active'] = FALSE;
105 }
107 /* Samba settings */
108 if(isset($_POST['samba_sid_active'])){
109 $this->samba_settings['samba_sid_active'] = TRUE;
110 if(isset($_POST['samba_sid'])){
111 $this->samba_settings['samba_sid'] = $_POST['samba_sid'];
112 }
113 }else{
114 $this->samba_settings['samba_sid_active'] = FALSE;
115 }
116 if(isset($_POST['samba_rid_active'])){
117 $this->samba_settings['samba_rid_active'] = TRUE;
118 if(isset($_POST['samba_rid'])){
119 $this->samba_settings['samba_rid'] = $_POST['samba_rid'];
120 }
121 }else{
122 $this->samba_settings['samba_rid_active'] = FALSE;
123 }
125 }
126 }
127 }
129 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
130 ?>