$tx = $sth->fetchrow_hashref();#
}
-my $usedq = $dbh->prepare("SELECT * FROM addresses ORDER BY emailaddr");
+my $usedq = $dbh->prepare(<<END);
+ SELECT *
+ FROM config
+ LEFT JOIN addresses USING (emailaddr)
+ LEFT JOIN texts USING (textid)
+ ORDER BY emailaddr
+END
$usedq->execute();
if (!$tx) { die "no such text $textid"; }
<tr><td colspan=2><textarea name="text" cols="79" rows="15"><%
$tx->{'text'} |h %></textarea></td></tr>
</&>
-</table><br><table>
+</table><table>
% while (my $row = $usedq->fetchrow_hashref()) {
<tr><td>Use for <% $row->{'emailaddr'} |h %></td>
<td><input type="checkbox"
-% if ($usedq->
-></td></tr>
+% if ($row->{'textid'} eq $textid) {
+ checked></td><td>(currently using this message)
+% } elsif (defined $row->{'textid'}) {
+ ></td><td>(currently using another message "<% $row->{'desc'} |h %>")
+% } else {
+ >
+% }
+</td></tr>
% }
-<p>
+</table><p>
<input type="hidden" name="textid" value="<% $tx->{'textid'} %>">
<input type="submit" name="save" value="Save">
<input type="submit" name="cancel" value="Cancel edit">