Thanks Bogus for the pointer to your site to give me a lead on how to add it to the user add form. And a special thanks to Loopy who laid out the ground work.
******************************************
I do need assistance on formatting. The result page is in need of some parsing. If more than one alt category is chosen, the format is as follows:
with this:
**************************************
This is what needs to be modified if you want to add it to the user add/modify form:
Before we continue, go to www.online-sweepstakes.com/links-mods/ to add the mod. Then continue:
1. db_utils.pl
add this:
$db_select_fields{$db_cols[$db_alt_cat]} = $db_select_fields{'Mult-AltCategories'} = $db_select_fields{'Category'}}
elsif (! exists $db_select_fields{$column} && $column eq "AltCategories" && ! exists $db_select_fields{'Category'}) {
$db_select_fields{$db_cols[$db_alt_cat]} = $db_select_fields{'Mult-AltCategories'} = join (",", &category_list);}
after this in sub build_select_field:
$db_select_fields{$db_cols[$db_category]} = $db_select_fields{'Mult-Related'} = join (",", &category_list);
}
2. site_html_templates.pl
here is what my add/modify section looks like:
# THE FOLLOWING ARE CGI GENERATED PAGES AND THE TEMPLATE MUST BE PRINTED, NOT RETURNED!#
########################################################################################
sub site_html_add_form {
# --------------------------------------------------------
# This routine determines how the add form page will look like.
#
&html_print_headers;
my $category = shift;
# $category ?
# ($category = qq~$category <input type=hidden name="Category" value="$category">~) :
# ($category = &build_select_field ("Category", "$in{'Category'}"));
my $category = &build_select_field ("Category", "$category");
my $altcategories = &build_select_field ("AltCategories","$in{'AltCategories'}","AltCategories","MULTIPLE Size=3");
print &load_template ('add.html', {
AltCategories => $altcategories,
Category => $category,
%globals
});
}
sub site_html_add_success {
# --------------------------------------------------------
# This routine determines how the add success page will look like.
&html_print_headers;
print &load_template ('add_success.html', {
AltCategories => $altcategories,
%in,
%globals
});
}
sub site_html_add_failure {
# --------------------------------------------------------
# This routine determines how the add failure page will look like.
my ($errormsg) = shift;
my $category = &build_select_field ("Category", "$in{'Category'}");
delete $in{'Category'};
my $altcategories = &build_select_field ("AltCategories","$in{'AltCategories'}","AltCategories","MULTIPLE Size=3");
delete $in{'AltCategories'};
&html_print_headers;
print &load_template ('add_error.html', {
AltCategories => $altcategories,
Category => $category,
error => $errormsg,
%in,
%globals
});
}
sub site_html_modify_form {
# --------------------------------------------------------
# This routine determines how the modify form page will look like.
my $category = &build_select_field ("Category", "$in{'Category'}");
my $altcategories = &build_select_field ("AltCategories","$in{'AltCategories'}","AltCategories","MULTIPLE Size=3");
&html_print_headers;
print &load_template ('modify.html', {
AltCategories => $altcategories,
Category => $category,
%globals
});
}
sub site_html_modify_success {
# --------------------------------------------------------
# This routine determines how the modify success page will look like.
&html_print_headers;
print &load_template ('modify_success.html', {
AltCategories => $altcategories,
%in,
%globals
});
}
sub site_html_modify_failure {
# --------------------------------------------------------
# This routine determines how the modify failure page will look like.
my $errormsg = shift;
my $category = &build_select_field ("Category", "$in{'Category'}");
delete $in{'Category'};
# $in{'Category'} = &build_select_field ("Category", $in{'Category'});
my $altcategories = &build_select_field ("AltCategories","$in{'AltCategories'}","AltCategories","MULTIPLE Size=3");
delete $in{'AltCategories'};
&html_print_headers;
print &load_template ('modify_error.html', {
AltCategories => $altcategories,
Category => $category,
error => $errormsg,
%in,
%globals
});
}
3. add.html,add_error.html,add_success.html,modify.html,modify_error.html,and modify_success.html
add this to the user form in between any field you want:
<td align="right" valign="top">Alt Categories:</td>
<td><%AltCategories%></td>
</tr>
4. add.cgi and modify.cgi
add this at sub send_email:
That should be it...
The only thing that really needs fixing is how it displays the success page on more than one alt categories.
Hope this addition is useful to all of you
Best wishes,
elms
------------------
www.webmerch.com
links@webmerch.com
[This message has been edited by elms (edited March 19, 1999).]
******************************************
I do need assistance on formatting. The result page is in need of some parsing. If more than one alt category is chosen, the format is as follows:
Code:
exists $in{$name} ? ($in{$name} .= "~~$value") : ($in{$name} = $value);with this:
Code:
exists $in{$name} ? ($in{$name} .= "<br>$value") : ($in{$name} = $value);This is what needs to be modified if you want to add it to the user add/modify form:
Before we continue, go to www.online-sweepstakes.com/links-mods/ to add the mod. Then continue:
1. db_utils.pl
add this:
Code:
if (! exists $db_select_fields{$column} && $column eq "AltCategories" && exists $db_select_fields{'Category'}) { $db_select_fields{$db_cols[$db_alt_cat]} = $db_select_fields{'Mult-AltCategories'} = $db_select_fields{'Category'}}
elsif (! exists $db_select_fields{$column} && $column eq "AltCategories" && ! exists $db_select_fields{'Category'}) {
$db_select_fields{$db_cols[$db_alt_cat]} = $db_select_fields{'Mult-AltCategories'} = join (",", &category_list);}
after this in sub build_select_field:
Code:
if (! exists $db_select_fields{$column}) { $db_select_fields{$db_cols[$db_category]} = $db_select_fields{'Mult-Related'} = join (",", &category_list);
}
2. site_html_templates.pl
here is what my add/modify section looks like:
Code:
######################################################################################## # THE FOLLOWING ARE CGI GENERATED PAGES AND THE TEMPLATE MUST BE PRINTED, NOT RETURNED!#
########################################################################################
sub site_html_add_form {
# --------------------------------------------------------
# This routine determines how the add form page will look like.
#
&html_print_headers;
my $category = shift;
# $category ?
# ($category = qq~$category <input type=hidden name="Category" value="$category">~) :
# ($category = &build_select_field ("Category", "$in{'Category'}"));
my $category = &build_select_field ("Category", "$category");
my $altcategories = &build_select_field ("AltCategories","$in{'AltCategories'}","AltCategories","MULTIPLE Size=3");
print &load_template ('add.html', {
AltCategories => $altcategories,
Category => $category,
%globals
});
}
sub site_html_add_success {
# --------------------------------------------------------
# This routine determines how the add success page will look like.
&html_print_headers;
print &load_template ('add_success.html', {
AltCategories => $altcategories,
%in,
%globals
});
}
sub site_html_add_failure {
# --------------------------------------------------------
# This routine determines how the add failure page will look like.
my ($errormsg) = shift;
my $category = &build_select_field ("Category", "$in{'Category'}");
delete $in{'Category'};
my $altcategories = &build_select_field ("AltCategories","$in{'AltCategories'}","AltCategories","MULTIPLE Size=3");
delete $in{'AltCategories'};
&html_print_headers;
print &load_template ('add_error.html', {
AltCategories => $altcategories,
Category => $category,
error => $errormsg,
%in,
%globals
});
}
sub site_html_modify_form {
# --------------------------------------------------------
# This routine determines how the modify form page will look like.
my $category = &build_select_field ("Category", "$in{'Category'}");
my $altcategories = &build_select_field ("AltCategories","$in{'AltCategories'}","AltCategories","MULTIPLE Size=3");
&html_print_headers;
print &load_template ('modify.html', {
AltCategories => $altcategories,
Category => $category,
%globals
});
}
sub site_html_modify_success {
# --------------------------------------------------------
# This routine determines how the modify success page will look like.
&html_print_headers;
print &load_template ('modify_success.html', {
AltCategories => $altcategories,
%in,
%globals
});
}
sub site_html_modify_failure {
# --------------------------------------------------------
# This routine determines how the modify failure page will look like.
my $errormsg = shift;
my $category = &build_select_field ("Category", "$in{'Category'}");
delete $in{'Category'};
# $in{'Category'} = &build_select_field ("Category", $in{'Category'});
my $altcategories = &build_select_field ("AltCategories","$in{'AltCategories'}","AltCategories","MULTIPLE Size=3");
delete $in{'AltCategories'};
&html_print_headers;
print &load_template ('modify_error.html', {
AltCategories => $altcategories,
Category => $category,
error => $errormsg,
%in,
%globals
});
}
3. add.html,add_error.html,add_success.html,modify.html,modify_error.html,and modify_success.html
add this to the user form in between any field you want:
Code:
<tr> <td align="right" valign="top">Alt Categories:</td>
<td><%AltCategories%></td>
</tr>
4. add.cgi and modify.cgi
add this at sub send_email:
Code:
Alt Categories: $in{'AltCategories'}That should be it...
The only thing that really needs fixing is how it displays the success page on more than one alt categories.
Hope this addition is useful to all of you
Best wishes,
elms
------------------
www.webmerch.com
links@webmerch.com
[This message has been edited by elms (edited March 19, 1999).]