From 1e2c38e92069941b495d8c8e6d4261f3165015a0 Mon Sep 17 00:00:00 2001 From: hickert Date: Mon, 2 Apr 2007 08:37:05 +0000 Subject: [PATCH] Updated setup schema check git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@5949 594d385d-05f5-0310-b6e9-bd551577e9d8 --- setup/class_setupStep7.inc | 78 ++++++++++++++++++++++++-------------- setup/setup_step7.tpl | 55 +++++++++++++++++++++------ 2 files changed, 92 insertions(+), 41 deletions(-) diff --git a/setup/class_setupStep7.inc b/setup/class_setupStep7.inc index 655866515..16414b8dc 100644 --- a/setup/class_setupStep7.inc +++ b/setup/class_setupStep7.inc @@ -22,9 +22,11 @@ class setup_step_7 extends setup_step { - var $checks = array(); + var $checked = array(); + var $not_checked = array(); var $schema_readable = FALSE; var $attributes = array(); + var $display_type = "faild"; function setup_step_7() { @@ -36,11 +38,20 @@ class setup_step_7 extends setup_step function execute() { - $checks = $this->check_schema(); + $this->check_schema(); + $failed_checks = 0 ; + foreach($this->checked as $val) { + if(!$val['STATUS']){ + $failed_checks ++; + } + } $smarty = get_smarty(); + $smarty->assign("display_type",$this->display_type); $smarty->assign("schema_readable",$this->schema_readable); - $smarty->assign("checks",$checks); + $smarty->assign("checks",$this->checked); + $smarty->assign("not_checked",$this->not_checked); + $smarty->assign("failed_checks",$failed_checks); return($smarty -> fetch (get_template_path("../setup/setup_step7.tpl"))); } @@ -55,6 +66,11 @@ class setup_step_7 extends setup_step { if(isset($_POST['step7_posted'])){ + /* Get diplay method */ + if(isset($_POST['display_type']) && in_array($_POST['display_type'],array("failed","checked","all"))){ + $this->display_type = $_POST['display_type']; + } + /* Get attributes */ foreach($this->attributes as $attr){ if(isset($_POST[$attr])){ @@ -95,12 +111,12 @@ class setup_step_7 extends setup_step "STATUS" => FALSE, "IS_MUST_HAVE" => FALSE, "MSG" => "", - "INFO" => _("There is currently no information specified for this schema extension.")); + "INFO" => "");#_("There is currently no information specified for this schema extension.")); /* The gosa base schema */ $checks['gosaObject'] = $def_check; - $checks['gosaObject']['REQUIRED_VERSION'] = "2.4"; + $checks['gosaObject']['REQUIRED_VERSION'] = "22.4"; $checks['gosaObject']['SCHEMA_FILES'] = array("gosa+samba3.schema","gosa.schema"); $checks['gosaObject']['CLASSES_REQUIRED'] = array("gosaObject"); $checks['gosaObject']['IS_MUST_HAVE'] = TRUE; @@ -120,27 +136,23 @@ class setup_step_7 extends setup_step $checks["gosaLockEntry"]["INFO"] = _("Used to lock currently edited entries to avoid multiple changes at the same time."); /* Some other checks */ - - - - /* asdfasdf */ foreach(array( "gosaCacheEntry" => array("version" => "2.4"), "gosaDepartment" => array("version" => "2.4"), "goFaxAccount" => array("version" => "1.0.4", "class" => "gofaxAccount","file" => "gofax.schema"), "goFaxSBlock" => array("version" => "1.0.4", "class" => "gofaxAccount","file" => "gofax.schema"), "goFaxRBlock" => array("version" => "1.0.4", "class" => "gofaxAccount","file" => "gofax.schema"), - "gosaUserTemplate" => array("version" => "2.4", "class" => "posixAccount","file" => "nis.schema"), + "gosaUserTemplate" => array("version" => "22.4", "class" => "posixAccount","file" => "nis.schema"), "gosaMailAccount" => array("version" => "2.4", "class" => "mailAccount","file" => "gosa+samba3.schema"), "gosaProxyAccount" => array("version" => "2.4", "class" => "proxyAccount","file" => "gosa+samba3.schema"), "gosaApplication" => array("version" => "2.4", "class" => "appgroup","file" => "gosa.schema"), - "gosaApplicationGroup" => array("version" => "2.4", "class" => "appgroup","file" => "gosa.schema"), + "gosaApplicationGroup" => array("version" => "22.4", "class" => "appgroup","file" => "gosa.schema"), "GOhard" => array("version" => "2.5", "class" => "terminals","file" => "goto.schema"), "gotoTerminal" => array("version" => "2.5", "class" => "terminals","file" => "goto.schema"), "goServer" => array("version" => "2.4","class" => "server","file" => "goserver.schema"), "goTerminalServer" => array("version" => "2.4", "class" => "terminals","file" => "goto.schema"), "goShareServer" => array("version" => "2.4", "class" => "terminals","file" => "goto.schema"), - "goNtpServer" => array("version" => "2.4", "class" => "terminals","file" => "goto.schema"), + "goNtpServer" => array("version" => "22.4", "class" => "terminals","file" => "goto.schema"), "goSyslogServer" => array("version" => "2.4", "class" => "terminals","file" => "goto.schema"), "goLdapServer" => array("version" => "2.4"), "goCupsServer" => array("version" => "2.4", "class" => array("posixAccount", "terminals"),), @@ -149,22 +161,17 @@ class setup_step_7 extends setup_step "goFaxServer" => array("version" => "2.4", "class" => "gofaxAccount","file" => "gofax.schema"), ) as $name => $values){ - $checks[$name] = $def_check; - if(isset($values['version'])){ - $checks[$name]["REQUIRED_VERSION"] = $values['version']; - } - if(isset($values['file'])){ - $checks[$name]["SCHEMA_FILES"] = array($values['file']); - } - $checks[$name]["CLASSES_REQUIRED"] = array($name); - } - - - - + $checks[$name] = $def_check; + if(isset($values['version'])){ + $checks[$name]["REQUIRED_VERSION"] = $values['version']; + } + if(isset($values['file'])){ + $checks[$name]["SCHEMA_FILES"] = array($values['file']); + } + $checks[$name]["CLASSES_REQUIRED"] = array($name); + } foreach($checks as $name => $value){ - foreach($value['CLASSES_REQUIRED'] as $class){ if(!isset($objectclasses[$name])){ @@ -178,9 +185,9 @@ class setup_step_7 extends setup_step $checks[$name]['STATUS'] = FALSE; if($value['IS_MUST_HAVE']){ - $checks[$name]['MSG'] = sprintf(_("Required objectclass '%s' does not have version %s"), $class, $value['REQUIRED_VERSION']); + $checks[$name]['MSG'] = sprintf(_("The required objectclass '%s' does not have version %s"), $class, $value['REQUIRED_VERSION']); }else{ - $checks[$name]['MSG'] = sprintf(_("Optional objectclass '%s' does not have version %s"), $class, $value['REQUIRED_VERSION']); + $checks[$name]['MSG'] = sprintf(_("The optional objectclass '%s' does not have version %s"), $class, $value['REQUIRED_VERSION']); } }else{ $checks[$name]['STATUS'] = TRUE; @@ -188,7 +195,20 @@ class setup_step_7 extends setup_step } } } - return($checks); + + $this->checked = $checks; + $tmp = $objectclasses; + $not_checked = array(); + foreach($tmp as $name => $val){ + $desc = "no description."; + if(preg_match("/DESC/",$val)){ + $desc = preg_replace("/^.*DESC[ ]*'/i","",$val) ; + $desc = preg_replace("/'.*$/i","",$desc) ; + } + $not_checked[$name] = $desc; + } + + $this->not_checked = $not_checked; } } diff --git a/setup/setup_step7.tpl b/setup/setup_step7.tpl index f4fca9104..f7c829e4e 100644 --- a/setup/setup_step7.tpl +++ b/setup/setup_step7.tpl @@ -1,18 +1,49 @@ +{t}Only display failed tests{/t}
+{t}Display checked object classes{/t}
+{t}Display all objectClasses also not checked but available classes{/t} + + +{if $failed_checks == 0} +

{t}Schema check was completely successful{/t}

+{else} +

{t}The schema check returned the following results{/t}

+{/if} + +
{foreach from=$checks item=val key=key} -
-
- {$key} -
-
- {$checks[$key].INFO} -
+ {if ( $display_type == "failed" && !$checks[$key].STATUS) || + $display_type == "checked" || + $display_type == "all"} -
- {$checks[$key].MSG} -
-
+
+ {$key} + {$checks[$key].INFO} +
+ + {if !$checks[$key].STATUS} + {if $checks[$key].IS_MUST_HAVE} + {$checks[$key].MSG} + {else} + {$checks[$key].MSG} + {/if} + {else} + {$checks[$key].MSG} + {/if} + + {/if} {/foreach} - +
+{if $display_type == "all"} +
+

{t}All available objectClasses{/t}

+ {foreach from=$not_checked item=val key=key} + {$key}   {$val}
+ {/foreach} +
+{/if} -- 2.30.2