end
elseif $"del" <> "" then
- Group.requireGroupName "poll";
showNormal := false;
- val poll = Poll.lookupPoll (Web.stoi ($"del")) %>
+ val poll = Poll.lookupPoll (Web.stoi ($"del"));
+ Poll.requireCanModify poll %>
<h3>Are you sure you want to delete poll <a href="poll?id=<% #id poll %>"><% Web.html (#title poll) %></a>?</h3>
<a href="poll?del2=<% $"del" %>">Yes, delete <% Web.html (#title poll) %>!</a>
<% elseif $"del2" <> "" then
- Group.requireGroupName "poll";
val poll = Poll.lookupPoll (Web.stoi ($"del2"));
+ Poll.requireCanModify poll;
Poll.deletePoll (Web.stoi ($"del2")) %>
<h3><% Web.html (#title poll) %> deleted!</h3>
<% if canModify then %>
<br><hr><br>
+<h3><a href="?del=<% id %>">Delete this poll</a></h3>
+
<h3>Add a new choice</h3>
<form action="poll" method="post">
fun canModify (poll : poll) =
Group.inGroupName "poll"
- orelse (#usr poll = Init.getUserId()
- andalso (dateLtNow (#starts poll)
- orelse not (#ready poll)))
+ orelse ((#usr poll = Init.getUserId()
+ andalso (dateLtNow (#starts poll)
+ orelse not (#ready poll))))
fun requireCanModify poll =
if canModify poll then