cvsimport
[hcoop/zz_old/portal.git] / domain.mlt
CommitLineData
ff2b7604 1<% @header [("title", ["Domain set-up requests"])];
2
3val admin = Group.inGroupName "server";
4
5if $"req" <> "" then
6 val dom = $"req";
7 if Util.validDomain dom then
8 val id = Domain.add (Init.getUserId(), dom, $"msg");
9 if not (Domain.notifyNew id) then
1fe415e0 10 %><h3>Error sending e-mail notification</h3><%
ff2b7604 11 end
1fe415e0 12 %><h3>Request added</h3><%
ff2b7604 13 else
1fe415e0 14 %><h3>Invalid domain name</h3><%
ff2b7604 15 end
16
17elseif $"cmd" = "open" then
1fe415e0 18 %><h3>Open requests</h3>
ff2b7604 19 <a href="domain?cmd=list">List all requests</a><%
20
21 foreach (name, req) in Domain.listOpen () do %>
22<br><hr><br>
1fe415e0 23<table class="blanks">
24<tr> <td>By:</td> <td><a href="user?id=<% #usr req %>"><% name %></a></td> </tr>
25<tr> <td>Time:</td> <td><% #stamp req %></td> </tr>
26<tr> <td>Domain:</td> <td><a href="<% Util.whoisUrl (#data req) %>"><% #data req %></a></td> </tr>
27<tr> <td>Reason:</td> <td colspan="2"><% Web.html (#msg req) %></td> </tr>
ff2b7604 28</table>
29
30<% if admin then %>
31 <br>
32 <a href="domain?mod=<% #id req %>">[Modify]</a>
33 <a href="domain?del=<% #id req %>">[Delete]</a><br>
acf5dabe 34 To set up, run: <tt>domtool-admin grant <% name %> domain <% #data req %></tt>
ff2b7604 35<% end %>
36
37<% end
38
39elseif $"cmd" = "list" then
1fe415e0 40 %><h3>All requests</h3><%
ff2b7604 41
42 foreach (name, req) in Domain.list () do %>
43<br><hr><br>
1fe415e0 44<table class="blanks">
45<tr> <td>By:</td> <td colspan="2"><a href="user?id=<% #usr req %>"><% name %></a></td> </tr>
46<tr> <td>Time:</td> <td colspan="2"><% #stamp req %></td> </tr>
47<tr> <td>Domain:</td> <td><a href="<% Util.whoisUrl (#data req) %>"><% #data req %></a></td> </tr>
48<tr> <td>Reason:</td> <td colspan="2"><% Web.html (#msg req) %></td> </tr>
ff2b7604 49</table>
50
51<% if admin then %>
52 <br>
53 <a href="domain?mod=<% #id req %>">[Modify]</a>
54 <a href="domain?del=<% #id req %>">[Delete]</a>
55<% end %>
56
57<% end
58
59elseif $"mod" <> "" then
60 Group.requireGroupName "server";
61 val id = Web.stoi ($"mod");
62 val req = Domain.lookup id;
63 val user = Init.lookupUser (#usr req) %>
1fe415e0 64<h3>Handle request</h3>
ff2b7604 65
add44c00 66<form action="domain" method="post">
ff2b7604 67<input type="hidden" name="save" value="<% id %>">
1fe415e0 68<table class="blanks">
69<tr> <td>Requestor:</td> <td><a href="user?id=<% #usr req %>"><% #name user %></a></td> </tr>
70<tr> <td>Time:</td> <td><% #stamp req %></td> </tr>
71<tr> <td>Status</b>:</td> <td><select name="status">
ff2b7604 72 <option value="0"<% if #status req = Domain.NEW then %> selected<% end %>>New</option>
73 <option value="1"<% if #status req = Domain.INSTALLED then %> selected<% end %>>Installed</option>
74 <option value="2"<% if #status req = Domain.REJECTED then %> selected<% end %>>Rejected</option>
75</select></td> </tr>
1fe415e0 76<tr> <td>Domain:</td> <td><input name="dom" value="<% #data req %>"></td> </tr>
77<tr> <td>Message:</td> <td><textarea name="msg" rows="10" cols="80" wrap="soft"><% Web.html (#msg req) %></textarea></td> </tr>
ff2b7604 78<tr> <td><input type="submit" value="Save"></td> </tr>
79</table>
80</form>
81
82<% elseif $"save" <> "" then
83 Group.requireGroupName "server";
84 val id = Web.stoi ($"save");
85 val req = Domain.lookup id;
86 val oldStatus = #status req;
87 val newStatus = Domain.statusFromInt (Web.stoi ($"status"));
88 Domain.modify {req with data = $"dom", msg = $"msg", status = newStatus};
89 if oldStatus <> newStatus then
90 if not (Domain.notifyMod (oldStatus, newStatus, Init.getUserName(), id)) then
1fe415e0 91 %><h3>Error sending e-mail notification</h3><%
ff2b7604 92 end
93 end
1fe415e0 94 %><h3>Request modified</h3>
ff2b7604 95 Back to: <a href="domain?cmd=open">open requests</a>, <a href="domain?cmd=list">all requests</a>
96
97<% elseif $"del" <> "" then
98 Group.requireGroupName "server";
99 val id = Web.stoi ($"del");
100 val req = Domain.lookup id;
101 val user = Init.lookupUser (#usr req)
1fe415e0 102 %><h3>Are you sure you want to delete request by <% #name user %> for <tt><% #data req %></tt>?</h3>
ff2b7604 103 <a href="domain?del2=<% id %>">Yes, I'm sure!</a>
104
105<% elseif $"del2" <> "" then
106 Group.requireGroupName "server";
107 val id = Web.stoi ($"del2");
108 Domain.delete id
1fe415e0 109 %><h3>Request deleted</b><h3>
ff2b7604 110 Back to: <a href="domain?cmd=open">open requests</a>, <a href="domain?cmd=list">all requests</a>
111
112<% else %>
113
1fe415e0 114<h3>Request new domain</h3>
ff2b7604 115
78304862 116Enter 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.
ff2b7604 117
add44c00 118<form action="domain" method="post">
1fe415e0 119<table class="blanks">
120<tr> <td>Domain:</td> <td><input name="req"></td> </tr>
121<tr> <td>Reason:</td> <td><textarea name="msg" rows="5" cols="80" wrap="soft"></textarea></td> </tr>
ff2b7604 122<tr> <td><input type="submit" value="Request"></td> </tr>
123</table>
124</form>
125
126<% end %>
127
128<% @footer[] %>