Gossamer Forum
Home : Products : DBMan : Customization :

After login, bypass HOME page, then go to modify_form_record of individual

Quote Reply
After login, bypass HOME page, then go to modify_form_record of individual
First up, I would like to say the support of the people in and that run this forum and at Gossamer is just simply fantastic!

Great job gals and guys !!

Hats off to JPD, Paul, Watt, LoisC, Alex, etc, etc !
(I have been reading the heck out of the forums for an answer.)

--------------------
Now,
I need to beg your help.
:)

I have a DBman database that I am trying to set up. I am well versed in html, but I am a perl-newbie (also programing-in-general-newbie). With that said, I have a database that I have (1) db.cgi file, but I want to have several "looks" or levels of interaction to it. I have figured out how to do most of it simply by using multiple "html.pl"s and multiple "defaults.cfg" files (they do have individual names, btw.) I want to use (1) copy of all the other files if possible. I have my eye on several MODs, but can only install what won't throw a monkey wrench into my basic design (I will worry about that later, as they are luxuries).

I have all the data fields and generated displayed pages like I want to this point, but the problem is getting "streamed-lined navigation" to them.

So basicly, I want to leave the db.cgi alone as much as possible, but want to "streamline my navigation" through out my database and reduce it to as few "clicks" as possible. I figure the best way to do this is to do it on the individual html.pl pages on each of the "sub htmL_XXXX_XXX"s I need to "tweak", if possible.

I think the way to do this (without being a perl guru such as L.C or JPD) is to edit the individual html.pl files and add code to get the "automatic bypasses" that I desire.


HERE is what I need:
What I am stuck on, is on my last "level", I need a way to get a successfully logged in user from the "login" to a their individual record at "modify_form_record". My "db key" is -NOT- my "userid", this is what makes it so hard, as I have seen JPD's examples on using the "ID" to do this way (if userid is id):


JPDs code where she helped someone else that used "userid" FOR "ID" (db key):
(it would be inserted into the top of sub html_home



###### send user to their record after login ######
unless ($per_admin) {
$in{$db_key} = $db_userid;
&view_records;
return;
}



The only problem with this is for me is, my userid is NOT the same as my DB's key.

SO, I need code that takes "userid" and searchs the DB and finds that person's record's ID (db key). I have figured out how to do this sort of, but it requires a person to "CLICK" a link. I am lookomg for a way to have the program do it with out a click needed.

Here is a code that generates a hyper link that has to be "clicked" to and individual logged in user to their individual record:


<$font1><a href="!; print $db_dir_url; print qq!/db.cgi?db=CONFIGTHREE&uid=!; print $db_uid; print qq!&USERIDFIELD=!; print $db_userid; print qq!&modify_form=search"><b>to EDIT Menu</b></a></font>

(this uses a .cfg file named "configthree.cfg" and the userid field is named "useridfield")

This works, I can generate the link for indivduals users, but it must be "clicked" to go there. What I am looking for a way in code to automaticly and to "bypass" or skip" the HOME page.

Here is what my newbie-code would look something like:
(You perl Gurus will like this,lol)


Ok, on the last one of my DBman's html.pl's "sub html_home" at the top of it, I add something like this:




# Only logged in users, that have records
# and will have used the "configthree.cfg
# permissions" will get here. Their "userid" is NOT
# their "ID", the DB tracks the db key of "ID".
# Users will have permission to modify, delete,
# but not search, their record will have already
# been added. The "$show_home_page" shows
# the home page, but only for admin only.


sub html_home {

if ($per_admin) {
&show_home_page;
}


else {

#<--START INSERT of PERL GURU's CODE HERE:----------


# Take the user's "$db_userid" from log in and search the DB for his/her record.
# Find the user's "ID" number, then insert the user's "ID" (db key) into a "$magic_variable",
# then stick it in "$in{'modify'} for the $modify_form_record,
# so it will "&get_record"$in{'modify'}" that person's record.

do "$magic_search_of_db_by_user's_userid_for_their_id_code_and_set_$in{'modify'}_to_it"


#------END of PERL GURU's CODE----->

$in{'modify'} = $magic_variable;
&html_modify_form_record;
return;

}
;



sub show_home_page {
# print a home page for admin to use only.

print "I am happy now etc etc.";
}
;




Ok, what I need is a the actual code for the "<----insert code of perl Guru-----End perl Guru's code>" part.
Someone, please help me?

As you can see, "My" version of the code does not work.
:)
Please, help me please?


PS....


Here is some other code, BUT it jumps the logged user to their view_record, and I want to jump them to their modify_form_record of their record:

$in{'userid'} = $db_userid;
my ($status, @hits) = &query(''view'');
if ($status eq ''ok'') {
&html_view_success(@hits);
}
else {
&html_add_form;
}



Last edited by:

perl-apprentice: Dec 11, 2001, 9:24 PM
Quote Reply
Re: [perl-apprentice] After login, bypass HOME page, then go to modify_form_record of individual In reply to
Hi all,
After login successfully, you could redirect user to the modify page.

Cheers,

Beck
Quote Reply
Re: [Beck] After login, bypass HOME page, then go to modify_form_record of individual In reply to
Here's what I use, place it in the html code in the proper subroutine:

Code:
<META HTTP-EQUIV = REFRESH CONTENT = "0; URL=$db_script_link_url&userid=$in{'userid'}&modify_form=1&ID=$in{'ID'}&type=order">

Change the 0; to a higher number for a longer delay before it sends the user on his/her way.

Note: this is an example. You'll need to change the db link as needed for your purposes. Also note the $in{'fieldname'}
as opposed to $rec{'fieldname'}.

Hope this helps you...

Quote Reply
Re: [Watts] After login, bypass HOME page, then go to modify_form_record of individual In reply to
Thanks Watt,
I know that this "redirect" would work, I had though about this, but what I am looking for is a way to do it "in" the program it's self. Instead of having the program send a page to the user, then the user's browser have to read the redirect and sending that back to the program, then having to wait for the modify-form-record to be finally sent.

I do appreciate your help, thanks.

I am looking for a "magic_script" that coverts a "userid" (login name) to "id" (db key) after login and puts it in the "$magic_variable". I would then feed the $magic_variable which contains the user's 'looked up' "ID" number (which is the db's key) and then uses that to feed it to the "$in{'modify'}" variable. Then send the program to the the sub modify_form_record where it will use the "$in{'modify'}" to get and display the person's sole record for display/modification.

