chiark / gitweb /
wip, don't do radiobuttons after all
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Wed, 12 Sep 2012 18:00:50 +0000 (19:00 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Wed, 12 Sep 2012 18:00:50 +0000 (19:00 +0100)
mason/edit

index c8ee036601ac0f7e578394100f99bb773dc2c215..9fc7a22d28d72f07a094871d97132436dca7ec94 100755 (executable)
@@ -37,7 +37,13 @@ if ($ARGS{'create'}) {
     $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"; }
@@ -49,14 +55,20 @@ 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">