X-Git-Url: https://git.hcoop.net/bpt/portal.git/blobdiff_plain/1b566e48ec4228ebf60088e7040b9d92a8c1fb01..a0a15865970cfb25bae970fbb652b1de41c17304:/poll.mlt diff --git a/poll.mlt b/poll.mlt index 4b7d968..735a201 100644 --- a/poll.mlt +++ b/poll.mlt @@ -27,9 +27,13 @@ elseif $"vote" <> "" then 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) %> +<% 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

@@ -47,7 +51,8 @@ foreach (you, cho) in choices do %>
-<% 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); editingPoll := SOME id; %>

Poll added!

<% end @@ -98,6 +106,7 @@ elseif $"mod" <> "" then Start date: End date: Max votes/person: + Official: > Description: @@ -112,6 +121,7 @@ elseif $"mod" <> "" 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 @@ -121,7 +131,7 @@ 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}; editingPoll := SOME (#id poll); %>

Poll record saved.

<% end @@ -224,6 +234,7 @@ elseif $"delChoice" <> "" then 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 +274,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) %> @@ -315,7 +327,11 @@ end %> <% | NONE => if showNormal then -val polls = Poll.listCurrentPolls (); +val mlen = Poll.membershipLength (Init.getUserId ()) %> + +

You have been an HCoop member for <% mlen %> days, so you are<% if mlen < Poll.votingMembershipRequirement then %> not<% end %> eligible to vote in official polls.

+ +<% val polls = Poll.listCurrentPolls (); switch polls of _::_ => %>

Current polls

@@ -338,6 +354,7 @@ end %> Start date: End date: Max votes/person: + Official: Description: