Gossamer Forum
Home : Products : DBMan : Installation :

Add "What's New" Mailing list to DBMan?

Quote Reply
Add "What's New" Mailing list to DBMan?
Anyone had any luck creating a "What's New" Mailing List to DBMan? I've got the mod to add a generic mailing list ( www.gossamer-threads.com/scripts/forum/resources/Forum5/HTML/000322.html ) working but it doesn't insert the new entries into the Text box like I need.

Any help would be sincerely and greatly appreciated.



------------------
Wayne Hunt
Amiga.org
http://www.amiga.org



[This message has been edited by Wayne Hunt (edited March 08, 1999).]
Quote Reply
Re: Add "What's New" Mailing list to DBMan? In reply to
You'll need to add a "require" statement for the nph-mail.cgi script (you may have to rename it to .pl -- I'm not sure about this kind of stuff).

Add a new "admin-only" link:

<a href="$db_script_link_url&mailer=1">Mailer</a>

In db.cgi, sub main, add a new command:

elsif ($in{'mailer'}) { if ($per_admin) { &mail_form; } else { &html_unauth; } }

In nph-email.cfg, take out the check password lines.

Then do a routine to determine the date that you want to start checking for. If you need some help with that, there's info here on the forum, or I can help you out.

You'll want to end up with a variable like $in{'Date-gt'} = [the day before you want to start looking];

Then get the record information:
my ($status, @hits) = &query("view");

You'll probably want to do some error-checking to be sure that you got results.

(One thing. I think there's a bug in the db.cgi script. Look in sub query for

if ($in{"$column-gt"} !~ /^\s*$/) { ($db_sort{$column} eq 'date') and (&date_to_unix($in{$column-gt}) or return "Invalid date format: '$in{$column}'");
push(@search_gt_fields, $i); }
if ($in{"$column-lt"} !~ /^\s*$/) { ($db_sort{$column} eq 'date') and (&date_to_unix($in{$column-lt}) or return "Invalid date format: '$in{$column}'");
push(@search_lt_fields, $i);
}

and make the changes I've indicated in bold.

Next you'll need to have a routine to format your records for the mailing. It will be much like the routiine in html_view_success:

for (0 .. $numhits - 1) {
[etc]

but as you go through the records, build up the text in a variable. For our purposes here, I'll call it $new_records.

Finally, you insert the information into the textarea--

<textarea name=body cols=60 rows=40>$new_records</textarea>

I hope this was clear. Please don't hesitate to ask if you don't understand.


------------------
JPD


Quote Reply
Re: Add "What's New" Mailing list to DBMan? In reply to
JP, thanks for the help, but you knew it was coming ;-)

Quote:
You'll need to add a "require" statement for the nph-mail.cgi script (you may have to rename it to .pl -- I'm not sure about this kind of stuff).

Forgive my ineptitude with Perl, but add it where? and how do requires work? Example please?

Quote:
Add a new "admin-only" link:
<a href="$db_script_link_url&mailer=1">Mailer</a>

In the html.pl, right?

Quote:
In nph-email.cfg, take out the check password lines.

I must have missed something here because I installed it per the link above and I've got no nph-email.cfg, just the .cgi file.

Quote:
Then do a routine to determine the date that you want to start checking for. If you need some help with that, there's info here on the forum, or I can help you out.

Please?! I feel completely over my head here. Originally I wanted to simply cron a once a week item to send out the changes/news for the last seven days. I can manage to remember to send it out manually of course, but the Perl programming you mention is completely beyond my comprehension at this stage of my DBMan awareness.

Is there _any_ way that I could possibly ship you my config/db files for your expert touch? You make it sound so simple that I'm embarrassed to be lost in the conversation...

Sincerely,


------------------
Wayne Hunt
Amiga.org
http://www.amiga.org

Quote Reply
Re: Add "What's New" Mailing list to DBMan? In reply to
  Smile

Code:
$days = 8; #must be one more than the number of days you really want
$time = time() - ($days * 86400);

my ($sec, $min, $hour, $day, $mon, $year, $dweek, $dyear, $daylight) = localtime($time);
my (@months) = qw!Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec!;
($day < 10) and ($day = "0$day");
$year = $year + 1900;
$in{'Date-gt'} = "$day-$months[$mon]-$year";

Of course, if you've changed the date format, you would make that adjustment here. And, if your date field isn't "Date," change the $in{'Date-gt'} accordingly.


Quote:
Is there _any_ way that I could possibly ship you my config/db files for your expert touch? You make it sound so simple that I'm embarrassed to be lost in the conversation...

Since this is something that a lot of people might be interested in doing, I'd rather leave the discussion out in the open. If you're completely lost, I can do it for you, but it's much more satisfying for you if you do it yourself.

BTW, Amiga rules!! Smile

------------------
JPD




[This message has been edited by JPDeni (edited March 08, 1999).]
Quote Reply
Re: Add "What's New" Mailing list to DBMan? In reply to
If I put a "require" statement in as suggested below, I get a 500 server error.

------------------
Wayne Hunt
Amiga.org
http://www.amiga.org

Quote Reply
Re: Add "What's New" Mailing list to DBMan? In reply to
I'm sorry. I'm going to have to take a whole lot of time to work on this. I thought I could do it "quick and dirty," but I realize now it will take some work.

When I get some time, I'll work on it. Sorry.


------------------
JPD


Quote Reply
Re: Add "What's New" Mailing list to DBMan? In reply to
JPDeni,

Absolutely no problem. I can appreciate time crunches, especially since I'm facing the North American "Amiga 99" tradeshow this weekend.

Good luck, and thank you very much.

------------------
Wayne Hunt
Amiga.org
http://www.amiga.org