From caf762dbfcd20ba1e64ac6dd5586eb7c5206c74c Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Wed, 12 Sep 2012 22:01:08 +0100 Subject: [PATCH] wip --- AwayMsg.pm | 2 +- mason/edit | 2 +- mason/main | 2 +- mason/save | 7 +++++-- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/AwayMsg.pm b/AwayMsg.pm index 3e95f71..acfb0ce 100644 --- a/AwayMsg.pm +++ b/AwayMsg.pm @@ -12,7 +12,7 @@ BEGIN { our ($VERSION, @ISA, @EXPORT, @EXPORT_OK, %EXPORT_TAGS); $VERSION = 1.00; @ISA = qw(Exporter); - @EXPORT = qw(db_connect db_commit www_begin + @EXPORT = qw(db_connect db_commit www_begin hquote $dbh); %EXPORT_TAGS = ( ); @EXPORT_OK = qw(); diff --git a/mason/edit b/mason/edit index bad80b8..9612413 100755 --- a/mason/edit +++ b/mason/edit @@ -58,7 +58,7 @@ if (!$tx) { die "no such text $textid"; } % while (my $row = $usedq->fetchrow_hashref()) { -
Use for <% $row->{'emailaddr'} |h %>{'emailaddr'}) %> +{'emailaddr'}) %> % if (!$create && $row->{'textid'} eq $textid) { checked>(currently using this message) % } elsif (defined $row->{'textid'}) { diff --git a/mason/main b/mason/main index a9a8817..03a01d9 100755 --- a/mason/main +++ b/mason/main @@ -40,7 +40,7 @@ $sth->execute();

Outbound messages

<%perl> -$sth = $dbh->prepare("SELECT * FROM texts ORDER BY desc"); +$sth = $dbh->prepare("SELECT * FROM texts ORDER BY textid"); $sthi = $dbh->prepare(< use AwayMsg; +use Data::Dumper; db_connect(); www_begin($r,$m); <%args> @@ -27,7 +28,7 @@ if ($textid ne 'new') { } if ($textid eq 'new') { - my $textid = time; + $textid = time; my $ntextq = $dbh->prepare("SELECT textid FROM texts". " ORDER BY textid DESC LIMIT 1"); $ntextq->execute(); @@ -38,6 +39,8 @@ if ($textid eq 'new') { } } +print STDERR Dumper([$textid, $desc, $subject, $text]); + my $dinsertq = $dbh->prepare("INSERT INTO texts (textid, desc, subject, text)". " VALUES (?,?,?,?)"); $dinsertq->execute($textid, $desc, $subject, $text); @@ -51,7 +54,7 @@ my $tlistq = $dbh->prepare("SELECT * FROM config"); $tlistq->execute(); while (my $row = $tlistq->fetchrow_hashref()) { if ($ARGS{"u_".hquote($row->{'emailaddr'})}) { -fixme + $tinsertq->execute($row->{'emailaddr'}, $textid); } } -- 2.30.2