Add all-balance summing and listing of retired balances
[hcoop/zz_old/portal.git] / apps.mlt
index adec3b6..af6e1bf 100644 (file)
--- a/apps.mlt
+++ b/apps.mlt
@@ -9,15 +9,15 @@ ref showNormal = true;
 if $"vote" <> "" then
        Group.requireGroupName "board";
        App.vote (you, Web.stoi ($"vote"))
-       %><h3><b>Vote registered</b></h3><%
+       %><h3>Vote registered</h3><%
 elseif $"unvote" <> "" then
        Group.requireGroupName "board";
        App.unvote (you, Web.stoi ($"unvote"))
-       %><h3><b>Unvote registered</b></h3><%
+       %><h3>Unvote registered</h3><%
 elseif $"deny" <> "" then
        showNormal := false;
        val appl = App.lookupApp (Web.stoi ($"deny"))
-       %><h3><b>Deny application for <% #name appl %></b></h3>
+       %><h3>Deny application for <% #name appl %></h3>
        <form action="apps" method="post">
        <input type="hidden" name="deny2" value="<% $"deny" %>">
        <b>Reason</b>:<br>
@@ -27,14 +27,14 @@ elseif $"deny" <> "" then
 elseif $"deny2" <> "" then
        Group.requireGroupName "board";
        if not (App.deny (Web.stoi ($"deny2"), $"msg")) then
-               %><h3><b>Error denying application</b></h3><%
+               %><h3>Error denying application</h3><%
        else
-               %><h3><b>Application denied</b></h3><%
+               %><h3>Application denied</h3><%
        end
 elseif $"approve" <> "" then
        showNormal := false;
        val appl = App.lookupApp (Web.stoi ($"approve"))
-       %><h3><b>Approve application for <% #name appl %></b></h3>
+       %><h3>Approve application for <% #name appl %></h3>
        <form action="apps" method="post">
        <input type="hidden" name="approve2" value="<% $"approve" %>">
        <b>Message</b>:<br>
@@ -44,23 +44,97 @@ elseif $"approve" <> "" then
 elseif $"approve2" <> "" then
        Group.requireGroupName "board";
        if not (App.approve (Web.stoi ($"approve2"), $"msg")) then
-               %><h3><b>Error approving application</b></h3><%
+               %><h3>Error approving application</h3><%
        else
-               %><h3><b>Application approved</b></h3><%
+               %><h3>Application approved</h3><%
        end
