1 <% @header[("title", ["Hosted sites"])];
3 val admin = Group.inGroupName "links";
4 val you = Init.getUserId ();
9 val id = Link.addLink (you, $"title", $"url", $"descr") %>
10 <h3><b>Link added</b></h3>
12 <% elseif $"mod" <> "" then
13 val id = Web.stoi ($"mod");
14 val link = Link.lookupLink id;
15 if (iff admin then false else you <> #usr link) then
16 %><h3><b>You can't modify somebody else's link.</b></h3><%
18 showNormal := false %>
20 <h3><b>Modify link</b></h3>
23 <input type="hidden" name="save" value="<% id %>">
25 <tr> <td align="right"><b>Title</b>:</td> <td><input name="title" value="<% Web.html (#title link) %>"></td> </tr>
26 <tr> <td align="right"><b>URL</b>:</td> <td><input name="url" value="<% Web.html (#url link) %>"></td> </tr>
27 <tr> <td align="right"><b>Description</b>:</td> <td><input name="descr" value="<% Web.html (#descr link) %>"></td> </tr>
28 <tr> <td><input type="submit" value="Save"></td> </t>
33 elseif $"save" <> "" then
34 val id = Web.stoi ($"save");
35 val link = Link.lookupLink id;
36 if (iff admin then false else you <> #usr link) then
37 %><h3><b>You can't modify somebody else's link.</b></h3><%
39 Link.modLink {link with title = $"title", url = $"url", descr = $"descr"}
40 %><h3><b>Link modified</b></h3><%
43 elseif $"del" <> "" then
44 val id = Web.stoi ($"del");
45 val link = Link.lookupLink id;
46 if (iff admin then false else you <> #usr link) then
47 %><h3><b>You can't delete somebody else's link.</b></h3><%
49 showNormal := false %>
50 <h3><b>Are you sure you want to delete link to "<% Web.html (#title link) %>"?</b></h3>
51 <a href="link?del2=<% id %>">Yes, delete "<% Web.html (#title link) %>"!</a><%
54 elseif $"del2" <> "" then
55 val id = Web.stoi ($"del2");
56 val link = Link.lookupLink id;
57 if (iff admin then false else you <> #usr link) then
58 %><h3><b>You can't delete somebody else's link.</b></h3><%
61 %><h3><b>Link "<% Web.html (#title link) %>" deleted</b></h3><%
68 <% foreach (name, link) in Link.listLinks () do %>
69 <tr> <td><a href="<% Web.html (#url link) %>"><% Web.html (#title link) %></a></td>
70 <td><% Web.html (#descr link) %></td>
71 <td>(<a href="user?id=<% #usr link %>"><% name %></a>)</td>
72 <% if (iff admin then true else you = #usr link) then %>
73 <td><a href="link?mod=<% #id link %>">[Modify]</a> <a href="link?del=<% #id link %>">[Delete]</a></td>
79 <h3><b>Add a link to a site you host with Hcoop</b></h3>
82 <input type="hidden" name="cmd" value="add">
84 <tr> <td align="right"><b>Title</b>:</td> <td><input name="title"></td> </tr>
85 <tr> <td align="right"><b>URL</b>:</td> <td><input name="url" value="http://"></td> </tr>
86 <tr> <td align="right"><b>Description</b>:</td> <td><input name="descr"></td> </tr>
87 <tr> <td><input type="submit" value="Add"></td> </t>