Your way will work, I am just looking for a faster way, that trims need for the internet redirect.

Thank you for your help and your time.

I am still looking for the code for the "magic_script", someone please help, please?
Quote Reply
Re: [perl-apprentice] After login, bypass HOME page, then go to modify_form_record of individual In reply to
Thank you BECK too.

I am well versed in html, but I didn't mention the meta tag approach, because I figured it would confuse people as to what I am looking for (ie the "magic_script" approach). Your answer is correct, I am just looking for a quicker way that cuts down the web traffic as small as possible.
Thanks.
Quote Reply
Re: [perl-apprentice] After login, bypass HOME page, then go to modify_form_record of individual In reply to
Yep you're right. Even with the "timer" set to 0, there is a bit of a delay (about a second or two). It especially depends on how big your script is, how fast the connection is, etc. If you absolutely run into a wall and want to use the redirect tag, here is what I do. For example in modify_success, instead of showing the record they just modified I throw in the meta tag and then center a very light grey text (size 5) on the screen that says "Please wait while we process your record" and then it takes them to wherever we want them to go.

Wish I could be of more help.

Mike.

Quote Reply
Re: [perl-apprentice] After login, bypass HOME page, then go to modify_form_record of individual In reply to
Maybe what I am looking for is a way to chop up the info contained my example hyper link above and feed it in perl code to the program at "modify_form", then have modify_form shoot it over to the person's record at modify_form_record, since each person only has one record.

( Just dont know how to do this "in" the perl code, I can do it over the web using "html + perl", but it requires extra web traffic and browser delay time.)
Quote Reply
Re: [perl-apprentice] After login, bypass HOME page, then go to modify_form_record of individual In reply to
The ""Please wait while we process your record"" is a good general html trick Watts, good idea. When I absolutely have to have something like this, I have this neat little "animated watch .gif", that shows a clocks hand moving or "counting down". It communicates the idea of "you have to wait and we are doing something" very well. Do you want a copy of the watch.gif ?


Back to my problem, thats turning my hair greyer, I think I need to chop up the "userid= $db_userid", then feed it to the modify_form and let it do the seach, but I just don't know how to write the code in perl. I have figured how the program reacts to html, I and I have a html solution, but I want to trim web traffic, if possible.

PS...
I wrote my first "if, else" statement ever the other day and actually USED some code I wrote in this little DBman project, it was life moving. lol . It made me feel like a kid at Christmas to "make code" that I needed and use it to "fix" a problem.

If I ever learn this perl stuff, I will be unstoppable and ready to take on the World.
lol
:)
Quote Reply
Re: [perl-apprentice] After login, bypass HOME page, then go to modify_form_record of individual In reply to
Maybe another way to "do it in the perl code", would to have a generic sub that basic acted like a personson's browser (minus the html).

So instead of a person's browser handling the mata redirect, perl code would handle the commands and send them to the db.cgi to rread and route them.

This ttype od solution would be a "generic" fix, that would not only work for me, but with a little adaptation would work for any person wanting to "jump around" from panel to panel. Possible, this would be a "Mod" idea for one of those "Perl Gurus"?
Quote Reply
Re: [perl-apprentice] After login, bypass HOME page, then go to modify_form_record of individual In reply to
Thanks Watts and Beck,
the redirect good actually well for this porpose. A neat tip is to add a little html "Processing transaction" repaeating "marque" under your "Please wait while your transaction is being processed" message. The marque is all html markup so it's really small in size and only adds a handful more bytes to the "bypass" sub, plus it shows "action" on the user's displayed bypass page.


I made a little generic recyclable bypass page that works well.

Thanks again.
Quote Reply
Re: [perl-apprentice] After login, bypass HOME page, then go to modify_form_record of individual In reply to
You might want to check this thread it may provide a simple solution using the userid rather that ID field.

http://www.gossamer-threads.com/perl/gforum/gforum.cgi?post=52640;search_string=Bypass%20html_home;#52640

Hope this helps


Unoffical DBMan FAQ

http://creativecomputingweb.com/dbman/index.shtml/
Quote Reply
Re: [LoisC] After login, bypass HOME page, then go to modify_form_record of individual In reply to
Once again it I have to THANK YOU to all the great people in this forum.

Also thanks to LC too. I guess since LoisC helps so many people, he too should be granted the honor of having an abbreviated name like the famed JPD does. Thanks LC!

What I decended to do after much thought and sawdust burn was to just use the meta redirect approach, as I do not have userid = db_key. I actually wrote a little "Bypass Page MOD" of sorts out ofthis to recycle it when I needed a short cut. The "jump to logged users' modify record" works great. My concerns about the html redirect delay time seems to be unfounded by the way Beck and Watts, but I guess you guys already knew that :). I use a heavily modified html.pl and if I find the time, I will try to write a "Bypass Page Navigation Mod" that would jump past the pages that are not need, there would have to be a few qualifiers on its use. I am still a 'perl-apprentice' and need justa little more perl OJT.

Thanks again to everyone that helped!

perl-apprentice