Support retiring balances of departed members
[hcoop/portal.git] / list.mlt
CommitLineData
9d1c0e98
AC
1<% @header [("title", ["Mailing list creation requests"])];
2
3val admin = Group.inGroupName "lists";
4
5if $"req" <> "" then
6 val dom = $"req";
7 if Util.validEmail dom then
8 val id = MailingList.add (Init.getUserId(), dom, $"msg");
9 if not (MailingList.notifyNew id) then
10 %><h3><b>Error sending e-mail notification</b></h3><%
11 end
12 %><h3><b>Request added</b></h3><%
13 else
14 %><h3><b>Invalid list e-mail address</b></h3><%
15 end
16
17elseif $"cmd" = "open" then
18 %><h3><b>Open requests</b></h3>
19 <a href="list?cmd=list">List all requests</a><%
20
21 foreach (name, req) in MailingList.listOpen () do %>
22<br><hr><br>
23<table>
24<tr> <td align="right"><b>By</b>:</td> <td><a href="user?id=<% #usr req %>"><% name %></a></td> </tr>
25<tr> <td align="right"><b>Time</b>:</td> <td><% #stamp req %></td> </tr>
26<tr> <td align="right"><b>List name</b>:</td> <td><% #data req %></td> </tr>
27<tr> <td align="right" valign="top"><b>Reason</b>:</td> <td colspan="2"><% Web.html (#msg req) %></td> </tr>
28</table>
29
37cec107
AC
30<% if admin then
31 val (user, dom) = MailingList.listWebHost (#data req) %>
9d1c0e98
AC
32 <br>
33 <a href="list?mod=<% #id req %>">[Modify]</a>
34 <a href="list?del=<% #id req %>">[Delete]</a><br>
37cec107 35 To set up, run: <tt>listnew <% user %>&nbsp;<% dom %>&nbsp;<% name %>&nbsp;<% Util.randomPassword () %></tt>
9d1c0e98
AC
36<% end %>
37
38<% end
39
40elseif $"cmd" = "list" then
41 %><h3><b>All requests</b></h3><%
42
43 foreach (name, req) in MailingList.list () do %>
44<br><hr><br>
45<table>
46<tr> <td align="right"><b>By</b>:</td> <td colspan="2"><a href="user?id=<% #usr req %>"><% name %></a></td> </tr>
47<tr> <td align="right"><b>Time</b>:</td> <td colspan="2"><% #stamp req %></td> </tr>
48<tr> <td align="right"><b>List name</b>:</td> <td><% #data req %></td> </tr>
49<tr> <td align="right" valign="top"><b>Reason</b>:</td> <td colspan="2"><% Web.html (#msg req) %></td> </tr>
50</table>
51
52<% if admin then %>
53 <br>
54 <a href="list?mod=<% #id req %>">[Modify]</a>
55 <a href="list?del=<% #id req %>">[Delete]</a>
56<% end %>
57
58<% end
59
60elseif $"mod" <> "" then
61 Group.requireGroupName "lists";
62 val id = Web.stoi ($"mod");
63 val req = MailingList.lookup id;
64 val user = Init.lookupUser (#usr req) %>
65<h3><b>Handle request</b></h3>
66
a4ccdb5e 67<form action="list" method="post">
9d1c0e98
AC
68<input type="hidden" name="save" value="<% id %>">
69<table>
70<tr> <td align="right"><b>Requestor</b>:</td> <td><a href="user?id=<% #usr req %>"><% #name user %></a></td> </tr>
71<tr> <td align="right"><b>Time</b>:</td> <td><% #stamp req %></td> </tr>
72<tr> <td align="right"><b>Status</b>:</td> <td><select name="status">
73 <option value="0"<% if #status req = MailingList.NEW then %> selected<% end %>>New</option>
74 <option value="1"<% if #status req = MailingList.INSTALLED then %> selected<% end %>>Installed</option>
75 <option value="2"<% if #status req = MailingList.REJECTED then %> selected<% end %>>Rejected</option>
76</select></td> </tr>
77<tr> <td align="right"><b>List name</b>:</td> <td><input name="dom" value="<% #data req %>"></td> </tr>
78<tr> <td align="right" valign="top"><b>Message</b>:</td> <td><textarea name="msg" rows="10" cols="80" wrap="soft"><% Web.html (#msg req) %></textarea></td> </tr>
79<tr> <td><input type="submit" value="Save"></td> </tr>
80</table>
81</form>
82
83<% elseif $"save" <> "" then
84 Group.requireGroupName "lists";
85 val id = Web.stoi ($"save");
86 val req = MailingList.lookup id;
87 val oldStatus = #status req;
88 val newStatus = MailingList.statusFromInt (Web.stoi ($"status"));
89 MailingList.modify {req with data = $"dom", msg = $"msg", status = newStatus};
90 if oldStatus <> newStatus then
91 if not (MailingList.notifyMod (oldStatus, newStatus, Init.getUserName(), id)) then
92 %><h3><b>Error sending e-mail notification</b></h3><%
93 end
94 end
95 %><h3><b>Request modified</b></h3>
96 Back to: <a href="list?cmd=open">open requests</a>, <a href="list?cmd=list">all requests</a>
97
98<% elseif $"del" <> "" then
99 Group.requireGroupName "lists";
100 val id = Web.stoi ($"del");
101 val req = MailingList.lookup id;
102 val user = Init.lookupUser (#usr req)
103 %><h3><b>Are you sure you want to delete request by <% #name user %> for <tt><% #data req %></tt>?</b></h3>
104 <a href="list?del2=<% id %>">Yes, I'm sure!</a>
105
106<% elseif $"del2" <> "" then
107 Group.requireGroupName "lists";
108 val id = Web.stoi ($"del2");
109 MailingList.delete id
110 %><h3><b>Request deleted</b><h3>
111 Back to: <a href="list?cmd=open">open requests</a>, <a href="list?cmd=list">all requests</a>
112
113<% else %>
114
115<h3><b>Request new mailing list</b></h3>
116
27e48ace
AC
117<p>Enter here the e-mail address you would like for your list. Please keep in mind that the part of your list address before the "@" must be unique across all mailing lists we run. We may reject applications with overly general names here, especially names of current users or UNIX usernames that are likely to be chosen by future members. The "Reason" field is optional.</p>
118
37cec107 119<p>If you want to use the Mailman web interface on your new list, and you want this to appear on a different web virtual host than hcoop.net, you should create a file <tt>.mailman</tt> in the domtool directory for this domain, before submitting a request. In that file, put the hostname of the vhost you want to use, and be sure to include a <tt>Mailman</tt> directive in that vhost's configuration.</p>
9d1c0e98 120
a4ccdb5e 121<form action="list" method="post">
9d1c0e98
AC
122<table>
123<tr> <td align="right" valign="top"><b>List name</b>:</td> <td><input name="req"></td> </tr>
124<tr> <td align="right" valign="top"><b>Reason</b>:</td> <td><textarea name="msg" rows="5" cols="80" wrap="soft"></textarea></td> </tr>
125<tr> <td><input type="submit" value="Request"></td> </tr>
126</table>
127</form>
128
129<% end %>
130
131<% @footer[] %>