Gossamer Forum
Home : Products : DBMan : Customization :

List All after Login

Quote Reply
List All after Login
Hi everyone! I've tried searching the threads but I'm struggling on this one.

I need a user to login to dbman and on pressing the 'submit' button, the user is taken straight to the result of 'List All' of that users records? ie. skip the home menu.

Pointers would be appreciated!

Keef

Quote Reply
Re: List All after Login In reply to
This may not be the greatest way of going about it, but here's how I did it:

In db.cgi:
Towards the top, near all the elsif's, find the code that says:
Code:

elsif ((keys(%in) <= 2) ||
($in{'login'})) { &html_home; }
else { &html_unkown_action; }
Replace &html_home; with &view_records;.

Then under sub view_records { add the following code:

$in{'Type'} = (($in{'Type'}) ? $in{'Type'} : 'Link' );
$in{'sb'} = (($in{'sb'}) ? $in{'sb'} : '0' );
$in{'so'} = (($in{'so'}) ? $in{'so'} : 'descend' );


Take notes of the sections in bold:
In the first line, change all the "Type"s to the field you want to "search" on. Then change "Link" to the value you want to "search" on.
In the second line, change "0" to the field you want to sort on
And in the third line, change "descend" to the order you want search on.

In other words, the above would normally be achieved by the link:
<a href="$db_script_link_url&view_records=1&Type=Link&sb=0&so=descend">

Like I said before though... there could be a better way, if anyone knows of one, let us know Smile

- Mark

Astro-Boy!!
http://www.zip.com.au/~astroboy/
Quote Reply
Re: List All after Login In reply to
If I wanted to do a "List All" after login, I would just change

Code:

elsif ((keys(%in) <= 2) ||
($in{'login'})) { &html_home; }
else { &html_unkown_action; }
to

Code:

elsif ((keys(%in) <= 2) ||
($in{'login'})) { print "Location: $db_script_link_url&view_records=1&$db_key=*\n\n"; }
else { &html_unkown_action; }
Of course, that means that users will never be able to see the home page.

If you wanted to list all when users log in, but allow them to go to the home page (for whatever reason you might), you would change it to

Code:

elsif ($in{'login'}) { print "Location: $db_script_link_url&view_records=1&$db_key=*\n\n"; }
elsif (keys(%in) <= 2) { &html_home; }
else { &html_unkown_action; }
JPD
http://www.jpdeni.com/dbman/
Quote Reply
Re: List All after Login In reply to
See? Told ya! Wink

Thanks Carol Smile

*snip*

- Mark

Astro-Boy!!
http://www.zip.com.au/~astroboy/
Quote Reply
Re: List All after Login In reply to
JP and Mark,

Thanks for the help - both worked but stuck with the JP's fix in the end. Changed it slightly to allow admin still to go to the home page with an if/else statement.

Keef

Quote Reply
Re: List All after Login In reply to
I'd like to this too. It works fine if people log in, however, I set up the database so that people have to add a record first before they can view any of the other records.

If I make these changes a first time login also gets the view all list AND will not be able to add a record since I dissabled the link on the bottom (after making one record there should be no need to add another one).

If anybody has some suggestions it would be grately appreciated.

Ronald