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 | ||
93b8d0fa AC |
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 %></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 | |
6f91863c AC |
40 | Group.requireGroupName "board"; |
41 | App.vote (you, Web.stoi ($"vote")) | |
b6dd1aaf | 42 | %><h3>Vote registered</h3><% |
6f91863c AC |
43 | elseif $"unvote" <> "" then |
44 | Group.requireGroupName "board"; | |
45 | App.unvote (you, Web.stoi ($"unvote")) | |
b6dd1aaf | 46 | %><h3>Unvote registered</h3><% |
6f91863c AC |
47 | elseif $"deny" <> "" then |
48 | showNormal := false; | |
49 | val appl = App.lookupApp (Web.stoi ($"deny")) | |
b6dd1aaf | 50 | %><h3>Deny application for <% #name appl %></h3> |
6f91863c AC |
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 | |
b6dd1aaf | 60 | %><h3>Error denying application</h3><% |
6f91863c | 61 | else |
b6dd1aaf | 62 | %><h3>Application denied</h3><% |
6f91863c AC |
63 | end |
64 | elseif $"approve" <> "" then | |
65 | showNormal := false; | |
66 | val appl = App.lookupApp (Web.stoi ($"approve")) | |
b6dd1aaf | 67 | %><h3>Approve application for <% #name appl %></h3> |
6f91863c AC |
68 | <form action="apps" method="post"> |
69 | <input type="hidden" name="approve2" value="<% $"approve" %>"> | |
746fe7b2 | 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> |
6f91863c AC |
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 | |
b6dd1aaf | 77 | %><h3>Error approving application</h3><% |
6f91863c | 78 | else |
b6dd1aaf | 79 | %><h3>Application approved</h3><% |
6f91863c | 80 | end |
98a5f121 AC |
81 | elseif $"cmd" = "approved" then |
82 | showNormal := false | |
83 | ||
b6dd1aaf | 84 | %><h3>Pending applications</h3><% |
98a5f121 AC |
85 | |
86 | foreach appl in App.listApps App.ACCEPTED do %> | |
87 | <br><hr><br> | |
b6dd1aaf AC |
88 | <table class="blanks"> |
89 | <tr> <td>Received:</td> <td><% #applied appl %></td> </tr> | |
90 | <tr> <td>Approved by:</td> <td><% | |
98a5f121 AC |
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> | |
b6dd1aaf AC |
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> | |
d5f8418b AC |
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 %> | |
b6dd1aaf AC |
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> | |
98a5f121 AC |
113 | </table> |
114 | ||
115 | <% if root then %> | |
116 | <a href="apps?add=<% #id appl %>">Add this member.</a><br> | |
117 | <% end | |
118 | end | |
119 | elseif $"add" <> "" then | |
120 | Group.requireGroupNum 0; | |
121 | showNormal := false; | |
122 | val id = Web.stoi ($"add"); | |
123 | val appl = App.lookupApp id; | |
124 | App.add id %> | |
125 | ||
688bf30c AC |
126 | First, run this on deleuze: |
127 | <blockquote><tt>magic-create-user-wrapper <% #name appl %> "<% #rname appl %>"<% if #forward appl then %> "<% #email appl %>"<% end %></tt></blockquote> | |
a4ccdb5e AC |
128 | |
129 | <form action="users" method="post"> | |
f3f3ad24 | 130 | <input type="hidden" name="app" value="<% #id appl %>"> |
b6dd1aaf AC |
131 | <table class="blanks"> |
132 | <tr> <td>Name:</td> <td><input name="name" value="<% Web.html (#name appl) %>"></td> </tr> | |
133 | <tr> <td>Real name:</td> <td><input name="rname" value="<% Web.html (#rname appl) %>"></td> </tr> | |
134 | <tr> <td>Funded by:</td> <td><select name="bal"> | |
98a5f121 AC |
135 | <option value="">A new balance</option> |
136 | <% foreach bal in Balance.listBalances () do %> | |
137 | <option value="<% #id bal %>"><% Web.html (#name bal) %></option> | |
138 | <% end %> | |
139 | </select></td></tr> | |
b6dd1aaf | 140 | <tr> <td>Initial transaction amount:</td> <td><input name="amount"></td> </tr> |
d5f8418b | 141 | <tr> <td>Initial transaction description:</td> <td><input name="descr"></td> </tr> |
848cdc06 | 142 | <!--tr> <td><input type="checkbox" name="subscribe" checked></td> <td>Subscribe to hcoop-announce</td> </tr--> |
b6dd1aaf | 143 | <tr> <td>Groups:</td> <td><select name="grp" size="5" multiple> |
98a5f121 AC |
144 | <% foreach group in Group.listGroups () do %> |
145 | <option value="<% #id group %>"<% if #name group = "paying" then %> selected<% end %>><% Web.html (#name group) %></option> | |
146 | <% end %> | |
147 | </select></td></tr> | |
148 | <tr> <td><input type="submit" name="cmd" value="Create"></td> </tr> | |
149 | </table> | |
150 | </form> | |
151 | ||
152 | <a href="apps?abort=<% #id appl %>">Abort adding this member</a> | |
153 | ||
154 | <% elseif $"abort" <> "" then | |
155 | App.abortAdd (Web.stoi ($"abort")) | |
b6dd1aaf | 156 | %><h3>Aborted</h3><% |
98a5f121 | 157 | |
6f91863c AC |
158 | end %> |
159 | ||
160 | <% if showNormal then %> | |
b6dd1aaf | 161 | <h3>Pending applications</h3> |
6f91863c | 162 | |
98a5f121 | 163 | <% foreach appl in App.listApps App.PENDING do %> |
6f91863c | 164 | <br><hr><br> |
b6dd1aaf AC |
165 | <table class="blanks"> |
166 | <tr> <td>Received:</td> <td><% #applied appl %></td> </tr> | |
167 | <tr> <td>Approved by:</td> <td><% | |
6f91863c AC |
168 | ref first = true; |
169 | ref found = false; | |
b8051818 AC |
170 | val votes = App.votes (#id appl); |
171 | foreach (id, name) in votes do | |
6f91863c AC |
172 | if first then |
173 | first := false | |
174 | else | |
175 | %>, <% | |
176 | end | |
177 | %><a href="user?id=<% id %>"><% name %></a><% | |
178 | if id = you then | |
179 | found := true | |
180 | %> <a href="apps?unvote=<% #id appl %>">[Unvote]</a><% | |
181 | end | |
182 | end %> <% if (iff board then not found else false) then %><a href="apps?vote=<% #id appl %>">[Vote]</a><% end %></td> </tr> | |
b6dd1aaf AC |
183 | <tr> <td>Username:</td> <td><% #name appl %></td> </tr> |
184 | <tr> <td>Real name:</td> <td><% Web.html (#rname appl) %></td> </tr> | |
185 | <tr> <td>E-mail address:</td> <td><a href="mailto:<% #email appl %>"><% #email appl %></a></td> </tr> | |
d5f8418b AC |
186 | <% switch #paypal appl of |
187 | SOME s => %><tr> <td>PayPal:</td> <td><a href="mailto:<% s %>"><% s %></a></td> </tr> | |
188 | <% end; | |
189 | switch #checkout appl of | |
190 | SOME s => %><tr> <td>Google Checkout:</td> <td><a href="mailto:<% s %>"><% s %></a></td> </tr> | |
191 | <% end %> | |
b6dd1aaf AC |
192 | <tr> <td>Forward e-mail?</td> <td><% if #forward appl then %>yes<% else %>no<% end %></td> </tr> |
193 | <tr> <td>Proposed uses:</td> <td><% Web.htmlNl (#uses appl) %></td> </tr> | |
194 | <tr> <td>Other information:</td> <td><% Web.htmlNl (#other appl) %></td> </tr> | |
6f91863c AC |
195 | </table> |
196 | ||
197 | <% if board then %> | |
b8051818 | 198 | <% if length votes >= 2 then %><a href="apps?approve=<% #id appl %>">Approve this member.</a><br><% end %> |
6f91863c AC |
199 | <a href="apps?deny=<% #id appl %>">Deny this application.</a> |
200 | <% end %> | |
201 | <% end | |
202 | end %> | |
203 | ||
204 | <% @footer[] %> |