summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTed Trask <ttrask01@yahoo.com>2014-04-23 16:12:07 +0000
committerTed Trask <ttrask01@yahoo.com>2014-04-23 16:12:07 +0000
commitd051bf48fb53481082b12a6778e7c7863f1979ca (patch)
treec36b471fe04729755c3c3bb264f2698a08505384
parent9e6bec69bac4ee45a8355aa5993bbd3f1c71dfcf (diff)
downloadacf-provisioning-d051bf48fb53481082b12a6778e7c7863f1979ca.tar.bz2
acf-provisioning-d051bf48fb53481082b12a6778e7c7863f1979ca.tar.xz
Changes to use new htmlviewfunctions functions
-rw-r--r--provisioning-dumpdatabase-html.lsp6
-rw-r--r--provisioning-editdevice-html.lsp3
-rw-r--r--provisioning-editdeviceparams-html.lsp3
-rw-r--r--provisioning-editparam-html.lsp15
-rw-r--r--provisioning-edittemplate-html.lsp15
-rw-r--r--provisioning-getclassvalues-html.lsp20
-rw-r--r--provisioning-listclasses-html.lsp16
-rw-r--r--provisioning-listclassgroups-html.lsp14
-rw-r--r--provisioning-listdevices-html.lsp20
-rw-r--r--provisioning-listfiles-html.lsp22
-rw-r--r--provisioning-listgroups-html.lsp14
-rw-r--r--provisioning-listparams-html.lsp14
-rw-r--r--provisioning-listrequests-html.lsp14
-rw-r--r--provisioning-listtemplates-html.lsp32
-rw-r--r--provisioning-model.lua18
-rw-r--r--provisioning-searchbyextension-html.lsp19
-rw-r--r--provisioning-searchbymac-html.lsp19
-rw-r--r--provisioning-searchdevices-html.lsp25
18 files changed, 156 insertions, 133 deletions
diff --git a/provisioning-dumpdatabase-html.lsp b/provisioning-dumpdatabase-html.lsp
index cb7b50b..c7ed7d4 100644
--- a/provisioning-dumpdatabase-html.lsp
+++ b/provisioning-dumpdatabase-html.lsp
@@ -4,14 +4,14 @@ html = require("acf.html")
%>
<% if form.value.data then %>
-<h1><%= html.html_escape(form.value.data.label) %></h1>
+<% local header_level = htmlviewfunctions.displaysectionstart(form.value.data, page_info) %>
<textarea name="filecontent">
<%= html.html_escape(form.value.data.value) %>
</textarea>
+<% htmlviewfunctions.displaysectionend(header_level) %>
<% end %>
-<h1><%= html.html_escape(form.label) %></h1>
<%
form.value.data = nil
- htmlviewfunctions.displayform(form, nil, nil, page_info, 2)
+ htmlviewfunctions.displayitem(form, page_info)
%>
diff --git a/provisioning-editdevice-html.lsp b/provisioning-editdevice-html.lsp
index cfb444c..a48c2a9 100644
--- a/provisioning-editdevice-html.lsp
+++ b/provisioning-editdevice-html.lsp
@@ -43,7 +43,6 @@ html = require("acf.html")
<% end %>
<% end %>
-<h1><%= html.html_escape(form.label) %></h1>
<%
if page_info.action == "editdevice" then
form.value.device_id.readonly = "true"
@@ -52,5 +51,5 @@ html = require("acf.html")
else
form.value.device_id.type = "hidden"
end
- htmlviewfunctions.displayform(form, nil, nil, page_info, 2)
+ htmlviewfunctions.displayitem(form, page_info)
%>
diff --git a/provisioning-editdeviceparams-html.lsp b/provisioning-editdeviceparams-html.lsp
index c3e9038..08137c6 100644
--- a/provisioning-editdeviceparams-html.lsp
+++ b/provisioning-editdeviceparams-html.lsp
@@ -51,7 +51,6 @@ end
<% end %>
<% end %>
-<h1><%= html.html_escape(form.label) %></h1>
<%
form.value.device_id.readonly = "true"
if not form.errtxt and form.value.groupdefaultoverride.value then
@@ -64,5 +63,5 @@ end
markoverride(v)
end
- htmlviewfunctions.displayform(form, nil, nil, page_info, 2)
+ htmlviewfunctions.displayitem(form, page_info)
%>
diff --git a/provisioning-editparam-html.lsp b/provisioning-editparam-html.lsp
index e86faa2..b597185 100644
--- a/provisioning-editparam-html.lsp
+++ b/provisioning-editparam-html.lsp
@@ -1,18 +1,9 @@
-<% local form, viewlibrary, page_info = ...
+<% local form, viewlibrary, page_info, session = ...
htmlviewfunctions = require("htmlviewfunctions")
html = require("acf.html")
%>
-<h1><%= html.html_escape(form.label) %></h1>
<%
- htmlviewfunctions.displayform(form, nil, nil, page_info, 2)
+ htmlviewfunctions.displayitem(form, page_info)
+ htmlviewfunctions.displayitem(cfe({type="link", value={userid=userid, redir=redir}, label="Options", option="Edit Options", action="editoptions"}), page_info)
%>
-
-<h2>Options</h2>
-<div class='item'><p class='left'></p>
-<div class='right'>
-<form action="<%= page_info.script .. page_info.prefix .. page_info.controller %>/editoptions" method="post">
-<input type="hidden" name="param_id" value="<%= form.value.param_id.value %>">
-<input type="submit" class="submit" value="Edit Options">
-</form>
-</div></div><!-- end .item -->
diff --git a/provisioning-edittemplate-html.lsp b/provisioning-edittemplate-html.lsp
index 9415968..aee98f1 100644
--- a/provisioning-edittemplate-html.lsp
+++ b/provisioning-edittemplate-html.lsp
@@ -2,10 +2,9 @@
<% htmlviewfunctions = require("htmlviewfunctions") %>
<% html = require("acf.html") %>
-<h1><%= html.html_escape(form.label) %></h1>
-<h2>Template Details</h2>
-<% form.action = page_info.script .. page_info.prefix .. page_info.controller .. "/" .. page_info.action %>
-<% htmlviewfunctions.displayformstart(form) %>
+<% local header_level = htmlviewfunctions.displaysectionstart(form, page_info) %>
+<% htmlviewfunctions.displayformstart(form, page_info) %>
+<% local header_level2 = htmlviewfunctions.displaysectionstart(cfe({label="Template Details"}), page_info, htmlviewfunctions.incrementheader(header_level)) %>
<%
if page_info.action == "edittemplate" then
form.value.filename.readonly = "true"
@@ -14,12 +13,14 @@ htmlviewfunctions.displayformitem(form.value.filename, "filename")
htmlviewfunctions.displayformitem(form.value.label, "label")
htmlviewfunctions.displayformitem(form.value.seq, "seq")
%>
+<% htmlviewfunctions.displaysectionend(header_level2) %>
-<h2>File Content</h2>
+<% htmlviewfunctions.displaysectionstart(cfe({label="File Content"}), page_info, header_level2) %>
<textarea name="filecontent">
<%= html.html_escape(form.value.filecontent.value) %>
</textarea>
-<% if form.value.filecontent.errtxt then %><p class='error'><%= string.gsub(html.html_escape(form.value.filecontent.errtxt), "\n", "<br/>") %></p><% end %>
-<% if form.value.filecontent.descr then %><p class='descr'><%= string.gsub(html.html_escape(form.value.filecontent.descr), "\n", "<br/>") %></p><% end %>
+<% htmlviewfunctions.displayinfo(form.value.filecontent) %>
+<% htmlviewfunctions.displaysectionend(header_level2) %>
<% htmlviewfunctions.displayformend(form) %>
+<% htmlviewfunctions.displaysectionend(header_level) %>
diff --git a/provisioning-getclassvalues-html.lsp b/provisioning-getclassvalues-html.lsp
index 616137e..2d19d7a 100644
--- a/provisioning-getclassvalues-html.lsp
+++ b/provisioning-getclassvalues-html.lsp
@@ -3,24 +3,24 @@ htmlviewfunctions = require("htmlviewfunctions")
html = require("acf.html")
%>
-<% if form.value.values then %>
-<h1>Class</h1>
-<% if form.errtxt then io.write("<p class='error'>" .. string.gsub(html.html_escape(form.errtxt), "\n", "<br/>") .. "</p>\n") end %>
- <% htmlviewfunctions.displayitem(form.value.class_id) %>
- <% htmlviewfunctions.displayitem(form.value.label) %>
-<h2>Parameter Values</h2>
<%
- session = require("session")
- val = session.serialize("values", form.value.values.value)
+if form.value.values then
+ local header_level = htmlviewfunctions.displaysectionstart(cfe({label="Class"}), page_info)
+ htmlviewfunctions.displayinfo(form)
+ htmlviewfunctions.displayitem(form.value.class_id)
+ htmlviewfunctions.displayitem(form.value.label)
+ 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
end
%>
-<h1><%= html.html_escape(form.label) %></h1>
<%
form.value.values = nil
form.value.label = nil
- htmlviewfunctions.displayform(form, nil, nil, page_info, 2)
+ htmlviewfunctions.displayitem(form, page_info)
%>
diff --git a/provisioning-listclasses-html.lsp b/provisioning-listclasses-html.lsp
index 59933d3..4770954 100644
--- a/provisioning-listclasses-html.lsp
+++ b/provisioning-listclasses-html.lsp
@@ -33,7 +33,7 @@ html = require("acf.html")
<% htmlviewfunctions.displaycommandresults({"deleteclass", "editclass"}, session) %>
<% htmlviewfunctions.displaycommandresults({"createclass"}, session, true) %>
-<h1>Classes</h1>
+<% local header_level = htmlviewfunctions.displaysectionstart(view, page_info) %>
<table id="list" class="tablesorter"><thead>
<tr>
<th>Action</th>
@@ -42,17 +42,20 @@ html = require("acf.html")
<th>Sequence</th>
</tr>
</thead><tbody>
+<% local class_id = cfe({ type="hidden", value="" }) %>
+<% local redir = cfe({ type="hidden", value=page_info.orig_action }) %>
<% for k,v in ipairs( view.value ) do %>
<tr>
<td>
- <% if viewlibrary.check_permission("deleteclass") then %>
- <%= html.link{value=page_info.script..page_info.prefix..page_info.controller.."/deleteclass?submit=true&class_id="..v.class_id, label="Delete ", class="deleteclass"} %>
- <% end %>
+ <% class_id.value = v.class_id %>
<% if viewlibrary.check_permission("editclass") then %>
- <%= html.link{value=page_info.script..page_info.prefix..page_info.controller.."/editclass?class_id="..v.class_id.."&redir="..page_info.orig_action, label="Edit "} %>
+ <% htmlviewfunctions.displayitem(cfe({type="link", value={class_id=class_id, redir=redir}, label="", option="Edit", action="editclass"}), page_info, -1) %>
<% end %>
<% if viewlibrary.check_permission("getclassvalues") then %>
- <%= html.link{value=page_info.script..page_info.prefix..page_info.controller.."/getclassvalues?submit=true&class_id="..v.class_id, label="View "} %>
+ <% htmlviewfunctions.displayitem(cfe({type="form", value={class_id=class_id}, label="", option="View", action="getclassvalues"}), page_info, -1) %>
+ <% end %>
+ <% if viewlibrary.check_permission("deleteclass") then %>
+ <% htmlviewfunctions.displayitem(cfe({type="form", value={class_id=class_id}, label="", option="Delete", action="deleteclass", class="deleteclass"}), page_info, -1) %>
<% end %>
</td>
<td><%= html.html_escape(v.group) %></td>
@@ -69,6 +72,7 @@ html = require("acf.html")
<% if #view.value == 0 then %>
<p>No classes found</p>
<% end %>
+<% htmlviewfunctions.displaysectionend(header_level) %>
<% if viewlibrary and viewlibrary.dispatch_component and viewlibrary.check_permission("createclass") then
viewlibrary.dispatch_component("createclass")
diff --git a/provisioning-listclassgroups-html.lsp b/provisioning-listclassgroups-html.lsp
index 8a23ad4..3ba750f 100644
--- a/provisioning-listclassgroups-html.lsp
+++ b/provisioning-listclassgroups-html.lsp
@@ -25,7 +25,7 @@ html = require("acf.html")
<% htmlviewfunctions.displaycommandresults({"deleteclassgroup", "editclassgroup"}, session) %>
<% htmlviewfunctions.displaycommandresults({"createclassgroup"}, session, true) %>
-<h1>Class Groups</h1>
+<% local header_level = htmlviewfunctions.displaysectionstart(view, page_info) %>
<table id="list" class="tablesorter"><thead>
<tr>
<th>Action</th>
@@ -34,14 +34,17 @@ html = require("acf.html")
<th>Sequence</th>
</tr>
</thead><tbody>
+<% local class_group_id = cfe({ type="hidden", value="" }) %>
+<% local redir = cfe({ type="hidden", value=page_info.orig_action }) %>
<% for k,v in ipairs( view.value ) do %>
<tr>
<td>
- <% if viewlibrary.check_permission("deleteclassgroup") then %>
- <%= html.link{value=page_info.script..page_info.prefix..page_info.controller.."/deleteclassgroup?submit=true&class_group_id="..v.class_group_id, label="Delete ", class="deletegroup"} %>
- <% end %>
+ <% class_group_id.value = v.class_group_id %>
<% if viewlibrary.check_permission("editclassgroup") then %>
- <%= html.link{value=page_info.script..page_info.prefix..page_info.controller.."/editclassgroup?class_group_id="..v.class_group_id.."&redir="..page_info.orig_action, label="Edit "} %>
+ <% htmlviewfunctions.displayitem(cfe({type="link", value={class_group_id=class_group_id, redir=redir}, label="", option="Edit", action="editclassgroup"}), page_info, -1) %>
+ <% end %>
+ <% if viewlibrary.check_permission("deleteclassgroup") then %>
+ <% htmlviewfunctions.displayitem(cfe({type="form", value={class_group_id=class_group_id}, label="", option="Delete", action="deleteclassgroup", class="deletegroup"}), page_info, -1) %>
<% end %>
</td>
<td><%= html.html_escape(v.name) %></td>
@@ -58,6 +61,7 @@ html = require("acf.html")
<% if #view.value == 0 then %>
<p>No class groups found</p>
<% end %>
+<% htmlviewfunctions.displaysectionend(header_level) %>
<% if viewlibrary and viewlibrary.dispatch_component and viewlibrary.check_permission("createclassgroup") then
viewlibrary.dispatch_component("createclassgroup")
diff --git a/provisioning-listdevices-html.lsp b/provisioning-listdevices-html.lsp
index 84206aa..c511d1e 100644
--- a/provisioning-listdevices-html.lsp
+++ b/provisioning-listdevices-html.lsp
@@ -52,7 +52,7 @@ end
table.sort(display)
%>
-<h1>Devices</h1>
+<% local header_level = htmlviewfunctions.displaysectionstart(view, page_info) %>
<table id="list" class="tablesorter"><thead>
<tr>
<th>Action</th>
@@ -62,22 +62,25 @@ table.sort(display)
<% end %>
</tr>
</thead><tbody>
+<% local device_id = cfe({ type="hidden", value="" }) %>
+<% local redir = cfe({ type="hidden", value=page_info.orig_action }) %>
<% for k,v in ipairs( view.value ) do %>
<tr>
<td>
- <% if viewlibrary.check_permission("deletedevice") then %>
- <%= html.link{value=page_info.script..page_info.prefix..page_info.controller.."/deletedevice?submit=true&device_id="..v.device_id, label="Delete ", class="deletedevice"} %>
- <% end %>
+ <% device_id.value = v.device_id %>
<% if viewlibrary.check_permission("editdevice") then %>
- <%= html.link{value=page_info.script..page_info.prefix..page_info.controller.."/editdevice?device_id="..v.device_id.."&redir="..page_info.orig_action, label="Edit "} %>
+ <% htmlviewfunctions.displayitem(cfe({type="link", value={device_id=device_id, redir=redir}, label="", option="Edit", action="editdevice"}), page_info, -1) %>
<% end %>
<% if viewlibrary.check_permission("overridedeviceparams") then %>
- <%= html.link{value=page_info.script..page_info.prefix..page_info.controller.."/overridedeviceparams?device_id="..v.device_id.."&redir="..page_info.orig_action, label="Params "} %>
+ <% htmlviewfunctions.displayitem(cfe({type="link", value={device_id=device_id, redir=redir}, label="", option="Params", action="overridedeviceparams"}), page_info, -1) %>
<% elseif viewlibrary.check_permission("editdeviceparams") then %>
- <%= html.link{value=page_info.script..page_info.prefix..page_info.controller.."/editdeviceparams?device_id="..v.device_id.."&redir="..page_info.orig_action, label="Params "} %>
+ <% htmlviewfunctions.displayitem(cfe({type="link", value={device_id=device_id, redir=redir}, label="", option="Params", action="editdeviceparams"}), page_info, -1) %>
<% end %>
<% if viewlibrary.check_permission("getdevicevalues") then %>
- <%= html.link{value=page_info.script..page_info.prefix..page_info.controller.."/getdevicevalues?submit=true&id=device_id&value="..v.device_id.."&viewtype=templated", label="View "} %>
+ <% htmlviewfunctions.displayitem(cfe({type="form", value={value=device_id, id=cfe({type="hidden", value="device_id"}), viewtype=cfe({type="hidden", value="templated"})}, label="", option="View", action="getdevicevalues"}), page_info, -1) %>
+ <% end %>
+ <% if viewlibrary.check_permission("deletedevice") then %>
+ <% htmlviewfunctions.displayitem(cfe({type="form", value={device_id=device_id}, label="", option="Delete", action="deletedevice", class="deletedevice"}), page_info, -1) %>
<% end %>
</td>
<td><%= html.html_escape(v.device_id) %></td>
@@ -95,6 +98,7 @@ table.sort(display)
<% if #view.value == 0 then %>
<p>No devices found</p>
<% end %>
+<% htmlviewfunctions.displaysectionend(header_level) %>
<% if page_info.action == "listdevices" and viewlibrary and viewlibrary.dispatch_component and viewlibrary.check_permission("createdevice") then
viewlibrary.dispatch_component("createdevice")
diff --git a/provisioning-listfiles-html.lsp b/provisioning-listfiles-html.lsp
index b1c0e5e..8269e65 100644
--- a/provisioning-listfiles-html.lsp
+++ b/provisioning-listfiles-html.lsp
@@ -31,23 +31,31 @@ end
<script type="text/javascript">
$(document).ready(function() {
- $("#list").tablesorter({widgets: ['zebra']});
+ $("#list").tablesorter({headers: {0:{sorter: false}}, widgets: ['zebra']});
});
</script>
<% htmlviewfunctions.displaycommandresults({"editfile"}, session) %>
-<h1>Provisioning Script Files</h1>
+<% local header_level = htmlviewfunctions.displaysectionstart(view, page_info) %>
<table id="list" class="tablesorter"><thead>
<tr>
+ <th>Action</th>
<th>File</th>
<th>Size</th>
<th>Last Modified</th>
</tr>
</thead><tbody>
-<%
- for k,v in ipairs( view.value ) do
- io.write( "<tr><td><a href=\"" .. html.html_escape(page_info.script .. page_info.prefix .. page_info.controller) .. "/editfile?filename=" .. html.html_escape(v.filename) .. "&redir=" .. html.html_escape(page_info.orig_action) .. "\">" .. html.html_escape(v.filename) .. '</a></td><td><span style="display:none">'..convertsize(v.size).."b</span>" .. html.html_escape(v.size) .."</td><td>" .. html.html_escape(v.mtime) .."</td></tr>\n" )
- end
-%>
+<% local filename = cfe({ type="hidden", value="" }) %>
+<% local redir = cfe({ type="hidden", value=page_info.orig_action }) %>
+<% for i,file in ipairs( view.value ) do %>
+ <% filename.value = file.filename %>
+ <tr>
+ <td><% htmlviewfunctions.displayitem(cfe({type="link", value={filename=filename, redir=redir}, label="", option="Edit", action="editfile"}), page_info, -1) %></td>
+ <td><%= html.html_escape(file.filename) %></td>
+ <td><span class="hide"><%= convertsize(file.size) %>b</span><%= html.html_escape(file.size) %></td>
+ <td><%= html.html_escape(file.mtime) %></td>
+ </tr>
+<% end %>
</tbody></table>
+<% htmlviewfunctions.displaysectionend(header_level) %>
diff --git a/provisioning-listgroups-html.lsp b/provisioning-listgroups-html.lsp
index 9d8268b..b6435af 100644
--- a/provisioning-listgroups-html.lsp
+++ b/provisioning-listgroups-html.lsp
@@ -25,7 +25,7 @@ html = require("acf.html")
<% htmlviewfunctions.displaycommandresults({"deletegroup", "editgroup"}, session) %>
<% htmlviewfunctions.displaycommandresults({"creategroup"}, session, true) %>
-<h1>Groups</h1>
+<% local header_level = htmlviewfunctions.displaysectionstart(view, page_info) %>
<table id="list" class="tablesorter"><thead>
<tr>
<th>Action</th>
@@ -34,14 +34,17 @@ html = require("acf.html")
<th>Sequence</th>
</tr>
</thead><tbody>
+<% local group_id = cfe({ type="hidden", value="" }) %>
+<% local redir = cfe({ type="hidden", value=page_info.orig_action }) %>
<% for k,v in ipairs( view.value ) do %>
<tr>
<td>
- <% if viewlibrary.check_permission("deletegroup") then %>
- <%= html.link{value=page_info.script..page_info.prefix..page_info.controller.."/deletegroup?submit=true&group_id="..v.group_id, label="Delete ", class="deletegroup"} %>
- <% end %>
+ <% group_id.value = v.group_id %>
<% if viewlibrary.check_permission("editgroup") then %>
- <%= html.link{value=page_info.script..page_info.prefix..page_info.controller.."/editgroup?group_id="..v.group_id.."&redir="..page_info.orig_action, label="Edit "} %>
+ <% htmlviewfunctions.displayitem(cfe({type="link", value={group_id=group_id, redir=redir}, label="", option="Edit", action="editgroup"}), page_info, -1) %>
+ <% end %>
+ <% if viewlibrary.check_permission("deletegroup") then %>
+ <% htmlviewfunctions.displayitem(cfe({type="form", value={group_id=group_id}, label="", option="Delete", action="deletegroup", class="deletegroup"}), page_info, -1) %>
<% end %>
</td>
<td><%= html.html_escape(v.name) %></td>
@@ -58,6 +61,7 @@ html = require("acf.html")
<% if #view.value == 0 then %>
<p>No groups found</p>
<% end %>
+<% htmlviewfunctions.displaysectionend(header_level) %>
<% if viewlibrary and viewlibrary.dispatch_component and viewlibrary.check_permission("creategroup") then
viewlibrary.dispatch_component("creategroup")
diff --git a/provisioning-listparams-html.lsp b/provisioning-listparams-html.lsp
index 3b0e255..177b30c 100644
--- a/provisioning-listparams-html.lsp
+++ b/provisioning-listparams-html.lsp
@@ -25,7 +25,7 @@ html = require("acf.html")
<% htmlviewfunctions.displaycommandresults({"deleteparam", "editparam"}, session) %>
<% htmlviewfunctions.displaycommandresults({"createparam"}, session, true) %>
-<h1>Parameters</h1>
+<% local header_level = htmlviewfunctions.displaysectionstart(view, page_info) %>
<table id="list" class="tablesorter"><thead>
<tr>
<th>Action</th>
@@ -35,14 +35,17 @@ html = require("acf.html")
<th>Sequence</th>
</tr>
</thead><tbody>
+<% local param_id = cfe({ type="hidden", value="" }) %>
+<% local redir = cfe({ type="hidden", value=page_info.orig_action }) %>
<% for k,v in ipairs( view.value ) do %>
<tr>
<td>
- <% if viewlibrary.check_permission("deleteparam") then %>
- <%= html.link{value=page_info.script..page_info.prefix..page_info.controller.."/deleteparam?submit=true&param_id="..v.param_id, label="Delete ", class="deleteparam"} %>
- <% end %>
+ <% param_id.value = v.param_id %>
<% if viewlibrary.check_permission("editparam") then %>
- <%= html.link{value=page_info.script..page_info.prefix..page_info.controller.."/editparam?param_id="..v.param_id.."&redir="..page_info.orig_action, label="Edit "} %>
+ <% htmlviewfunctions.displayitem(cfe({type="link", value={param_id=param_id, redir=redir}, label="", option="Edit", action="editparam"}), page_info, -1) %>
+ <% end %>
+ <% if viewlibrary.check_permission("deleteparam") then %>
+ <% htmlviewfunctions.displayitem(cfe({type="form", value={param_id=param_id}, label="", option="Delete", action="deleteparam", class="deleteparam"}), page_info, -1) %>
<% end %>
</td>
<td><%= html.html_escape(v.name) %></td>
@@ -60,6 +63,7 @@ html = require("acf.html")
<% if #view.value == 0 then %>
<p>No parameters found</p>
<% end %>
+<% htmlviewfunctions.displaysectionend(header_level) %>
<% if viewlibrary and viewlibrary.dispatch_component and viewlibrary.check_permission("createparam") then
viewlibrary.dispatch_component("createparam")
diff --git a/provisioning-listrequests-html.lsp b/provisioning-listrequests-html.lsp
index a53e24f..2bb9338 100644
--- a/provisioning-listrequests-html.lsp
+++ b/provisioning-listrequests-html.lsp
@@ -48,7 +48,7 @@ html = require("acf.html")
<% htmlviewfunctions.displaycommandresults({"deleterequest", "editdevice"}, session) %>
-<h1>Requests</h1>
+<% local header_level = htmlviewfunctions.displaysectionstart(cfe({label="Requests"}), page_info) %>
<table id="list" class="tablesorter"><thead>
<tr>
<th>Action</th>
@@ -58,24 +58,27 @@ html = require("acf.html")
<th>User Agent</th>
</tr>
</thead><tbody>
+<% local mac = cfe({ type="hidden", value="" }) %>
+<% local redir = cfe({ type="hidden", value="searchdevices" }) %>
<% for k,v in ipairs( view.value ) do %>
<tr>
<td>
+ <% mac.value = v.mac %>
<% if viewlibrary.check_permission("deleterequest") then %>
- <%= html.link{value=page_info.script..page_info.prefix..page_info.controller.."/deleterequest?submit=true&mac="..v.mac, label="Delete ", class="deleterequest"} %>
+ <% htmlviewfunctions.displayitem(cfe({type="form", value={mac=mac}, label="", option="Delete", action="deleterequest", class="deleterequest" }), page_info, -1) %>
<% end %>
<% if v.device_id then %>
<% if viewlibrary.check_permission("searchdevices") then %>
- <%= html.link{value=page_info.script..page_info.prefix..page_info.controller.."/searchdevices?submit=true&id=device_id&value="..v.device_id.."&redir=searchdevices", label="Search "} %>
+ <% htmlviewfunctions.displayitem(cfe({type="form", value={id=cfe({type="hidden", value="device_id"}), value=cfe({type="hidden", value=v.device_id}), redir=redir}, label="", option="Search", action="searchdevices" }), page_info, -1) %>
<% end %>
<% else %>
<% if viewlibrary.check_permission("createdevicefromrequest") then %>
- <%= html.link{value=page_info.script..page_info.prefix..page_info.controller.."/createdevicefromrequest?submit=true&mac="..v.mac, label="Create "} %>
+ <% htmlviewfunctions.displayitem(cfe({type="form", value={mac=mac}, label="", option="Create", action="createdevicefromrequest" }), page_info, -1) %>
<% end %>
<% end %>
</td>
<td>
- <span style="display:none">
+ <span class="hide">
<% local date = {}
date.year, date.month, date.day, date.hour, date.min, date.sec, remainder = string.match(v.date, "(%d+)%-(%d+)%-(%d+) (%d+):(%d+):(%d+)")
local rem = string.match(v.date, "%.%d+$")
@@ -90,3 +93,4 @@ html = require("acf.html")
<% end %>
</tbody>
</table>
+<% htmlviewfunctions.displaysectionend(header_level) %>
diff --git a/provisioning-listtemplates-html.lsp b/provisioning-listtemplates-html.lsp
index ee67b17..a649bec 100644
--- a/provisioning-listtemplates-html.lsp
+++ b/provisioning-listtemplates-html.lsp
@@ -3,6 +3,20 @@ htmlviewfunctions = require("htmlviewfunctions")
html = require("acf.html")
%>
+<%
+function convertsize(size)
+ if string.find(size, "k$") then
+ return tonumber(string.match(size, "[%d.]*")) * 1024.0
+ elseif string.find(size, "M$") then
+ return tonumber(string.match(size, "[%d.]*")) * 1024.0 * 1024.0
+ elseif string.find(size, "G$") then
+ return tonumber(string.match(size, "[%d.]*")) + 1024.0 * 1024.0 * 1024.0
+ else
+ return tonumber(string.match(size, "[%d.]*"))
+ end
+end
+%>
+
<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>');
@@ -25,7 +39,7 @@ html = require("acf.html")
<% htmlviewfunctions.displaycommandresults({"deletetemplate", "edittemplate"}, session) %>
<% htmlviewfunctions.displaycommandresults({"createtemplate"}, session, true) %>
-<h1>Templates</h1>
+<% local header_level = htmlviewfunctions.displaysectionstart(view, page_info) %>
<table id="list" class="tablesorter"><thead>
<tr>
<th>Action</th>
@@ -36,23 +50,26 @@ html = require("acf.html")
<th>Last Modified</th>
</tr>
</thead><tbody>
+<% local filename = cfe({ type="hidden", value="" }) %>
+<% local redir = cfe({ type="hidden", value=page_info.orig_action }) %>
<% for k,v in ipairs( view.value ) do %>
<tr>
<td>
- <% if viewlibrary.check_permission("deletetemplate") and v.label then %>
- <%= html.link{value=page_info.script..page_info.prefix..page_info.controller.."/deletetemplate?submit=true&filename="..v.filename, label="Delete ", class="deletetemplate"} %>
- <% end %>
+ <% filename.value = v.filename %>
<% if viewlibrary.check_permission("edittemplate") and v.label then %>
- <%= html.link{value=page_info.script..page_info.prefix..page_info.controller.."/edittemplate?filename="..v.filename.."&redir="..page_info.orig_action, label="Edit "} %>
+ <% htmlviewfunctions.displayitem(cfe({type="link", value={filename=filename, redir=redir}, label="", option="Edit", action="edittemplate"}), page_info, -1) %>
+ <% end %>
+ <% if viewlibrary.check_permission("deletetemplate") and v.label then %>
+ <% htmlviewfunctions.displayitem(cfe({type="form", value={filename=filename}, label="", option="Delete", action="deletetemplate", class="deletetemplate"}), page_info, -1) %>
<% end %>
<% if viewlibrary.check_permission("createtemplate") and not v.label then %>
- <%= html.link{value=page_info.script..page_info.prefix..page_info.controller.."/createtemplate?filename="..v.filename.."&redir="..page_info.orig_action, label="Create "} %>
+ <% htmlviewfunctions.displayitem(cfe({type="link", value={filename=filename, redir=redir}, label="", option="Create", action="createtemplate"}), page_info, -1) %>
<% end %>
</td>
<td><%= html.html_escape(v.filename) %></td>
<td><%= html.html_escape(v.label) %></td>
<td><%= html.html_escape(v.seq) %></td>
- <td><%= html.html_escape(v.filesize) %></td>
+ <td><span class="hide"><%= convertsize(v.filesize) %>b</span><%= html.html_escape(v.filesize) %></td>
<td><%= html.html_escape(v.mtime) %></td>
</tr>
<% end %>
@@ -65,6 +82,7 @@ html = require("acf.html")
<% if #view.value == 0 then %>
<p>No templates found</p>
<% end %>
+<% htmlviewfunctions.displaysectionend(header_level) %>
<% if viewlibrary and viewlibrary.dispatch_component and viewlibrary.check_permission("createtemplate") then
viewlibrary.dispatch_component("createtemplate")
diff --git a/provisioning-model.lua b/provisioning-model.lua
index 0408dc9..ee13fb8 100644
--- a/provisioning-model.lua
+++ b/provisioning-model.lua
@@ -524,7 +524,7 @@ mymodule.list_templates = function()
end
end
- return cfe({ type="structure", value=retval, label="List of Templates", errtxt=errtxt })
+ return cfe({ type="structure", value=retval, label="Templates", errtxt=errtxt })
end
mymodule.get_template = function(self, clientdata)
@@ -675,7 +675,7 @@ mymodule.list_class_groups = function()
errtxt = err
end
- return cfe({ type="structure", value=retval, label="List of Class Groups", errtxt=errtxt })
+ return cfe({ type="structure", value=retval, label="Class Groups", errtxt=errtxt })
end
mymodule.get_class_group = function(self, clientdata)
@@ -828,7 +828,7 @@ mymodule.list_classes = function()
errtxt = err
end
- return cfe({ type="structure", value=retval, label="List of Classes", errtxt=errtxt })
+ return cfe({ type="structure", value=retval, label="Classes", errtxt=errtxt })
end
mymodule.get_class = function(self, clientdata)
@@ -1021,7 +1021,7 @@ mymodule.list_groups = function()
errtxt = err
end
- return cfe({ type="structure", value=retval, label="List of Parameter Groups", errtxt=errtxt })
+ return cfe({ type="structure", value=retval, label="Parameter Groups", errtxt=errtxt })
end
mymodule.get_group = function(self, clientdata)
@@ -1263,7 +1263,7 @@ mymodule.list_params = function()
errtxt = err
end
- return cfe({ type="structure", value=retval, label="List of Parameters", errtxt=errtxt })
+ return cfe({ type="structure", value=retval, label="Parameters", errtxt=errtxt })
end
mymodule.get_param = function(self, clientdata)
@@ -1460,7 +1460,7 @@ mymodule.list_devices = function()
errtxt = err
end
- return cfe({ type="structure", value=retval, label="List of Devices", errtxt=errtxt })
+ return cfe({ type="structure", value=retval, label="Devices", errtxt=errtxt })
end
mymodule.get_existing_device = function(self, clientdata)
@@ -1732,7 +1732,7 @@ mymodule.search_device_values = function(self, search)
end
end
if success then
- retval.result = cfe({type="structure", value={}, label="List of Devices", seq=4 })
+ retval.result = cfe({type="structure", value={}, label="Devices", seq=4 })
local res, err = pcall(function()
local connected = databaseconnect()
-- Get the devices from the DB
@@ -1867,7 +1867,7 @@ function mymodule.list_files()
table.insert(retval, details)
end
table.sort(retval, function(a,b) return a.filename < b.filename end)
- return cfe({ type="structure", value=retval, label="List of Provisioning Script files" })
+ return cfe({ type="structure", value=retval, label="Provisioning Script Files" })
end
function mymodule.get_database()
@@ -2059,7 +2059,7 @@ mymodule.list_requests = function()
errtxt = err
end
- return cfe({ type="structure", value=retval, label="List of Requests", errtxt=errtxt })
+ return cfe({ type="structure", value=retval, label="Requests", errtxt=errtxt })
end
mymodule.get_delete_request = function(self, clientdata)
diff --git a/provisioning-searchbyextension-html.lsp b/provisioning-searchbyextension-html.lsp
index d8dda52..2365df6 100644
--- a/provisioning-searchbyextension-html.lsp
+++ b/provisioning-searchbyextension-html.lsp
@@ -36,16 +36,9 @@ if session.searchdevicesresult then
end
%>
-<h1>Search by Extension</h1>
-<form action="/cgi-bin/acf/provisioning/provisioning/searchdevices" method="post">
-<input type="hidden" name="id" value=".extension">
-<input type="hidden" name="comparison" value="~">
-<div class='item'><p class='left'>Extension</p>
-<div class='right'>
-<input class="text" type="text" name="value" value="" >
-</div></div><!-- end .item -->
-<div class='item'><p class='left'></p>
-<div class='right'>
-<input class="submit" type="submit" name="submit" value="Search">
-</div></div><!-- end .item -->
-</form>
+<%
+local id = cfe({type="hidden", value=".extension"})
+local comparison = cfe({type="hidden", value="~"})
+local value = cfe({label="Extension"})
+htmlviewfunctions.displayitem(cfe({type="form", label="Search by Extension", value={id=id, comparison=comparison, value=value}, action="searchdevices", option="Search"}), page_info)
+%>
diff --git a/provisioning-searchbymac-html.lsp b/provisioning-searchbymac-html.lsp
index ce50f47..c0c6dc4 100644
--- a/provisioning-searchbymac-html.lsp
+++ b/provisioning-searchbymac-html.lsp
@@ -35,16 +35,9 @@ if session.searchdevicesresult then
end
%>
-<H1>Search by MAC Address</H1>
-<form action="/cgi-bin/acf/provisioning/provisioning/searchdevices" method="post">
-<input type="hidden" name="id" value="device.mac">
-<input type="hidden" name="comparison" value="~">
-<div class='item'><p class='left'>MAC Address</p>
-<div class='right'>
-<input class="text" type="text" name="value" value="" >
-</div></div><!-- end .item -->
-<div class='item'><p class='left'></p>
-<div class='right'>
-<input class="submit" type="submit" name="submit" value="Search">
-</div></div><!-- end .item -->
-</form>
+<%
+local id = cfe({type="hidden", value="device.mac"})
+local comparison = cfe({type="hidden", value="~"})
+local value = cfe({label="MAC Address"})
+htmlviewfunctions.displayitem(cfe({type="form", label="Search by MAC Address", value={id=id, comparison=comparison, value=value}, action="searchdevices", option="Search"}), page_info)
+%>
diff --git a/provisioning-searchdevices-html.lsp b/provisioning-searchdevices-html.lsp
index 4732c53..3cecce2 100644
--- a/provisioning-searchdevices-html.lsp
+++ b/provisioning-searchdevices-html.lsp
@@ -1,4 +1,4 @@
-<% local form, viewlibrary, page_info = ...
+<% local form, viewlibrary, page_info, session = ...
htmlviewfunctions = require("htmlviewfunctions")
html = require("acf.html")
%>
@@ -23,28 +23,25 @@ html = require("acf.html")
<% 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)
+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
elseif form.value.result then
local func = haserl.loadfile(page_info.viewfile:gsub("searchdevices", "listdevices"))
func(form.value.result, viewlibrary, page_info, session)
+end
%>
-<% end %>
-<h1><%= html.html_escape(form.label) %></h1>
<%
form.value.result = nil
- htmlviewfunctions.displayform(form, nil, nil, page_info, 2)
+ htmlviewfunctions.displayitem(form, page_info)
%>