Commit | Line | Data |
---|---|---|
6f91863c AC |
1 | <% @header [("title", ["Membership applications"])]; |
2 | ||
3 | val you = Init.getUserId (); | |
f3a41f3b | 4 | val board = Group.reallyInGroupName "board"; |
6f91863c AC |
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"> | |
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> | |
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 | 85 | |
96bd398e | 86 | foreach appl in App.listApps [App.ACCEPTED, App.BEING_ADDED] do %> |
98a5f121 | 87 | <br><hr><br> |
b6dd1aaf | 88 | <table class="blanks"> |
6b8b767b | 89 | <tr> <td>Received:</td> <td><% #applied appl %> (<% Util.diffFromNow (#applied appl) %> ago)</td> </tr> |
b6dd1aaf | 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> | |
96bd398e | 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 %> |
98a5f121 AC |
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; | |
96bd398e | 125 | App.preAdd id %> |
98a5f121 | 126 | |
688bf30c | 127 | First, run this on deleuze: |
7be17e39 | 128 | <blockquote><tt>new-user <% #name appl %> "<% #rname appl %>"<% if #forward appl then %> "<% #email appl %>"<% end %></tt></blockquote> |
a4ccdb5e AC |
129 | |
130 | <form action="users" method="post"> | |
f3f3ad24 | 131 | <input type="hidden" name="app" value="<% #id appl %>"> |
b6dd1aaf AC |
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"> | |
98a5f121 AC |
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> | |
b6dd1aaf | 141 | <tr> <td>Initial transaction amount:</td> <td><input name="amount"></td> </tr> |
d5f8418b | 142 | <tr> <td>Initial transaction description:</td> <td><input name="descr"></td> </tr> |
848cdc06 | 143 | <!--tr> <td><input type="checkbox" name="subscribe" checked></td> <td>Subscribe to hcoop-announce</td> </tr--> |
b6dd1aaf | 144 | <tr> <td>Groups:</td> <td><select name="grp" size="5" multiple> |
98a5f121 AC |
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")) | |
b6dd1aaf | 157 | %><h3>Aborted</h3><% |
98a5f121 | 158 | |
6f91863c AC |
159 | end %> |
160 | ||
161 | <% if showNormal then %> | |
b6dd1aaf | 162 | <h3>Pending applications</h3> |
6f91863c | 163 | |
96bd398e | 164 | <% foreach appl in App.listApps [App.PENDING] do %> |
6f91863c | 165 | <br><hr><br> |
b6dd1aaf | 166 | <table class="blanks"> |
6b8b767b | 167 | <tr> <td>Received:</td> <td><% #applied appl %> (<% Util.diffFromNow (#applied appl) %> ago)</td></tr> |
b6dd1aaf | 168 | <tr> <td>Approved by:</td> <td><% |
6f91863c AC |
169 | ref first = true; |
170 | ref found = false; | |
b8051818 AC |
171 | val votes = App.votes (#id appl); |
172 | foreach (id, name) in votes do | |
6f91863c AC |
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> | |
b6dd1aaf AC |
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> | |
d5f8418b AC |
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 %> | |
b6dd1aaf AC |
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> | |
6f91863c AC |
196 | </table> |
197 | ||
198 | <% if board then %> | |
b8051818 | 199 | <% if length votes >= 2 then %><a href="apps?approve=<% #id appl %>">Approve this member.</a><br><% end %> |
6f91863c AC |
200 | <a href="apps?deny=<% #id appl %>">Deny this application.</a> |
201 | <% end %> | |
6b8b767b | 202 | <% end |
6f91863c AC |
203 | end %> |
204 | ||
7be17e39 | 205 | <% @footer[] %> |