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")) | |
12 | %><h3><b>Vote registered</b></h3><% | |
13 | elseif $"unvote" <> "" then | |
14 | Group.requireGroupName "board"; | |
15 | App.unvote (you, Web.stoi ($"unvote")) | |
16 | %><h3><b>Unvote registered</b></h3><% | |
17 | elseif $"deny" <> "" then | |
18 | showNormal := false; | |
19 | val appl = App.lookupApp (Web.stoi ($"deny")) | |
20 | %><h3><b>Deny application for <% #name appl %></b></h3> | |
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 | |
30 | %><h3><b>Error denying application</b></h3><% | |
31 | else | |
32 | %><h3><b>Application denied</b></h3><% | |
33 | end | |
34 | elseif $"approve" <> "" then | |
35 | showNormal := false; | |
36 | val appl = App.lookupApp (Web.stoi ($"approve")) | |
37 | %><h3><b>Approve application for <% #name appl %></b></h3> | |
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 | |
47 | %><h3><b>Error approving application</b></h3><% | |
48 | else | |
49 | %><h3><b>Application approved</b></h3><% | |
50 | end | |
98a5f121 AC |
51 | elseif $"cmd" = "approved" then |
52 | showNormal := false | |
53 | ||
54 | %><h3><b>Pending applications</b></h3><% | |
55 | ||
56 | foreach appl in App.listApps App.ACCEPTED do %> | |
57 | <br><hr><br> | |
58 | <table> | |
59 | <tr> <td align="right"><b>Received</b>:</td> <td><% #applied appl %></td> </tr> | |
60 | <tr> <td align="right"><b>Approved by</b>:</td> <td><% | |
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> | |
71 | <tr> <td align="right"><b>Username</b>:</td> <td><% #name appl %></td> </tr> | |
72 | <tr> <td align="right"><b>Real name</b>:</td> <td><% Web.html (#rname appl) %></td> </tr> | |
73 | <tr> <td align="right"><b>E-mail address</b>:</td> <td><a href="mailto:<% #email appl %>"><% #email appl %></a></td> </tr> | |
74 | <tr> <td align="right"><b>Forward e-mail?</b></td> <td><% if #forward appl then %>yes<% else %>no<% end %></td> </tr> | |
75 | <tr> <td align="right" valign="top"><b>Proposed uses</b>:</td> <td><% Web.htmlNl (#uses appl) %></td> </tr> | |
76 | <tr> <td align="right" valign="top"><b>Other information</b>:</td> <td><% Web.htmlNl (#other appl) %></td> </tr> | |
77 | </table> | |
78 | ||
79 | <% if root then %> | |
80 | <a href="apps?add=<% #id appl %>">Add this member.</a><br> | |
81 | <% end | |
82 | end | |
83 | elseif $"add" <> "" then | |
84 | Group.requireGroupNum 0; | |
85 | showNormal := false; | |
86 | val id = Web.stoi ($"add"); | |
87 | val appl = App.lookupApp id; | |
88 | App.add id %> | |
89 | ||
90 | First, create this UNIX user: | |
91 | <blockquote><tt>adduser <% #name appl %> "<% #rname appl %>"<% if #forward appl then %>" <% #email appl %>"<% end %></tt></blockquote> | |
92 | ||
93 | <form action="users"> | |
94 | <table> | |
95 | <tr> <td align="right"><b>Name</b>:</td> <td><input name="name" value="<% Web.html (#name appl) %>"></td> </tr> | |
96 | <tr> <td align="right"><b>Real name</b>:</td> <td><input name="rname" value="<% Web.html (#rname appl) %>"></td> </tr> | |
97 | <tr> <td align="right" valign="top"><b>Funded by</b>:</td> <td><select name="bal"> | |
98 | <option value="">A new balance</option> | |
99 | <% foreach bal in Balance.listBalances () do %> | |
100 | <option value="<% #id bal %>"><% Web.html (#name bal) %></option> | |
101 | <% end %> | |
102 | </select></td></tr> | |
103 | <tr> <td align="right"><b>Initial transaction amount</b>:</td> <td><input name="amount"></td> </tr> | |
104 | <tr> <td align="right"><b>Initial transaction description</b>:</td> <td><input name="descr"></td> </tr> | |
105 | <tr> <td align="right"><input type="checkbox" name="subscribe" checked></td> <td>Subscribe to hcoop-announce</td> </tr> | |
106 | <tr> <td align="right"><b>Groups</b>:</td> <td><select name="grp" size="5" multiple> | |
107 | <% foreach group in Group.listGroups () do %> | |
108 | <option value="<% #id group %>"<% if #name group = "paying" then %> selected<% end %>><% Web.html (#name group) %></option> | |
109 | <% end %> | |
110 | </select></td></tr> | |
111 | <tr> <td><input type="submit" name="cmd" value="Create"></td> </tr> | |
112 | </table> | |
113 | </form> | |
114 | ||
115 | <a href="apps?abort=<% #id appl %>">Abort adding this member</a> | |
116 | ||
117 | <% elseif $"abort" <> "" then | |
118 | App.abortAdd (Web.stoi ($"abort")) | |
119 | %><h3><b>Aborted</b></h3><% | |
120 | ||
6f91863c AC |
121 | end %> |
122 | ||
123 | <% if showNormal then %> | |
124 | <h3><b>Pending applications</b></h3> | |
125 | ||
98a5f121 | 126 | <% foreach appl in App.listApps App.PENDING do %> |
6f91863c AC |
127 | <br><hr><br> |
128 | <table> | |
129 | <tr> <td align="right"><b>Received</b>:</td> <td><% #applied appl %></td> </tr> | |
130 | <tr> <td align="right"><b>Approved by</b>:</td> <td><% | |
131 | ref first = true; | |
132 | ref found = false; | |
133 | foreach (id, name) in App.votes (#id appl) do | |
134 | if first then | |
135 | first := false | |
136 | else | |
137 | %>, <% | |
138 | end | |
139 | %><a href="user?id=<% id %>"><% name %></a><% | |
140 | if id = you then | |
141 | found := true | |
142 | %> <a href="apps?unvote=<% #id appl %>">[Unvote]</a><% | |
143 | end | |
144 | end %> <% if (iff board then not found else false) then %><a href="apps?vote=<% #id appl %>">[Vote]</a><% end %></td> </tr> | |
145 | <tr> <td align="right"><b>Username</b>:</td> <td><% #name appl %></td> </tr> | |
146 | <tr> <td align="right"><b>Real name</b>:</td> <td><% Web.html (#rname appl) %></td> </tr> | |
147 | <tr> <td align="right"><b>E-mail address</b>:</td> <td><a href="mailto:<% #email appl %>"><% #email appl %></a></td> </tr> | |
148 | <tr> <td align="right"><b>Forward e-mail?</b></td> <td><% if #forward appl then %>yes<% else %>no<% end %></td> </tr> | |
149 | <tr> <td align="right" valign="top"><b>Proposed uses</b>:</td> <td><% Web.htmlNl (#uses appl) %></td> </tr> | |
150 | <tr> <td align="right" valign="top"><b>Other information</b>:</td> <td><% Web.htmlNl (#other appl) %></td> </tr> | |
151 | </table> | |
152 | ||
153 | <% if board then %> | |
98a5f121 | 154 | <a href="apps?approve=<% #id appl %>">Approve this member.</a><br> |
6f91863c AC |
155 | <a href="apps?deny=<% #id appl %>">Deny this application.</a> |
156 | <% end %> | |
157 | <% end | |
158 | end %> | |
159 | ||
160 | <% @footer[] %> |