Code

Udpated setup
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 9 Feb 2007 07:04:42 +0000 (07:04 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 9 Feb 2007 07:04:42 +0000 (07:04 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@5712 594d385d-05f5-0310-b6e9-bd551577e9d8

html/themes/default/style.css
setup/class_setupStep4.inc
setup/setup_step4.tpl

index 0724fa04fc3f5888894b86f962437f9ed2d6d3e1..d4d6026a7c1ab485388c78f3daf782d2446fc0b4 100644 (file)
@@ -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;
 }
index 2f916100bd68146c2371e00a763c62416df91785..b35d3a66b58ed32db63bb43bab14dfc88b4426e7 100644 (file)
@@ -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("<font color='red'>".$str."</font>");
+    }else{
+      if(empty($this->admin)){
+        $str = sprintf(_("Anonymous bind successful on server '%s'. Please specify user and password."),$this->connection); 
+        return("<font color='blue'>".$str."</font>");
+      }else{
+        $str = sprintf(_("Bind as user '%s' successful on server '%s'."),$this->admin,$this->connection);
+        return("<font color='green'>".$str."</font>");
+      }      
+    }
 
-    $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();
-    }
   }
 }
 
index 2ad3175cbbd5f230e4197e2a0d84a8d3e3850ed4..5b02f8ee3252e8288075b5d7e10c16648dce3bfb 100644 (file)
@@ -4,9 +4,10 @@
                        {t}Location description{/t}
                </div>
                <div class='step4_value'>
-                       <input type='text' name='location' maxlength='80' size='25' value='{$location}'>
+                       <input type='text' name='location' maxlength='80' size='25' value='{$location}' style='width:100%;'>
                </div>
                <div class='step4_status'>
+                       
                </div>
        </div>
        <div class='step4_container'>
                        <div style='vertical-align:middle;height:100%;'>{t}Connection url{/t}</div>
                </div>
                <div class='step4_value'>
-                       <input type='text' name='connection' maxlength='80' size='25' value='{$connection}'>
+                       <input type='text' name='connection' maxlength='80' size='25' value='{$connection}' style='width:100%;'>
                </div>
                <div class='step4_status'>
-                       {if !$connection_established}
-                               {t}Connection failed{/t}        
-                       {/if}
-                       <input type='submit' name='next' value='{t}Next{/t}'>
-               </div>
-               <div>
+                       <input type='submit' value='{t}Try connect{/t}'>
                </div>
        </div>
-
+       <div style='float:left; width:680px;padding-bottom:10px;'>
+               {t}Status{/t}: {$connection_status}
+       </div>
+       <br>
        <div class='step4_container'>
                <div class='step4_name'> 
-                       {t}Admin DN{/t}
+                       {t}Base{/t}
                </div>
                <div class='step4_value'>
-                       <input type='text' name='admin' maxlength='80' size='40' value='{$admin}'>
+
+                       {if $namingContextsCount >= 1}
+
+                               <select name='base' style='width:100%;'>                
+                                       {html_options values=$namingContexts output=$namingContexts}
+                               </select>
+                       {else}
+                               <input type='text' name='base' maxlength='80' size='40' value='{$base}' style='width:100%;'>
+                       {/if}
+
                </div>
                <div class='step4_status'>
-                       asd
+               
                </div>
        </div>
 
        <div class='step4_container'>
-               <div class='step4_name'>
-                       {t}Admin password{/t}
+               <div class='step4_name'> 
+                       {t}Admin DN{/t}
                </div>
                <div class='step4_value'>
-                       <input type='password' name='password' maxlength='20' size='20' value='{$password}'>
+                       <input type='text' name='admin' maxlength='80' size='40' value='{$admin}' style='width:100%;'>
                </div>
                <div class='step4_status'>
-                       asd
                </div>
        </div>
+
        <div class='step4_container'>
-               <div class='step4_name'> 
-                       {t}Base{/t}
+               <div class='step4_name'>
+                       {t}Admin password{/t}
                </div>
                <div class='step4_value'>
-                       <input type='text' name='base' maxlength='80' size='40' value='{$base}'>
+                       <input type='password' name='password' maxlength='20' size='20' value='{$password}' style='width:100%;'>
                </div>
                <div class='step4_status'>
-                       <input type='submit' name='get_base' value="{t}Get base{/t}">
                </div>
        </div>
                
 
-{if $connection_established}
+{if 1== 0}
 
                
        <div class='step4_container'>