elseif votes <= 0 then
%><h3>You must specify a positive number of votes per person.</h3><%
else
- val id = Poll.addPoll (Init.getUserId(), title, $"descr", starts, ends, votes, official);
+ val id = Poll.addPoll (Init.getUserId(), title, $"descr", starts, ends, votes, official, false);
editingPoll := SOME id;
%><h3>Poll added!</h3><%
end
<input type="hidden" name="id" value="<% $"mod" %>">
<table class="blanks">
<tr> <td>Title:</td> <td><input name="title" value="<% Web.html (#title poll) %>"></td> </tr>
+<tr> <td>Ready?</td> <td><input type="checkbox" name="ready" <% if #ready poll then " checked" else "" end %>></td> </tr>
<tr> <td>Start date:</td> <td><input name="starts" value="<% Web.html (#starts poll) %>"></td> </tr>
<tr> <td>End date:</td> <td><input name="ends" value="<% Web.html (#ends poll) %>"></td> </tr>
<tr> <td>Max votes/person:</td> <td><input name="votes" value="<% #votes poll %>"></td> </tr>
val ends = $"ends";
val votes = Web.stoi ($"votes");
val official = $"official" = "on";
- if title = "" then
+ val ready = $"ready" = "on";
+ if not (Poll.canModify poll) then
+ %><h3>You can't modify this poll anymore, because voting is already open.</h3><%
+ elseif title = "" then
%><h3>Your poll must have a title.</h3><%
elseif not pollAdmin and not (Poll.dateGeNow starts) then
%><h3>That start date is in the past!</h3><%
elseif votes <= 0 then
%><h3>You must specify a positive number of votes per person.</h3><%
else
- Poll.modPoll {poll with title = title, descr = $"descr", starts = starts, ends = ends, votes = votes, official = official};
+ Poll.modPoll {poll with title = title, descr = $"descr", starts = starts, ends = ends, votes = votes, official = official,
+ ready = ready};
editingPoll := SOME (#id poll);
%><h3>Poll record saved.</h3><%
end
val id = Web.stoi ($"addChoice");
editingPoll := SOME id;
val descr = $"descr";
- if descr = "" then
+ val poll = Poll.lookupPoll id;
+ if not (Poll.canModify poll) then
+ %><h3>You can't modify this poll anymore, because voting is already open.</h3><%
+ elseif descr = "" then
%><h3>Your poll choice must have a description.</h3><%
else
val id = Poll.addChoice (id, Web.stor ($"seq"), descr);