From 37a61d7a8f2538b1fcb0f9b636345c84d74d5cf6 Mon Sep 17 00:00:00 2001 From: Ted Trask Date: Thu, 10 Apr 2014 04:59:37 +0000 Subject: Changes to use new htmlviewfunctions functions --- lbu-config-html.lsp | 14 ++++++-------- lbu-listbackups-html.lsp | 5 +++-- lbu-listchanges-html.lsp | 25 ++++++++++++------------- lbu-model.lua | 13 +++++++++++-- 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 %> -

Config

<% - 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) %> -

Backup Archives

+<% local header_level = htmlviewfunctions.displaysectionstart(view, page_info) %> <% if #view.value == 0 then %>

No backup files

<% else %> @@ -35,9 +35,10 @@ html = require("acf.html") <% for i,name in ipairs(view.value) do %> - <%= 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) %> <%= html.html_escape(name) %> <% end %> <% 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 %> -

Download Overlay

-

Generate and download overlay

-
-
- -
-
-<% 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 +%> -

Changes Since Last Commit

-

Files changed since last commit

-
+<% local header_level = htmlviewfunctions.displaysectionstart(view, page_info) %> + <% htmlviewfunctions.displayitemstart() %> + Files changed since last commit + <% htmlviewfunctions.displayitemmiddle() %>
<% 
 		if (#view.value == 0) then
 			io.write("None")
@@ -34,4 +32,5 @@ html = require("acf.html")
 			end
 		end
 	%>
-
+ <% 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") %> -

System Info

<% 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) +%> -- cgit v1.2.3