X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?p=nj-awaymsg.git;a=blobdiff_plain;f=mason%2Fedit;h=6f256ef4f71927ec6c30cc5e02236fe2cde85630;hp=7869cc814c4cc6526c0aec599e2efd881d48223a;hb=6d236f348881a1c212a5f085a615e4c5a86cd050;hpb=1f01b365b07c5952ec878a4ca0d4b69f2ed14f80 diff --git a/mason/edit b/mason/edit index 7869cc8..6f256ef 100755 --- a/mason/edit +++ b/mason/edit @@ -1,6 +1,7 @@ <%init> use AwayMsg; db_connect(); +www_begin($r,$m); <%args> @@ -22,21 +23,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 "out of office" setup - -

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

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