Reports for figuring out which accounts to freeze or boot; most of new SSL request...
[bpt/portal.git] / domain.mlt
CommitLineData
5da9f4a9
AC
1<% @header [("title", ["Domain set-up requests"])];
2
3val admin = Group.inGroupName "server";
4
5if $"req" <> "" then
6 val dom = $"req";
06e14693
AC
7 if not (Util.validDomain dom) then
8 %><h3>Invalid domain name</h3><%
9 elseif String.isPrefix "www." dom and $"want_www" = "" then
10 val base = String.extract (dom, 4, NONE)
11 %><h3>Are you sure you want to request a domain that begins with "www."?</h3>
12 <p>You probably meant to request <tt><% base %></tt> instead, which would grant you the ability to configure <tt><% dom %></tt> as well. Unless you've registered <tt><% dom %></tt> directly with your registrar, you will be unable to configure it without the right to set nameservers for <tt><% base %></tt>.</p>
13 <p><a href="?req=<% Web.urlEncode dom %>&want_www=1&msg=<% Web.urlEncode ($"msg") %>">Yes, go ahead and place the request!</a></p><%
14 else
5da9f4a9
AC
15 val id = Domain.add (Init.getUserId(), dom, $"msg");
16 if not (Domain.notifyNew id) then
b6dd1aaf 17 %><h3>Error sending e-mail notification</h3><%
5da9f4a9 18 end
b6dd1aaf 19 %><h3>Request added</h3><%
5da9f4a9
AC
20 end
21
22elseif $"cmd" = "open" then
b6dd1aaf 23 %><h3>Open requests</h3>
5da9f4a9
AC
24 <a href="domain?cmd=list">List all requests</a><%
25
26 foreach (name, req) in Domain.listOpen () do %>
27<br><hr><br>
b6dd1aaf
AC
28<table class="blanks">
29<tr> <td>By:</td> <td><a href="user?id=<% #usr req %>"><% name %></a></td> </tr>
6b8b767b 30<tr> <td>Time:</td> <td><% #stamp req %> (<% Util.diffFromNow (#stamp req) %> ago)</td> </tr>
b6dd1aaf
AC
31<tr> <td>Domain:</td> <td><a href="<% Util.whoisUrl (#data req) %>"><% #data req %></a></td> </tr>
32<tr> <td>Reason:</td> <td colspan="2"><% Web.html (#msg req) %></td> </tr>
5da9f4a9
AC
33</table>
34
35<% if admin then %>
36 <br>
37 <a href="domain?mod=<% #id req %>">[Modify]</a>
38 <a href="domain?del=<% #id req %>">[Delete]</a><br>
ba5de264 39 To set up, run: <tt>domtool-admin grant <% name %> domain <% #data req %></tt>
5da9f4a9
AC
40<% end %>
41
42<% end
43
44elseif $"cmd" = "list" then
b6dd1aaf 45 %><h3>All requests</h3><%
5da9f4a9
AC
46
47 foreach (name, req) in Domain.list () do %>
48<br><hr><br>
b6dd1aaf
AC
49<table class="blanks">
50<tr> <td>By:</td> <td colspan="2"><a href="user?id=<% #usr req %>"><% name %></a></td> </tr>
6b8b767b 51<tr> <td>Time:</td> <td colspan="2"><% #stamp req %> (<% Util.diffFromNow (#stamp req) %> ago)</td> </tr>
b6dd1aaf
AC
52<tr> <td>Domain:</td> <td><a href="<% Util.whoisUrl (#data req) %>"><% #data req %></a></td> </tr>
53<tr> <td>Reason:</td> <td colspan="2"><% Web.html (#msg req) %></td> </tr>
5da9f4a9
AC
54</table>
55
56<% if admin then %>
57 <br>
58 <a href="domain?mod=<% #id req %>">[Modify]</a>
59 <a href="domain?del=<% #id req %>">[Delete]</a>
60<% end %>
61
62<% end
63
64elseif $"mod" <> "" then
65 Group.requireGroupName "server";
66 val id = Web.stoi ($"mod");
67 val req = Domain.lookup id;
68 val user = Init.lookupUser (#usr req) %>
b6dd1aaf 69<h3>Handle request</h3>
5da9f4a9 70
a4ccdb5e 71<form action="domain" method="post">
5da9f4a9 72<input type="hidden" name="save" value="<% id %>">
b6dd1aaf
AC
73<table class="blanks">
74<tr> <td>Requestor:</td> <td><a href="user?id=<% #usr req %>"><% #name user %></a></td> </tr>
6b8b767b 75<tr> <td>Time:</td> <td><% #stamp req %> (<% Util.diffFromNow (#stamp req) %> ago)</td> </tr>
b6dd1aaf 76<tr> <td>Status</b>:</td> <td><select name="status">
5da9f4a9
AC
77 <option value="0"<% if #status req = Domain.NEW then %> selected<% end %>>New</option>
78 <option value="1"<% if #status req = Domain.INSTALLED then %> selected<% end %>>Installed</option>
79 <option value="2"<% if #status req = Domain.REJECTED then %> selected<% end %>>Rejected</option>
80</select></td> </tr>
b6dd1aaf
AC
81<tr> <td>Domain:</td> <td><input name="dom" value="<% #data req %>"></td> </tr>
82<tr> <td>Message:</td> <td><textarea name="msg" rows="10" cols="80" wrap="soft"><% Web.html (#msg req) %></textarea></td> </tr>
5da9f4a9
AC
83<tr> <td><input type="submit" value="Save"></td> </tr>
84</table>
85</form>
86
87<% elseif $"save" <> "" then
88 Group.requireGroupName "server";
89 val id = Web.stoi ($"save");
90 val req = Domain.lookup id;
91 val oldStatus = #status req;
92 val newStatus = Domain.statusFromInt (Web.stoi ($"status"));
93 Domain.modify {req with data = $"dom", msg = $"msg", status = newStatus};
94 if oldStatus <> newStatus then
95 if not (Domain.notifyMod (oldStatus, newStatus, Init.getUserName(), id)) then
b6dd1aaf 96 %><h3>Error sending e-mail notification</h3><%
5da9f4a9
AC
97 end
98 end
b6dd1aaf 99 %><h3>Request modified</h3>
5da9f4a9
AC
100 Back to: <a href="domain?cmd=open">open requests</a>, <a href="domain?cmd=list">all requests</a>
101
102<% elseif $"del" <> "" then
103 Group.requireGroupName "server";
104 val id = Web.stoi ($"del");
105 val req = Domain.lookup id;
106 val user = Init.lookupUser (#usr req)
b6dd1aaf 107 %><h3>Are you sure you want to delete request by <% #name user %> for <tt><% #data req %></tt>?</h3>
5da9f4a9
AC
108 <a href="domain?del2=<% id %>">Yes, I'm sure!</a>
109
110<% elseif $"del2" <> "" then
111 Group.requireGroupName "server";
112 val id = Web.stoi ($"del2");
113 Domain.delete id
b6dd1aaf 114 %><h3>Request deleted</b><h3>
5da9f4a9
AC
115 Back to: <a href="domain?cmd=open">open requests</a>, <a href="domain?cmd=list">all requests</a>
116
117<% else %>
118
b6dd1aaf 119<h3>Request new domain</h3>
5da9f4a9 120
9d1c0e98 121Enter the full Internet domain name that you own and would like set up here. We don't do domain registration, so it is your responsibility to register this name with your registrar of choice before submitting it here. The "Reason" field is optional.
5da9f4a9 122
a4ccdb5e 123<form action="domain" method="post">
b6dd1aaf
AC
124<table class="blanks">
125<tr> <td>Domain:</td> <td><input name="req"></td> </tr>
126<tr> <td>Reason:</td> <td><textarea name="msg" rows="5" cols="80" wrap="soft"></textarea></td> </tr>
5da9f4a9
AC
127<tr> <td><input type="submit" value="Request"></td> </tr>
128</table>
129</form>
130
131<% end %>
132
133<% @footer[] %>