Code

Updated setup
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 9 Feb 2007 10:09:53 +0000 (10:09 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 9 Feb 2007 10:09:53 +0000 (10:09 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@5714 594d385d-05f5-0310-b6e9-bd551577e9d8

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

index d4d6026a7c1ab485388c78f3daf782d2446fc0b4..9b2952e108764ac173d91fb9434e8d987be7f777 100644 (file)
@@ -1046,7 +1046,7 @@ li.step4_value, div.step4_value {
 }
 
 li.step4_status, div.step4_status {
-       text-align:right;
+       text-align:center;
     vertical-align: middle;
        overflow: hidden;
        height:2.0em;
index bac087915ed4bd8d0dbd9fb214ff54589e3f0b6d..c1470837a4f47df1943acfd151bcce215bd0f946 100644 (file)
@@ -41,6 +41,9 @@ class setup_step_4 extends setup_step
   var $connect_id = FALSE;
   var $bind_id    = FALSE;
 
+  var $resolve_filter = "*";
+  var $resolve_user   = FALSE;
+
   var $attributes = array("connection","location","admin","password","base","peopleou","peopledn","groupou",
                           "uidbase","encryption","mail","errors");
 
@@ -75,8 +78,15 @@ class setup_step_4 extends setup_step
     /* Assign connection status */
     $smarty->assign("connection_status",$this->get_connection_status());
 
+    /* Addign resolved users */
+    $smarty->assign("resolve_user",$this->resolve_user);
+    if($this->resolve_user){
+      $tmp = $this->resolve_user();
+      $smarty->assign("resolved_users",$tmp);
+      $smarty->assign("resolved_users_count",count($tmp));
+      $smarty->assign("resolve_filter",$this->resolve_filter);
+    }
     return($smarty -> fetch (get_template_path("../setup/setup_step4.tpl")));
-
   }
 
   /* Returns the classnames auf the mail classes */
@@ -105,16 +115,16 @@ class setup_step_4 extends setup_step
 
   function get_connection_status()
   {
-
-    
+    $this->connect_id = FALSE;
+    $this->bind_id    = FALSE;
 
     @ldap_set_option(NULL, LDAP_OPT_DEBUG_LEVEL, 7);
-    $cid = @ldap_connect($this->connection);
+    $this->connect_id = @ldap_connect($this->connection);
       
-    @ldap_set_option($cid, LDAP_OPT_PROTOCOL_VERSION, 3);
-    $ds = @ldap_bind($cid, $this->admin, $this->password);
+    @ldap_set_option($this->connect_id, LDAP_OPT_PROTOCOL_VERSION, 3);
+    $this->bind_id = @ldap_bind($this->connect_id, $this->admin, $this->password);
     
-    if(!$ds){
+    if(!$this->bind_id){
       $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);
@@ -129,9 +139,24 @@ class setup_step_4 extends setup_step
         return("<font color='green'>".$str."</font>");
       }      
     }
-
   }
 
+  
+  function resolve_user()
+  {
+    $filter  = $this->resolve_filter;
+    $ldap = new LDAP("","",$this->connection);
+    $ldap->cd($this->base);
+    $ldap->search("(&(objectClass=person)(|(uid=".$filter.")(cn=".$filter.")))");
+    $tmp = array();
+    while($attrs = $ldap->fetch()){
+      $tmp[$attrs['dn']]=$attrs['dn'];
+      natcasesort($tmp);
+    }
+    return($tmp);
+  }   
+
+
   function save_object()
   {
     foreach($this->attributes as $attr){
@@ -139,6 +164,22 @@ class setup_step_4 extends setup_step
         $this->$attr = $_POST[$attr];
       }
     }
+
+    if(isset($_POST['resolve_user'])){
+      $this->resolve_user = !$this->resolve_user;
+    }
+    
+    if(isset($_POST['resolve_filter'])){
+      $this->resolve_filter = $_POST['resolve_filter'];
+    }
+
+    if(isset($_POST['use_selected_user'])){
+
+      if(isset($_POST['admin_to_use'])){
+        $this->admin = $_POST['admin_to_use'];
+        $this->resolve_user = false;
+      }
+    }
   }
 }
 
index 92fb445dba6ed38d23a869a48a6e33e276ebedd9..c19f3218257d07b70bba758929271a6f0c650f0f 100644 (file)
@@ -18,7 +18,7 @@
                        <input type='text' name='connection' maxlength='80' size='25' value='{$connection}' style='width:100%;'>
                </div>
                <div class='step4_status'>
-                       <input type='submit' value='{t}Try connect{/t}'>
+                       <input type='submit' value='{t}Try connect{/t}' style='width:90%;'>
                </div>
        </div>
        <div style='float:left; width:680px;padding-bottom:10px;'>
                        {t}Admin DN{/t}
                </div>
                <div class='step4_value'>
-                       <input type='text' name='admin' maxlength='80' size='40' value='{$admin}' style='width:100%;'>
+                       
+                       <input type='text' name='admin' maxlength='160' size='40' value='{$admin}' style='width:100%;'>
                </div>
                <div class='step4_status'>
+                       <input type='submit' name='resolve_user' value='{t}Select user{/t}' style='width:90%;' >
                </div>
        </div>
 
+       {if $resolve_user}
+       <div style='float:left; width:680px;padding-bottom:10px;border: solid 1px #CCC;'>
+        <div class='step4_name' style='background-color:#DDD'>
+                       <input type='text' value='{$resolve_filter}' name='resolve_filter'>
+        </div>
+               <div class='step4_value' style='background-color:#CCC'>
+                       <input type='submit' value='{t}Search{/t}' name='resolve_search'>
+        </div>
+               <div class='step4_status'>
+                       <input type='submit' value='{t}Use selected user{/t}' name='use_selected_user' style='width:90%;'>
+               </div>
+               <select name='admin_to_use' size=6 style="width:680px;background-color:#DDD;">                          
+                       {html_options options=$resolved_users selected=$admin}
+               </select>
+       </div>          
+       {/if}
+
        <div class='step4_container'>
                <div class='step4_name'>
                        {t}Admin password{/t}