chiark
/
gitweb
/
~ian
/
nj-awaymsg.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
wip, don't do radiobuttons after all
[nj-awaymsg.git]
/
mason
/
edit
diff --git
a/mason/edit
b/mason/edit
index c8ee036601ac0f7e578394100f99bb773dc2c215..9fc7a22d28d72f07a094871d97132436dca7ec94 100755
(executable)
--- a/
mason/edit
+++ b/
mason/edit
@@
-37,7
+37,13
@@
if ($ARGS{'create'}) {
$tx = $sth->fetchrow_hashref();#
}
$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"; }
$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>
</&>
<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"
% 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">
<input type="hidden" name="textid" value="<% $tx->{'textid'} %>">
<input type="submit" name="save" value="Save">
<input type="submit" name="cancel" value="Cancel edit">