ok.. i believe this code is ready for release. It's quite simple and (hopefully) easy to install.
to see a demo..
www.pdamania.com/modify.cgi
login as:
u: pdamania
p: test
then go to
www.pdamania.com/user.cgi?to=/modify.cgi
login as:
u: jsu7785
p: test
anyways.. overall..
ADD CGI: 0
MOD CGI: 2 (add.cgi, modify.cgi)
ADD TEMPLATE: 2 (modify.html, modify_link.html)
MOD TEMPLATE: 2 (modify_form.html, modify_failure.html)
also.. if you guys want delete.cgi just tell me. it's already finished. it's just that you actually have to mod some things in the admin..
anyways..
get the two files.. add.cgi and modify.cgi
www.widgetz.com/sql/add.txt
www.widgetz.com/sql/modify.txt
then you are going to need to add templates..
HTML_Templates.pm
---------------------
add this to @EXPORT
add these subroutines..
# --------------------------------------------------------
# This routine displays the user's links to modify.
#
my ($tags, $dynamic) = @_;
my $style = defined $dynamic ? $dynamic->param('t') : undef;
(ref $tags eq 'HASH') or croak "HTML_TEMPLATES: Argument '$tags' must be hash reference";
defined $dynamic and &load_user ($dynamic, $tags);
my $output = &load_template ('modify.html', {
%$tags,
%GLOBALS
}, undef, $style);
defined $dynamic and &clean_output($dynamic, \$output);
print $output;
}
sub site_html_modify_link {
# --------------------------------------------------------
my ($rec, $dynamic) = @_;
my $style = defined $dynamic ? $dynamic->param('t') : undef;
(ref $rec eq 'HASH') or croak "HTML_TEMPLATES: Argument '$rec' must be hash reference";
($rec->{'isDetail'} eq 'Yes') ?
($rec->{'LinkURL'} = "$LINKS{build_detail_url}/${$rec}{'ID'}$LINKS{build_extension}") :
($rec->{'LinkURL'} = $rec->{'URL'});
# defined $dynamic and &load_user ($dynamic, $user);
my $output = &load_template ('modify_link.html', {
%$rec,
%GLOBALS
}, undef, $style);
return $output;
}
get the 4 templates..
www.widgetz.com/sql/modify_html.txt
www.widgetz.com/sql/modify_link_html.txt
www.widgetz.com/sql/modify_form_html.txt
www.widgetz.com/sql/modify_error_html.txt
basically.. the form and the error have 1 hidden tag added (the ID) and then the Current URL taken out..
this is a secure system.. it won't let anyone not logged in slip by and it won't let anyone not authorized to edit a link to edit a link.. keep in mind that this mod doesn't allow admins to edit all the links.. [that's what the administration is for]
oh yea.. you have to add a field to the Links Database..
name: Username
form: 20
max : 35
default: PDAmania (in your case the administrator's name.. so when you add links from the admin.. it will be defaulted to you)
now it should be ready.. some of you might have to fix user.cgi (i had to)
find:
my $user_cookie = $in->cookie ( -name => 'Username', -value => $user, -expires => '+1y' );
change to
-name => 's',
-value => $session,
-expires => '+3h',
-path => '/',
-domain => '.pdamania.com'
);
my $user_cookie = $in->cookie (
-name => 'Username',
-value => $user,
-expires => '+1y',
-path => '/',
-domain => '.pdamania.com'
);
change the domain to yours (yes.. keep the first period).. leave the path alone.. it allows for the cookie to be used anywhere.. (in your domain)..
anyways.. hopefully my instructions are good.. tell me..
i'll make a website with the links sql mods after finals and after my ski trip (i snowboard .. parents/relatives ski).. that's in february for your information so it's a LONG time..
------------------
Jerry Su
[This message has been edited by widgetz (edited January 01, 2000).]
to see a demo..
www.pdamania.com/modify.cgi
login as:
u: pdamania
p: test
then go to
www.pdamania.com/user.cgi?to=/modify.cgi
login as:
u: jsu7785
p: test
anyways.. overall..
ADD CGI: 0
MOD CGI: 2 (add.cgi, modify.cgi)
ADD TEMPLATE: 2 (modify.html, modify_link.html)
MOD TEMPLATE: 2 (modify_form.html, modify_failure.html)
also.. if you guys want delete.cgi just tell me. it's already finished. it's just that you actually have to mod some things in the admin..
anyways..
get the two files.. add.cgi and modify.cgi
www.widgetz.com/sql/add.txt
www.widgetz.com/sql/modify.txt
then you are going to need to add templates..
HTML_Templates.pm
---------------------
add this to @EXPORT
Code:
&site_html_modify &site_html_modify_linkadd these subroutines..
Code:
sub site_html_modify { # --------------------------------------------------------
# This routine displays the user's links to modify.
#
my ($tags, $dynamic) = @_;
my $style = defined $dynamic ? $dynamic->param('t') : undef;
(ref $tags eq 'HASH') or croak "HTML_TEMPLATES: Argument '$tags' must be hash reference";
defined $dynamic and &load_user ($dynamic, $tags);
my $output = &load_template ('modify.html', {
%$tags,
%GLOBALS
}, undef, $style);
defined $dynamic and &clean_output($dynamic, \$output);
print $output;
}
sub site_html_modify_link {
# --------------------------------------------------------
my ($rec, $dynamic) = @_;
my $style = defined $dynamic ? $dynamic->param('t') : undef;
(ref $rec eq 'HASH') or croak "HTML_TEMPLATES: Argument '$rec' must be hash reference";
($rec->{'isDetail'} eq 'Yes') ?
($rec->{'LinkURL'} = "$LINKS{build_detail_url}/${$rec}{'ID'}$LINKS{build_extension}") :
($rec->{'LinkURL'} = $rec->{'URL'});
# defined $dynamic and &load_user ($dynamic, $user);
my $output = &load_template ('modify_link.html', {
%$rec,
%GLOBALS
}, undef, $style);
return $output;
}
get the 4 templates..
www.widgetz.com/sql/modify_html.txt
www.widgetz.com/sql/modify_link_html.txt
www.widgetz.com/sql/modify_form_html.txt
www.widgetz.com/sql/modify_error_html.txt
basically.. the form and the error have 1 hidden tag added (the ID) and then the Current URL taken out..
this is a secure system.. it won't let anyone not logged in slip by and it won't let anyone not authorized to edit a link to edit a link.. keep in mind that this mod doesn't allow admins to edit all the links.. [that's what the administration is for]
oh yea.. you have to add a field to the Links Database..
name: Username
form: 20
max : 35
default: PDAmania (in your case the administrator's name.. so when you add links from the admin.. it will be defaulted to you)
now it should be ready.. some of you might have to fix user.cgi (i had to)
find:
Code:
my $session_cookie = $in->cookie ( -name => 's', -value => $session, -expires => '+3h' ); my $user_cookie = $in->cookie ( -name => 'Username', -value => $user, -expires => '+1y' );
change to
Code:
my $session_cookie = $in->cookie ( -name => 's',
-value => $session,
-expires => '+3h',
-path => '/',
-domain => '.pdamania.com'
);
my $user_cookie = $in->cookie (
-name => 'Username',
-value => $user,
-expires => '+1y',
-path => '/',
-domain => '.pdamania.com'
);
change the domain to yours (yes.. keep the first period).. leave the path alone.. it allows for the cookie to be used anywhere.. (in your domain)..
anyways.. hopefully my instructions are good.. tell me..
i'll make a website with the links sql mods after finals and after my ski trip (i snowboard .. parents/relatives ski).. that's in february for your information so it's a LONG time..
------------------
Jerry Su
[This message has been edited by widgetz (edited January 01, 2000).]