diff options
author | Ted Trask <ttrask01@yahoo.com> | 2014-04-10 04:59:37 +0000 |
---|---|---|
committer | Ted Trask <ttrask01@yahoo.com> | 2014-04-10 04:59:37 +0000 |
commit | 37a61d7a8f2538b1fcb0f9b636345c84d74d5cf6 (patch) | |
tree | 3bdf36b571cd4eea3868f1976274666bcab42fea | |
parent | cb6b77833f255b8acbf61fb0c343c01dbf845a84 (diff) | |
download | acf-alpine-conf-37a61d7a8f2538b1fcb0f9b636345c84d74d5cf6.tar.bz2 acf-alpine-conf-37a61d7a8f2538b1fcb0f9b636345c84d74d5cf6.tar.xz |
Changes to use new htmlviewfunctions functions
-rw-r--r-- | lbu-config-html.lsp | 14 | ||||
-rw-r--r-- | lbu-listbackups-html.lsp | 5 | ||||
-rw-r--r-- | lbu-listchanges-html.lsp | 25 | ||||
-rw-r--r-- | lbu-model.lua | 13 | ||||
-rw-r--r-- | lbu-status-html.lsp | 13 |
5 files changed, 36 insertions, 34 deletions
diff --git a/lbu-config-html.lsp b/lbu-config-html.lsp index 05ecad3..52d9d77 100644 --- a/lbu-config-html.lsp +++ b/lbu-config-html.lsp @@ -8,14 +8,12 @@ htmlviewfunctions = require("htmlviewfunctions") viewlibrary.dispatch_component("status") end %> -<h1>Config</h1> <% - local order = { "LBU_MEDIA", "ENCRYPTION", "DEFAULT_CIPHER", "PASSWORD" } - htmlviewfunctions.displayform(form, order, nil, page_info, 2) +htmlviewfunctions.displayitem(form, page_info) - if viewlibrary and viewlibrary.dispatch_component then - viewlibrary.dispatch_component("editincluded") - viewlibrary.dispatch_component("editexcluded") - viewlibrary.dispatch_component("listbackups") - end +if viewlibrary and viewlibrary.dispatch_component then + viewlibrary.dispatch_component("editincluded") + viewlibrary.dispatch_component("editexcluded") + viewlibrary.dispatch_component("listbackups") +end %> diff --git a/lbu-listbackups-html.lsp b/lbu-listbackups-html.lsp index 9b656cc..2da5ab4 100644 --- a/lbu-listbackups-html.lsp +++ b/lbu-listbackups-html.lsp @@ -23,7 +23,7 @@ html = require("acf.html") <% htmlviewfunctions.displaycommandresults({"selectbackup"}, session) %> -<h1>Backup Archives</h1> +<% local header_level = htmlviewfunctions.displaysectionstart(view, page_info) %> <% if #view.value == 0 then %> <p>No backup files</p> <% else %> @@ -35,9 +35,10 @@ html = require("acf.html") </thead><tbody> <% for i,name in ipairs(view.value) do %> <tr><td> - <%= html.link{value="selectbackup?backup="..name.."&redir=config&submit=true", label="Revert "} %> + <% htmlviewfunctions.displayitem(cfe({type="link", value={backup=cfe({ type="hidden", value=name })}, label="", option="Revert", action="selectbackup"}), page_info, -1) %> </td> <td><%= html.html_escape(name) %></td></tr> <% end %> </tbody></table> <% end %> +<% htmlviewfunctions.displaysectionend(header_level) %> diff --git a/lbu-listchanges-html.lsp b/lbu-listchanges-html.lsp index 84c94ae..2b65046 100644 --- a/lbu-listchanges-html.lsp +++ b/lbu-listchanges-html.lsp @@ -12,19 +12,17 @@ html = require("acf.html") end %> -<% if viewlibrary.check_permission("getpackage") then %> -<h1>Download Overlay</h1> - <div class='item'><p class='left'>Generate and download overlay</p> - <div class='right'> - <form action="<%= html.html_escape(page_info.script .. page_info.prefix) %>lbu/getpackage" method="post"> - <input type="hidden" name="viewtype" value="stream"> - <input class="submit" type="submit" name="submit" value="Download"></form> - </div></div><!-- end .item --> -<% end %> +<% +if viewlibrary.check_permission("getpackage") then + local viewtype = cfe({type="hidden", value="stream"}) + htmlviewfunctions.displayitem(cfe({type="form", value={viewtype=viewtype}, label="Download Overlay", option="Download", action="getpackage" }), page_info) +end +%> -<h1>Changes Since Last Commit</h1> - <div class='item'><p class='left'>Files changed since last commit</p> - <div class='right'> +<% local header_level = htmlviewfunctions.displaysectionstart(view, page_info) %> + <% htmlviewfunctions.displayitemstart() %> + Files changed since last commit + <% htmlviewfunctions.displayitemmiddle() %> <pre><% if (#view.value == 0) then io.write("None") @@ -34,4 +32,5 @@ html = require("acf.html") end end %></pre> - </div></div><!-- end .item --> + <% htmlviewfunctions.displayitemend() %> +<% htmlviewfunctions.displaysectionend(header_level) %> diff --git a/lbu-model.lua b/lbu-model.lua index 6116a9d..ac9f926 100644 --- a/lbu-model.lua +++ b/lbu-model.lua @@ -164,6 +164,7 @@ function mymodule.getstatus () status["version"] = cfe({ value=get_version(), label="Program version", + seq=2, }) status["committed"] = cfe({ @@ -171,12 +172,15 @@ function mymodule.getstatus () value=(#mymodule.list().value==0), descr=descrtxt, label="Program status", + seq=1, }) local config = mymodule.getconfig() status["LBU_MEDIA"] = config.value.LBU_MEDIA + status["LBU_MEDIA"].seq=3 if (config.value.ENCRYPTION.value) then status["DEFAULT_CIPHER"] = config.value.DEFAULT_CIPHER + status["DEFAULT_CIPHER"].seq=4 end return cfe({ type="group", value=status, label="LBU Status" }) @@ -189,7 +193,7 @@ function mymodule.list() ret[#ret + 1] = { name=k, status=v } end table.sort(ret, function(a,b) return (a.name < b.name) end) - return cfe({ type="structure", value=ret, label="List of changes" }) + return cfe({ type="structure", value=ret, label="Changes Since Last Commit" }) end function mymodule.getconfig (self, clientdata) @@ -206,12 +210,14 @@ function mymodule.getconfig (self, clientdata) label="Media for commit", type="select", option=availablemedias() or {}, + seq=1, }) config["ENCRYPTION"] = cfe({ value=(configopts.ENCRYPTION ~= nil), label="Password protected commits", type="boolean", + seq=2, }) config["DEFAULT_CIPHER"] = cfe({ @@ -219,16 +225,19 @@ function mymodule.getconfig (self, clientdata) label="Cipher to use for encryption", option=getciphers() or {}, type="select", + seq=3, }) config["PASSWORD"] = cfe({ value=configopts.PASSWORD or "", label="Password when encrypting", + seq=4, }) config["BACKUP_LIMIT"] = cfe({ value=configopts.BACKUP_LIMIT or "0", label="Backup archive limit", + seq=5, }) retval = cfe({ type="group", value=config, label="LBU Config" }) @@ -362,7 +371,7 @@ function mymodule.getbackupfiles() files[#files + 1] = line end end - return cfe({ type="list", value=files, label="Backup archive list"}) + return cfe({ type="list", value=files, label="Backup Archives"}) end function mymodule.get_selectbackup(self, clientdata) diff --git a/lbu-status-html.lsp b/lbu-status-html.lsp index 58739d4..e3966b0 100644 --- a/lbu-status-html.lsp +++ b/lbu-status-html.lsp @@ -1,19 +1,14 @@ -<% local view, viewlibrary, pageinfo, session = ... +<% local view, viewlibrary, page_info, session = ... htmlviewfunctions = require("htmlviewfunctions") %> -<h1>System Info</h1> <% if view.value.committed.value then view.value.committed.value = "There are no uncommitted files" else view.value.committed.value = "WARNING!\nUntil you commit, you will lose your changes at next reboot/shutdown!" end -view.value.committed.type = "string" -htmlviewfunctions.displayitem(view.value.committed) +view.value.committed.type = "text" -for name,value in pairs(view.value) do - if name ~= "committed" then - htmlviewfunctions.displayitem(value) - end -end %> +htmlviewfunctions.displayitem(view, page_info) +%> |