"" => Balance.addBalance ($"name")
| s => Web.stoi s);
- val id = Init.addUser ($"name", $"rname", bal, ap);
+ val id = Init.addUser ($"name", $"rname", bal, ap, 1);
Group.addToGroups (id, map Web.stoi (Web.getMultiParam "grp"));
if $"amount" <> "" then
Init.grandfatherUsers()
%><h3>Grandfathered</h3>
-<% end %>
-
-<% if showNormal then %>
+<% elseif $"cmd" = "addform" then
+ showNormal := false %>
<h3>New member</h3>
<form action="users" method="post">
</table>
</form>
+<% elseif $"cmd" = "unmigrated" then
+ showNormal := false;
+ ref negative = 0;
+ val users = Init.unmigratedUsers () %>
+
+<h3>Unmigrated members (<% length users %>)</h3>
+
+<table>
+<% foreach user in users do %>
+ <tr> <td><a href="user?id=<% #id user %>"><% Web.html (#name user) %></a></td>
+<% val bal = Balance.lookupBalance (#bal user);
+if Balance.isNegative bal then
+ negative := negative + 1
+end %>
+<td><% #amount bal %></td><td>
+<%if #name bal <> #name user then %>
+ <i><% Web.html (#name bal) %></i>
+<% end %>
+</td> </tr>
+<% end %>
+</table>
+
+<p><% negative %> have negative balances.</p>
+
+<% elseif $"cmd" = "diff" then
+ showNormal := false;
+
+ val against = (case $"against" of
+ "" => Init.usersInAfs ()
+ | x => String.tokens Char.isSpace x);
+
+ val diff = Init.usersDiff (Init.listUsernames (), against) %>
+
+<h3>User diff</h3>
+
+<h4>Only on the portal:</h4>
+<ul>
+<% foreach user in #onlyInFirst diff do %>
+ <li> <a href="user?id=<% valOf (Init.userNameToId user) %>"><% Web.html user %></a></li>
+<% end %>
+</ul>
+
+<h4>Only in AFS:</h4>
+<ul>
+<% foreach user in #onlyInSecond diff do %>
+ <li> <% Web.html user %></li>
+<% end %>
+</ul>
+
+<% end %>
+
+<% if showNormal then %>
+
+<a href="users?cmd=addform">Add a user manually</a><br>
+
<h3>Manage current members</h3>
<table>
</table>
<br><a href="users?cmd=grandfather">Grandfather old users to have applications</a><br>
+<a href="users?cmd=unmigrated">Who hasn't migrated yet?</a><br>
+<a href="users?cmd=diff">How does the set of users in AFS compare with the set of active portal users?</a><br>
<% end %>