chiark / gitweb /
run-mason.cgi: seems to work
[nj-awaymsg.git] / mason / main
index 4e98c172f9cb21c85203777e0a4722f701a42a64..a9bc72e20621da1a183218ecba490259ef544095 100755 (executable)
@@ -1,12 +1,10 @@
 <%init>
 use AwayMsg;
 db_connect();
+www_begin($r,$m);
 my ($sth,$row,$sthi,$rowi);
 </%init>
-<html lang="en"><head>
-<title>Email "out of office" setup</title>
-</head><body>
-<h1>Email "out of office" setup</h1>
+<&htmlhead, subpage => 'Overview' &>
 
 <h2>Email addresses and their configuration</h2>
 <%perl>
@@ -29,11 +27,11 @@ $sth->execute();
 <tr>
 <td><% $row->{'emailaddr'} |h %></td>
 %     if (defined $row->{'textid'}) {
+<td>active</td>
 <td><% $row->{'desc'} |h %></td>
 %     } else {
 <td>inactive</td>
 <td></td>
-<td></td>
 %     }
 </tr>
 % }
@@ -42,7 +40,7 @@ $sth->execute();
 <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 = ?
@@ -56,15 +54,20 @@ $sth->execute();
 
 <&| 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>
 % }