Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

problems passing value

by grashoper (Monk)
on Feb 26, 2008 at 07:11 UTC ( [id://670244]=perlquestion: print w/replies, xml ) Need Help??

grashoper has asked for the wisdom of the Perl Monks concerning the following question:

Hello all, still struggling with trying to make my helpfile context sensitive, thanks to much assistance from here, I can read in my hash values, and even get them output to screen but for some reason my topic hash values don't survive into the next phase of the operation which would be to force the contents of the iframe to jump to the relevant portion of the helpfile. I figured out how to switch to the correct tab, but no content loads within that tab when I do, how do I get that to happen? Shouldn't a $request->$redirect(tabname); work? some code that sort of works..I think am about 1/2 the way there..
User = $Request->item("Login")->item(); $Site = $Request->item("Site")->item(); $topic= $Request->item("Topic")->item(); my $Referer = $Request->ServerVariables("HTTP_REFERER")->item(); my $string=$Request->ServerVariables("QUERY_STRING")->item(); use CGI; use OLE; $query= new CGI; %ttopics = ( home => 'C1.html', listingmgr => 'C2.html', cma => 'C3.html', ) if (!defined($topic)) { # ...handle error... next; } $nightmare = $ttopics{$topic}; @_=$nightmare; print "@_ is "; if (!defined($target)) { # ...handle error... next; } $Response->Write("Topic is $topic\n"); $Response->Write("my target is $nightmare\n"); if ($Session->{'isAuthenticated'} = 1) { $Response->Redirect($Session->{'this'}); #this is the index file of help website. }
this actually does assign correct value to hash and prints out, this is matching a topic being passed from querystring of a production server to an online help website so thusfar I have managed to pass my value into the site (Proven by printing it out in the actual page generated.. now in the base file, I find a $current variable which sets the tab to be main, I change that to be my help tab(my desired tab if I have a query string) however no help content is displayed until I click that tab again, how can I force it to display something anything but that darn blank window Ok I am posting the 'missing' pieces of the preauth file to see if pc88 is onto something..my apologies for the length of this, I am still new to perl and not sure what info to post. the value of 'this' is the index.asp file and is set in global.asa, I think I now understand why it is not working, its due to the transform which doesn't get called until clicking on the help tab, which is going to be a problem, I was thinking a possible workaround would be to try to input the helpfile into the db and pull it out that way but I am not sure how to go about stuffing an entire series of helpfile into the db, can anyone offer advice on how to go about setting that up so it would work, it would need to connect to db-execute a query with the existing querystring topic as a parameter and populate the iframe with the desired help content.
$User = $Request->item("Login")->item(); $Site = $Request->item("Site")->item(); $topic= $Request->item("Topic")->item(); my $Referer = $Request->ServerVariables("HTTP_REFERER")->item(); my $string=$Request->ServerVariables("QUERY_STRING")->item(); use CGI; use OLE; $query= new CGI; %ttopics = ( home => 'c1.htm', listingmgr => 'c2.htm', ); if (!defined($topic)) { $Response->write("hey we don't have a topic its undefined\n"); # ...handle error... } $nightmare = $ttopics{$topic}; @_=$nightmare; print "@_ is "; if (!defined($nightmare)) { $Response->write("no startpoint specified\n"); # ...handle error... } $Response->Write("Topic is $topic\n"); $Response->Write("my startpoint is $nightmare\n"); #commented out testing values in hash worked #while (my ($topic, $ttopics)=each(%ttopics)){ #$Response->Write("$topic=>$ttopics\n"); #} ### TEMPORARY ALIAS WORKAROUND - Set Site Alias to correct Site Code if ($Site eq "BAY") { $Site = "BRB" } ### END ALIAS WORKAROUND #### SESSION ISSUE WORKAROUND - if already authed or never logged out +undef the session variables #### if ($Session->{'isAuthenticated'} = 1) { $Session->{'isAuthenticated'} = -1; $Session->{'acrobatVersion'} = undef; $Session->{'screenX'} = undef; $Session->{'screenY'} = undef; $Session->{'usrID'} = undef; $Session->{'usrName'} = undef; $Session->{'usrSystem'} = undef; $Session->{'usrAccount'} = undef; $Session->{'usrPassword'} = undef; $Session->{'usrLevel'} = undef; $Session->{'usrEveningContact'} = undef; $Response->Redirect($Session->{'this'.$nightmare}); # this may need to be commented out as this is global!# } # if ($Referer =~ m/mlxchange.com/i) # { my $sql = "SELECT Name1, Name2, Name3, Email, SystemID, AccountID, AccessLvl, MLXChange, PhoneNum, AltNum, Password, ContactEmail, ContactNum FROM ARAdmin.MLSUser WHERE Username = '$User' AND SystemID = '$Site'"; my $MLSUser = ARSselect($sql); if ($MLSUser->{numMatches} == 1) { $Session->{'isAuthenticated'} = 1; $Session->{'acrobatVersion'} = $Request->item("acrobatVers +ion")->item(); $Session->{'screenX'} = $Request->item("screenX")->item(); $Session->{'screenY'} = $Request->item("screenY")->item(); $Session->{'usrID'} = $User; $Session->{'usrName'} = @{@{$MLSUser->{rows}}[0]}[ +0]." ".@{@{$MLSUser->{rows}}[0]}[2]; $Session->{'usrSystem'} = @{@{$MLSUser->{rows}}[0] +}[4]; $Session->{'usrAccount'} = @{@{$MLSUser->{rows}}[0]}[5 +]; $Session->{'usrPassword'} = @{@{$MLSUser->{rows}}[0]}[ +10]; $Session->{'usrLevel'} = @{@{$MLSUser->{rows}}[0]} +[6]; $Session->{'usrEveningContact'} = @{@{$MLSUser->{rows} +}[0]}[9]; if (@{@{$MLSUser->{rows}}[0]}[11]) { $Session->{'usrEmail'} = @{@{$MLSUser->{rows}} +[0]}[11]; } else { $Session->{'usrEmail'} = @{@{$MLSUser->{rows}} +[0]}[3]; } if (@{@{$MLSUser->{rows}}[0]}[7] == 2) { $Session->{'usrType'} = "Pro"; } else { $Session->{'usrType'} = "Std"; } if (uc($User) eq "NAT") { $Session->{'usrClass'} = "8"; } else { $Session->{'usrClass'} = "0"; } if (@{@{$MLSUser->{rows}}[0]}[12]) { $Session->{'usrDayContact'} = @{@{$MLSUser->{rows} +}[0]}[12]; } else { $Session->{'usrDayContact'} = @{@{$MLSUser->{rows} +}[0]}[8]; } } else { #$Response->Redirect($Session->{'this'}); } # } if ($Session->{'isAuthenticated'} && $Session->{'trackSession'} && + !$Session->{'SessionTracked'}) { use OLE; my $Conn = CreateObject OLE "ADODB.Connection"; $Conn->Open("PROVIDER=SQLOLEDB;DATA SOURCE=$Session->{'sqlServ +er'};UID=$Session->{'sqlUser'};PWD=$Session->{'sqlPass'};DATABASE=$Se +ssion->{'dbName'}"); my $RS = $Server->CreateObject("ADODB.Recordset"); my $RS2 = $Server->CreateObject("ADODB.Recordset"); my $sql = "INSERT into t_Sessions (Site, SessionDate, Session +ID, System, Account, UserLevel, UserType, UserID, Name, UserClass, Us +erIP, UserAgent, UserResolution, UserAcrobatVer, UserTimeSpent, Refer +rer) values ('". substr($Request->ServerVariables("SERVER_NAME")->ite +m(),0,50). "','". MSSQLDate($Session->{'timeStart'}). "','". $Session->{'SessionID'}. "','". substr(uc($Session->{'usrSystem'}),0,3). "','". substr(uc($Session->{'usrAccount'}),0,3). "','". substr($Session->{'usrLevel'},0,5). "','". substr($Session->{'usrType'},0,3). "','". substr($Session->{'usrID'},0,15). "','". substr($Session->{'usrName'},0,50). "','". substr($Session->{'usrClass'},0,10). "','". substr($Request->ServerVariables("REMOTE_ADDR")->ite +m(),0,15). "','". substr($Request->ServerVariables("HTTP_USER_AGENT")- +>item(),0,255). "','". substr($Session->{'screenX'}."x".$Session->{'screenY +'},0,10). "','". $Session->{'acrobatVersion'}. "','0','". substr($Request->ServerVariables("HTTP_REFERER")->it +em(),0,255). "');"; if ($Session->{'trackDB'}){lg("DB","$sql");} $RS = $Conn->Execute($sql); my $sqlQ = "SELECT idSession FROM t_Sessions WHERE SessionID='$Session->{'SessionID'}' AND SessionDate = '".MSSQLDate($Session->{'ti +meStart'})."';"; if ($Session->{'trackDB'}){lg("DB","$sqlQ");} $RS2->Open($sqlQ, $Conn); if (!$RS2->EOF()) { $Session->{'idSession'} = $RS2->Fields('idSession')->{Valu +e}; $RS2->Close; $Session->{'SessionTracked'} = 1; } $Conn->Close; #$Response->Redirect($Session->{'this'}); }

Replies are listed 'Best First'.
Re: problems passing value
by pc88mxer (Vicar) on Feb 26, 2008 at 14:35 UTC
    Not directly related to your question, but I just spotted this:

    if ($Session->{'isAuthenticated'} = 1)

    I think you want == here.

Re: problems passing value
by gman (Friar) on Feb 26, 2008 at 10:36 UTC

    I'm I understanding you correctly, that you are generating a hyperlink ex. http://somesite.com/helppage#bookmark ? But you need to specify a target

    <a href="http://somesite.com/helppage#bookmark" target="some frame or window"> text </a>

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://670244]
Approved by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (4)
As of 2024-03-28 18:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found