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
|
<% local form, viewlibrary, page_info, session = ...
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) %>
<%
-- This view is also used for getdevicevalues, and this is where the values are displayed
if form.value.values then
local header_level = htmlviewfunctions.displaysectionstart(cfe({label="Device"}), page_info)
htmlviewfunctions.displayinfo(form)
htmlviewfunctions.displayitem(cfe({label="Device ID", readonly=true, value=form.value.result.value[1].device_id}), page_info)
local header_level2 = htmlviewfunctions.displaysectionstart(cfe({label="Parameter Values"}), page_info, htmlviewfunctions.incrementheader(header_level))
val = require("session").serialize("values", form.value.values.value)
val = string.gsub(val, "[^\n]*%{%}\n", "")
print("<pre>"..val.."</pre>")
htmlviewfunctions.displaysectionend(header_level2)
htmlviewfunctions.displaysectionend(header_level)
form.value.values = nil
-- And here we display the list of devices in the result
elseif form.value.result then
local func = haserl.loadfile(page_info.viewfile:gsub(page_info.action, "listdevices"))
func(form.value.result, viewlibrary, page_info, session)
end
%>
<%
form.value.result = nil
htmlviewfunctions.displayitem(form, page_info)
%>
|