Application pipeline seems to be working
[hcoop/zz_old/portal.git] / apps.mlt
CommitLineData
453d7579 1<% @header [("title", ["Membership applications"])];
2
3val you = Init.getUserId ();
4val board = Group.inGroupName "board";
5val root = Group.inGroupNum 0;
6
7ref showNormal = true;
8
9if $"vote" <> "" then
10 Group.requireGroupName "board";
11 App.vote (you, Web.stoi ($"vote"))
1fe415e0 12 %><h3>Vote registered</h3><%
453d7579 13elseif $"unvote" <> "" then
14 Group.requireGroupName "board";
15 App.unvote (you, Web.stoi ($"unvote"))
1fe415e0 16 %><h3>Unvote registered</h3><%
453d7579 17elseif $"deny" <> "" then
18 showNormal := false;
19 val appl = App.lookupApp (Web.stoi ($"deny"))
1fe415e0 20 %><h3>Deny application for <% #name appl %></h3>
453d7579 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><%
27elseif $"deny2" <> "" then
28 Group.requireGroupName "board";
29 if not (App.deny (Web.stoi ($"deny2"), $"msg")) then
1fe415e0 30 %><h3>Error denying application</h3><%
453d7579 31 else
1fe415e0 32 %><h3>Application denied</h3><%
453d7579 33 end
34elseif $"approve" <> "" then
35 showNormal := false;
36 val appl = App.lookupApp (Web.stoi ($"approve"))
1fe415e0 37 %><h3>Approve application for <% #name appl %></h3>
453d7579 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><%
44elseif $"approve2" <> "" then
45 Group.requireGroupName "board";
46 if not (App.approve (Web.stoi ($"approve2"), $"msg")) then
1fe415e0 47 %><h3>Error approving application</h3><%
453d7579 48 else
1fe415e0 49 %><h3>Application approved</h3><%
453d7579 50 end
4b8df0b1 51elseif $"cmd" = "approved" then
52 showNormal := false
53
1fe415e0 54 %><h3>Pending applications</h3><%
4b8df0b1 55
56 foreach appl in App.listApps App.ACCEPTED do %>
57 <br><hr><br>
1fe415e0 58 <table class="blanks">
59 <tr> <td>Received:</td> <td><% #applied appl %></td> </tr>
60 <tr> <td>Approved by:</td> <td><%
4b8df0b1 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>
1fe415e0 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>
74 <tr> <td>Forward e-mail?</td> <td><% if #forward appl then %>yes<% else %>no<% end %></td> </tr>
75 <tr> <td>Proposed uses:</td> <td><% Web.htmlNl (#uses appl) %></td> </tr>
76 <tr> <td>Other information:</td> <td><% Web.htmlNl (#other appl) %></td> </tr>
4b8df0b1 77 </table>
78
79 <% if root then %>
80 <a href="apps?add=<% #id appl %>">Add this member.</a><br>
81 <% end
82 end
83elseif $"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
cee714e2 90First, run this on deleuze:
91<blockquote><tt>magic-create-user-wrapper <% #name appl %> "<% #rname appl %>"<% if #forward appl then %> "<% #email appl %>"<% end %></tt></blockquote>
add44c00 92
93<form action="users" method="post">
5146e435 94<input type="hidden" name="app" value="<% #id appl %>">
1fe415e0 95<table class="blanks">
96<tr> <td>Name:</td> <td><input name="name" value="<% Web.html (#name appl) %>"></td> </tr>
97<tr> <td>Real name:</td> <td><input name="rname" value="<% Web.html (#rname appl) %>"></td> </tr>
98<tr> <td>Funded by:</td> <td><select name="bal">
4b8df0b1 99 <option value="">A new balance</option>
100<% foreach bal in Balance.listBalances () do %>
101 <option value="<% #id bal %>"><% Web.html (#name bal) %></option>
102<% end %>
103</select></td></tr>
1fe415e0 104<tr> <td>Initial transaction amount:</td> <td><input name="amount"></td> </tr>
105<tr> <td>Initial transaction description:</td> <td><input name="descr" value="PayPal"></td> </tr>
106<tr> <td><input type="checkbox" name="subscribe" checked></td> <td>Subscribe to hcoop-announce</td> </tr>
107<tr> <td>Groups:</td> <td><select name="grp" size="5" multiple>
4b8df0b1 108<% foreach group in Group.listGroups () do %>
109 <option value="<% #id group %>"<% if #name group = "paying" then %> selected<% end %>><% Web.html (#name group) %></option>
110<% end %>
111</select></td></tr>
112<tr> <td><input type="submit" name="cmd" value="Create"></td> </tr>
113</table>
114</form>
115
116<a href="apps?abort=<% #id appl %>">Abort adding this member</a>
117
118<% elseif $"abort" <> "" then
119 App.abortAdd (Web.stoi ($"abort"))
1fe415e0 120 %><h3>Aborted</h3><%
4b8df0b1 121
453d7579 122end %>
123
124<% if showNormal then %>
1fe415e0 125<h3>Pending applications</h3>
453d7579 126
4b8df0b1 127<% foreach appl in App.listApps App.PENDING do %>
453d7579 128 <br><hr><br>
1fe415e0 129 <table class="blanks">
130 <tr> <td>Received:</td> <td><% #applied appl %></td> </tr>
131 <tr> <td>Approved by:</td> <td><%
453d7579 132 ref first = true;
133 ref found = false;
03577083 134 val votes = App.votes (#id appl);
135 foreach (id, name) in votes do
453d7579 136 if first then
137 first := false
138 else
139 %>, <%
140 end
141 %><a href="user?id=<% id %>"><% name %></a><%
142 if id = you then
143 found := true
144 %> <a href="apps?unvote=<% #id appl %>">[Unvote]</a><%
145 end
146 end %> <% if (iff board then not found else false) then %><a href="apps?vote=<% #id appl %>">[Vote]</a><% end %></td> </tr>
1fe415e0 147 <tr> <td>Username:</td> <td><% #name appl %></td> </tr>
148 <tr> <td>Real name:</td> <td><% Web.html (#rname appl) %></td> </tr>
149 <tr> <td>E-mail address:</td> <td><a href="mailto:<% #email appl %>"><% #email appl %></a></td> </tr>
150 <tr> <td>Forward e-mail?</td> <td><% if #forward appl then %>yes<% else %>no<% end %></td> </tr>
151 <tr> <td>Proposed uses:</td> <td><% Web.htmlNl (#uses appl) %></td> </tr>
152 <tr> <td>Other information:</td> <td><% Web.htmlNl (#other appl) %></td> </tr>
453d7579 153 </table>
154
155 <% if board then %>
03577083 156 <% if length votes >= 2 then %><a href="apps?approve=<% #id appl %>">Approve this member.</a><br><% end %>
453d7579 157 <a href="apps?deny=<% #id appl %>">Deny this application.</a>
158 <% end %>
159<% end
160end %>
161
162<% @footer[] %>