Add delete links on poll pages
[bpt/portal.git] / poll.mlt
index dac0ede..200c96a 100644 (file)
--- a/poll.mlt
+++ b/poll.mlt
@@ -142,15 +142,15 @@ elseif $"mod" <> "" then
        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>
 
@@ -320,6 +320,8 @@ end %>
 
 <% 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">