<%init> use AwayMsg; db_connect(); www_begin($r,$m); <%shared> our ($cgi,$ar); <%args> $create => undef <%perl> my $textid; if (defined $create) { } else { foreach my $k (keys %ARGS) { if ($k =~ m/^t_(\d{0,7})$/) { $textid= $1; last; } } die unless defined $textid; } 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(<execute(); if (!$tx) { die "no such text $textid"; } <& htmlhead, subpage => "Edit \"$tx->{'desc'}\"" &>
<% $ar->secret_hidden_html() %> <&| txtable, tx => $tx, inputs => 1 &> % while (my $row = $usedq->fetchrow_hashref()) { % }
Use for <% $row->{'emailaddr'} |h %> {'emailaddr'}) %> % if (!$create && $row->{'textid'} eq $textid) { checked>(currently using this message) % } elsif (defined $row->{'textid'}) { >(currently using another message "<% $row->{'desc'} |h %>") % } else { > % }