% @header[("title", ["Contact kind admin"])];
Group.requireGroupName "contact";
ref showNormal = true;
if $"cmd" = "add" then
val id = Contact.addKind ($"name", (iff $"url" = "on" then SOME ($"urlPrefix", $"urlPostfix") else NONE))
%>
Contact kind added
<% elseif $"mod" <> "" then
showNormal := false;
val id = Web.stoi ($"mod");
val kind = Contact.lookupKind id %>
<% elseif $"save" <> "" then
val id = Web.stoi ($"save");
val kind = Contact.lookupKind id;
Contact.modKind {kind with name = $"name", makeUrl = (iff $"url" = "on" then SOME ($"urlPrefix", $"urlPostfix") else NONE)}
%> Contact kind modified
<% elseif $"del" <> "" then
showNormal := false;
val id = Web.stoi ($"del");
val kind = Contact.lookupKind id %>
Are you sure you want to delete "<% Web.html (#name kind) %>"?
">Yes, delete "<% Web.html (#name kind) %>"!
<% elseif $"del2" <> "" then
val id = Web.stoi ($"del2");
val kind = Contact.lookupKind id;
Contact.deleteKind id %>
"<% Web.html (#name kind) %>" deleted
<% end %>
<% if showNormal then %>
Add a contact kind
Current contact kinds
Kind | URL pattern |
<% foreach kind in Contact.listKinds () do %>
<% Web.html (#name kind) %> |
<% switch #makeUrl kind of
NONE => %>none<%
| SOME (pre, post) => Web.html pre %>...<% Web.html post
end %> |
[Modify] [Delete] |
<% end %>
<% end %>
<% @footer[] %>