1 <% @header [("title", ["Domain set-up requests"])];
3 val admin = Group.inGroupName "server";
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><%
15 val id = Domain.add (Init.getUserId(), dom, $"msg");
16 if not (Domain.notifyNew id) then
17 %><h3>Error sending e-mail notification</h3><%
19 %><h3>Request added</h3><%
22 elseif $"cmd" = "open" then
23 %><h3>Open requests</h3>
24 <a href="domain?cmd=list">List all requests</a><%
26 foreach (name, req) in Domain.listOpen () do %>
28 <table class="blanks">
29 <tr> <td>By:</td> <td><a href="user?id=<% #usr req %>"><% name %></a></td> </tr>
30 <tr> <td>Time:</td> <td><% #stamp req %> (<% Util.diffFromNow (#stamp req) %> ago)</td> </tr>
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>
37 <a href="domain?mod=<% #id req %>">[Modify]</a>
38 <a href="domain?del=<% #id req %>">[Delete]</a><br>
39 To set up, run: <tt>domtool-admin grant <% name %> domain <% #data req %></tt>
44 elseif $"cmd" = "list" then
45 %><h3>All requests</h3><%
47 foreach (name, req) in Domain.list () do %>
49 <table class="blanks">
50 <tr> <td>By:</td> <td colspan="2"><a href="user?id=<% #usr req %>"><% name %></a></td> </tr>
51 <tr> <td>Time:</td> <td colspan="2"><% #stamp req %> (<% Util.diffFromNow (#stamp req) %> ago)</td> </tr>
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>
58 <a href="domain?mod=<% #id req %>">[Modify]</a>
59 <a href="domain?del=<% #id req %>">[Delete]</a>
64 elseif $"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) %>
69 <h3>Handle request</h3>
71 <form action="domain" method="post">
72 <input type="hidden" name="save" value="<% id %>">
73 <table class="blanks">
74 <tr> <td>Requestor:</td> <td><a href="user?id=<% #usr req %>"><% #name user %></a></td> </tr>
75 <tr> <td>Time:</td> <td><% #stamp req %> (<% Util.diffFromNow (#stamp req) %> ago)</td> </tr>
76 <tr> <td>Status</b>:</td> <td><select name="status">
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>
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>
83 <tr> <td><input type="submit" value="Save"></td> </tr>
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 not (Domain.notifyMod (oldStatus, newStatus, Init.getUserName(), id)) then
95 %><h3>Error sending e-mail notification</h3><%
97 %><h3>Request modified</h3>
98 Back to: <a href="domain?cmd=open">open requests</a>, <a href="domain?cmd=list">all requests</a>
100 <% elseif $"del" <> "" then
101 Group.requireGroupName "server";
102 val id = Web.stoi ($"del");
103 val req = Domain.lookup id;
104 val user = Init.lookupUser (#usr req)
105 %><h3>Are you sure you want to delete request by <% #name user %> for <tt><% #data req %></tt>?</h3>
106 <a href="domain?del2=<% id %>">Yes, I'm sure!</a>
108 <% elseif $"del2" <> "" then
109 Group.requireGroupName "server";
110 val id = Web.stoi ($"del2");
112 %><h3>Request deleted</b><h3>
113 Back to: <a href="domain?cmd=open">open requests</a>, <a href="domain?cmd=list">all requests</a>
117 <h3>Request new domain</h3>
119 Enter 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.
121 <form action="domain" method="post">
122 <table class="blanks">
123 <tr> <td>Domain:</td> <td><input name="req" required="required"></td> </tr>
124 <tr> <td>Reason:</td> <td><textarea name="msg" rows="5" cols="80" wrap="soft"></textarea></td> </tr>
125 <tr> <td><input type="submit" value="Request"></td> </tr>
129 <h3>Your current domains</h3>
131 <p>To remove any domain you control, you can run <tt>domtool-admin
132 rmdom $DOMAIN</tt>.</p>
135 <% foreach dom in ChooseDomain.domains (Init.getUserName ()) do %>
136 <li><tt><% dom %></tt></li>