Gossamer Forum
Home : Products : Links 2.0 : Customization :

Show another page before the add form in add.cgi

Quote Reply
Show another page before the add form in add.cgi
I want to show users another page before they actually start filling the add form. Basically, the other page they see first will include the terms and conditions and the listing types, fees for featured links, etc., Once they agree (preferably after they check a box under agreement), then they get to see the form that they can start filling.

I have the add confirm mod installed - so when they go back to make corrections, they should see the actual form and not the terms and conditions page.

Has anyone done this - how can I do this?

Thanks
Quote Reply
Re: [socrates] Show another page before the add form in add.cgi In reply to
Make the 'Add Resource' links point to the 'terms' page (instead of add.cgi), then at the bottom of the 'terms' page have a form-based button labeled "Accept Terms" or whatever. That form would be processed by add.cgi, as a first condition, which would then present the add form. Requires rewriting the first part of add.cgi, but is quite easy. If you need more help, let me know.


Leonard
aka PerlFlunkie
Quote Reply
Re: [PerlFlunkie] Show another page before the add form in add.cgi In reply to
Thanks - and that is the easiest way but I have links from many pages and external sites, linking directly to add.cgi - so the easier way for me would be to change something in add.cgi. Hence, I was hoping to find a solution to change something in add.cgi so when called, it will return an HTML page first. If there is way to do this from add.cgi, please let me know.
Quote Reply
Re: [socrates] Show another page before the add form in add.cgi In reply to
OK, maybe something like so...

Code:
sub main {
# --------------------------------------------------------
local (%in) = &parse_form;
# We are processing the form.
if ((keys %in != 0) && ($in{'do'} eq 'agree')) { # Terms Page mod
&process_form;
}
# Otherwise we are displaying the form (in site_html.pl).
elseif { # Terms Page mod (add 'if')
if ($in{'do'} eq 'agree') { # Terms Page mod

if ($db_single_category) {
my %is_valid = map { $_ => 1 } &category_list;
$ENV{'HTTP_REFERER'} =~ s,/[^/]+\.[^/]+$,,;
$ENV{'HTTP_REFERER'} =~ m,$build_root_url/(.+?)/?$,;
$is_valid{$1} ? &site_html_add_form ($1) : &site_html_add_form ();
}
else {
&site_html_add_form ();
}
} # Terms Page mod
}
else { # Terms Page mod (4 lines)
# We give them the terms page
&site_html_terms_page;
}
}

Next create the Terms Page as a template (with your text), and also in site_html_templates.pl (as a routine). Include this in the template:

Code:

<form action="<%db_cgi_url%>/add.cgi" method="post">
<input type="hidden" name="do" value="agree">
<input type="submit" value="Agree to Terms">
</form>


Put the hidden input into the add and add-confirm form templates, too.

<input type="hidden" name="do" value="agree">


Leonard
aka PerlFlunkie
Quote Reply
Re: [PerlFlunkie] Show another page before the add form in add.cgi In reply to
Thanks a lot but the elsif loop is causing problems (I did correct the syntax error - elseif).

# Otherwise we are displaying the form (in site_html.pl).
elseif { # Terms Page mod (add 'if')
Quote Reply
Re: [socrates] Show another page before the add form in add.cgi In reply to
Oops, missed that extra 'e' in 'elsif'...

Try this:

Code:
# Otherwise we are displaying the form (in site_html.pl).
if (($db_single_category) && ($in{'do'} eq 'agree')) { # Terms Page mod
my %is_valid = map { $_ => 1 } &category_list;
$ENV{'HTTP_REFERER'} =~ s,/[^/]+\.[^/]+$,,;
$ENV{'HTTP_REFERER'} =~ m,$build_root_url/(.+?)/?$,;
$is_valid{$1} ? &site_html_add_form ($1) : &site_html_add_form ();
}
else {
if ($in{'do'} eq 'agree') { # Terms Page mod
&site_html_add_form ();
} # Terms Page mod
}
}


Leonard
aka PerlFlunkie
Quote Reply
Re: [PerlFlunkie] Show another page before the add form in add.cgi In reply to
Thanks - I tried it but it does not work and I am just gonna let it go. I had tried somewhat close to what you suggested : if (($db_single_category) && ($in{'do'} eq 'agree')) { # Terms Page mod

I tried it again but after the agreement, it sends the user to the add confirm page and not to the add form page. So, I think it is complicated and I am just going to make a static agreement page first as you suggested earlier.

Thanks again.
Quote Reply
Re: [socrates] Show another page before the add form in add.cgi In reply to
Sorry can't help more, my head has been out of Perl for awhile, so I don't remember it well enough right now. You can put the terms on the add form page, and have a checkbox that must be checked before accepting the submission, that would be pretty easy to do.


Leonard
aka PerlFlunkie