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") %>
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>You can't modify somebody else's link.</h3><%
18 showNormal := false %>
22 <form action="link" method="post">
23 <input type="hidden" name="save" value="<% id %>">
24 <table class="blanks">
25 <tr> <td>Title:</td> <td><input name="title" value="<% Web.html (#title link) %>" required="required"></td> </tr>
26 <tr> <td>URL:</td> <td><input name="url" value="<% Web.html (#url link) %>" type="url" required="required"></td> </tr>
27 <tr> <td>Description:</td> <td><input name="descr" value="<% Web.html (#descr link) %>" required="required"></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>You can't modify somebody else's link.</h3><%
39 Link.modLink {link with title = $"title", url = $"url", descr = $"descr"}
40 %><h3>Link modified</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>You can't delete somebody else's link.</h3><%
49 showNormal := false %>
50 <h3>Are you sure you want to delete link to "<% Web.html (#title link) %>"?</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>You can't delete somebody else's link.</h3><%
61 %><h3>Link "<% Web.html (#title link) %>" deleted</h3><%
67 <h3>Add a link to a site you host with Hcoop</h3>
69 <form action="link" method="post">
70 <input type="hidden" name="cmd" value="add">
71 <table class="blanks">
72 <tr> <td>Title:</td> <td><input name="title" required="required"></td> </tr>
73 <tr> <td>URL:</td> <td><input name="url" value="http://" type="url" required="required"></td> </tr>
74 <tr> <td>Description:</td> <td><input name="descr" required="required"></td> </tr>
75 <tr> <td><input type="submit" value="Add"></td> </t>
80 <% foreach (name, link) in Link.listLinks () do %>
81 <tr> <td><a href="<% Web.html (#url link) %>"><% Web.html (#title link) %></a></td>
82 <td><% Web.html (#descr link) %></td>
83 <td>(<a href="user?id=<% #usr link %>"><% name %></a>)</td>
84 <% if (iff admin then true else you = #usr link) then %>
85 <td><a href="link?mod=<% #id link %>">[Modify]</a> <a href="link?del=<% #id link %>">[Delete]</a></td>