Gossamer Forum
Home : Products : Links 2.0 : Customization :

Modify Link From Directory Listing

Quote Reply
Modify Link From Directory Listing
Currently, I'm using password protection for resource (link) modification. Password protection and modification are based on the link ID and a user defined password. When a user clicks on "Modify" they are taken to a page where they must input their link ID and their password before they are taken to the modify page, where the fields are then filled in with the current values for their resource. This works well, and is based off of Paul's modify password protect mod.

Here's the deal. To encourage folks to keep their listings up-to-date, I would like to include a modify link with each listing in the directory. That's easy enough, but what I'm trying to do is pass the link ID to the modify page and have it pre-fill in the Resource ID: Text Box. (so all they have to do is input their password.)

I'm very knew to Perl (which will be obvious in a minute) and I'm not sure if I'm even going about this correctly. Maybe there is an easier way?

Here's how I'm trying to do this:

In link.html I have:
<a href="<%db_cgi_url%>/modify.cgi?id=<%ID%>">[Modify]</a>


In site_html_templates.pl I have the following to pass the id value to the modify_pre.html template:


sub site_html_modify_pre {
# --------------------------------------------------------
# This routine determines how the modify form page will look like.

&html_print_headers;
print &load_template ('modify_pre.html', {

Id => $id,
%globals

});
}

And then in my modify_pre.html template I've added this to stick the ID value into the field:

<input name="ID" value="<%Id%>" size="10">

Where I'm stuck is I don't know how to tell modify.cgi to grab the value of 'id' (sent with the link), set it to $id and then pass $id to the site_html_modify_pre subroutine in site_html_templates.pl

Sorry 'bout the long post, but I don't know where else to turn. I feel like maybe there's an easier way to do this and that I'm going about it all wrong. It's not real important that I get this to work, but it is driving me crazy-- mostly because I don't know how to do it and I guess I'm just the curious type.

Elaine

Last edited by:

eanders: Dec 11, 2002, 11:30 PM
Quote Reply
Re: [eanders] Modify Link From Directory Listing In reply to
Why play with site_html_templates.pl? <%ID%> should be available whenever link.html is used...(see jump.cgi?ID=<%ID%>)....there shouldn't be any need to edit anything but the templates.

You seem to have the right idea about the modification though....simply call modify.cgi?ID=<%ID%>

Hope that helps Smile

Andy (mod)
andy@ultranerds.co.uk


IMPORTANT: I've now moved to ultranerds.co.uk, and the .com will no longer work!
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates
Quote Reply
Re: [eanders] Modify Link From Directory Listing In reply to
notice the case of the variable ID in your post

Code:
In link.html I have:
<a href="<%db_cgi_url%>/modify.cgi?id=<%ID%>">[Modify]</a>

print &load_template ('modify_pre.html', {

Id => $id,
%globals

and

<input name="ID" value="<%Id%>" size="10">


one thing to learn about case in PERL: perl is case sensitve.

ID, Id and id are all different variables.

Always use the variable shown in links.def and follow the case shown there.

So, in your examples, use ID.

other than that it should work.

just out of curiosity, are you sure this mod is from paul? his uses a Username variable in the links.def in addition to the ID.


Gene
"The older I get, the more I admire competence, just simple competence in any field from adultery to zoology."
Quote Reply
Re: [esm] Modify Link From Directory Listing In reply to
Gene,
I'm using a modification of Paul's mod (I think). I needed to change Paul's mod a bit because I did not want to use usernames, just link ID and Password. Also, wanted people to be able to retrieve their password with just a link ID (supply the link ID only and the password is sent to the email address on record). I also removed the password reversal part, as this seemed confusing to my beta testers (aka family members). No offense Paul, my family members are easily confused (which tends to make them good beta testers for web sites).

Anyway, let me try to explain what I'm trying to do again:

I have this in link.html with every listing:
<a href="<%db_cgi_url%>/modify.cgi?ID=<%ID%>">[Modify]</a>
When the user clicks on this link, it sends the Link ID to modify.cgi.

I think I need to create something like what's below to tell modify.cgi to pass the value of ID to the modify_pre.html template. (The modify_pre.html template is simply a page that asks for Link ID and Password.)

After this bit of code in modify.cgi
sub main {
# --------------------------------------------------------
local (%in) = &parse_form;

Add something like this:

if ($in{'ID'}) {
$id = ($in{'ID'});
&site_html_modify_form_pre($id);
}


Which would tell modify.cgi to pass the value of ID ($id) to the site_html_modify_form_pre subroutine.


In sub site_html_modify_form_pre I think I would need to do something like this:

sub site_html_modify_form_pre {
# --------------------------------------------------------
# This routine determines how the modify form page will look like.

&html_print_headers;
print &load_template ('modify_pre.html', {
$id => ID,
%globals
});
}

That should pass the value of ID ($id) to the modify_pre.html template and fill in the Link ID text box with the Link ID. My modify_pre.html template looks like this.

<input name="ID" value="<%ID%>" size="10">

Maybe, that will better explain what I'm trying to do. I'm very new to Perl, (as in, just started messing with it a couple of weeks ago), so don't laugh Tongue I'm very well aware of the fact that I have no idea what I'm doing.

Elaine
Quote Reply
Re: [eanders] Modify Link From Directory Listing In reply to
well, if you are changing Paul's mod, you are way ahead of me....I know how to spell perl...does that count??Unsure eliminating the username and substituting the ID is probably no small task.

If I had to do it, I would stay as close as possible to the original code and I would use something similar to the sub main { section in the rate.cgi file as a starting point.


Gene
"The older I get, the more I admire competence, just simple competence in any field from adultery to zoology."
Quote Reply
Re: [esm] Modify Link From Directory Listing In reply to
Gene - YOUR A GENIUS!
I looked in rate.cgi to see how it handled passing the Link ID and there was my answer! I still have to work out a couple of weird things, but you gave me a place to start.

Thank you Smile
Elaine
Quote Reply
Re: [eanders] Modify Link From Directory Listing In reply to
well, I've been called lots of things in my life but not that. well, at least, not too often Sly

let us know how it goes.


Gene
"The older I get, the more I admire competence, just simple competence in any field from adultery to zoology."
Quote Reply
Re: [esm] Modify Link From Directory Listing In reply to
In case anyone else wants to do something like this in the future, here's what I did, and it seems to be working.Shocked
Thanks again to Gene, for pointing me in the right direction!
Elaine


In link.html:
<a href="<%db_cgi_url%>/modify.cgi?RID=<%ID%>">[Modify]</a>

In modify.cgi:
sub main {
# --------------------------------------------------------
local (%in) = &parse_form;

# We are processing the form.

if ($in{'RID'}) {
&site_html_modify_form_pre('RID');
}


In site_html_template.pl:
sub site_html_modify_form_pre {
# --------------------------------------------------------
# This routine determines how the modify form page will look like.
my $id = $in{'RID'};
&html_print_headers;
print &load_template ('modify_pre.html', {
ID => $id,
%globals
});
}

In modify_pre.html (template):
<input name="ID" value="<%ID%>" size="10">