Code

Set setup attribute 'list_summary' to false as default.
[gosa.git] / setup / class_setupStep_Schema.inc
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_Schema extends setup_step
24 {
25   var $checked = array();
26   var $not_checked = array();
27   var $schema_readable  = FALSE;
28   var $attributes       = array("enable_schema_check","samba_version");
29   var $enable_schema_check = TRUE;
30   var $samba_version       = 3;
32   function Step_Schema()
33   {
34     $this->update_strings();
35   }
37   
38   function update_strings()
39   {
40     $this->s_title      = _("LDAP schema check");
41     $this->s_title_long = _("LDAP schema check");
42     $this->s_info       = _("Perform test on your current LDAP schema");
43   }
45   
46   function execute()
47   {
48     $this->check_schema();
49     $failed_checks = 0 ; 
50     foreach($this->checked as $val) {
51       if(!$val['STATUS']){
52         $failed_checks ++;
53       }
54     }
56     if($failed_checks == 0){
57       $this->is_completed = TRUE;
58     }else{
59       $this->is_completed = TRUE;
60     }
62     $smarty = get_smarty();
63     $smarty->assign("bool",array(FALSE => _("No"), TRUE => _("Yes")));
64     $smarty->assign("schema_readable",$this->schema_readable);
65     $smarty->assign("enable_schema_check",$this->enable_schema_check);
66     $smarty->assign("checks",$this->checked);
67     $smarty->assign("not_checked",$this->not_checked);
68     $smarty->assign("failed_checks",$failed_checks);
69     return($smarty -> fetch (get_template_path("../setup/setup_schema.tpl")));
70   }
72   function save_object()
73   {
74     if(isset($_POST['step7_posted'])){
76       /* Get attributes */
77       foreach($this->attributes as $attr){
78         if(isset($_POST[$attr])){
79           $this->$attr = validate($_POST[$attr]);
80         }
81       }
82     }
83   }
85   function check_schema()
86   {
87     $cfg = $this->parent->captured_values;
88     $rfc2307bis = $cfg['rfc2307bis'];
89     $this->checked = check_schema($cfg,$rfc2307bis);
91     /* Get objectclasses */
92     $ldap = new LDAP($cfg['admin'],$cfg['password'],$cfg['connection'] ,FALSE,$cfg['tls']);
93     $objectclasses = $ldap->get_objectclasses();
94     if(count($objectclasses) == 0){
95       print_red(_("Can't get schema information from server. No schema check possible!"));
96     }
98     /* Which samba version do we use? */
99     if(isset($objectclasses['sambaSamAccount'])){
100       $this->samba_version = 3;
101     } elseif(isset($objectclasses['sambaAccount'])) {
102       $this->samba_version = 2;
103     }else{
104       $this->samba_version = 0;
105     }
106   }
109 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
110 ?>