Commit | Line | Data |
---|---|---|
6f91863c AC |
1 | <% @header [("title", ["Membership applications"])]; |
2 | ||
3 | val you = Init.getUserId (); | |
4 | val board = Group.inGroupName "board"; | |
5 | val root = Group.inGroupNum 0; | |
6 | ||
7 | ref showNormal = true; | |
8 | ||
9 | if $"vote" <> "" then | |
10 | Group.requireGroupName "board"; | |
11 | App.vote (you, Web.stoi ($"vote")) | |
b6dd1aaf | 12 | %><h3>Vote registered</h3><% |
6f91863c AC |
13 | elseif $"unvote" <> "" then |
14 | Group.requireGroupName "board"; | |
15 | App.unvote (you, Web.stoi ($"unvote")) | |
b6dd1aaf | 16 | %><h3>Unvote registered</h3><% |
6f91863c AC |
17 | elseif $"deny" <> "" then |
18 | showNormal := false; | |
19 | val appl = App.lookupApp (Web.stoi ($"deny")) | |
b6dd1aaf | 20 | %><h3>Deny application for <% #name appl %></h3> |
6f91863c AC |
21 | <form action="apps" method="post"> |
22 | <input type="hidden" name="deny2" value="<% $"deny" %>"> | |
23 | <b>Reason</b>:<br> | |
24 | <textarea name="msg" rows="5" cols="80" wrap="soft"></textarea><br> | |
25 | <input type="submit" value="Submit"> | |
26 | </form><% | |
27 | elseif $"deny2" <> "" then | |
28 | Group.requireGroupName "board"; | |
29 | if not (App.deny (Web.stoi ($"deny2"), $"msg")) then | |
b6dd1aaf | 30 | %><h3>Error denying application</h3><% |
6f91863c | 31 | else |
b6dd1aaf | 32 | %><h3>Application denied</h3><% |
6f91863c AC |
33 | end |
34 | elseif $"approve" <> "" then | |
35 | showNormal := false; | |
36 | val appl = App.lookupApp (Web.stoi ($"approve")) | |
b6dd1aaf | 37 | %><h3>Approve application for <% #name appl %></h3> |
6f91863c AC |
38 | <form action="apps" method="post"> |
39 | <input type="hidden" name="approve2" value="<% $"approve" %>"> | |
40 | <b>Message</b>:<br> | |
41 | <textarea name="msg" rows="5" cols="80" wrap="soft"></textarea><br> | |
42 | <input type="submit" value="Submit"> | |
43 | </form><% | |
44 | elseif $"approve2" <> "" then | |
45 | Group.requireGroupName "board"; | |
46 | if not (App.approve (Web.stoi ($"approve2"), $"msg")) then | |
b6dd1aaf | 47 | %><h3>Error approving application</h3><% |
6f91863c | 48 | else |
b6dd1aaf | 49 | %><h3>Application approved</h3><% |
6f91863c | 50 | end |
98a5f121 AC |
51 | elseif $"cmd" = "approved" then |
52 | showNormal := false | |
53 | ||
b6dd1aaf | 54 | %><h3>Pending applications</h3><% |
98a5f121 AC |
55 | |
56 | foreach appl in App.listApps App.ACCEPTED do %> | |
57 | <br><hr><br> | |
b6dd1aaf AC |
58 | <table class="blanks"> |
59 | <tr> <td>Received:</td> <td><% #applied appl %></td> </tr> | |
60 | <tr> <td>Approved by:</td> <td><% | |
98a5f121 AC |
61 | ref first = true; |
62 | ref found = false; | |
63 | foreach (id, name) in App.votes (#id appl) do | |
64 | if first then | |
65 | first := false | |
66 | else | |
67 | %>, <% | |
68 | end | |
69 | %><a href="user?id=<% id %>"><% name %></a><% | |
70 | end %> </td> </tr> | |
b6dd1aaf AC |
71 | <tr> <td>Username:</td> <td><% #name appl %></td> </tr> |
72 | <tr> <td>Real name:</td> <td><% Web.html (#rname appl) %></td> </tr> | |
73 | <tr> <td>E-mail address:</td> <td><a href="mailto:<% #email appl %>"><% #email appl %></a></td> </tr> | |
d5f8418b AC |
74 | <% switch #paypal appl of |
75 | SOME s => %><tr> <td>PayPal:</td> <td><a href="mailto:<% s %>"><% s %></a></td> </tr> | |
76 | <% end; | |
77 | switch #checkout appl of | |
78 | SOME s => %><tr> <td>Google Checkout:</td> <td><a href="mailto:<% s %>"><% s %></a></td> </tr> | |
79 | <% end %> | |
b6dd1aaf AC |
80 | <tr> <td>Forward e-mail?</td> <td><% if #forward appl then %>yes<% else %>no<% end %></td> </tr> |
81 | <tr> <td>Proposed uses:</td> <td><% Web.htmlNl (#uses appl) %></td> </tr> | |
82 | <tr> <td>Other information:</td> <td><% Web.htmlNl (#other appl) %></td> </tr> | |
98a5f121 AC |
83 | </table> |
84 | ||
85 | <% if root then %> | |
86 | <a href="apps?add=<% #id appl %>">Add this member.</a><br> | |
87 | <% end | |
88 | end | |
89 | elseif $"add" <> "" then | |
90 | Group.requireGroupNum 0; | |
91 | showNormal := false; | |
92 | val id = Web.stoi ($"add"); | |
93 | val appl = App.lookupApp id; | |
94 | App.add id %> | |
95 | ||
688bf30c AC |
96 | First, run this on deleuze: |
97 | <blockquote><tt>magic-create-user-wrapper <% #name appl %> "<% #rname appl %>"<% if #forward appl then %> "<% #email appl %>"<% end %></tt></blockquote> | |
a4ccdb5e AC |
98 | |
99 | <form action="users" method="post"> | |
f3f3ad24 | 100 | <input type="hidden" name="app" value="<% #id appl %>"> |
b6dd1aaf AC |
101 | <table class="blanks"> |
102 | <tr> <td>Name:</td> <td><input name="name" value="<% Web.html (#name appl) %>"></td> </tr> | |
103 | <tr> <td>Real name:</td> <td><input name="rname" value="<% Web.html (#rname appl) %>"></td> </tr> | |
104 | <tr> <td>Funded by:</td> <td><select name="bal"> | |
98a5f121 AC |
105 | <option value="">A new balance</option> |
106 | <% foreach bal in Balance.listBalances () do %> | |
107 | <option value="<% #id bal %>"><% Web.html (#name bal) %></option> | |
108 | <% end %> | |
109 | </select></td></tr> | |
b6dd1aaf | 110 | <tr> <td>Initial transaction amount:</td> <td><input name="amount"></td> </tr> |
d5f8418b | 111 | <tr> <td>Initial transaction description:</td> <td><input name="descr"></td> </tr> |
b6dd1aaf AC |
112 | <tr> <td><input type="checkbox" name="subscribe" checked></td> <td>Subscribe to hcoop-announce</td> </tr> |
113 | <tr> <td>Groups:</td> <td><select name="grp" size="5" multiple> | |
98a5f121 AC |
114 | <% foreach group in Group.listGroups () do %> |
115 | <option value="<% #id group %>"<% if #name group = "paying" then %> selected<% end %>><% Web.html (#name group) %></option> | |
116 | <% end %> | |
117 | </select></td></tr> | |
118 | <tr> <td><input type="submit" name="cmd" value="Create"></td> </tr> | |
119 | </table> | |
120 | </form> | |
121 | ||
122 | <a href="apps?abort=<% #id appl %>">Abort adding this member</a> | |
123 | ||
124 | <% elseif $"abort" <> "" then | |
125 | App.abortAdd (Web.stoi ($"abort")) | |
b6dd1aaf | 126 | %><h3>Aborted</h3><% |
98a5f121 | 127 | |
6f91863c AC |
128 | end %> |
129 | ||
130 | <% if showNormal then %> | |
b6dd1aaf | 131 | <h3>Pending applications</h3> |
6f91863c | 132 | |
98a5f121 | 133 | <% foreach appl in App.listApps App.PENDING do %> |
6f91863c | 134 | <br><hr><br> |
b6dd1aaf AC |
135 | <table class="blanks"> |
136 | <tr> <td>Received:</td> <td><% #applied appl %></td> </tr> | |
137 | <tr> <td>Approved by:</td> <td><% | |
6f91863c AC |
138 | ref first = true; |
139 | ref found = false; | |
b8051818 AC |
140 | val votes = App.votes (#id appl); |
141 | foreach (id, name) in votes do | |
6f91863c AC |
142 | if first then |
143 | first := false | |
144 | else | |
145 | %>, <% | |
146 | end | |
147 | %><a href="user?id=<% id %>"><% name %></a><% | |
148 | if id = you then | |
149 | found := true | |
150 | %> <a href="apps?unvote=<% #id appl %>">[Unvote]</a><% | |
151 | end | |
152 | end %> <% if (iff board then not found else false) then %><a href="apps?vote=<% #id appl %>">[Vote]</a><% end %></td> </tr> | |
b6dd1aaf AC |
153 | <tr> <td>Username:</td> <td><% #name appl %></td> </tr> |
154 | <tr> <td>Real name:</td> <td><% Web.html (#rname appl) %></td> </tr> | |
155 | <tr> <td>E-mail address:</td> <td><a href="mailto:<% #email appl %>"><% #email appl %></a></td> </tr> | |
d5f8418b AC |
156 | <% switch #paypal appl of |
157 | SOME s => %><tr> <td>PayPal:</td> <td><a href="mailto:<% s %>"><% s %></a></td> </tr> | |
158 | <% end; | |
159 | switch #checkout appl of | |
160 | SOME s => %><tr> <td>Google Checkout:</td> <td><a href="mailto:<% s %>"><% s %></a></td> </tr> | |
161 | <% end %> | |
b6dd1aaf AC |
162 | <tr> <td>Forward e-mail?</td> <td><% if #forward appl then %>yes<% else %>no<% end %></td> </tr> |
163 | <tr> <td>Proposed uses:</td> <td><% Web.htmlNl (#uses appl) %></td> </tr> | |
164 | <tr> <td>Other information:</td> <td><% Web.htmlNl (#other appl) %></td> </tr> | |
6f91863c AC |
165 | </table> |
166 | ||
167 | <% if board then %> | |
b8051818 | 168 | <% if length votes >= 2 then %><a href="apps?approve=<% #id appl %>">Approve this member.</a><br><% end %> |
6f91863c AC |
169 | <a href="apps?deny=<% #id appl %>">Deny this application.</a> |
170 | <% end %> | |
171 | <% end | |
172 | end %> | |
173 | ||
174 | <% @footer[] %> |