1 <% @header[("title", ["Contact kind admin"])];
3 Group.requireGroupName "contact";
8 val id = Contact.addKind ($"name", (iff $"url" = "on" then SOME ($"urlPrefix", $"urlPostfix") else NONE))
9 %> <h3>Contact kind added</h3>
11 <% elseif $"mod" <> "" then
13 val id = Web.stoi ($"mod");
14 val kind = Contact.lookupKind id %>
16 <form action="kind" method="post">
17 <input type="hidden" name="save" value="<% id %>">
18 <table class="blanks">
19 <tr> <td>Name:</td> <td><input name="name" value="<% Web.html (#name kind) %>"></td> </tr>
20 <tr> <td>URL pattern:</td> <td><%
21 switch #makeUrl kind of
22 NONE => %><input type="checkbox" name="url"> <input name="urlPrefix">...<input name="urlPostfix"><%
23 | SOME (pre, post) => %><input type="checkbox" name="url" checked> <input name="urlPrefix" value="<% Web.html pre %>">...<input name="urlPostfix" value="<% Web.html post %>"><%
26 <tr> <td><input type="submit" value="Save"></td> </tr>
30 <% elseif $"save" <> "" then
31 val id = Web.stoi ($"save");
32 val kind = Contact.lookupKind id;
33 Contact.modKind {kind with name = $"name", makeUrl = (iff $"url" = "on" then SOME ($"urlPrefix", $"urlPostfix") else NONE)}
34 %> <h3>Contact kind modified</h3>
36 <% elseif $"del" <> "" then
38 val id = Web.stoi ($"del");
39 val kind = Contact.lookupKind id %>
40 <h3>Are you sure you want to delete "<% Web.html (#name kind) %>"?</h3>
42 <a href="kind?del2=<% $"del" %>">Yes, delete "<% Web.html (#name kind) %>"!</a>
44 <% elseif $"del2" <> "" then
45 val id = Web.stoi ($"del2");
46 val kind = Contact.lookupKind id;
47 Contact.deleteKind id %>
48 <h3>"<% Web.html (#name kind) %>" deleted</h3>
52 <% if showNormal then %>
54 <h3>Add a contact kind</h3>
56 <form action="kind" method="post">
57 <input type="hidden" name="cmd" value="add">
58 <table class="blanks">
59 <tr> <td>Name:</td> <td><input name="name"></td> </tr>
60 <tr> <td>URL pattern:</td> <td><input type="checkbox" name="url"> <input name="urlPrefix">...<input name="urlPostfix"></td> </tr>
61 <tr> <td><input type="submit" value="Add"></td> </tr>
65 <h3>Current contact kinds</h3>
68 <tr> <td><b>Kind</b></td> <td><b>URL pattern</b></td> </tr>
69 <% foreach kind in Contact.listKinds () do %>
71 <td><% Web.html (#name kind) %></td>
72 <td><% switch #makeUrl kind of
73 NONE => %><i>none</i><%
74 | SOME (pre, post) => Web.html pre %>...<% Web.html post
76 <td><a href="kind?mod=<% #id kind %>">[Modify]</a> <a href="kind?del=<% #id kind %>">[Delete]</a></td>