diff options
l---------[-rw-r--r--] | apk-config-html.lsp | 15 | ||||
-rw-r--r-- | apk-controller.lua | 38 | ||||
-rw-r--r-- | apk-html.lsp | 20 |
3 files changed, 9 insertions, 64 deletions
diff --git a/apk-config-html.lsp b/apk-config-html.lsp index a884ec9..4b6b762 100644..120000 --- a/apk-config-html.lsp +++ b/apk-config-html.lsp @@ -1,14 +1 @@ -<? local form = ... ?> -<? require("viewfunctions") ?> -<? ---[[ DEBUG INFORMATION -io.write("<H1>DEBUGGING</H1><span style='color:red'><H2>DEBUG INFO: CFE</H2>") -io.write(html.cfe_unpack(form)) -io.write("</span>") ---]] -?> - -<H1><?= form.label ?></H1> -<? - displayform(form) -?> +../form-html.lsp
\ No newline at end of file diff --git a/apk-controller.lua b/apk-controller.lua index 9bb53bb..9876347 100644 --- a/apk-controller.lua +++ b/apk-controller.lua @@ -1,4 +1,5 @@ -- the interfaces controller +require("controllerfunctions") module (..., package.seeall) @@ -9,11 +10,7 @@ read = function(self) end loaded = function(self) - -- Get command result out of session data - local cmdresult = self.sessiondata.cmdresult - self.sessiondata.cmdresult = nil - local loaded = self.model.get_loaded_packages() - return cfe({ type="group", value={loaded=loaded, cmdresult=cmdresult} }) + return cfe({ type="group", value={loaded=self.model.get_loaded_packages()} }) end available = function(self) @@ -21,38 +18,13 @@ available = function(self) end delete = function(self) - local package = self.clientdata.package or "" - local cmdresult = self.model.delete_package(package, self.sessiondata) - -- Put the result in session data and redirect - self.sessiondata.cmdresult = cmdresult - redirect(self) + return self:redirect_to_referrer(self.model.delete_package(self.clientdata.package or "", self.sessiondata)) end install = function(self) - local package = self.clientdata.package or "" - local cmdresult = self.model.install_package(package, self.sessiondata) - -- Put the result in session data and redirect - self.sessiondata.cmdresult = cmdresult - redirect(self) + return self:redirect_to_referrer(self.model.install_package(self.clientdata.package or "", self.sessiondata)) end config = function(self) - local config = self.model.get_config() - if self.clientdata.Save then - for name,value in pairs(config.value) do - if self.clientdata[name] then - value.value = self.clientdata[name] - end - end - config = self.model.set_config(config) - if not config.errtxt then - config.descr = "Saved Configuration" - end - end - - config.type = "form" - config.option = "Save" - config.label = "Edit Configuration" - - return config + return controllerfunctions.handle_form(self, self.model.get_config, self.model.set_config, self.clientdata, "Save", "Edit Configuration", "Configuration Saved") end diff --git a/apk-html.lsp b/apk-html.lsp index 19cb085..13c1749 100644 --- a/apk-html.lsp +++ b/apk-html.lsp @@ -1,4 +1,5 @@ -<? local form = ... ?> +<? local form, viewlibrary, page_info, session = ... ?> +<? require("viewfunctions") ?> <? --[[ DEBUG INFORMATION io.write("<H1>DEBUGGING</H1><span style='color:red'><H2>DEBUG INFO: CFE</H2>") @@ -7,12 +8,7 @@ io.write("</span>") --]] ?> -<? if form.value.cmdresult then ?> -<H1>Command Result</H1> -<DL> -<?= form.value.cmdresult.value ?> -</DL> -<? end ?> +<? displaycommandresults({"delete", "install"}, session) ?> <? if form.value.loaded then ?> <H1>Loaded Packages</H1> @@ -59,13 +55,3 @@ io.write("</span>") </TABLE> </DL> <? end ?> - -<? ---[[ DEBUG INFORMATION -io.write("<H1>DEBUGGING</H1><span style='color:red'><H2>DEBUG INFO: CFE</H2>") -io.write(html.cfe_unpack(form)) -io.write("</span>") ---]] -?> - - |