Gossamer Forum
Home : Products : DBMan : Installation :

how many users maximum / sort users in administration

Quote Reply
how many users maximum / sort users in administration
Two questions:

1. Perhaps a stupid question:
i have a database where 5000 members should be able to modify a record assigned to them. But what will it do when i call admin. Then a file is created with all names in the option. Is it possible to delete the given option list and to give the administrator only a empty field where he can put the name of a user and then start the inquiry.

2. Is it possible to sort the users by userid? Now i get with the option list a very confusable list...
Quote Reply
Re: how many users maximum / sort users in administration In reply to
Not without a whole lot of work to the admin_display subroutine in db.cgi. I'm afraid I can't help you with this one right now.

------------------
JPD
Quote Reply
Re: how many users maximum / sort users in administration In reply to
Okay. If you just want a blank field, that's a little (a lot!) easier than sorting the names.

In db.cgi, sub admin_display

change

$user_list = qq~<select name="username"><option> </option>~;

to

$user_list = qq~<input type=text name="username"~;


change

$user_list .= qq~<option value="$data[0]" SELECTED>$data[0]</option>\n~;

to

$user_list .= qq~ value="$data[0]"~;


delete

else {
$user_list .= qq~<option value="$data[0]">$data[0]</option>\n~;
}


change

$user_list .= "</select>";

to

$user_list .= " size=12>";

That should do it, although I haven't tried it.



------------------
JPD
Quote Reply
Re: how many users maximum / sort users in administration In reply to
I hope you can help me: i want that userlist shouldn't be shown to the administrator( it is too long and it is unsorted). So what should be changed in db.cgi?

the administrator has to inquire each user.
Thanks!!
Quote Reply
Re: how many users maximum / sort users in administration In reply to
Well, it took me a while, but I figured out how to sort the user list in the admin display. The only thing is that it sorts the uppercase letters first and then the lowercase letters. Still, it should help if you've got a lot of users on your system.

In db.cgi, sub admin_display

change

Code:
# If we are inquiring, let's look for the specified user.
my (@data, $user_list, $perm, $password);
$user_list = qq~<select name="username"><option> </option>~;
LINE: foreach $line (@lines) {
$line =~ /^#/ and next LINE;
$line =~ /^\s*$/ and next LINE;
chomp $line;
@data = split (/:/, $line);
if ($in{'inquire'} and ($in{'username'} eq $data[0])) {
$user_list .= qq~<option value="$data[0]" SELECTED>$data[0]</option>\n~;
$perm = qq|
View <input type=checkbox name="per_view" value="1" |;
($data[2] and $perm .= "CHECKED"); $perm .= qq|>
Add <input type=checkbox name="per_add" value="1" |;
($data[3] and $perm .= "CHECKED"); $perm .= qq|>
Delete <input type=checkbox name="per_del" value="1" |;
($data[4] and $perm .= "CHECKED"); $perm .= qq|>
Modify <input type=checkbox name="per_mod" value="1" |;
($data[5] and $perm .= "CHECKED"); $perm .= qq|>
Admin <input type=checkbox name="per_admin" value="1" |;
($data[6] and $perm .= "CHECKED"); $perm .= qq|>|;
$password = $data[1];
}
else {
$user_list .= qq~<option value="$data[0]">$data[0]</option>\n~;
}
}
$user_list .= "</select>";

to

Code:
# If we are inquiring, let's look for the specified user.
my (@data, $user_list, $perm, $password);
$user_list = qq~<select name="username"><option> </option>~;
LINE: foreach $line (@lines) {
$line =~ /^#/ and next LINE;
$line =~ /^\s*$/ and next LINE;
chomp $line;
@data = split (/:/, $line);
push (@users,$data[0]);
if ($in{'inquire'} and ($in{'username'} eq $data[0])) {
$password = $data[1];
$perm = qq|
View <input type=checkbox name="per_view" value="1" |;
($data[2] and $perm .= "CHECKED"); $perm .= qq|>
Add <input type=checkbox name="per_add" value="1" |;
($data[3] and $perm .= "CHECKED"); $perm .= qq|>
Delete <input type=checkbox name="per_del" value="1" |;
($data[4] and $perm .= "CHECKED"); $perm .= qq|>
Modify <input type=checkbox name="per_mod" value="1" |;
($data[5] and $perm .= "CHECKED"); $perm .= qq|>
Admin <input type=checkbox name="per_admin" value="1" |;
($data[6] and $perm .= "CHECKED"); $perm .= qq|>|;
}
}
foreach $user (sort @users) {
if ($in{'inquire'} and ($in{'username'} eq $user)) {
$user_list .= qq~<option value="$user" SELECTED>$user</option>\n~;
}
else {
$user_list .= qq~<option value="$user">$user</option>\n~;
}
}
$user_list .= "</select>";



------------------
JPD




[This message has been edited by JPDeni (edited March 10, 1999).]