]> git.entuzijast.net Git - freeradius-dialup-admin.git/commitdiff
In user_new show a select box with all the available groups. Based on an idea by...
authorkkalev <kkalev>
Tue, 28 Jan 2003 14:14:53 +0000 (14:14 +0000)
committerkkalev <kkalev>
Tue, 28 Jan 2003 14:14:53 +0000 (14:14 +0000)
Changelog
htdocs/user_new.php3
lib/sql/defaults.php3

index 1e4dd0c937dd4279cc13a583cab01bb2630f5866..1eec2b9d705f7be6f485112988ca13f9e3b8a2d3 100644 (file)
--- a/Changelog
+++ b/Changelog
@@ -33,6 +33,7 @@ Ver 1.62:
 * Fix a small bug in lib/ldap/create_user.php3. Unset the mod array before adding any values to it.
 * Fix a small problem with debugging
 * Do a write lock in radacct before truncating it in truncate_radacct
+* In user_new show a select box with all the available groups. Based on an idea by Karel Stadler (kstadler)
 Ver 1.61:
 * Add a string encoder for greek
 * If general_decode_normal_attributes is set then encode attributes in lib/ldap/change_info. In the near future
index 145b9833bb88996da2386ba79b4d70f95c8f5a65..c2eb99356e64b31377d9cb5aaf7a8ac13e408c68 100644 (file)
@@ -91,13 +91,19 @@ EOM;
 EOM;
        if ($config[general_lib_type] == 'sql'){
                if (isset($member_groups))
-                       $group = $member_groups[0];
+                       $selected[$member_groups[0]] = 'selected';
                echo <<<EOM
        <tr>
                <td align=right colspan=$colspan bgcolor="#d0ddb0">
                Group
                </td><td>
-               <input type=text name="Fgroup" value="$group" size=35>
+               <select name="Fgroup">
+EOM;
+               foreach ($member_groups as $group)
+                       echo "<option value=\"$group\" $selected[$group]>$group\n";
+
+               echo <<<EOM
+               </select>
                </td>
        </tr>
 EOM;
index bd2a701eff46f9e9c4688cc004fca0cd0d11dc41..d144bc3f1ff2d4b0d373b13f128a6bfd9b92d7c0 100644 (file)
@@ -110,4 +110,26 @@ if ($login != ''){
                        echo "<b>Could not connect to SQL database</b><br>\n";
        }while($stop == 0);
 }
+else{
+       if (is_file("../lib/sql/drivers/$config[sql_type]/functions.php3"))
+               include_once("../lib/sql/drivers/$config[sql_type]/functions.php3");
+       else{
+               echo "<b>Could not include SQL library</b><br>\n";
+               exit();
+       }
+       unset($member_groups);
+       $link = @da_sql_pconnect($config);
+       if ($link){
+               $res = @da_sql_query($link,$config,
+               "SELECT DISTINCT GroupName FROM $config[sql_usergroup_table];");
+               if ($res){
+                       while(($row = @da_sql_fetch_array($res,$config)))
+                               $member_groups[] = $row[GroupName];
+               }
+               else
+                       echo "<b>Database query failed: " . da_sql_error($link,$config) . "</b><br>\n";
+       }
+       else
+               echo "<b>Could not connect to SQL database</b><br>\n";
+}
 ?>