% @header [("title", ["Domain set-up requests"])];
val admin = Group.inGroupName "server";
if $"req" <> "" then
val dom = $"req";
if Util.validDomain dom then
val id = Domain.add (Init.getUserId(), dom, $"msg");
if not (Domain.notifyNew id) then
%>
Error sending e-mail notification
<%
end
%>Request added
<%
else
%>Invalid domain name
<%
end
elseif $"cmd" = "open" then
%>Open requests
List all requests<%
foreach (name, req) in Domain.listOpen () do %>
<% if admin then %>
[Modify]
[Delete]
To set up, run: domtool-admin grant <% name %> domain <% #data req %>
<% end %>
<% end
elseif $"cmd" = "list" then
%>All requests
<%
foreach (name, req) in Domain.list () do %>
<% if admin then %>
[Modify]
[Delete]
<% end %>
<% end
elseif $"mod" <> "" then
Group.requireGroupName "server";
val id = Web.stoi ($"mod");
val req = Domain.lookup id;
val user = Init.lookupUser (#usr req) %>
Handle request
<% elseif $"save" <> "" then
Group.requireGroupName "server";
val id = Web.stoi ($"save");
val req = Domain.lookup id;
val oldStatus = #status req;
val newStatus = Domain.statusFromInt (Web.stoi ($"status"));
Domain.modify {req with data = $"dom", msg = $"msg", status = newStatus};
if oldStatus <> newStatus then
if not (Domain.notifyMod (oldStatus, newStatus, Init.getUserName(), id)) then
%>Error sending e-mail notification
<%
end
end
%>Request modified
Back to: open requests, all requests
<% elseif $"del" <> "" then
Group.requireGroupName "server";
val id = Web.stoi ($"del");
val req = Domain.lookup id;
val user = Init.lookupUser (#usr req)
%>Are you sure you want to delete request by <% #name user %> for <% #data req %>?
Yes, I'm sure!
<% elseif $"del2" <> "" then
Group.requireGroupName "server";
val id = Web.stoi ($"del2");
Domain.delete id
%>Request deleted
Back to: open requests, all requests
<% else %>
Request new domain
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.
<% end %>
<% @footer[] %>