X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?a=blobdiff_plain;f=mason%2Fedit;h=e887bdb739a78f84caf2bf5cf60f28400c46795f;hb=9cc1c4dfcca1ae70756fef8b9ebf37aa357c8e60;hp=6edfbbc68e19f3f7d39c06cb661821e8a6c5230a;hpb=e0f35763c54487334f2b8cef76da5f362ef76917;p=nj-awaymsg.git diff --git a/mason/edit b/mason/edit index 6edfbbc..e887bdb 100755 --- a/mason/edit +++ b/mason/edit @@ -22,21 +22,29 @@ 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();# +} if (!$tx) { die "no such text $textid"; } - -Editing - <% $tx->{'desc'} |h %> - Email away message setup - -

Edit "<% $tx->{'desc'} |h %>"

+<& htmlhead, subpage => "Edit \"$tx->{'desc'}\"" &>
<&| txtable, tx => $tx, inputs => 1 &> - - + + +