Mercurial Hosting > disearch
comparison src/add_server.html.luan @ 12:3e2cb946d511
form handling
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Mon, 30 Oct 2023 14:59:45 -0600 |
parents | 62dd23f0b549 |
children | 80105b716a62 |
comparison
equal
deleted
inserted
replaced
11:62dd23f0b549 | 12:3e2cb946d511 |
---|---|
12 | 12 |
13 return function() | 13 return function() |
14 local parameters = Http.request.parameters | 14 local parameters = Http.request.parameters |
15 local id = parameters.id or error() | 15 local id = parameters.id or error() |
16 local name = parameters.name or error() | 16 local name = parameters.name or error() |
17 local icon = parameters.icon | 17 name = html_encode(name) |
18 local icon = parameters.icon or error() | |
18 Io.stdout = Http.response.text_writer() | 19 Io.stdout = Http.response.text_writer() |
19 %> | 20 %> |
20 <!doctype html> | 21 <!doctype html> |
21 <html> | 22 <html> |
22 <head> | 23 <head> |
23 <% head() %> | 24 <% head() %> |
24 <title>Disearch</title> | 25 <title>Disearch</title> |
26 <style> | |
27 input[type="url"] { | |
28 width: 100%; | |
29 } | |
30 </style> | |
25 </head> | 31 </head> |
26 <body> | 32 <body> |
27 <% header() %> | 33 <% header() %> |
28 | 34 |
29 <h1>Add server</h1> | 35 <h1>Add server</h1> |
30 | 36 |
31 <p><%=html_encode(name)%></p> | 37 <form page onsubmit="ajaxForm('/add_server.js',this); return false"> |
32 <% if icon ~= nil then %> | 38 <input type=hidden name=id value="<%=id%>"> |
33 <p><img src="https://cdn.discordapp.com/icons/<%=id%>/<%=icon%>.png"></p> | 39 <input type=hidden name=name value="<%=name%>"> |
34 <% end %> | 40 <input type=hidden name=icon value="<%=icon%>"> |
41 <p><%=name%></p> | |
42 <p><img icon src="https://cdn.discordapp.com/icons/<%=id%>/<%=icon%>.png"></p> | |
43 <p> | |
44 Invite URL:<br> | |
45 <input type=url required name=invite> | |
46 <span error=invite></span> | |
47 </p> | |
48 <p><input type=submit></p> | |
49 </form> | |
35 | 50 |
36 <% footer() %> | 51 <% footer() %> |
37 </body> | 52 </body> |
38 </html> | 53 </html> |
39 <% | 54 <% |