payment: note that Stripe has instituted an additional 1% fee for non-US cards
[hcoop/portal.git] / apps.mlt
CommitLineData
6f91863c
AC
1<% @header [("title", ["Membership applications"])];
2
3val you = Init.getUserId ();
f3a41f3b 4val board = Group.reallyInGroupName "board";
6f91863c
AC
5val root = Group.inGroupNum 0;
6
7ref showNormal = true;
8
93b8d0fa
AC
9if $"show" <> "" then
10 showNormal := false;
11 val usr = Web.stoi ($"show");
12 val user = Init.lookupUser usr;
13 val appl = App.lookupApp (#app user) %>
14
15 <table class="blanks">
6b8b767b 16 <tr> <td>Received:</td> <td><% #applied appl %> (<% Util.diffFromNow (#applied appl) %> ago)</td> </tr>
93b8d0fa
AC
17 <tr> <td>Approved by:</td> <td><%
18 ref first = true;
19 ref found = false;
20 val votes = App.votes (#id appl);
21 foreach (id, name) in votes do
22 if first then
23 first := false
24 else
25 %>, <%
26 end
27 %><a href="user?id=<% id %>"><% name %></a><%
28 if id = you then
29 found := true
30 %> <a href="apps?unvote=<% #id appl %>">[Unvote]</a><%
31 end
32 end %> <% if (iff board then not found else false) then %><a href="apps?vote=<% #id appl %>">[Vote]</a><% end %></td> </tr>
33 <tr> <td>Username:</td> <td><% #name appl %></td> </tr>
34 <tr> <td>Real name:</td> <td><% Web.html (#rname appl) %></td> </tr>
81200ec2 35 <tr> <td>E-mail:</td> <td><a href="mailto:<% #email appl %>"><% #email appl %></a></td> </tr>
93b8d0fa
AC
36 <tr> <td>Forward e-mail?</td> <td><% if #forward appl then %>yes<% else %>no<% end %></td> </tr>
37 <tr> <td>Proposed uses:</td> <td><% Web.htmlNl (#uses appl) %></td> </tr>
38 <tr> <td>Other information:</td> <td><% Web.htmlNl (#other appl) %></td> </tr>
39 </table>
40<% elseif $"vote" <> "" then
6f91863c
AC
41 Group.requireGroupName "board";
42 App.vote (you, Web.stoi ($"vote"))
b6dd1aaf 43 %><h3>Vote registered</h3><%
6f91863c
AC
44elseif $"unvote" <> "" then
45 Group.requireGroupName "board";
46 App.unvote (you, Web.stoi ($"unvote"))
b6dd1aaf 47 %><h3>Unvote registered</h3><%
6f91863c
AC
48elseif $"deny" <> "" then
49 showNormal := false;
50 val appl = App.lookupApp (Web.stoi ($"deny"))
b6dd1aaf 51 %><h3>Deny application for <% #name appl %></h3>
6f91863c
AC
52 <form action="apps" method="post">
53 <input type="hidden" name="deny2" value="<% $"deny" %>">
54 <b>Reason</b>:<br>
55 <textarea name="msg" rows="5" cols="80" wrap="soft"></textarea><br>
56 <input type="submit" value="Submit">
57 </form><%
58elseif $"deny2" <> "" then
59 Group.requireGroupName "board";
60 if not (App.deny (Web.stoi ($"deny2"), $"msg")) then
b6dd1aaf 61 %><h3>Error denying application</h3><%
6f91863c 62 else
b6dd1aaf 63 %><h3>Application denied</h3><%
6f91863c
AC
64 end
65elseif $"approve" <> "" then
66 showNormal := false;
67 val appl = App.lookupApp (Web.stoi ($"approve"))
b6dd1aaf 68 %><h3>Approve application for <% #name appl %></h3>
6f91863c
AC
69 <form action="apps" method="post">
70 <input type="hidden" name="approve2" value="<% $"approve" %>">
746fe7b2 71 <b>Message</b> (will be added at the end of <tt>~hcoop/portal/welcome.txt</tt>, so you might want to include some introductory text):<br>
6f91863c
AC
72 <textarea name="msg" rows="5" cols="80" wrap="soft"></textarea><br>
73 <input type="submit" value="Submit">
74 </form><%
75elseif $"approve2" <> "" then
76 Group.requireGroupName "board";
77 if not (App.approve (Web.stoi ($"approve2"), $"msg")) then
b6dd1aaf 78 %><h3>Error approving application</h3><%
6f91863c 79 else
b6dd1aaf 80 %><h3>Application approved</h3><%
6f91863c 81 end
98a5f121
AC
82elseif $"cmd" = "approved" then
83 showNormal := false
84
b6dd1aaf 85 %><h3>Pending applications</h3><%
98a5f121 86
96bd398e 87 foreach appl in App.listApps [App.ACCEPTED, App.BEING_ADDED] do %>
98a5f121 88 <br><hr><br>
b6dd1aaf 89 <table class="blanks">
6b8b767b 90 <tr> <td>Received:</td> <td><% #applied appl %> (<% Util.diffFromNow (#applied appl) %> ago)</td> </tr>
b6dd1aaf 91 <tr> <td>Approved by:</td> <td><%
98a5f121
AC
92 ref first = true;
93 ref found = false;
94 foreach (id, name) in App.votes (#id appl) do
95 if first then
96 first := false
97 else
98 %>, <%
99 end
100 %><a href="user?id=<% id %>"><% name %></a><%
101 end %> </td> </tr>
b6dd1aaf
AC
102 <tr> <td>Username:</td> <td><% #name appl %></td> </tr>
103 <tr> <td>Real name:</td> <td><% Web.html (#rname appl) %></td> </tr>
104 <tr> <td>E-mail address:</td> <td><a href="mailto:<% #email appl %>"><% #email appl %></a></td> </tr>
d5f8418b
AC
105 <% switch #paypal appl of
106 SOME s => %><tr> <td>PayPal:</td> <td><a href="mailto:<% s %>"><% s %></a></td> </tr>
d5f8418b 107 <% end %>
b6dd1aaf
AC
108 <tr> <td>Forward e-mail?</td> <td><% if #forward appl then %>yes<% else %>no<% end %></td> </tr>
109 <tr> <td>Proposed uses:</td> <td><% Web.htmlNl (#uses appl) %></td> </tr>
110 <tr> <td>Other information:</td> <td><% Web.htmlNl (#other appl) %></td> </tr>
96bd398e 111 <% if #status appl = App.BEING_ADDED then %><tr> <td colspan="2" align="left"><font color="red"><b>WARNING: Someone already followed the add link for this application. Maybe he forgot to finish.</b></font></td></tr><% end %>
98a5f121
AC
112 </table>
113
114 <% if root then %>
115 <a href="apps?add=<% #id appl %>">Add this member.</a><br>
116 <% end
117 end
118elseif $"add" <> "" then
119 Group.requireGroupNum 0;
120 showNormal := false;
121 val id = Web.stoi ($"add");
122 val appl = App.lookupApp id;
96bd398e 123 App.preAdd id %>
98a5f121 124
e19c1d8f 125First, run this on gibran:
7be17e39 126<blockquote><tt>new-user <% #name appl %> "<% #rname appl %>"<% if #forward appl then %> "<% #email appl %>"<% end %></tt></blockquote>
a4ccdb5e
AC
127
128<form action="users" method="post">
f3f3ad24 129<input type="hidden" name="app" value="<% #id appl %>">
b6dd1aaf
AC
130<table class="blanks">
131<tr> <td>Name:</td> <td><input name="name" value="<% Web.html (#name appl) %>"></td> </tr>
132<tr> <td>Real name:</td> <td><input name="rname" value="<% Web.html (#rname appl) %>"></td> </tr>
133<tr> <td>Funded by:</td> <td><select name="bal">
98a5f121
AC
134 <option value="">A new balance</option>
135<% foreach bal in Balance.listBalances () do %>
136 <option value="<% #id bal %>"><% Web.html (#name bal) %></option>
137<% end %>
138</select></td></tr>
b6dd1aaf 139<tr> <td>Initial transaction amount:</td> <td><input name="amount"></td> </tr>
d5f8418b 140<tr> <td>Initial transaction description:</td> <td><input name="descr"></td> </tr>
848cdc06 141<!--tr> <td><input type="checkbox" name="subscribe" checked></td> <td>Subscribe to hcoop-announce</td> </tr-->
b6dd1aaf 142<tr> <td>Groups:</td> <td><select name="grp" size="5" multiple>
98a5f121
AC
143<% foreach group in Group.listGroups () do %>
144 <option value="<% #id group %>"<% if #name group = "paying" then %> selected<% end %>><% Web.html (#name group) %></option>
145<% end %>
146</select></td></tr>
147<tr> <td><input type="submit" name="cmd" value="Create"></td> </tr>
148</table>
149</form>
150
151<a href="apps?abort=<% #id appl %>">Abort adding this member</a>
152
153<% elseif $"abort" <> "" then
154 App.abortAdd (Web.stoi ($"abort"))
b6dd1aaf 155 %><h3>Aborted</h3><%
98a5f121 156
6f91863c
AC
157end %>
158
159<% if showNormal then %>
b6dd1aaf 160<h3>Pending applications</h3>
6f91863c 161
96bd398e 162<% foreach appl in App.listApps [App.PENDING] do %>
6f91863c 163 <br><hr><br>
b6dd1aaf 164 <table class="blanks">
6b8b767b 165 <tr> <td>Received:</td> <td><% #applied appl %> (<% Util.diffFromNow (#applied appl) %> ago)</td></tr>
b6dd1aaf 166 <tr> <td>Approved by:</td> <td><%
6f91863c
AC
167 ref first = true;
168 ref found = false;
b8051818
AC
169 val votes = App.votes (#id appl);
170 foreach (id, name) in votes do
6f91863c
AC
171 if first then
172 first := false
173 else
174 %>, <%
175 end
176 %><a href="user?id=<% id %>"><% name %></a><%
177 if id = you then
178 found := true
179 %> <a href="apps?unvote=<% #id appl %>">[Unvote]</a><%
180 end
181 end %> <% if (iff board then not found else false) then %><a href="apps?vote=<% #id appl %>">[Vote]</a><% end %></td> </tr>
b6dd1aaf
AC
182 <tr> <td>Username:</td> <td><% #name appl %></td> </tr>
183 <tr> <td>Real name:</td> <td><% Web.html (#rname appl) %></td> </tr>
184 <tr> <td>E-mail address:</td> <td><a href="mailto:<% #email appl %>"><% #email appl %></a></td> </tr>
d5f8418b
AC
185 <% switch #paypal appl of
186 SOME s => %><tr> <td>PayPal:</td> <td><a href="mailto:<% s %>"><% s %></a></td> </tr>
d5f8418b 187 <% end %>
b6dd1aaf
AC
188 <tr> <td>Forward e-mail?</td> <td><% if #forward appl then %>yes<% else %>no<% end %></td> </tr>
189 <tr> <td>Proposed uses:</td> <td><% Web.htmlNl (#uses appl) %></td> </tr>
190 <tr> <td>Other information:</td> <td><% Web.htmlNl (#other appl) %></td> </tr>
6f91863c
AC
191 </table>
192
193 <% if board then %>
11668142 194 <% if length votes >= 3 then %><a href="apps?approve=<% #id appl %>">Approve this member.</a><br><% end %>
6f91863c
AC
195 <a href="apps?deny=<% #id appl %>">Deny this application.</a>
196 <% end %>
6b8b767b 197<% end
6f91863c
AC
198end %>
199
7be17e39 200<% @footer[] %>