Commit | Line | Data |
---|---|---|
9d1c0e98 AC |
1 | <% @header [("title", ["Mailing list creation requests"])]; |
2 | ||
3 | val admin = Group.inGroupName "lists"; | |
4 | ||
5 | if $"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 | |
b6dd1aaf | 10 | %><h3>Error sending e-mail notification</h3><% |
9d1c0e98 | 11 | end |
b6dd1aaf | 12 | %><h3>Request added</h3><% |
9d1c0e98 | 13 | else |
b6dd1aaf | 14 | %><h3>Invalid list e-mail address</h3><% |
9d1c0e98 AC |
15 | end |
16 | ||
17 | elseif $"cmd" = "open" then | |
b6dd1aaf | 18 | %><h3>Open requests</h3> |
9d1c0e98 AC |
19 | <a href="list?cmd=list">List all requests</a><% |
20 | ||
21 | foreach (name, req) in MailingList.listOpen () do %> | |
22 | <br><hr><br> | |
b6dd1aaf AC |
23 | <table class="blanks"> |
24 | <tr> <td>By:</td> <td><a href="user?id=<% #usr req %>"><% name %></a></td> </tr> | |
6b8b767b | 25 | <tr> <td>Time:</td> <td><% #stamp req %> (<% Util.diffFromNow (#stamp req) %> ago)</td> </tr> |
b6dd1aaf AC |
26 | <tr> <td>List name:</td> <td><% #data req %></td> </tr> |
27 | <tr> <td>Reason:</td> <td colspan="2"><% Web.html (#msg req) %></td> </tr> | |
9d1c0e98 AC |
28 | </table> |
29 | ||
37cec107 | 30 | <% if admin then |
acb31ead | 31 | val vitals = 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> | |
acb31ead | 35 | To set up, run: <tt>listnew <% #user vitals %> <% #dom vitals %> <% #vhost vitals %> <% name %> <% Util.randomPassword () %></tt> |
9d1c0e98 AC |
36 | <% end %> |
37 | ||
38 | <% end | |
39 | ||
40 | elseif $"cmd" = "list" then | |
b6dd1aaf | 41 | %><h3>All requests</h3><% |
9d1c0e98 AC |
42 | |
43 | foreach (name, req) in MailingList.list () do %> | |
44 | <br><hr><br> | |
b6dd1aaf AC |
45 | <table class="blanks"> |
46 | <tr> <td>By:</td> <td colspan="2"><a href="user?id=<% #usr req %>"><% name %></a></td> </tr> | |
6b8b767b | 47 | <tr> <td>Time:</td> <td colspan="2"><% #stamp req %> (<% Util.diffFromNow (#stamp req) %> ago)</td> </tr> |
b6dd1aaf AC |
48 | <tr> <td>List name:</td> <td><% #data req %></td> </tr> |
49 | <tr> <td>Reason:</td> <td colspan="2"><% Web.html (#msg req) %></td> </tr> | |
9d1c0e98 AC |
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 | ||
60 | elseif $"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) %> | |
b6dd1aaf | 65 | <h3>Handle request</h3> |
9d1c0e98 | 66 | |
a4ccdb5e | 67 | <form action="list" method="post"> |
9d1c0e98 | 68 | <input type="hidden" name="save" value="<% id %>"> |
b6dd1aaf AC |
69 | <table class="blanks"> |
70 | <tr> <td>Requestor:</td> <td><a href="user?id=<% #usr req %>"><% #name user %></a></td> </tr> | |
6b8b767b | 71 | <tr> <td>Time:</td> <td><% #stamp req %> (<% Util.diffFromNow (#stamp req) %> ago)</td> </tr> |
b6dd1aaf | 72 | <tr> <td>Status:</td> <td><select name="status"> |
9d1c0e98 AC |
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> | |
b6dd1aaf AC |
77 | <tr> <td>List name:</td> <td><input name="dom" value="<% #data req %>"></td> </tr> |
78 | <tr> <td>Message:</td> <td><textarea name="msg" rows="10" cols="80" wrap="soft"><% Web.html (#msg req) %></textarea></td> </tr> | |
9d1c0e98 AC |
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}; | |
8812fb4d AC |
90 | if not (MailingList.notifyMod (oldStatus, newStatus, Init.getUserName(), id)) then |
91 | %><h3>Error sending e-mail notification</h3><% | |
9d1c0e98 | 92 | end |
b6dd1aaf | 93 | %><h3>Request modified</h3> |
9d1c0e98 AC |
94 | Back to: <a href="list?cmd=open">open requests</a>, <a href="list?cmd=list">all requests</a> |
95 | ||
96 | <% elseif $"del" <> "" then | |
97 | Group.requireGroupName "lists"; | |
98 | val id = Web.stoi ($"del"); | |
99 | val req = MailingList.lookup id; | |
100 | val user = Init.lookupUser (#usr req) | |
b6dd1aaf | 101 | %><h3>Are you sure you want to delete request by <% #name user %> for <tt><% #data req %></tt>?</h3> |
9d1c0e98 AC |
102 | <a href="list?del2=<% id %>">Yes, I'm sure!</a> |
103 | ||
104 | <% elseif $"del2" <> "" then | |
105 | Group.requireGroupName "lists"; | |
106 | val id = Web.stoi ($"del2"); | |
107 | MailingList.delete id | |
b6dd1aaf | 108 | %><h3>Request deleted</b><h3> |
9d1c0e98 AC |
109 | Back to: <a href="list?cmd=open">open requests</a>, <a href="list?cmd=list">all requests</a> |
110 | ||
111 | <% else %> | |
112 | ||
b6dd1aaf | 113 | <h3>Request new mailing list</h3> |
9d1c0e98 | 114 | |
27e48ace AC |
115 | <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> |
116 | ||
090e5fb2 | 117 | <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, then you should follow <a href="http://wiki.hcoop.net/MemberManual/Email/MailingLists">these instructions</a> <b>before</b> requesting the list. You should only need to follow the instructions once per domain.</p> |
9d1c0e98 | 118 | |
a4ccdb5e | 119 | <form action="list" method="post"> |
b6dd1aaf AC |
120 | <table class="blanks"> |
121 | <tr> <td>List name:</td> <td><input name="req"></td> </tr> | |
122 | <tr> <td>Reason:</td> <td><textarea name="msg" rows="5" cols="80" wrap="soft"></textarea></td> </tr> | |
9d1c0e98 AC |
123 | <tr> <td><input type="submit" value="Request"></td> </tr> |
124 | </table> | |
125 | </form> | |
126 | ||
127 | <% end %> | |
128 | ||
15730af7 | 129 | <% @footer[] %> |