<% @header [("title", ["Roll call!"])]; val you = Init.getUserId (); ref viewingCall = NONE; ref showNormal = true; if $"cmd" = "respond" then showNormal := false; val rol = Web.stoi ($"rol"); val code = $"code"; val rc = Roll.lookupEntry (rol, you); if code = #code rc then Roll.respond (rol, you); %>

Your response has been saved. Thank you!

<% else %>

Incorrect code!

<% end elseif $"cmd" = "add" then Group.requireAnyGroupName ["root", "board"]; val title = $"title"; val msg = $"msg"; if title = "" then %>

Your roll call must have a title.

<% else val id = Roll.addRollCall (title, msg); viewingCall := SOME id; %>

Roll call added!

<% end elseif $"mod" <> "" then Group.requireAnyGroupName ["root", "board"]; showNormal := false; val rc = Roll.lookupRollCall (Web.stoi ($"mod")) %>

Modify roll call

">
Title:
Message:
<% elseif $"cmd" = "Save" then Group.requireAnyGroupName ["root", "board"]; val rc = Roll.lookupRollCall (Web.stoi ($"id")); val title = $"title"; val msg = $"msg"; if title = "" then %>

Your rol call must have a title.

<% else Roll.modRollCall {rc with title = title, msg = msg}; viewingCall := SOME (#id rc); %>

Roll call saved.

<% end elseif $"del" <> "" then Group.requireAnyGroupName ["root", "board"]; showNormal := false; val rc = Roll.lookupRollCall (Web.stoi ($"del")) %>

Are you sure you want to delete roll call "<% Web.html (#title rc) %>"?

">Yes, delete <% Web.html (#title rc) %>! <% elseif $"del2" <> "" then Group.requireAnyGroupName ["root", "board"]; val rc = Roll.lookupRollCall (Web.stoi ($"del2")); Roll.deleteRollCall (Web.stoi ($"del2")) %>

<% Web.html (#title rc) %> deleted!

<% elseif $"cmd" = "mailall" then Group.requireAnyGroupName ["root", "board"]; showNormal := false; ref first = true %> Mail everyone! <% elseif $"view" <> "" then Group.requireAnyGroupName ["root", "board"]; val id = Web.stoi ($"view"); viewingCall := SOME id end; if showNormal then Group.requireAnyGroupName ["root", "board"]; switch viewingCall of NONE => %>

Existing roll calls

<% foreach rc in Roll.listRollCalls () do %>
  • <% Web.html (#title rc) %> (<% #started rc %>)
  • <% end %>

    New roll call

    Title:
    Message:
    Mail everyone! (provides mailto: link) <% | SOME id => val rc = Roll.lookupRollCall id %>

    Roll call "<% Web.html (#title rc) %>"

    Started: <% #started rc %>
    Message: <% Web.htmlNl (#msg rc) %>
    [ Modify | Delete ]
    <% val (didnt, did) = Roll.listEntries id %>

    Didn't respond yet:

    <% foreach (usr, ent) in didnt do %>
  • <% Web.html (#name usr) %>
  • <% end %>

    Responded:

    <% foreach (usr, ent) in did do %>
  • <% Web.html (#name usr) %> (<% switch #responded ent of SOME st => st end %>)
  • <% end %> <% end end %> <% @footer[] %>