<%init>
use AwayMsg;
db_connect();
+www_begin($r,$m);
my ($sth,$row,$sthi,$rowi);
</%init>
<&htmlhead, subpage => 'Overview' &>
<hr>
<h2>Outbound messages</h2>
<%perl>
-$sth = $dbh->prepare("SELECT * FROM texts ORDER BY desc");
+$sth = $dbh->prepare("SELECT * FROM texts ORDER BY textid");
$sthi = $dbh->prepare(<<END);
SELECT * FROM addresses
WHERE textid = ?
<&| txtable, tx => $row &>
% $sthi->execute($row->{'textid'});
+% my $anyused = 0;
% while (my $rowi= $sthi->fetchrow_hashref()) {
<tr><td>Used for:</td><td><% $rowi->{'emailaddr'} |h %></td></tr>
+% $anyused++;
+% }
+% if ($anyused) {
+<tr><td colspan=2>Not currently in use</td></tr>
% }
</&>
<pre>
<% $row->{'text'} |h %>
</pre>
-<input type="submit" name="t<% $row->{'textid'} %>"
+<input type="submit" name="t_<% $row->{'textid'} %>"
value="Edit or configure this message">
<hr>
% }