Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Getting the URL for GT Community

Quote Reply
Getting the URL for GT Community
Hi,

I was wondering if anybody new how I can get the URL of the page in order to insert it in the code to pass to GT Community.

I have a quick login system on LinkSQL (an this obviously goes through Community) however since I don't provide the initial pages URL to community then it just stays on the Community home page. So the user will most probably be wondering what is going on when he clicks "login" and then ends up on a page saying 'hello "username" '. I know that I forgot once or twice myself where I had come from when I was surprised by it !

I did a <%GT::Template::dump%> and nothing seems to correspond.

Anybody got any clues ?

Thanks, John
Significant Media

Last edited by:

Jag: Oct 12, 2004, 6:58 PM
Quote Reply
Re: [Jag] Getting the URL for GT Community In reply to
Community Home Page After Login:

<a href="http://yourdomain.tld/path/to/page.cgi?d=1">Directory Service Name</a>

If i have understood your question correctly. The user would have to click this link if login is not from redirection.

HyTC

Thanks
HyTC
==================================
Mail Me If Contacting Privately Is That Necessary.
==================================
Quote Reply
Re: [HyperTherm] Getting the URL for GT Community In reply to
Hi

At the moment I have this :
<form name="myform" action="<%db_cgi_url%>/community.cgi?<%if url%>;url=<%escape_url url%><%endif%>" method="post">

but this is obviously code from community so when I try to use it on the LinkSQL templates there is no <%url%> tag so there is no indication to GT Community as to where it should redirect the user once the user has been authenticated.

I suppose you are saying I should jusy put a link back to the directory. I 've done this but the redirect function in community that kicks in when it comes from a function like add.cgi and redirects the user to the add.cgi page once he has been authenticated is very user friendly.

I was thinking there was some way to pull the URL from the originating page so as to enable this cool redirecting Unsure

Thanks for your input,

John
Significant Media
Quote Reply
Re: [Jag] Getting the URL for GT Community In reply to
Aah ok.
If you want to put a community_login box on LinksSQL and would want that once the user is authenticated he is back as logged in on Linkssql page w/o going thru community really.

If that be it, then just an idea.

Check what the redirection url is when you click on user.cgi or something (with community installed and integrated)

If that redirection url can also be passed as a hidden field on your Login interface on Link SQL. Just a suggestion for a try though. Can't really say if it'll work

HyTC

Thanks
HyTC
==================================
Mail Me If Contacting Privately Is That Necessary.
==================================

Last edited by:

HyperTherm: Oct 12, 2004, 7:35 PM
Quote Reply
Re: [HyperTherm] Getting the URL for GT Community In reply to
Ok

that sounds interesting I'll give it a whirl Wink

John
Significant Media
Quote Reply
Re: [HyperTherm] Getting the URL for GT Community In reply to
I get half way there Wink

I get the url I came from via user.cgi that passes it on to the community script but the username and password are stipped along the way so I just get the community login page where the user has to enter his details again Unsure.

It was worth a try though !

Thanks
Significant Media
Quote Reply
Re: [Jag] Getting the URL for GT Community In reply to
Sorry.
I just extrapolated from common knowledge and as it happened it did not work.
:/

HyTC
Quote Reply
Re: [Jag] Getting the URL for GT Community In reply to
Hey It works.

Silly question but did u have do=user_home as hidden field to?

What i did was took the entire source code of the redirected login community page for a qucik test and it worked.

Could explore this further if time permits you :)

HyTC
Quote Reply
Re: [HyperTherm] Getting the URL for GT Community In reply to
Is there any chance of you posting the code you have I've got this from my page but I guess I have some things missing because do_user_home isn't on mine.

<form name="myform" action="<%db_cgi_url%>/community.cgi?<%if url%>;url=<%escape_url url%><%endif%>" method="post">
<%if t%><input type="hidden" name="t" value="<%escape_html t%>"><%endif%>
<input type="hidden" name="do" value="user_home">
<input size="12" name="username" <%if username%>value="<%escape_html username%>"<%endif%>><br>
<input size="12" type="password" name="password"><br>
<input value="user_login" name="do" type="image" src="<%build_images_url%>/go.gif" width="41" height="28" border="0"><br>

I've added it so this is what I have but I can't get it to work from LinkSQL pages. Obviously it works from community pages...

As I said the <%url%> tag doesn't bring anything up.

Am I doing something wrong in this code or are you using similar code ?

John
Significant Media
Quote Reply
Re: [Jag] Getting the URL for GT Community In reply to
Hi

Try this which i just lifted from a working test sample and changed the paths:


<form name="myform"
action="http://domain.tld/path/to/community.cgi" method="POST">
<input type="hidden" name="do" value="user_login"><input type="hidden" name="url"
value="http://domain.tld/path/to/page.cgi?d=1"><table
width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
<tr valign="top">
<td width="40%"><table width="100%" style="border:1px solid #336699" cellspacing="0"
cellpadding="0" align="right">
<tr valign="top">
<td height="270"><table width="100%" border="0" cellspacing="6" cellpadding="1"
bgcolor="#DFEFFF" height="100%">
<tr bgcolor="#DFEFFF" valign="top">
<td><table width="100%" border="0" cellspacing="1" cellpadding="2">
<tr>
<td class="body" align="right"><br />
<table border="0" cellspacing="2" cellpadding="1" align="center">
<tr>
<td align="right" class="body">Username:</td>
<td><input type="text" name="username" size="20" class="object" /></td>
</tr>
<tr>
<td align="right" class="body">Password:</td>
<td><input type="password" name="password" size="20" class="object" /> </td>
</tr>
<tr align="left">
<td colspan="2" class="body">Remember Login: <input type="checkbox" name="remember"
value="1" /> <br />
</td>
</tr>
<tr align="center">
<td colspan="2" class="body"><input type="submit" name="Submit" value="Sign In"
class="button" /> </td>
</tr>
</table>
</td>
</tr>
<tr align="center">
<td class="body" height="30">Forgot your password? <a
href="http://domain.tld/path/to/community.cgi?do=user_lostpw">Retrieve
it here!</a> </td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</form>


