Support retiring balances of departed members
[hcoop/zz_old/portal.git] / poll.mlt
index 3abe588..834f22d 100644 (file)
--- a/poll.mlt
+++ b/poll.mlt
@@ -32,7 +32,7 @@ elseif $"vote" <> "" then
 
 <h3><b>Choices</b></h3>
 
-<form action="poll">
+<form action="poll" method="post">
 <input type="hidden" name="vote2" value="<% id %>">
 <% val choices = Poll.listChoicesWithMyVotes id;
 if #votes poll = 1 then %>
@@ -72,9 +72,9 @@ elseif $"cmd" = "add" then
        val votes = Web.stoi ($"votes");
        if title = "" then
                %><h3><b>Your poll must have a title.</b></h3><%
-       elseif not (Poll.dateGeNow starts) then
+       elseif not pollAdmin and not (Poll.dateGeNow starts) then
                %><h3><b>That start date is in the past!</b></h3><%
-       elseif not (Poll.dateLe (starts, ends)) then
+       elseif not pollAdmin and not (Poll.dateLe (starts, ends)) then
                %><h3><b>The end date comes before the start date!</b></h3><%
        elseif votes <= 0 then
                %><h3><b>You must specify a positive number of votes per person.</b></h3><%
@@ -91,7 +91,7 @@ elseif $"mod" <> "" then
        Poll.requireCanModify poll %>
 <h3><b>Modify poll</b></h3>
 
-<form action="poll">
+<form action="poll" method="post">
 <input type="hidden" name="id" value="<% $"mod" %>">
 <table>
 <tr> <td align="right"><b>Title</b>:</td> <td><input name="title" value="<% Web.html (#title poll) %>"></td> </tr>
@@ -114,9 +114,9 @@ elseif $"mod" <> "" then
        val votes = Web.stoi ($"votes");
        if title = "" then
                %><h3><b>Your poll must have a title.</b></h3><%
-       elseif not (Poll.dateGeNow starts) then
+       elseif not pollAdmin and not (Poll.dateGeNow starts) then
                %><h3><b>That start date is in the past!</b></h3><%
-       elseif not (Poll.dateLe (starts, ends)) then
+       elseif not pollAdmin and not (Poll.dateLe (starts, ends)) then
                %><h3><b>The end date comes before the start date!</b></h3><%
        elseif votes <= 0 then
                %><h3><b>You must specify a positive number of votes per person.</b></h3><%
@@ -157,7 +157,7 @@ elseif $"modChoice" <> "" then
        val poll = Poll.lookupPoll (#pol cho);
        Poll.requireCanModify poll %>
 
-<form action="poll">
+<form action="poll" method="post">
 <input type="hidden" name="saveChoice" value="<% id %>">
 <table>
 <tr> <td align="right"><b>Text</b>:</td> <td><input name="descr" value="<% Web.html (#descr cho) %>"></td> </tr>
@@ -207,6 +207,17 @@ elseif $"delChoice" <> "" then
 
 <h3><b>Vote Report</b></h3>
 
+<p>Voters:
+<%     ref first = true;
+       foreach user in Poll.listPollVoters id do
+               if first then
+                       first := false
+               else
+                       %>, <%
+               end
+               %><a href="user?id=<% #id user %>"><% #name user %></a><%
+       end %></p>
+
 <table>
 <tr> <td align="right"><b>Poll#</b>:</td> <td><% id %></td> </tr>
 <tr> <td align="right"><b>Title</b>:</td> <td><% Web.html (#title poll) %></td> </tr>
@@ -257,6 +268,8 @@ end %>
 
 <h3><b>Choices<% if Poll.takingVotes poll then %><a href="poll?vote=<% id %>">(Vote!)</a><% end %></b></h3>
 
+<p><% Poll.countVoters (#id poll) %> people have voted.</p>
+
 <% if Poll.takingVotes poll then %>
 <table>
 <tr> <td><b>You</b></td> <td><b>Total</b></td> </tr>
@@ -272,7 +285,6 @@ end %>
 <% end %>
 </table>
 
-<a href="poll?report=<% id %>">Vote Report</a>
 <% else
 foreach cho in Poll.listChoices id do %>
        <li> <% Web.html (#descr cho) %>
@@ -284,11 +296,13 @@ foreach cho in Poll.listChoices id do %>
 <% end
 end %>
 
+<a href="poll?report=<% id %>">Vote Report</a>
+
 <% if canModify then %>
 <br><hr><br>
 <h3><b>Add a new choice</b></h3>
 
-<form action="poll">
+<form action="poll" method="post">
 <input type="hidden" name="addChoice" value="<% id %>">
 <table>
 <tr> <td align="right"><b>Text</b>:</td> <td><input name="descr"></td> </tr>
@@ -305,7 +319,7 @@ if showNormal then %>
 
 <h3><b>Create a poll</b></h3>
 
-<form action="poll">
+<form action="poll" method="post">
 <input type="hidden" name="cmd" value="add">
 <table>
 <tr> <td align="right"><b>Title</b>:</td> <td><input name="title"></td> </tr>