X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?a=blobdiff_plain;ds=sidebyside;f=mason%2Fedit;h=c8ee036601ac0f7e578394100f99bb773dc2c215;hb=ad848a3d5e86602f7a568e6a0b034b21a177171a;hp=0781e9b02341ba0327c86406c973ac7bde86ea48;hpb=dd6268cdf15ec8d2670e195cfebceb5116b61229;p=nj-awaymsg.git diff --git a/mason/edit b/mason/edit index 0781e9b..c8ee036 100755 --- a/mason/edit +++ b/mason/edit @@ -1,6 +1,7 @@ <%init> use AwayMsg; db_connect(); +www_begin($r,$m); %init> <%args> @@ -22,21 +23,40 @@ if (defined $create) { die unless defined $textid; } -my $sth = $dbh->prepare("SELECT * FROM texts WHERE textid=?"); -$sth->execute($textid); -my $tx = $sth->fetchrow_hashref();# +my $tx; + +if ($ARGS{'create'}) { + my $date = `date --iso-8601=minutes`; chomp $date or die; + $tx = { desc => "Message created $date", + subject => "Away from my email", + textid => "new", + text => "" }; +} else { + my $sth = $dbh->prepare("SELECT * FROM texts WHERE textid=?"); + $sth->execute($textid); + $tx = $sth->fetchrow_hashref();# +} + +my $usedq = $dbh->prepare("SELECT * FROM addresses ORDER BY emailaddr"); +$usedq->execute(); if (!$tx) { die "no such text $textid"; } %perl> -
-