+elseif $"cmd" = "approved" then
+       showNormal := false
+
+       %><h3>Pending applications</h3><%
+
+       foreach appl in App.listApps App.ACCEPTED do %>
+               <br><hr><br>
+               <table class="blanks">
+               <tr> <td>Received:</td> <td><% #applied appl %></td> </tr>
+               <tr> <td>Approved by:</td> <td><%
+                       ref first = true;
+                       ref found = false;
+                       foreach (id, name) in App.votes (#id appl) do
+                               if first then
+                                       first := false
+                               else
+                                       %>, <%
+                               end
+                               %><a href="user?id=<% id %>"><% name %></a><%
+                       end %> </td> </tr>
+       <tr> <td>Username:</td> <td><% #name appl %></td> </tr>
+       <tr> <td>Real name:</td> <td><% Web.html (#rname appl) %></td> </tr>
+       <tr> <td>E-mail address:</td> <td><a href="mailto:<% #email appl %>"><% #email appl %></a></td> </tr>
+       <tr> <td>Forward e-mail?</td> <td><% if #forward appl then %>yes<% else %>no<% end %></td> </tr>
+       <tr> <td>Proposed uses:</td> <td><% Web.htmlNl (#uses appl) %></td> </tr>
+       <tr> <td>Other information:</td> <td><% Web.htmlNl (#other appl) %></td> </tr>
+       </table>
+
+       <% if root then %>
+               <a href="apps?add=<% #id appl %>">Add this member.</a><br>
+       <% end
+       end
+elseif $"add" <> "" then
+       Group.requireGroupNum 0;
+       showNormal := false;
+       val id = Web.stoi ($"add");
+       val appl = App.lookupApp id;
+       App.add id %>
+
+First, create this UNIX user:
+<blockquote><tt>portal_adduser <% #name appl %> "<% #rname appl %>"<% if #forward appl then %> "<% #email appl %>"<% end %></tt></blockquote>
+
+<p>You should then run <tt>visudo</tt> to add <% #name appl %> to the <tt>MEMBERS</tt> group.  If you're not transmitting <% #name appl %>'s password to him by other means, run <tt>savepass <% #name appl %> &lt;password&gt;</tt> to save it in <tt>~<% #name appl %>/.pass</tt>.  If <% #name appl %> is bootstrapping with public-key ssh, don't forget to run <tt>savekey <% #name appl %> &lt;authorized_keys file location&gt;</tt>.</p>
+
+<form action="users" method="post">
+<input type="hidden" name="app" value="<% #id appl %>">
+<table class="blanks">
+<tr> <td>Name:</td> <td><input name="name" value="<% Web.html (#name appl) %>"></td> </tr>
+<tr> <td>Real name:</td> <td><input name="rname" value="<% Web.html (#rname appl) %>"></td> </tr>
+<tr> <td>Funded by:</td> <td><select name="bal">
+       <option value="">A new balance</option>
+<% foreach bal in Balance.listBalances () do %>
+       <option value="<% #id bal %>"><% Web.html (#name bal) %></option>
+<% end %>
+</select></td></tr>
+<tr> <td>Initial transaction amount:</td> <td><input name="amount"></td> </tr>
+<tr> <td>Initial transaction description:</td> <td><input name="descr" value="PayPal"></td> </tr>
+<tr> <td><input type="checkbox" name="subscribe" checked></td> <td>Subscribe to hcoop-announce</td> </tr>
+<tr> <td>Groups:</td> <td><select name="grp" size="5" multiple>
+<% foreach group in Group.listGroups () do %>
+       <option value="<% #id group %>"<% if #name group = "paying" then %> selected<% end %>><% Web.html (#name group) %></option>
+<% end %>
+</select></td></tr>
+<tr> <td><input type="submit" name="cmd" value="Create"></td> </tr>
+</table>
+</form>
+
+<a href="apps?abort=<% #id appl %>">Abort adding this member</a>
+
+<% elseif $"abort" <> "" then
+       App.abortAdd (Web.stoi ($"abort"))
+       %><h3>Aborted</h3><%
+
 end %>
 
 <% if showNormal then %>
-<h3><b>Pending applications</b></h3>
+<h3>Pending applications</h3>
 
-<% foreach appl in App.listPending () do %>
+<% foreach appl in App.listApps App.PENDING do %>
        <br><hr><br>
-       <table>
-       <tr> <td align="right"><b>Received</b>:</td> <td><% #applied appl %></td> </tr>
-       <tr> <td align="right"><b>Approved by</b>:</td> <td><%
+       <table class="blanks">
+       <tr> <td>Received:</td> <td><% #applied appl %></td> </tr>
+       <tr> <td>Approved by:</td> <td><%
                ref first = true;
                ref found = false;
-               foreach (id, name) in App.votes (#id appl) do
+               val votes = App.votes (#id appl);
+               foreach (id, name) in votes do
                        if first then
                                first := false
                        else
@@ -72,16 +146,16 @@ end %>
                                %> <a href="apps?unvote=<% #id appl %>">[Unvote]</a><%
                        end
                end %> <% if (iff board then not found else false) then %><a href="apps?vote=<% #id appl %>">[Vote]</a><% end %></td> </tr>
-       <tr> <td align="right"><b>Username</b>:</td> <td><% #name appl %></td> </tr>
-       <tr> <td align="right"><b>Real name</b>:</td> <td><% Web.html (#rname appl) %></td> </tr>
-       <tr> <td align="right"><b>E-mail address</b>:</td> <td><a href="mailto:<% #email appl %>"><% #email appl %></a></td> </tr>
-       <tr> <td align="right"><b>Forward e-mail?</b></td> <td><% if #forward appl then %>yes<% else %>no<% end %></td> </tr>
-       <tr> <td align="right" valign="top"><b>Proposed uses</b>:</td> <td><% Web.htmlNl (#uses appl) %></td> </tr>
-       <tr> <td align="right" valign="top"><b>Other information</b>:</td> <td><% Web.htmlNl (#other appl) %></td> </tr>
+       <tr> <td>Username:</td> <td><% #name appl %></td> </tr>
+       <tr> <td>Real name:</td> <td><% Web.html (#rname appl) %></td> </tr>
+       <tr> <td>E-mail address:</td> <td><a href="mailto:<% #email appl %>"><% #email appl %></a></td> </tr>
+       <tr> <td>Forward e-mail?</td> <td><% if #forward appl then %>yes<% else %>no<% end %></td> </tr>
+       <tr> <td>Proposed uses:</td> <td><% Web.htmlNl (#uses appl) %></td> </tr>
+       <tr> <td>Other information:</td> <td><% Web.htmlNl (#other appl) %></td> </tr>
        </table>
 
        <% if board then %>
-       <a href="apps?approve=<% #id appl %>">Add this member.</a><br>
+       <% if length votes >= 2 then %><a href="apps?approve=<% #id appl %>">Approve this member.</a><br><% end %>
        <a href="apps?deny=<% #id appl %>">Deny this application.</a>
        <% end %>
 <% end