I noticed a reference to an Expire Listing mod that was created by Widgetz, but I can't find it in the resources section or the URL that was mentioned in this forum elsewhere. Anyone know where I can get it?
for about of week now.. i have privately sold licenses to use the mods..
starting next week there will be a system available for these mods.. $20 amazon gift certificate for use and support of all the mods (includes new documentation).. $20 per install per script..
i will release the mods into the system one by one.. first the mods will have minor rewrites.. then new documentation.. the only mods i have done are review.cgi and mylinks.cgi as of now..
basically.. there is a credit system i am working on.. basically the $20 pays for my time..
Jerry Su
starting next week there will be a system available for these mods.. $20 amazon gift certificate for use and support of all the mods (includes new documentation).. $20 per install per script..
i will release the mods into the system one by one.. first the mods will have minor rewrites.. then new documentation.. the only mods i have done are review.cgi and mylinks.cgi as of now..
basically.. there is a credit system i am working on.. basically the $20 pays for my time..
Jerry Su
Jul 21, 2000, 8:33 AM
User (79 posts)
Jul 21, 2000, 8:33 AM
Post #7 of 28
Views: 9473
There is I beleive an alternate script for the "expirator" authored by Alex Krohn as follows. Does anyone have the "read me" file that goes with this?
#!/usr/local/bin/perl
#
##### LDN MODIFY - Expire by no. of days old instead of by date
#
#
# -------------
# Links
# -------------
# Links Manager
#
# File: nph-build.cgi
# Description: Builds a set of HTML pages from the template directory. This is a
# non parsed header script, and should display the output directly as it may
# take quite a while to perform. It can also be called from the
# command line or via a cron routine. Read the README for more details.
# Author: Alex Krohn
# Email: alex@gossamer-threads.com
# Web: http://www.gossamer-threads.com/
# Version: 2.0
#
# (c) 1998 Gossamer Threads Inc.
#
# This script is not freeware! Please read the README for full details
# on registration and terms of use.
# =====================================================================
# Required Librariers
# --------------------------------------------------------
eval {
($0 =~ m,(.*)/[^/]+,) && unshift (@INC, "$1"); # Get the script location: UNIX /
($0 =~ m,(.*)\\[^\\]+,) && unshift (@INC, "$1"); # Get the script location: Windows \
require "links.cfg"; # Change this to full path to links.cfg if you have problems.
require "$db_script_path/db_utils.pl";
require "$db_script_path/links.def";
require "$db_script_path/db.pl";
require "$db_script_path/admin_html.pl";
$build_use_templates ?
require "$db_script_path/site_html_templates.pl" :
require "$db_script_path/site_html.pl";
use vars qw(%category %subcategories @links @new_links @cool_links %stats $grand_total $use_html $nph $date $time);
};
if ($@) {
print "HTTP/1.0 200 OK\n";
print "Content-type: text/plain\n\n";
print "Error including libraries: $@\n";
print "Make sure they exist, permissions are set properly, and paths are set correctly.";
exit;
}
# ========================================================
eval { &main; }; # Trap any fatal errors so the program hopefully
if ($@) { &cgierr("fatal error: $@"); } # never produces that nasty 500 server error page.
exit; # There are only two exit calls in the script, here and in in &cgierr.
sub main {
# --------------------------------------------------------
$time = &get_time;
$date = &get_date;
$| = 1; # Must flush output.
$nph = 1;
&html_print_headers;
local($succstr, $errstr);
local(%in) = &parse_form; # Get Form Results
if ($in{'delete_records'} eq "1") {&delete_records;}
elsif ($in{'email_to_expired_records'} eq "1") {&html_email_notification;}
else {&html_expire_form;}
}
sub html_record_form_spreadsheet_expire {
# --------------------------------------------------------
# Displays a record in a one row format
my (%rec) = @_;
my ($font) = qq|Font face="Verdana, Arial, Helvetica" Size=1 Color=#003399|;
print qq|
<td><strong><a href="$build_jump_url?$db_key=$rec{$db_key}">$rec{$db_title}</a></strong>
</td><td>$rec{$db_modified}</td><td>$rec{$db_expiration}</td>
|;
}
sub html_expire_form {
# --------------------------------------------------------
# search for expirated records
my ($message) = @_;
my (@hits, @num_days) = ();
my (@db_form_header_columns_expire) = ("Document", "Added", "Expired", "Days Exp.");
my ($numhits, $maxhits,$days, $i, $totalexp) = 0;
open (DB, "<$db_file_name") or &cgierr("error in records. unable to open db file: $db_file_name. Reason: $!");
@lines = <DB>;
close DB;
LINE: foreach $line (@lines) {
if ($line =~ /^$/) { next LINE; }
if ($line =~ /^#/) { $output .= $line; next LINE; }
chomp ($line);
@rec = &split_decode($line);
$days = &days_old($rec[$db_modified]);
### LDN MODIFY START - Expire for no. of days old instead of by date
if ($rec[$db_expiration]) { # let's check if the link have an expiration field
if ($days > $rec[$db_expiration]){ # if this page is expired add the link to the expire.db
push(@hits, @rec);
push(@num_days, ($days));
$totalexp++;
}
}
### LDN MODIFY END
}
$numhits = $totalexp; #($hits+1) / ($db_cols+1);
$maxhits = $db_max_hits;
$maxhits = $in{'mh'} if ($in{'mh'});
&html_print_headers;
print qq|
<HTML><HEAD>
<TITLE>Expirator.</TITLE>
</HEAD>
<p>Links Manager: Expirator</p>
<H2><TT>Expirator</TT></H2>
<p>Pages checked on $date at $time
--------------------------------------------------------</p><p></p>
<FORM ACTION="$db_dir_url/nph-expirator.cgi" METHOD="GET">
<input type="hidden" name="db" value="$db_name">
|;
print qq|<p><font size=3 color=red>$message</font></font></p>| if ($message ne "");
# Go through each hit and convert the array to hash and send to
# html_record for printing. Also add a checkbox with name=key and value=delete.
if ($numhits < 1) { # search returned 0
print qq|No expired records found.</font>|;
}
else {
# Print Column Headers
if ($numhits == $maxhits) {
print qq|<P>Too much records found on search (<strong>$maxhits</strong>).
<A HREF="$db_search_next_url">Next $maxhits</a>?|;
}
else {
print qq|<P>There are <strong>$numhits</strong> expired records<p></p>|;
}
print qq| Check records then choose an action and press the "Proceed" button
<TABLE BORDER=1 CELLPADDING=6 CELLSPACING=0><tr><td><strong>$db_key</strong></td>|;
foreach $col (@db_form_header_columns_expire) {
print qq|<td><strong>$col</font></strong></td>|;
}
print "</tr>";
# Print Main Body.
for ($i = 0; $i < $numhits; $i++) {
%tmp = &array_to_hash ($i, @hits);
print qq|<TR><TD valign=top width="50">
<INPUT TYPE=CHECKBOX NAME="$tmp{$db_key}" VALUE="delete">$tmp{$db_key}</font></TD>|;
### LDN MODIFY START -----------------------------------------------------------------
print qq|
<td><strong><a href="$build_jump_url?$db_key=$tmp{$db_key}">$tmp{'Title'}</a></strong>
</td><td>$tmp{'Date'}</td><td>$tmp{'ExpireDays'}</td>
|;
### &html_record_form_spreadsheet_expire (%tmp); # Original Code
### LDN MODIFY END -------------------------------------------------------------------
print qq|
<TD>$num_days[$i]</TD></TR>|;
}
$template_email_body = &load_template ('email-exp.txt', \%tmp);
print qq|</TABLE><P>
<INPUT TYPE="radio" NAME="delete_records" VALUE="1">Delete Selected Records
<INPUT TYPE="radio" NAME="email_to_expired_records" VALUE="1">Email Notification to Selected Records
( <INPUT TYPE="checkbox" NAME ="is_debug" VALUE ="yes" CHECKED>Debug Mode)
<P>
<table border=0>
<tr><td valign="top">
<INPUT TYPE="SUBMIT" VALUE="Proceed">
<INPUT TYPE="RESET" VALUE="Reset"><p></p></td></tr><tr><td>|;
# <font color=blue>E-mail message will look like:
<font color=red>Don't make any changes here! To change use <a href="$db_dir_url/admin.cgi?db=links&html_edit_template=1">Edit Templates</a> and edit email-exp.txt</font></font><BR>
# <TEXTAREA NAME="message_to_email_body" ROWS="15" COLS="80" WRAP="VIRTUAL" MAXLENGTH="7000">$template_email_body</TEXTAREA>
# </td></tr>
print qq|</table>
|;
}
print qq|
</FORM></BODY></HTML>|;
}
sub html_email_notification {
# --------------------------------------------------------
# email a notification email to selected people
my (%email_listm, $succstr, $errstr);
my ($line, @lines, $id, @rest, $output, $message_to_email_tmp);
my ($rec_to_email) = 0;
foreach $key (keys %in){ # Build a hash of keys to email.
if ($in{$key} eq "delete"){
$email_list{$key} = 1;
$rec_to_email = 1;
}
}
if (!$rec_to_email) {
&html_expire_form("You must mark at least one record.");
exit;
}
print qq|
<html><head>
<title>Email Notification</title>
</head>
<FONT SIZE=4>Email Notification sent to </FONT></font><BR>
<P>Expirator needs <b>time</b> to finish its work. Please be patient and wait until the program tells you that all e-mails are sent.
<font color=blue>BLUE</font> color tells that the records have been mailed correctly, <font color=red>RED</font> color tells you that
email could not be emailed.</font>
<p>Process started [$date][$time]...<BR>
|;
open (DB, "<$db_file_name") or &cgierr("error in records. unable to open db file: $db_file_name. Reason: $!");
@lines = <DB>;
close DB;
LINE: foreach $line (@lines) {
if ($line =~ /^$/) { next LINE; }
if ($line =~ /^#/) { $output .= $line; next LINE; }
chomp ($line);
(@rec) = &split_decode($line);
%tmp = &array_to_hash (0, @rec);
if ($email_list{$rec[0]}) {
if ($in{'is_debug'} ne "yes")
{ print qq|<font color=blue>$rec[0] ($rec[$db_contact_email])
$rec[$db_contact_name] - $rec[$db_url]</font><BR>
|;
sleep 1 ;
&send_email(%tmp);
}
else {$template_email_body = &load_template('email-exp.txt', \%tmp);
print "<hr><PRE><font color=black SIZE=1>$template_email_body</font></pre>\n\n";
$errstr .= "$rec[0] $rec[1]\n";
}
$succstr .= "$rec[0] $rec[1]\n";
}
}
if ($online) {&send_email_to_admin;
print qq|<hr>Log email sent to the administrator.</font>|;}
print qq|
<p>Completed! [$time]
<p><font color="red"><b>WARNING!</b></font> You could accidentally restart the process and email again!
It is strongly recomended to <B>CLOSE immediately this window</B> to prevent any kind of error.<BR>
If you want to definitely cancel selected records just press the back button and complete the action.
</font>
</BODY></HTML>
|;
}
sub send_email_to_admin {
# --------------------------------------------------------
# Sends an email to the admin, letting him know that there is
# a new link waiting to be validated. No error checking as we don't
# want users to see the informative &cgierr output.
# Check to make sure that there is an admin email address defined.
$db_admin_email or &cgierr("Admin Email Address Not Defined in config file!");
my $to = $db_admin_email;
my $from = $db_admin_email;
my $subject = "Expired Links\n";
my $msg = qq|
EXPIRATOR MAIL LOG
---------------------------------------------
|;
my $msg .= qq|DEBUG MODE WAS ACTIVE - NO MAIL SENT -| if ($in{'is_debug'} eq "yes");
my $msg .= qq|
---------------------------------------------
Expirator Successfully emailed messages to:
---------------------------------------------
$succstr
=============================================
---------------------------------------------
Could not send email to records:
---------------------------------------------
$errstr
=============================================
Remote Host: $ENV{'REMOTE_HOST'}
Completed : [$date] - [$time]
Sincerely,
Links Manager.
|;
# Then mail it away!
require "$db_lib_path/Mailer.pm";
my $mailer = new Mailer ( { smtp => $db_smtp_server,
sendmail => $db_mail_path,
from => $from,
subject => $subject,
to => $to,
msg => $msg,
log => $db_mailer_log
} ) or return;
$mailer->send or return;
}
sub send_email {
# --------------------------------------------------------
# All the link information is stored in %link.
my (%link) = @_;
# Set the to, from, subject and message to send.
my $to = $link{'Contact Email'};
my $from = $db_admin_email;
my $subject = "$your_link_is_expired";
my $msg = &load_template ('email-exp.txt', \%link);
# Then mail it away!
require "$db_data_path/Mailer.pm";
my $mailer = new Mailer ( { smtp => $db_smtp_server,
sendmail => $db_mail_path,
from => $from,
subject => $subject,
to => $to,
msg => $msg,
log => $db_mailer_log
} ) or
&cgierr("Unable to init mailer! Reason: $Mailer::error");
$mailer->send or &cgierr ("Unable to send modification message. Reason: $Mailer::error");
}
#!/usr/local/bin/perl
#
##### LDN MODIFY - Expire by no. of days old instead of by date
#
#
# -------------
# Links
# -------------
# Links Manager
#
# File: nph-build.cgi
# Description: Builds a set of HTML pages from the template directory. This is a
# non parsed header script, and should display the output directly as it may
# take quite a while to perform. It can also be called from the
# command line or via a cron routine. Read the README for more details.
# Author: Alex Krohn
# Email: alex@gossamer-threads.com
# Web: http://www.gossamer-threads.com/
# Version: 2.0
#
# (c) 1998 Gossamer Threads Inc.
#
# This script is not freeware! Please read the README for full details
# on registration and terms of use.
# =====================================================================
# Required Librariers
# --------------------------------------------------------
eval {
($0 =~ m,(.*)/[^/]+,) && unshift (@INC, "$1"); # Get the script location: UNIX /
($0 =~ m,(.*)\\[^\\]+,) && unshift (@INC, "$1"); # Get the script location: Windows \
require "links.cfg"; # Change this to full path to links.cfg if you have problems.
require "$db_script_path/db_utils.pl";
require "$db_script_path/links.def";
require "$db_script_path/db.pl";
require "$db_script_path/admin_html.pl";
$build_use_templates ?
require "$db_script_path/site_html_templates.pl" :
require "$db_script_path/site_html.pl";
use vars qw(%category %subcategories @links @new_links @cool_links %stats $grand_total $use_html $nph $date $time);
};
if ($@) {
print "HTTP/1.0 200 OK\n";
print "Content-type: text/plain\n\n";
print "Error including libraries: $@\n";
print "Make sure they exist, permissions are set properly, and paths are set correctly.";
exit;
}
# ========================================================
eval { &main; }; # Trap any fatal errors so the program hopefully
if ($@) { &cgierr("fatal error: $@"); } # never produces that nasty 500 server error page.
exit; # There are only two exit calls in the script, here and in in &cgierr.
sub main {
# --------------------------------------------------------
$time = &get_time;
$date = &get_date;
$| = 1; # Must flush output.
$nph = 1;
&html_print_headers;
local($succstr, $errstr);
local(%in) = &parse_form; # Get Form Results
if ($in{'delete_records'} eq "1") {&delete_records;}
elsif ($in{'email_to_expired_records'} eq "1") {&html_email_notification;}
else {&html_expire_form;}
}
sub html_record_form_spreadsheet_expire {
# --------------------------------------------------------
# Displays a record in a one row format
my (%rec) = @_;
my ($font) = qq|Font face="Verdana, Arial, Helvetica" Size=1 Color=#003399|;
print qq|
<td><strong><a href="$build_jump_url?$db_key=$rec{$db_key}">$rec{$db_title}</a></strong>
</td><td>$rec{$db_modified}</td><td>$rec{$db_expiration}</td>
|;
}
sub html_expire_form {
# --------------------------------------------------------
# search for expirated records
my ($message) = @_;
my (@hits, @num_days) = ();
my (@db_form_header_columns_expire) = ("Document", "Added", "Expired", "Days Exp.");
my ($numhits, $maxhits,$days, $i, $totalexp) = 0;
open (DB, "<$db_file_name") or &cgierr("error in records. unable to open db file: $db_file_name. Reason: $!");
@lines = <DB>;
close DB;
LINE: foreach $line (@lines) {
if ($line =~ /^$/) { next LINE; }
if ($line =~ /^#/) { $output .= $line; next LINE; }
chomp ($line);
@rec = &split_decode($line);
$days = &days_old($rec[$db_modified]);
### LDN MODIFY START - Expire for no. of days old instead of by date
if ($rec[$db_expiration]) { # let's check if the link have an expiration field
if ($days > $rec[$db_expiration]){ # if this page is expired add the link to the expire.db
push(@hits, @rec);
push(@num_days, ($days));
$totalexp++;
}
}
### LDN MODIFY END
}
$numhits = $totalexp; #($hits+1) / ($db_cols+1);
$maxhits = $db_max_hits;
$maxhits = $in{'mh'} if ($in{'mh'});
&html_print_headers;
print qq|
<HTML><HEAD>
<TITLE>Expirator.</TITLE>
</HEAD>
<p>Links Manager: Expirator</p>
<H2><TT>Expirator</TT></H2>
<p>Pages checked on $date at $time
--------------------------------------------------------</p><p></p>
<FORM ACTION="$db_dir_url/nph-expirator.cgi" METHOD="GET">
<input type="hidden" name="db" value="$db_name">
|;
print qq|<p><font size=3 color=red>$message</font></font></p>| if ($message ne "");
# Go through each hit and convert the array to hash and send to
# html_record for printing. Also add a checkbox with name=key and value=delete.
if ($numhits < 1) { # search returned 0
print qq|No expired records found.</font>|;
}
else {
# Print Column Headers
if ($numhits == $maxhits) {
print qq|<P>Too much records found on search (<strong>$maxhits</strong>).
<A HREF="$db_search_next_url">Next $maxhits</a>?|;
}
else {
print qq|<P>There are <strong>$numhits</strong> expired records<p></p>|;
}
print qq| Check records then choose an action and press the "Proceed" button
<TABLE BORDER=1 CELLPADDING=6 CELLSPACING=0><tr><td><strong>$db_key</strong></td>|;
foreach $col (@db_form_header_columns_expire) {
print qq|<td><strong>$col</font></strong></td>|;
}
print "</tr>";
# Print Main Body.
for ($i = 0; $i < $numhits; $i++) {
%tmp = &array_to_hash ($i, @hits);
print qq|<TR><TD valign=top width="50">
<INPUT TYPE=CHECKBOX NAME="$tmp{$db_key}" VALUE="delete">$tmp{$db_key}</font></TD>|;
### LDN MODIFY START -----------------------------------------------------------------
print qq|
<td><strong><a href="$build_jump_url?$db_key=$tmp{$db_key}">$tmp{'Title'}</a></strong>
</td><td>$tmp{'Date'}</td><td>$tmp{'ExpireDays'}</td>
|;
### &html_record_form_spreadsheet_expire (%tmp); # Original Code
### LDN MODIFY END -------------------------------------------------------------------
print qq|
<TD>$num_days[$i]</TD></TR>|;
}
$template_email_body = &load_template ('email-exp.txt', \%tmp);
print qq|</TABLE><P>
<INPUT TYPE="radio" NAME="delete_records" VALUE="1">Delete Selected Records
<INPUT TYPE="radio" NAME="email_to_expired_records" VALUE="1">Email Notification to Selected Records
( <INPUT TYPE="checkbox" NAME ="is_debug" VALUE ="yes" CHECKED>Debug Mode)
<P>
<table border=0>
<tr><td valign="top">
<INPUT TYPE="SUBMIT" VALUE="Proceed">
<INPUT TYPE="RESET" VALUE="Reset"><p></p></td></tr><tr><td>|;
# <font color=blue>E-mail message will look like:
<font color=red>Don't make any changes here! To change use <a href="$db_dir_url/admin.cgi?db=links&html_edit_template=1">Edit Templates</a> and edit email-exp.txt</font></font><BR>
# <TEXTAREA NAME="message_to_email_body" ROWS="15" COLS="80" WRAP="VIRTUAL" MAXLENGTH="7000">$template_email_body</TEXTAREA>
# </td></tr>
print qq|</table>
|;
}
print qq|
</FORM></BODY></HTML>|;
}
sub html_email_notification {
# --------------------------------------------------------
# email a notification email to selected people
my (%email_listm, $succstr, $errstr);
my ($line, @lines, $id, @rest, $output, $message_to_email_tmp);
my ($rec_to_email) = 0;
foreach $key (keys %in){ # Build a hash of keys to email.
if ($in{$key} eq "delete"){
$email_list{$key} = 1;
$rec_to_email = 1;
}
}
if (!$rec_to_email) {
&html_expire_form("You must mark at least one record.");
exit;
}
print qq|
<html><head>
<title>Email Notification</title>
</head>
<FONT SIZE=4>Email Notification sent to </FONT></font><BR>
<P>Expirator needs <b>time</b> to finish its work. Please be patient and wait until the program tells you that all e-mails are sent.
<font color=blue>BLUE</font> color tells that the records have been mailed correctly, <font color=red>RED</font> color tells you that
email could not be emailed.</font>
<p>Process started [$date][$time]...<BR>
|;
open (DB, "<$db_file_name") or &cgierr("error in records. unable to open db file: $db_file_name. Reason: $!");
@lines = <DB>;
close DB;
LINE: foreach $line (@lines) {
if ($line =~ /^$/) { next LINE; }
if ($line =~ /^#/) { $output .= $line; next LINE; }
chomp ($line);
(@rec) = &split_decode($line);
%tmp = &array_to_hash (0, @rec);
if ($email_list{$rec[0]}) {
if ($in{'is_debug'} ne "yes")
{ print qq|<font color=blue>$rec[0] ($rec[$db_contact_email])
$rec[$db_contact_name] - $rec[$db_url]</font><BR>
|;
sleep 1 ;
&send_email(%tmp);
}
else {$template_email_body = &load_template('email-exp.txt', \%tmp);
print "<hr><PRE><font color=black SIZE=1>$template_email_body</font></pre>\n\n";
$errstr .= "$rec[0] $rec[1]\n";
}
$succstr .= "$rec[0] $rec[1]\n";
}
}
if ($online) {&send_email_to_admin;
print qq|<hr>Log email sent to the administrator.</font>|;}
print qq|
<p>Completed! [$time]
<p><font color="red"><b>WARNING!</b></font> You could accidentally restart the process and email again!
It is strongly recomended to <B>CLOSE immediately this window</B> to prevent any kind of error.<BR>
If you want to definitely cancel selected records just press the back button and complete the action.
</font>
</BODY></HTML>
|;
}
sub send_email_to_admin {
# --------------------------------------------------------
# Sends an email to the admin, letting him know that there is
# a new link waiting to be validated. No error checking as we don't
# want users to see the informative &cgierr output.
# Check to make sure that there is an admin email address defined.
$db_admin_email or &cgierr("Admin Email Address Not Defined in config file!");
my $to = $db_admin_email;
my $from = $db_admin_email;
my $subject = "Expired Links\n";
my $msg = qq|
EXPIRATOR MAIL LOG
---------------------------------------------
|;
my $msg .= qq|DEBUG MODE WAS ACTIVE - NO MAIL SENT -| if ($in{'is_debug'} eq "yes");
my $msg .= qq|
---------------------------------------------
Expirator Successfully emailed messages to:
---------------------------------------------
$succstr
=============================================
---------------------------------------------
Could not send email to records:
---------------------------------------------
$errstr
=============================================
Remote Host: $ENV{'REMOTE_HOST'}
Completed : [$date] - [$time]
Sincerely,
Links Manager.
|;
# Then mail it away!
require "$db_lib_path/Mailer.pm";
my $mailer = new Mailer ( { smtp => $db_smtp_server,
sendmail => $db_mail_path,
from => $from,
subject => $subject,
to => $to,
msg => $msg,
log => $db_mailer_log
} ) or return;
$mailer->send or return;
}
sub send_email {
# --------------------------------------------------------
# All the link information is stored in %link.
my (%link) = @_;
# Set the to, from, subject and message to send.
my $to = $link{'Contact Email'};
my $from = $db_admin_email;
my $subject = "$your_link_is_expired";
my $msg = &load_template ('email-exp.txt', \%link);
# Then mail it away!
require "$db_data_path/Mailer.pm";
my $mailer = new Mailer ( { smtp => $db_smtp_server,
sendmail => $db_mail_path,
from => $from,
subject => $subject,
to => $to,
msg => $msg,
log => $db_mailer_log
} ) or
&cgierr("Unable to init mailer! Reason: $Mailer::error");
$mailer->send or &cgierr ("Unable to send modification message. Reason: $Mailer::error");
}
Dec 9, 2001, 11:18 AM
Enthusiast (504 posts)
Dec 9, 2001, 11:18 AM
Post #9 of 28
Views: 9271
I installed this mod and have the following problem with it.
1. I created a new field called ExpireDays.
2. In the links.def to make it a select box I added the following:
3. Created the field in the DB using the field.cgi.
No problems to this point the field and select box appear in the admin section.
In the sites.templates.html.pl I added under the sub_site_html_add_form & add_failure.
and
In sub site_html_add_success I used:
In the sub_site_html_modify form:
I used :
and
Sub_site_html_modify_sucess
used
In sub_site.html_failure
used:
delete $in{'Expiredays'};
and
In the add page I used:
<td align="left" valign="top" bgcolor="#EEEEEE"><font face="Arial,Helvetica" size="2">
<b>Expire Days:</b><br><FONT COLOR="#FF0000">Required</font></td><td><font face="Arial,Helvetica" size="2"><%expiredays%><br><b>Please select Number of Days</b></font></td>
</tr>
When I go to the add page this is the error message I get next to the Expiry Days select column.
Appreciate some guidence on this matter.
What I trying to achieve is when the user add a entry he can select the number of days the entry expires.
Many thanks.
1. I created a new field called ExpireDays.
Code:
ExpireDays => [16, 'numer', 3, 2, 1, '', ''],2. In the links.def to make it a select box I added the following:
Code:
ExpireDays => '30,60,90,182,365'3. Created the field in the DB using the field.cgi.
No problems to this point the field and select box appear in the admin section.
In the sites.templates.html.pl I added under the sub_site_html_add_form & add_failure.
Code:
my $expiredays = &build_select_field ("Expiredays","$in{'Expiredays'}");and
Code:
expiredays => $expiredays,In sub site_html_add_success I used:
Code:
expiredays => $expiredays,In the sub_site_html_modify form:
I used :
Code:
my $expiredays = &build_select_field ("Expiredays","$rec{'Expiredays'}");and
Code:
expiredays => $expiredays,Sub_site_html_modify_sucess
used
Code:
expiredays => $expiredays,In sub_site.html_failure
used:
Code:
my $expiredays = &build_select_field ("Expiredays","$in{'Expiredays'}"); delete $in{'Expiredays'};
and
Code:
expiredays => $expiredays,In the add page I used:
Code:
<tr> <td align="left" valign="top" bgcolor="#EEEEEE"><font face="Arial,Helvetica" size="2">
<b>Expire Days:</b><br><FONT COLOR="#FF0000">Required</font></td><td><font face="Arial,Helvetica" size="2"><%expiredays%><br><b>Please select Number of Days</b></font></td>
</tr>
When I go to the add page this is the error message I get next to the Expiry Days select column.
Quote:
error building select field: no select fields specified in config for field 'Expiredays'!Appreciate some guidence on this matter.
What I trying to achieve is when the user add a entry he can select the number of days the entry expires.
Many thanks.
Dec 9, 2001, 12:30 PM
Enthusiast (504 posts)
Dec 9, 2001, 12:30 PM
Post #11 of 28
Views: 9311
Hey Paul!
Many thanks - changed that in the add form - no error message but no select field shows up either.
http://www.nzcid.org.nz/ads/add.cgi
Do not understand.. I have another select field called region and that works no worries at all.
Anyways assistance appreciated.
Dec 9, 2001, 1:36 PM
Enthusiast (504 posts)
Dec 9, 2001, 1:36 PM
Post #12 of 28
Views: 9304
Hey Paul!
Thanks again - working now. It was my case in the site.template.html.pl that was the other part of the problem.
As you said - case sensitive needed to be
I continue to develop this further now and see how I get on.
Blessing to you.
Thanks again - working now. It was my case in the site.template.html.pl that was the other part of the problem.
As you said - case sensitive
Code:
expirydays =>$expiredaysCode:
ExpireDays => $expiredays.I continue to develop this further now and see how I get on.
Blessing to you.
Dec 9, 2001, 2:30 PM
Enthusiast (504 posts)
Dec 9, 2001, 2:30 PM
Post #13 of 28
Views: 9306
Quote:
There is I beleive an alternate script for the "expirator" authored by Alex Krohn as follows. Does anyone have the "read me" file that goes with this?I asked Alex if he was the author of the mod and he told me he was not. Does anyone know who the author is? Would like the read me file as well.
Many thanks
Dec 9, 2001, 7:11 PM
Enthusiast (504 posts)
Dec 9, 2001, 7:11 PM
Post #14 of 28
Views: 9228
Hey Paul!
Wonder if you could assist me again.
In the site.template.html.pl just the error sections I use this code for the select fields but they do not appear. Meaning if a user leaves a field blank and it goes to the error template the select fields do not show up.
$in{'Category'} ?
($in{'Category'} = qq~<input type=hidden name="Category" value="$in{'Category'}">$in{'Category'}~) :
($in{'Category'} = &build_select_field ("Category"));
my $region = &build_select_field ("Region","$in{'Region'}");
my $expiredays = &build_select_field ("ExpireDays","$in{'ExpireDays'}");
Would appreciate some assistance here as well.
Wonder if you could assist me again.
In the site.template.html.pl just the error sections I use this code for the select fields but they do not appear. Meaning if a user leaves a field blank and it goes to the error template the select fields do not show up.
Code:
my ($errormsg) = shift; $in{'Category'} ?
($in{'Category'} = qq~<input type=hidden name="Category" value="$in{'Category'}">$in{'Category'}~) :
($in{'Category'} = &build_select_field ("Category"));
my $region = &build_select_field ("Region","$in{'Region'}");
my $expiredays = &build_select_field ("ExpireDays","$in{'ExpireDays'}");
Would appreciate some assistance here as well.
Dec 9, 2001, 7:23 PM
Veteran (17240 posts)
Dec 9, 2001, 7:23 PM
Post #15 of 28
Views: 9272
jerrysu (widgetz) wrote the original Mod, Ian.
BTW: I wrote a similar and less complicated mod for DBMAN that works with Links because of the flat files being similarly structured. I posted the codes for the MOD in the DBMAN CUSTOMIZATION FORUM about a year ago.
========================================
Buh Bye!
Cheers,
Me
BTW: I wrote a similar and less complicated mod for DBMAN that works with Links because of the flat files being similarly structured. I posted the codes for the MOD in the DBMAN CUSTOMIZATION FORUM about a year ago.
========================================
Buh Bye!
Cheers,
Me
Dec 9, 2001, 7:39 PM
Enthusiast (504 posts)
Dec 9, 2001, 7:39 PM
Post #16 of 28
Views: 9277
Hey Elliot!
Thanks for the tip. More than one to skin a cat they say. I removed all the code and on that page and only displayed the error message as well as "please push your back button and fix the errors".
Thanks my friend - good to talk again.
If I have time I try and find what you posted.. I remember having this problem sometime ago, but cannot remember how I fixed it. :)
God Bless
Thanks for the tip. More than one to skin a cat they say. I removed all the code and on that page and only displayed the error message as well as "please push your back button and fix the errors".
Thanks my friend - good to talk again.
If I have time I try and find what you posted.. I remember having this problem sometime ago, but cannot remember how I fixed it. :)
God Bless
Dec 10, 2001, 12:01 AM
Enthusiast (504 posts)
Dec 10, 2001, 12:01 AM
Post #17 of 28
Views: 9254
Tried searching - can u give me some key words.. Tried all sorts of words.
BTW I am using your password mod and decided I use it with this directory - however using everything the same from the other directory I cannot get the ExpireDays select field to show up. It just shows as whatever the user has in that select box in text but not the select box.
Man this ExpireDays is getting to be It might appear to be what Paul says but I made sure the case is right and tested the different ways.. so I sure it is not that.
The code I use in the modifyhtml to bring these selects fields up is:
Code:
sub site_html_modify_form { # --------------------------------------------------------
# This routine determines how the modify form page will look like.
my %rec = @_;
my $category = &build_select_field ("Category", "$rec{'Category'}");
my $expiredays = &build_select_field ("ExpireDays","$rec{'ExpireDays'}");
my $region = &build_select_field ("Region","$rec{'Region'}");
&html_print_headers;
print &load_template ('modify.html', {
category => $category,
Address => $address,
region => $region,
ExpireDays => $expiredays,
Password => $password,
%rec,
%globals
});
}
Dec 10, 2001, 10:36 AM
Enthusiast (504 posts)
Dec 10, 2001, 10:36 AM
Post #18 of 28
Views: 9278
I ran this cgi and this is the message from the server log.
If anyone has any idea how to get this cgi script working I would appreciate it.
Quote:
[Tue Dec 11 07:31:11 2001] [error] [client 210.55.105.171] malformed header from script. Bad header=HTTP/1.0 200 OK: /xxxxx/xxxx/ads/nphexpire.cgiIf anyone has any idea how to get this cgi script working I would appreciate it.
Dec 10, 2001, 3:14 PM
Enthusiast (504 posts)
Dec 10, 2001, 3:14 PM
Post #20 of 28
Views: 9238
Thnaks again Paul.. Tried that but still came up with the error - however on the server I am using the file needed to be renamed nhp-whatever.cgi not nphexpirator.cgi.
When this was done the script worked with the http etc commented out.
Blessings Paul and YES the script appears to work ok for those who are interested to know.
When this was done the script worked with the http etc commented out.
Blessings Paul and YES the script appears to work ok for those who are interested to know.
Dec 11, 2001, 12:47 PM
Enthusiast (504 posts)
Dec 11, 2001, 12:47 PM
Post #21 of 28
Views: 9165
Quote:
The code I use in the modify.html to bring these selects fields up is: Code:
sub site_html_modify_form { # --------------------------------------------------------
# This routine determines how the modify form page will look like.
my %rec = @_;
my $category = &build_select_field ("Category", "$rec{'Category'}");
my $expiredays = &build_select_field ("ExpireDays","$rec{'ExpireDays'}");
my $region = &build_select_field ("Region","$rec{'Region'}");
&html_print_headers;
print &load_template ('modify.html', {
category => $category,
Address => $address,
region => $region,
ExpireDays => $expiredays,
Password => $password,
%rec,
%globals
});
}
The region and category selects come up but not the Expiry Days. It shows as text :
Go here http://www.nzcid.org.nz/ads/modify.cgi
In the ID field put "1" in the password field put "test" and when the form appears look at the bottom to see the ExpireDays and it will be in text not the select box.
Any assistance appreciated.
Dec 12, 2001, 7:54 PM
Enthusiast (504 posts)
Dec 12, 2001, 7:54 PM
Post #23 of 28
Views: 9194
Hey Will!
The script that you download from the resources section is called nhpexpirator.txt.
It say rename it to nphexpirator.cgi - as it is a nph file on my server at least I had to call it nph-expire.cgi. The expire bit I choose and it worked when I ran it.
Does it replace nph-build - do not think so, have a look at the code contained in the file..
I got an error message when I first tried to run it. it is mentioned above and PaulW suggested I comment out that line in the script. I did and it worked.
Hope that helps.