chiark / gitweb /
wip
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Wed, 12 Sep 2012 21:01:08 +0000 (22:01 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Wed, 12 Sep 2012 21:01:08 +0000 (22:01 +0100)
AwayMsg.pm
mason/edit
mason/main
mason/save

index 3e95f713bc7763b8be455920704a17545b444b21..acfb0ce848d64d2876085ec7245458583bc8d227 100644 (file)
@@ -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();
index bad80b836604c6e0ed5a891cb8605611f6324853..96124131d93a83a3e464d4c9c702650882cad3b2 100755 (executable)
@@ -58,7 +58,7 @@ if (!$tx) { die "no such text $textid"; }
 </table><table>
 % while (my $row = $usedq->fetchrow_hashref()) {
 <tr><td>Use for <% $row->{'emailaddr'} |h %></td>
-<td><input type="checkbox" value="1" name=u_<% hqote($row->{'emailaddr'}) %>
+<td><input type="checkbox" value="1" name=u_<% hquote($row->{'emailaddr'}) %>
 %     if (!$create && $row->{'textid'} eq $textid) {
  checked></td><td>(currently using this message)
 %     } elsif (defined $row->{'textid'}) {
index a9a881719d368e8c7d2b4f0e9546b6fd1719515d..03a01d90615c7725fa88fc775010585e3b905aa6 100755 (executable)
@@ -40,7 +40,7 @@ $sth->execute();
 <hr>
 <h2>Outbound messages</h2>
 <%perl>
-$sth = $dbh->prepare("SELECT * FROM texts ORDER BY desc");
+$sth = $dbh->prepare("SELECT * FROM texts ORDER BY textid");
 $sthi = $dbh->prepare(<<END);
     SELECT * FROM addresses
      WHERE textid = ?
index 1f813c4867d969858902737870bbccb0f0648ed0..cedd05b28e87d389583cddfccb492fa5a520f343 100755 (executable)
@@ -1,5 +1,6 @@
 <%init>
 use AwayMsg;
+use Data::Dumper;
 db_connect();
 www_begin($r,$m);
 </%init><%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);
     }
 }