Reports for figuring out which accounts to freeze or boot; most of new SSL request...
[bpt/portal.git] / apps.mlt
1 <% @header [("title", ["Membership applications"])];
2
3 val you = Init.getUserId ();
4 val board = Group.reallyInGroupName "board";
5 val root = Group.inGroupNum 0;
6
7 ref showNormal = true;
8
9 if $"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">
16 <tr> <td>Received:</td> <td><% #applied appl %> (<% Util.diffFromNow (#applied appl) %> ago)</td> </tr>
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>
35 <tr> <td>Forward e-mail?</td> <td><% if #forward appl then %>yes<% else %>no<% end %></td> </tr>
36 <tr> <td>Proposed uses:</td> <td><% Web.htmlNl (#uses appl) %></td> </tr>
37 <tr> <td>Other information:</td> <td><% Web.htmlNl (#other appl) %></td> </tr>
38 </table>
39 <% elseif $"vote" <> "" then
40 Group.requireGroupName "board";
41 App.vote (you, Web.stoi ($"vote"))
42 %><h3>Vote registered</h3><%
43 elseif $"unvote" <> "" then
44 Group.requireGroupName "board";
45 App.unvote (you, Web.stoi ($"unvote"))
46 %><h3>Unvote registered</h3><%
47 elseif $"deny" <> "" then
48 showNormal := false;
49 val appl = App.lookupApp (Web.stoi ($"deny"))
50 %><h3>Deny application for <% #name appl %></h3>
51 <form action="apps" method="post">
52 <input type="hidden" name="deny2" value="<% $"deny" %>">
53 <b>Reason</b>:<br>
54 <textarea name="msg" rows="5" cols="80" wrap="soft"></textarea><br>
55 <input type="submit" value="Submit">
56 </form><%
57 elseif $"deny2" <> "" then
58 Group.requireGroupName "board";
59 if not (App.deny (Web.stoi ($"deny2"), $"msg")) then
60 %><h3>Error denying application</h3><%
61 else
62 %><h3>Application denied</h3><%
63 end
64 elseif $"approve" <> "" then
65 showNormal := false;
66 val appl = App.lookupApp (Web.stoi ($"approve"))
67 %><h3>Approve application for <% #name appl %></h3>
68 <form action="apps" method="post">
69 <input type="hidden" name="approve2" value="<% $"approve" %>">
70 <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>
71 <textarea name="msg" rows="5" cols="80" wrap="soft"></textarea><br>
72 <input type="submit" value="Submit">
73 </form><%
74 elseif $"approve2" <> "" then
75 Group.requireGroupName "board";
76 if not (App.approve (Web.stoi ($"approve2"), $"msg")) then
77 %><h3>Error approving application</h3><%
78 else
79 %><h3>Application approved</h3><%
80 end
81 elseif $"cmd" = "approved" then
82 showNormal := false
83
84 %><h3>Pending applications</h3><%
85
86 foreach appl in App.listApps [App.ACCEPTED, App.BEING_ADDED] do %>
87 <br><hr><br>
88 <table class="blanks">
89 <tr> <td>Received:</td> <td><% #applied appl %> (<% Util.diffFromNow (#applied appl) %> ago)</td> </tr>
90 <tr> <td>Approved by:</td> <td><%
91 ref first = true;
92 ref found = false;
93 foreach (id, name) in App.votes (#id appl) do
94 if first then
95 first := false
96 else
97 %>, <%
98 end
99 %><a href="user?id=<% id %>"><% name %></a><%
100 end %> </td> </tr>
101 <tr> <td>Username:</td> <td><% #name appl %></td> </tr>
102 <tr> <td>Real name:</td> <td><% Web.html (#rname appl) %></td> </tr>
103 <tr> <td>E-mail address:</td> <td><a href="mailto:<% #email appl %>"><% #email appl %></a></td> </tr>
104 <% switch #paypal appl of
105 SOME s => %><tr> <td>PayPal:</td> <td><a href="mailto:<% s %>"><% s %></a></td> </tr>
106 <% end;
107 switch #checkout appl of
108 SOME s => %><tr> <td>Google Checkout:</td> <td><a href="mailto:<% s %>"><% s %></a></td> </tr>
109 <% end %>
110 <tr> <td>Forward e-mail?</td> <td><% if #forward appl then %>yes<% else %>no<% end %></td> </tr>
111 <tr> <td>Proposed uses:</td> <td><% Web.htmlNl (#uses appl) %></td> </tr>
112 <tr> <td>Other information:</td> <td><% Web.htmlNl (#other appl) %></td> </tr>
113 <% 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 %>
114 </table>
115
116 <% if root then %>
117 <a href="apps?add=<% #id appl %>">Add this member.</a><br>
118 <% end
119 end
120 elseif $"add" <> "" then
121 Group.requireGroupNum 0;
122 showNormal := false;
123 val id = Web.stoi ($"add");
124 val appl = App.lookupApp id;
125 App.preAdd id %>
126
127 First, run this on deleuze:
128 <blockquote><tt>new-user <% #name appl %> "<% #rname appl %>"<% if #forward appl then %> "<% #email appl %>"<% end %></tt></blockquote>
129
130 <form action="users" method="post">
131 <input type="hidden" name="app" value="<% #id appl %>">
132 <table class="blanks">
133 <tr> <td>Name:</td> <td><input name="name" value="<% Web.html (#name appl) %>"></td> </tr>
134 <tr> <td>Real name:</td> <td><input name="rname" value="<% Web.html (#rname appl) %>"></td> </tr>
135 <tr> <td>Funded by:</td> <td><select name="bal">
136 <option value="">A new balance</option>
137 <% foreach bal in Balance.listBalances () do %>
138 <option value="<% #id bal %>"><% Web.html (#name bal) %></option>
139 <% end %>
140 </select></td></tr>
141 <tr> <td>Initial transaction amount:</td> <td><input name="amount"></td> </tr>
142 <tr> <td>Initial transaction description:</td> <td><input name="descr"></td> </tr>
143 <!--tr> <td><input type="checkbox" name="subscribe" checked></td> <td>Subscribe to hcoop-announce</td> </tr-->
144 <tr> <td>Groups:</td> <td><select name="grp" size="5" multiple>
145 <% foreach group in Group.listGroups () do %>
146 <option value="<% #id group %>"<% if #name group = "paying" then %> selected<% end %>><% Web.html (#name group) %></option>
147 <% end %>
148 </select></td></tr>
149 <tr> <td><input type="submit" name="cmd" value="Create"></td> </tr>
150 </table>
151 </form>
152
153 <a href="apps?abort=<% #id appl %>">Abort adding this member</a>
154
155 <% elseif $"abort" <> "" then
156 App.abortAdd (Web.stoi ($"abort"))
157 %><h3>Aborted</h3><%
158
159 end %>
160
161 <% if showNormal then %>
162 <h3>Pending applications</h3>
163
164 <% foreach appl in App.listApps [App.PENDING] do %>
165 <br><hr><br>
166 <table class="blanks">
167 <tr> <td>Received:</td> <td><% #applied appl %> (<% Util.diffFromNow (#applied appl) %> ago)</td></tr>
168 <tr> <td>Approved by:</td> <td><%
169 ref first = true;
170 ref found = false;
171 val votes = App.votes (#id appl);
172 foreach (id, name) in votes do
173 if first then
174 first := false
175 else
176 %>, <%
177 end
178 %><a href="user?id=<% id %>"><% name %></a><%
179 if id = you then
180 found := true
181 %> <a href="apps?unvote=<% #id appl %>">[Unvote]</a><%
182 end
183 end %> <% if (iff board then not found else false) then %><a href="apps?vote=<% #id appl %>">[Vote]</a><% end %></td> </tr>
184 <tr> <td>Username:</td> <td><% #name appl %></td> </tr>
185 <tr> <td>Real name:</td> <td><% Web.html (#rname appl) %></td> </tr>
186 <tr> <td>E-mail address:</td> <td><a href="mailto:<% #email appl %>"><% #email appl %></a></td> </tr>
187 <% switch #paypal appl of
188 SOME s => %><tr> <td>PayPal:</td> <td><a href="mailto:<% s %>"><% s %></a></td> </tr>
189 <% end;
190 switch #checkout appl of
191 SOME s => %><tr> <td>Google Checkout:</td> <td><a href="mailto:<% s %>"><% s %></a></td> </tr>
192 <% end %>
193 <tr> <td>Forward e-mail?</td> <td><% if #forward appl then %>yes<% else %>no<% end %></td> </tr>
194 <tr> <td>Proposed uses:</td> <td><% Web.htmlNl (#uses appl) %></td> </tr>
195 <tr> <td>Other information:</td> <td><% Web.htmlNl (#other appl) %></td> </tr>
196 </table>
197
198 <% if board then %>
199 <% if length votes >= 2 then %><a href="apps?approve=<% #id appl %>">Approve this member.</a><br><% end %>
200 <a href="apps?deny=<% #id appl %>">Deny this application.</a>
201 <% end %>
202 <% end
203 end %>
204
205 <% @footer[] %>