X-Git-Url: http://git.hcoop.net/hcoop/portal.git/blobdiff_plain/a0a15865970cfb25bae970fbb652b1de41c17304..daaa0de7fc21561fd324cbc93fc99d69646b537f:/poll.mlt
diff --git a/poll.mlt b/poll.mlt
index 735a201..200c96a 100644
--- a/poll.mlt
+++ b/poll.mlt
@@ -87,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, official);
+ val id = Poll.addPoll (Init.getUserId(), title, $"descr", starts, ends, votes, official, false);
editingPoll := SOME id;
%>
Poll added!
<%
end
@@ -103,6 +103,7 @@ elseif $"mod" <> "" then
">
Title:
+
Ready?
>
Start date:
End date:
Max votes/person:
@@ -122,7 +123,10 @@ elseif $"mod" <> "" then
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
+ %>
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!
<%
@@ -131,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, official = official};
+ 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 %>
@@ -153,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);
@@ -312,6 +320,8 @@ end %>
<% if canModify then %>
+