apt: new process for package install on puppet nodes
[hcoop/portal.git] / domain.mlt
index 78dc955..c426e46 100644 (file)
@@ -4,14 +4,19 @@ val admin = Group.inGroupName "server";
 
 if $"req" <> "" then
        val dom = $"req";
-       if Util.validDomain dom then
+       if not (Util.validDomain dom) then
+               %><h3>Invalid domain name</h3><%
+       elseif String.isPrefix "www." dom and $"want_www" = "" then
+               val base = String.extract (dom, 4, NONE)
+               %><h3>Are you sure you want to request a domain that begins with "www."?</h3>
+               <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>
+               <p><a href="?req=<% Web.urlEncode dom %>&want_www=1&msg=<% Web.urlEncode ($"msg") %>">Yes, go ahead and place the request!</a></p><%
+       else
                val id = Domain.add (Init.getUserId(), dom, $"msg");
                if not (Domain.notifyNew id) then
                        %><h3>Error sending e-mail notification</h3><%
                end
                %><h3>Request added</h3><%
-       else
-               %><h3>Invalid domain name</h3><%
        end
 
 elseif $"cmd" = "open" then
@@ -22,7 +27,7 @@ elseif $"cmd" = "open" then
 <br><hr><br>
 <table class="blanks">
 <tr> <td>By:</td> <td><a href="user?id=<% #usr req %>"><% name %></a></td> </tr>
-<tr> <td>Time:</td> <td><% #stamp req %></td> </tr>
+<tr> <td>Time:</td> <td><% #stamp req %> (<% Util.diffFromNow (#stamp req) %> ago)</td> </tr>
 <tr> <td>Domain:</td> <td><a href="<% Util.whoisUrl (#data req) %>"><% #data req %></a></td> </tr>
 <tr> <td>Reason:</td> <td colspan="2"><% Web.html (#msg req) %></td> </tr>
 </table>
@@ -43,7 +48,7 @@ elseif $"cmd" = "list" then
 <br><hr><br>
 <table class="blanks">
 <tr> <td>By:</td> <td colspan="2"><a href="user?id=<% #usr req %>"><% name %></a></td> </tr>
-<tr> <td>Time:</td> <td colspan="2"><% #stamp req %></td> </tr>
+<tr> <td>Time:</td> <td colspan="2"><% #stamp req %> (<% Util.diffFromNow (#stamp req) %> ago)</td> </tr>
 <tr> <td>Domain:</td> <td><a href="<% Util.whoisUrl (#data req) %>"><% #data req %></a></td> </tr>
 <tr> <td>Reason:</td> <td colspan="2"><% Web.html (#msg req) %></td> </tr>
 </table>
@@ -67,7 +72,7 @@ elseif $"mod" <> "" then
 <input type="hidden" name="save" value="<% id %>">
 <table class="blanks">
 <tr> <td>Requestor:</td> <td><a href="user?id=<% #usr req %>"><% #name user %></a></td> </tr>
-<tr> <td>Time:</td> <td><% #stamp req %></td> </tr>
+<tr> <td>Time:</td> <td><% #stamp req %> (<% Util.diffFromNow (#stamp req) %> ago)</td> </tr>
 <tr> <td>Status</b>:</td> <td><select name="status">
        <option value="0"<% if #status req = Domain.NEW then %> selected<% end %>>New</option>
        <option value="1"<% if #status req = Domain.INSTALLED then %> selected<% end %>>Installed</option>
@@ -86,10 +91,8 @@ elseif $"mod" <> "" then
        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
-                       %><h3>Error sending e-mail notification</h3><%
-               end
+       if not (Domain.notifyMod (oldStatus, newStatus, Init.getUserName(), id)) then
+               %><h3>Error sending e-mail notification</h3><%
        end
        %><h3>Request modified</h3>
        Back to: <a href="domain?cmd=open">open requests</a>, <a href="domain?cmd=list">all requests</a>
@@ -117,12 +120,23 @@ Enter the full Internet domain name that you own and would like set up here.  We
 
 <form action="domain" method="post">
 <table class="blanks">
-<tr> <td>Domain:</td> <td><input name="req"></td> </tr>
+<tr> <td>Domain:</td> <td><input name="req" required="required"></td> </tr>
 <tr> <td>Reason:</td> <td><textarea name="msg" rows="5" cols="80" wrap="soft"></textarea></td> </tr>
 <tr> <td><input type="submit" value="Request"></td> </tr>
 </table>
 </form>
 
+<h3>Your current domains</h3>
+
+<p>To remove any domain you control, you can run <tt>domtool-admin
+rmdom $DOMAIN</tt>.</p>
+
+<ul>
+<% foreach dom in ChooseDomain.domains (Init.getUserName ()) do %>
+   <li><tt><% dom %></tt></li>
+<% end %>
+</ul>
+
 <% end %>
 
 <% @footer[] %>
\ No newline at end of file