+<% if #official poll and Poll.membershipLength (Init.getUserId ()) < Poll.votingMembershipRequirement then %>
+
You haven't been a member long enough to vote in an official poll.
+<% else %>
Choices
-<% elseif $"vote2" <> "" then
+<% end
+elseif $"vote2" <> "" then
val id = Web.stoi ($"vote2");
val poll = Poll.lookupPoll id;
editingPoll := SOME id;
@@ -56,7 +61,9 @@ foreach (you, cho) in choices do %>
[""] => []
| v => map Web.stoi v;
- if length votes > #votes poll then
+ if #official poll and Poll.membershipLength (Init.getUserId ()) < Poll.votingMembershipRequirement then
+ %>
You haven't been a member long enough to vote in an official poll.
<%
+ elseif length votes > #votes poll then
%>
You can't vote for that many different choices!
<%
elseif not (Poll.noDupes votes) then
%>
You can't vote multiple times for the same choice!
<%
@@ -70,6 +77,7 @@ elseif $"cmd" = "add" then
val starts = $"starts";
val ends = $"ends";
val votes = Web.stoi ($"votes");
+ val official = $"official" = "on";
if title = "" then
%>
Your poll must have a title.
<%
elseif not pollAdmin and not (Poll.dateGeNow starts) then
@@ -79,7 +87,7 @@ elseif $"cmd" = "add" then
elseif votes <= 0 then
%>
You must specify a positive number of votes per person.
<%
else
- val id = Poll.addPoll (Init.getUserId(), title, $"descr", starts, ends, votes);
+ val id = Poll.addPoll (Init.getUserId(), title, $"descr", starts, ends, votes, official, false);
editingPoll := SOME id;
%>
Poll added!
<%
end
@@ -95,9 +103,11 @@ elseif $"mod" <> "" then
">
Title:
+
Ready?
>
Start date:
End date:
Max votes/person:
+
Official:
>
Description:
@@ -112,7 +122,11 @@ elseif $"mod" <> "" then
val starts = $"starts";
val ends = $"ends";
val votes = Web.stoi ($"votes");
- if title = "" then
+ val official = $"official" = "on";
+ val ready = $"ready" = "on";
+ if not (Poll.canModify poll) then
+ %>
You can't modify this poll anymore, because voting is already open.
<%
+ elseif title = "" then
%>
Your poll must have a title.
<%
elseif not pollAdmin and not (Poll.dateGeNow starts) then
%>
That start date is in the past!
<%
@@ -121,21 +135,22 @@ elseif $"mod" <> "" then
elseif votes <= 0 then
%>
You must specify a positive number of votes per person.
<%
else
- Poll.modPoll {poll with title = title, descr = $"descr", starts = starts, ends = ends, votes = votes};
+ Poll.modPoll {poll with title = title, descr = $"descr", starts = starts, ends = ends, votes = votes, official = official,
+ ready = ready};
editingPoll := SOME (#id poll);
%>
Poll record saved.
<%
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 %>
@@ -143,7 +158,10 @@ elseif $"del" <> "" then
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
+ %>
You can't modify this poll anymore, because voting is already open.
<%
+ elseif descr = "" then
%>
Your poll choice must have a description.
<%
else
val id = Poll.addChoice (id, Web.stor ($"seq"), descr);
@@ -221,9 +239,10 @@ elseif $"delChoice" <> "" then
Poll#:
<% id %>
Title:
<% Web.html (#title poll) %>
-
Start>:
<% Web.html (#starts poll) %>
+
Start:
<% Web.html (#starts poll) %>
End:
<% Web.html (#ends poll) %>
Votes/person:
<% #votes poll %>
+
Official:
<% if #official poll then "yes" else "no" end %>
Description:
<% Web.htmlNl (#descr poll) %>
@@ -263,6 +282,7 @@ end %>
Start:
<% Web.html (#starts poll) %>
End:
<% Web.html (#ends poll) %>
Votes/person:
<% #votes poll %>
+
Official:
<% if #official poll then "yes" else "no" end %>
Description:
<% Web.htmlNl (#descr poll) %>
@@ -300,6 +320,8 @@ end %>
<% if canModify then %>
+