+<%init>
+use AwayMsg;
+db_connect();
+</%init>
+<%args>
+$textid
+$save => 0
+$cancel => 0
+$textid => undef
+</%args>
+<%perl>
+if ($save) {
+ my $ins;
+ $dbh->do('BEGIN');
+ if ($textid eq 'new') {
+ my $ntextq = $dbh->prepare("SELECT textid FROM texts".
+ " ORDER BY textid DESC LIMIT 1");
+ $ntextq->execute();
+ my $ntextrow = $ntextq->fetchrow_hashref();
+ if ($ntextrow) {
+ $textid = $ntextrow->{'textid'} + 1;
+ } else {
+ $textid = 1;
+ }
+ } else {
+ my $dtextq = $dbh->prepare("DELETE FROM texts WHERE textid = ?");
+ my $ndeleted = $dtextq->execute($textid);
+ if (!$ndeleted) {
+</%perl>
+
+
+ $ins = $dbh->prepare("INSERT INTO texts VALUES (
+ $sth = $dbh->
+}