More fun for the new server\!
[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
30<% if admin then %>
31 <br>
32 <a href="list?mod=<% #id req %>">[Modify]</a>
33 <a href="list?del=<% #id req %>">[Delete]</a><br>
e84acecc 34 To set up, run: <tt>newlist <% #data req %>&nbsp;<% name %><% Init.emailSuffix %> <% Util.randomPassword () %></tt>
9d1c0e98
AC
35<% end %>
36
37<% end
38
39elseif $"cmd" = "list" then
40 %><h3><b>All requests</b></h3><%
41
42 foreach (name, req) in MailingList.list () do %>
43<br><hr><br>
44<table>
45<tr> <td align="right"><b>By</b>:</td> <td colspan="2"><a href="user?id=<% #usr req %>"><% name %></a></td> </tr>
46<tr> <td align="right"><b>Time</b>:</td> <td colspan="2"><% #stamp req %></td> </tr>
47<tr> <td align="right"><b>List name</b>:</td> <td><% #data req %></td> </tr>
48<tr> <td align="right" valign="top"><b>Reason</b>:</td> <td colspan="2"><% Web.html (#msg req) %></td> </tr>
49</table>
50
51<% if admin then %>
52 <br>
53 <a href="list?mod=<% #id req %>">[Modify]</a>
54 <a href="list?del=<% #id req %>">[Delete]</a>
55<% end %>
56
57<% end
58
59elseif $"mod" <> "" then
60 Group.requireGroupName "lists";
61 val id = Web.stoi ($"mod");
62 val req = MailingList.lookup id;
63 val user = Init.lookupUser (#usr req) %>
64<h3><b>Handle request</b></h3>
65
66<form action="list">
67<input type="hidden" name="save" value="<% id %>">
68<table>
69<tr> <td align="right"><b>Requestor</b>:</td> <td><a href="user?id=<% #usr req %>"><% #name user %></a></td> </tr>
70<tr> <td align="right"><b>Time</b>:</td> <td><% #stamp req %></td> </tr>
71<tr> <td align="right"><b>Status</b>:</td> <td><select name="status">
72 <option value="0"<% if #status req = MailingList.NEW then %> selected<% end %>>New</option>
73 <option value="1"<% if #status req = MailingList.INSTALLED then %> selected<% end %>>Installed</option>
74 <option value="2"<% if #status req = MailingList.REJECTED then %> selected<% end %>>Rejected</option>
75</select></td> </tr>
76<tr> <td align="right"><b>List name</b>:</td> <td><input name="dom" value="<% #data req %>"></td> </tr>
77<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>
78<tr> <td><input type="submit" value="Save"></td> </tr>
79</table>
80</form>
81
82<% elseif $"save" <> "" then
83 Group.requireGroupName "lists";
84 val id = Web.stoi ($"save");
85 val req = MailingList.lookup id;
86 val oldStatus = #status req;
87 val newStatus = MailingList.statusFromInt (Web.stoi ($"status"));
88 MailingList.modify {req with data = $"dom", msg = $"msg", status = newStatus};
89 if oldStatus <> newStatus then
90 if not (MailingList.notifyMod (oldStatus, newStatus, Init.getUserName(), id)) then
91 %><h3><b>Error sending e-mail notification</b></h3><%
92 end
93 end
94 %><h3><b>Request modified</b></h3>
95 Back to: <a href="list?cmd=open">open requests</a>, <a href="list?cmd=list">all requests</a>
96
97<% elseif $"del" <> "" then
98 Group.requireGroupName "lists";
99 val id = Web.stoi ($"del");
100 val req = MailingList.lookup id;
101 val user = Init.lookupUser (#usr req)
102 %><h3><b>Are you sure you want to delete request by <% #name user %> for <tt><% #data req %></tt>?</b></h3>
103 <a href="list?del2=<% id %>">Yes, I'm sure!</a>
104
105<% elseif $"del2" <> "" then
106 Group.requireGroupName "lists";
107 val id = Web.stoi ($"del2");
108 MailingList.delete id
109 %><h3><b>Request deleted</b><h3>
110 Back to: <a href="list?cmd=open">open requests</a>, <a href="list?cmd=list">all requests</a>
111
112<% else %>
113
114<h3><b>Request new mailing list</b></h3>
115
27e48ace
AC
116<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>
117
118<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.</p>
9d1c0e98
AC
119
120<form action="list">
121<table>
122<tr> <td align="right" valign="top"><b>List name</b>:</td> <td><input name="req"></td> </tr>
123<tr> <td align="right" valign="top"><b>Reason</b>:</td> <td><textarea name="msg" rows="5" cols="80" wrap="soft"></textarea></td> </tr>
124<tr> <td><input type="submit" value="Request"></td> </tr>
125</table>
126</form>
127
128<% end %>
129
130<% @footer[] %>