summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTed Trask <ttrask01@yahoo.com>2014-04-10 06:02:36 +0000
committerTed Trask <ttrask01@yahoo.com>2014-04-10 06:02:36 +0000
commit3d6451d0b5fed1f8fbe5c431d1cfb7f002514373 (patch)
tree392ad63e25c36942a4d3bb0fe9d899170d4ebcca
parent5c241915dc49b7ecee0fd3f09d34dd2b0766904b (diff)
downloadacf-dhcp-3d6451d0b5fed1f8fbe5c431d1cfb7f002514373.tar.bz2
acf-dhcp-3d6451d0b5fed1f8fbe5c431d1cfb7f002514373.tar.xz
Changes to use new htmlviewfunctions functions
-rw-r--r--dhcp-home-html.lsp13
-rw-r--r--dhcp-listfiles-html.lsp17
-rw-r--r--dhcp-listhosts-html.lsp21
-rw-r--r--dhcp-listsubnets-html.lsp23
-rw-r--r--dhcp-model.lua4
5 files changed, 41 insertions, 37 deletions
diff --git a/dhcp-home-html.lsp b/dhcp-home-html.lsp
index 39be215..769c40e 100644
--- a/dhcp-home-html.lsp
+++ b/dhcp-home-html.lsp
@@ -8,14 +8,11 @@
viewlibrary.dispatch_component("status")
end %>
-<h1>Global Settings</h1>
-<div class='item'><p class='left'>Edit global settings</p>
-<div class='right'>
-<form action="<%= html.html_escape(page_info.script .. page_info.prefix .. page_info.controller .. "/settings") %>" method="post">
-<input class="hidden" type="hidden" name="redir" value="<%= html.html_escape(page_info.orig_action) %>" >
-<input type=submit value="Edit" class="submit">
-</form>
-</div></div><!-- end .item -->
+<%
+local header_level = htmlviewfunctions.displaysectionstart(cfe({label="Global Settings"}), page_info)
+htmlviewfunctions.displayitem(cfe({type="link", value={redir=cfe({ type="hidden", value=page_info.orig_action })}, label="Edit global settings", option="Edit", action="settings"}), page_info, 0)
+htmlviewfunctions.displaysectionend(header_level)
+%>
<% if viewlibrary and viewlibrary.dispatch_component then
viewlibrary.dispatch_component("listsubnets")
diff --git a/dhcp-listfiles-html.lsp b/dhcp-listfiles-html.lsp
index 3e1bb65..f39e60e 100644
--- a/dhcp-listfiles-html.lsp
+++ b/dhcp-listfiles-html.lsp
@@ -31,7 +31,7 @@ end
<script type="text/javascript">
$(document).ready(function() {
- $("#list").tablesorter({widgets: ['zebra']});
+ $("#list").tablesorter({headers: {0:{sorter: false}}, widgets: ['zebra']});
});
</script>
@@ -41,21 +41,26 @@ end
viewlibrary.dispatch_component("status")
end %>
-<h1><%= html.html_escape(data.label) %></h1>
+<% local header_level = htmlviewfunctions.displaysectionstart(data, 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 i,file in ipairs(data.value) do %>
+<% local filename = cfe({ type="hidden", value="" }) %>
+<% local redir = cfe({ type="hidden", value=page_info.orig_action }) %>
+<% for i,file in ipairs( data.value ) do %>
+ <% filename.value = file.filename %>
<tr>
- <td>
- <%= html.link{value = "expert?filename=" .. file.filename.."&redir="..page_info.orig_action, label=file.filename} %>
- </td>
+ <td><% htmlviewfunctions.displayitem(cfe({type="link", value={filename=filename, redir=redir}, label="", option="Edit", action="expert"}), page_info, -1) %></td>
+ <td><%= html.html_escape(file.filename) %></td>
<td><span style="display:none"><%= convertsize(file.filesize) %>b</span><%= html.html_escape(file.filesize) %></td>
<td><%= html.html_escape(file.mtime) %></td>
</tr>
<% end %>
</tbody></table>
+<% htmlviewfunctions.displaysectionend(header_level) %>
+
diff --git a/dhcp-listhosts-html.lsp b/dhcp-listhosts-html.lsp
index 871f92e..2959db6 100644
--- a/dhcp-listhosts-html.lsp
+++ b/dhcp-listhosts-html.lsp
@@ -22,28 +22,29 @@
<% htmlviewfunctions.displaycommandresults({"edithost", "delhost", "createhost"}, session) %>
-<h1>Host Declarations</h1>
+<% local header_level = htmlviewfunctions.displaysectionstart(view, page_info) %>
<table id="listhosts" class="tablesorter"><thead>
<tr>
<th>Action</th>
<th>Host</th>
</tr>
</thead><tbody>
+<% local hst = cfe({ type="hidden", value="" }) %>
+<% local redir = cfe({ type="hidden", value=page_info.orig_action }) %>
<% for i,host in ipairs(view.value) do %>
<tr>
<td>
- <%= html.link{value=page_info.script..page_info.prefix..page_info.controller.."/edithost?host="..host.."&redir="..page_info.orig_action, label="Edit "} %>
- <%= html.link{value=page_info.script..page_info.prefix..page_info.controller.."/delhost?submit=true&host="..host, label="Delete "} %>
+ <%
+ hst.value = host
+ htmlviewfunctions.displayitem(cfe({type="link", value={host=hst, redir=redir}, label="", option="Edit", action="edithost"}), page_info, -1)
+ htmlviewfunctions.displayitem(cfe({type="form", value={host=hst}, label="", option="Delete", action="delhost" }), page_info, -1)
+ %>
</td>
<td><%= html.html_escape(host) %></td>
</tr>
<% end %>
</tbody></table>
-<div class='item'><p class='left'>Add new host</p>
-<div class='right'>
-<form action="<%= html.html_escape(page_info.script .. page_info.prefix .. page_info.controller .. "/createhost") %>" method="post">
-<input class="hidden" type="hidden" name="redir" value="<%= html.html_escape(page_info.orig_action) %>" >
-<input class="submit" type="submit" name="submit" value="New">
-</form>
-</div></div><!-- end .item -->
+<% htmlviewfunctions.displayitem(cfe({type="link", value={redir=redir}, label="Add new host", option="New", action="createhost"}), page_info, 0) %>
+
+<% htmlviewfunctions.displaysectionend(header_level) %>
diff --git a/dhcp-listsubnets-html.lsp b/dhcp-listsubnets-html.lsp
index 00bd1ef..158ee60 100644
--- a/dhcp-listsubnets-html.lsp
+++ b/dhcp-listsubnets-html.lsp
@@ -22,28 +22,29 @@
<% htmlviewfunctions.displaycommandresults({"editsubnet", "delsubnet", "createsubnet"}, session) %>
-<h1>Subnet Declarations</h1>
+<% local header_level = htmlviewfunctions.displaysectionstart(view, page_info) %>
<table id="listsubnets" class="tablesorter"><thead>
<tr>
<th>Action</th>
<th>Subnet</th>
</tr>
</thead><tbody>
+<% local subn = cfe({ type="hidden", value="" }) %>
+<% local redir = cfe({ type="hidden", value=page_info.orig_action }) %>
<% for i,subnet in ipairs(view.value) do %>
<tr>
<td>
- <%= html.link{value=page_info.script..page_info.prefix..page_info.controller.."/editsubnet?subnet="..subnet.."&redir="..page_info.orig_action, label="Edit "} %>
- <%= html.link{value=page_info.script..page_info.prefix..page_info.controller.."/delsubnet?submit=true&subnet="..subnet, label="Delete "} %>
+ <%
+ subn.value = subnet
+ htmlviewfunctions.displayitem(cfe({type="link", value={subnet=subn, redir=redir}, label="", option="Edit", action="editsubnet"}), page_info, -1)
+ htmlviewfunctions.displayitem(cfe({type="form", value={subnet=subn}, label="", option="Delete", action="delsubnet" }), page_info, -1)
+ %>
</td>
<td><%= html.html_escape(subnet) %></td>
</tr>
<% end %>
</tbody></table>
-
-<div class='item'><p class='left'>Add new subnet</p>
-<div class='right'>
-<form action="<%= html.html_escape(page_info.script .. page_info.prefix .. page_info.controller .. "/createsubnet") %>" method="post">
-<input class="hidden" type="hidden" name="redir" value="<%= html.html_escape(page_info.orig_action) %>" >
-<input class="submit" type="submit" name="submit" value="New">
-</form>
-</div></div><!-- end .item -->
+
+<% htmlviewfunctions.displayitem(cfe({type="link", value={redir=redir}, label="Add new subnet", option="New", action="createsubnet"}), page_info, 0) %>
+
+<% htmlviewfunctions.displaysectionend(header_level) %>
diff --git a/dhcp-model.lua b/dhcp-model.lua
index 6c34931..5f84e8e 100644
--- a/dhcp-model.lua
+++ b/dhcp-model.lua
@@ -521,7 +521,7 @@ mymodule.get_hosts = function ()
end
end
- return cfe({ type="list", value=retval, label="Host list" })
+ return cfe({ type="list", value=retval, label="Host Declarations" })
end
mymodule.create_new_subnet = function()
@@ -689,7 +689,7 @@ mymodule.get_subnets = function ()
end
end
- return cfe({ type="list", value=retval, label="Subnet list" })
+ return cfe({ type="list", value=retval, label="Subnet Declarations" })
end
mymodule.read_settings = function()