summaryrefslogtreecommitdiffstats
path: root/provisioning-searchdevices-html.lsp
blob: 4732c5300a9a576e5b36ab7727661758cc2ab1d0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<% local form, viewlibrary, page_info = ... 
htmlviewfunctions = require("htmlviewfunctions")
html = require("acf.html")
%>

<script type="text/javascript">
	if (typeof jQuery == 'undefined') {
		document.write('<script type="text/javascript" src="<%= html.html_escape(page_info.wwwprefix) %>/js/jquery-latest.js"><\/script>');
	}
</script>

<script type="text/javascript">
	$(function(){
		$('input, select').first().focus();
		$('input, select').keydown(function(e){
			if (e.keyCode == 13) {
				$(this).parents('form').find('input.submit').click();
				return false;
			}
		});
	});
</script>

<% htmlviewfunctions.displaycommandresults({"deletedevice", "editdevice", "editdeviceparams", "overridedeviceparams"}, session) %>

<% if form.value.values then %>
<h1>Device</h1>
<% if form.errtxt then io.write("<p class='error'>" .. string.gsub(html.html_escape(form.errtxt), "\n", "<br/>") .. "</p>\n") end %>
	<div class='item'><p class='left'>Device ID</p>
	<div class='right'>
	<input class="text" type="text" value="<%= html.html_escape(form.value.result.value[1].device_id) %>" readonly="true">
	</div></div><!-- end .item -->
<h2>Parameter Values</h2>
<%
	session = require("session")
	val = session.serialize("values", form.value.values.value)
	val = string.gsub(val, "[^\n]*%{%}\n", "")
	print("<pre>"..val.."</pre>")
	form.value.values = nil
elseif form.value.result then
	local func = haserl.loadfile(page_info.viewfile:gsub("searchdevices", "listdevices"))
	func(form.value.result, viewlibrary, page_info, session)
%>
<% end %>

<h1><%= html.html_escape(form.label) %></h1>
<%
	form.value.result = nil
	htmlviewfunctions.displayform(form, nil, nil, page_info, 2)
%>