From 81ddbd5e24d4e99439933ab7f734320f616ba86f Mon Sep 17 00:00:00 2001 From: hickert Date: Fri, 9 Feb 2007 07:04:42 +0000 Subject: [PATCH] Udpated setup git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@5712 594d385d-05f5-0310-b6e9-bd551577e9d8 --- html/themes/default/style.css | 7 +++-- setup/class_setupStep4.inc | 53 ++++++++++++++++++----------------- setup/setup_step4.tpl | 49 ++++++++++++++++++-------------- 3 files changed, 60 insertions(+), 49 deletions(-) diff --git a/html/themes/default/style.css b/html/themes/default/style.css index 0724fa04f..d4d6026a7 100644 --- a/html/themes/default/style.css +++ b/html/themes/default/style.css @@ -1033,13 +1033,13 @@ li.step4_name, div.step4_name { vertical-align: middle; float:left; overflow: hidden; - width:200px; + width:160px; height:2.0em; } li.step4_value, div.step4_value { float:left; - width:200px; + width:360px; overflow: hidden; vertical-align: middle; height:2.0em; @@ -1051,12 +1051,13 @@ li.step4_status, div.step4_status { overflow: hidden; height:2.0em; text-decoration: none; + background-color: #BBBBBB; } ul.step4_container, div.step4_container { border: solid 1px #CCC; - width:500px; + width:680px; height:2.0em; float:left; } diff --git a/setup/class_setupStep4.inc b/setup/class_setupStep4.inc index 2f916100b..b35d3a66b 100644 --- a/setup/class_setupStep4.inc +++ b/setup/class_setupStep4.inc @@ -62,12 +62,19 @@ class setup_step_4 extends setup_step $smarty->assign($attr,$this->$attr); } - $smarty->assign("connection_established",$this->is_connection_established()); - $smarty->assign("peopledns",array("uid","cn")); $smarty->assign("crypt_methods",$this->crypt_methods); $smarty->assign("mail_methods",$this->mail_methods); + + $attr = @LDAP::get_naming_contexts($this->connection); + unset($attr['count']); + $smarty->assign("namingContexts",$attr); + $smarty->assign("namingContextsCount",count($attr)); + + /* Assign connection status */ + $smarty->assign("connection_status",$this->get_connection_status()); + return($smarty -> fetch (get_template_path("../setup/setup_step4.tpl"))); } @@ -96,34 +103,35 @@ class setup_step_4 extends setup_step return($methods); } - /* Check if specified server is reachable */ - function is_connection_established() + function get_connection_status() { + + @ldap_set_option(NULL, LDAP_OPT_DEBUG_LEVEL, 7); $cid = @ldap_connect($this->connection); $ds = @ldap_bind($cid, $this->admin, $this->password); @ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3); - } - - - function try_to_get_base_automatically() - { - - @ldap_set_option(NULL, LDAP_OPT_DEBUG_LEVEL, 7); - $cid = @ldap_connect($this->connection); - - $ds = @ldap_bind($cid); - @ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3); + + if(!$ds){ + $str = sprintf(_("Anonymous bind failed on server '%s'."),$this->connection); + if(!empty($this->admin)){ + $str = sprintf(_("Bind as user '%s' failed on server '%s'."),$this->admin,$this->connection); + } + return("".$str.""); + }else{ + if(empty($this->admin)){ + $str = sprintf(_("Anonymous bind successful on server '%s'. Please specify user and password."),$this->connection); + return("".$str.""); + }else{ + $str = sprintf(_("Bind as user '%s' successful on server '%s'."),$this->admin,$this->connection); + return("".$str.""); + } + } - $sr= ldap_search ($ds, NULL, "objectClass=*", array("namingContexts")); - $attr= ldap_get_entries($cid,$sr); - echo ldap_error($cid); - print_a($attr); } - function save_object() { foreach($this->attributes as $attr){ @@ -131,11 +139,6 @@ class setup_step_4 extends setup_step $this->$attr = $_POST[$attr]; } } - - /* Get base automatically */ - if(isset($_POST['get_base'])){ - $this->try_to_get_base_automatically(); - } } } diff --git a/setup/setup_step4.tpl b/setup/setup_step4.tpl index 2ad3175cb..5b02f8ee3 100644 --- a/setup/setup_step4.tpl +++ b/setup/setup_step4.tpl @@ -4,9 +4,10 @@ {t}Location description{/t}
- +
+
@@ -14,55 +15,61 @@
{t}Connection url{/t}
- +
- {if !$connection_established} - {t}Connection failed{/t} - {/if} - -
-
+
- +
+ {t}Status{/t}: {$connection_status} +
+
- {t}Admin DN{/t} + {t}Base{/t}
- + + {if $namingContextsCount >= 1} + + + {else} + + {/if} +
- asd +
-
- {t}Admin password{/t} +
+ {t}Admin DN{/t}
- +
- asd
+
-
- {t}Base{/t} +
+ {t}Admin password{/t}
- +
-
-{if $connection_established} +{if 1== 0}
-- 2.30.2