domain.tld : is the domain on which LinksSQL and community are (presuming it to be the same as community doesn't work with GT products and community on different domains) substitute with your domain

Specify the complete pat to the cgi's in the above
This from a test install of community + forum on same tld.

Good Luck

HyTC
Quote Reply
Re: [HyperTherm] Getting the URL for GT Community In reply to
Hi,

I've just looked at this and it does seem to work but I'd have to create a different version of it per template so that the person was redirected to the place he came from in LinksSQL. Even in the forum if the user logs in from a specific post he/she doesn't get redirected to that page...

If the person comes from New or from Popular the URL needs to be created for that specific page for it to work.
But that got me thinking that your previous comment would lead to a more dynamic solution :
If there was a script like the user.cgi that parsed both the URL and the username and password to passed it on to community.cgi then it wouldn't be necessary to create a URL per page.
I think Crazy.

Anyway thanks for your input.

John
Significant Media
Quote Reply
Re: [Jag] Getting the URL for GT Community In reply to
Hi.

Even that should be possible.
say for example in case of Forum.

From whereever you are logging in you would have the post_id/forum_id etc etc.

So can't that be used in the url name value pair as a template tag?
I am just not sure about the tags names but this is just a shot in the dark. So you could have the login box built up in some forum template and passon the additional values of post_id, forum_id, category_id etc etc if they are available as template tags (which should be)

Say for a user loging in from a category of your forum

name="url"
value="<%forum_cgi_path_tag%>?category=<%catid_tag%>;etc etc"
type="hidden"

Just replace the example tags with the actual ones applicable...

Similarly i think it could be extended to LSQL niot too sure though as i do not use community for centralised authentication.

Give it a try if time permits :)

HyTC

[EDIT]
For the query string to the url, see if more generalised query srting tag is there which can be used. In forum i think you have <%hidden_query%>, i am not too sure though. This would/should automagically get everything to the url value with something like:

name="url"
value="<%cgi_root_url%>/gforum.cgi?<%hidden_query%>
type="hidden"

Just a shot in the dark.
[/EDIT]

Thanks
HyTC
==================================
Mail Me If Contacting Privately Is That Necessary.
==================================

Last edited by:

HyperTherm: Oct 14, 2004, 7:53 PM
Quote Reply
Re: [HyperTherm] Getting the URL for GT Community In reply to
Hi,

That sounds interesting. I'll try it out. I've put it to one side but I'll have a go because it sounds interesting your idea of recreating the URL in the way the script would pick it up...

Thanks,

John
Significant Media
Quote Reply
Re: [Jag] Getting the URL for GT Community In reply to
Hi.

OK, i know this was not fun more so as perl is greek to me. Just tried it out on a Community+Forum test install.

Included the search box code as posted in include_header.html but with a following change:

save a template qs.html

then in the search code, replace the url name value pair stuff with <%include qs.shtml%>

so it would look something like gforum.cgi?<%include qs.html%>

And here's what you have in qs.html:

<%ifnot main_page%>
<%ifnot this_do eq 'search' or this_do eq 'whos_online'%>
<%ifnot so%>
<%if cats_query%>
<%cats_query%>;
<%endif%>
<%endunless%>
<%endif%>
<%endunless%>
<%ifnot main_page%>
<%ifnot cats_query%>
<%ifnot this_do eq 'search' or this_do eq 'whos_online'%>
<%if so%><%ifnot root_post_id%>forum=<%forum_id%>
<%else%>post=<%root_post_id%><%endif%>;
<%endif%>
<%endunless%>
<%endunless%>
<%endunless%>
<%ifnot main_page%>
<%ifnot cats_query%>
<%ifnot so%>
<%if this_do%>do=<%this_do%>;
<%endif%>
<%endif%>
<%endunless%>
<%endunless%>
<%hidden_query%>">

Check it out :)

Similar stuff you would have to figure it out for LSQL too, unless of course someone helps you out with a Global to get the complete URL wherefrom you are logging in and in that case it would be easier...

Learning the hard way though :)

HyTC

Thanks
HyTC
==================================
Mail Me If Contacting Privately Is That Necessary.
==================================

Last edited by:

HyperTherm: Oct 15, 2004, 9:45 AM
Quote Reply
Re: [HyperTherm] Getting the URL for GT Community In reply to
That's a pretty impressive list of statements...

I was thinking about it this afternoon (I'm nearly as mad about it as you are Wink) and wondering how I would need to set it up in order to reduce the need for to many statements. I suppose that the larger amount of template specific areas may be an advantage with LinksSQL in that specific templates like for example the search page would enable a more specific type of set of statements to refine the URL passed on...

But it will obviously lead to something similar to what you have posted !

John
Significant Media
Quote Reply
Re: [Jag] Getting the URL for GT Community In reply to
Hi.

The shortest possible thing would be if someone or you could do a global for DOCUMENT_URI /QUERY_STRING or whatever ENV variables so that then from the page the url vale can can just be a template tag.

ALternativey, though i have not tried but should work is having the following in relevant template and then use them

<%set qs = ........%>

Globals etc just as i said is greek to me
So that lengthy if's :/

HyTC

Thanks
HyTC
==================================
Mail Me If Contacting Privately Is That Necessary.
==================================