Gossamer Forum
Home : Products : DBMan : Customization :

A couple of questions about changing some things

Quote Reply
A couple of questions about changing some things
Hello,

Just two questions.

How is it possible to NOT allow users to use all the search options?
Say I only wanted to allow a user to search ONE db field, instead of allowing users to use the * wildcards and basically list all the entires.

Also, how could I list the database in a-z format?

Thank you.


Quote Reply
Re: A couple of questions about changing some things In reply to
In Reply To:
How is it possible to NOT allow users to use all the search options?
Say I only wanted to allow a user to search ONE db field, instead of allowing users to use the * wildcards and basically list all the entires.
You will need to customise your search form, and rather than have a "keyword" field, have a text field for the fields you want to allow them to search on.
eg: <input type="text" name="field_name">

In Reply To:
Also, how could I list the database in a-z format?
You can sort your search results by adding the sb and so options to your search string. eg:
link: db.cgi?db=default&uid=default&view_records=1&ID=*&sb=1&so=ascend
hidden fields: <input type="hidden" name="sb" value="1"> <input type="hidden" name="so" value="ascend">

sb should point to the field number you want to sort on, while so can be set to either descend or ascend

Good luck!

- Mark


Astro-Boy!!
http://www.zip.com.au/~astroboy/
Quote Reply
Re: A couple of questions about changing some things In reply to
Thanks.

But just adding one search option doesn't stop someone with knowledge of DBman to use extra search options.

How could I force people to use options that I set, so noone with DBman knowledge can screw around with it?

Thanks.

Quote Reply
Re: A couple of questions about changing some things In reply to
You could probobly hack in a line to the query sub-routine which stops a KEYWORD search based on user permissions.

For example, say you wanted to stop a keyword search if the current uid was "default":
Code:

# First thing we do is find out what we are searching for. We build a list of fields
# we want to search on in @search_fields.
if ($in{'keyword'}) { # If this is a keyword search, we are searching the same
$i = 0; # thing in all fields. Make sure "match any" option is
$in{'ma'} = "on"; # on, otherwise this will almost always fail.
if ($db_userid eq 'default') { return "you do not have permisson to do keyword searches"; }
foreach $column (@db_cols) {
if (($db_sort{$column} eq 'date') or &date_to_unix($in{'keyword'})) { $i++; next; }
if ($i == $auth_user_field) { $i++; next; }
push (@search_fields, $i); # Search every column
$in{$column} = $in{'keyword'}; # Fill %in with keyword we are looking for.
$i++;
}
}
You could always change the red IF to suit your criteria.

Hope this helps.

- Mark


Astro-Boy!!
http://www.zip.com.au/~astroboy/
Quote Reply
Re: A couple of questions about changing some things In reply to
Thank you. Just one more question.

How could I list the data base by a letter.
So if a persons name starts with A, it will only list the persons records with the letter A in their names.

How could I disable all the other search options too?

Thanks.

Quote Reply
Re: A couple of questions about changing some things In reply to
Search this forum and also the Resource Center for Alphabetical Mod.

Regards,

Eliot Lee
Quote Reply
Re: A couple of questions about changing some things In reply to
Thanks.

I found a nice thread. Smile