diff options
author | Mika Havela <mika.havela@gmail.com> | 2008-02-14 15:33:20 +0000 |
---|---|---|
committer | Mika Havela <mika.havela@gmail.com> | 2008-02-14 15:33:20 +0000 |
commit | 422d93b32eb1c30d9a684146d258ed01ab99a850 (patch) | |
tree | 244d6fee9337f1e7e0843b405946d6cf2eb3882d /lbu-controller.lua | |
parent | 0201f4b56d290494cf5d01756670ae16b2e38936 (diff) | |
download | acf-alpine-conf-422d93b32eb1c30d9a684146d258ed01ab99a850.tar.bz2 acf-alpine-conf-422d93b32eb1c30d9a684146d258ed01ab99a850.tar.xz |
Rebuilt LBU so it uses cfe instead.v0.2
git-svn-id: svn://svn.alpinelinux.org/acf/alpine-conf/trunk@719 ab2d0c66-481e-0410-8bed-d214d4d58bed
Diffstat (limited to 'lbu-controller.lua')
-rw-r--r-- | lbu-controller.lua | 114 |
1 files changed, 105 insertions, 9 deletions
diff --git a/lbu-controller.lua b/lbu-controller.lua index 04b729a..8dbaccb 100644 --- a/lbu-controller.lua +++ b/lbu-controller.lua @@ -42,22 +42,84 @@ config = function (self) cmdresult[var] = self.model:editconfig(var, self.clientdata[var], "change_value") end end - if (self.clientdata.cmd_add_include) and (self.clientdata.item_add_include) then - cmdresult = self.model:lbuincexcl("include", self.clientdata.item_add_include, "add") + if (self.clientdata.cmd_add_included) and (self.clientdata.item_add_included) then + cmdresult = self.model:lbuincexcl("include", self.clientdata.item_add_included, "add") end - if (self.clientdata.cmd_add_exclude) and (self.clientdata.item_add_exclude) then - cmdresult = self.model:lbuincexcl("exclude", self.clientdata.item_add_exclude, "add") + if (self.clientdata.cmd_add_excluded) and (self.clientdata.item_add_excluded) then + cmdresult = self.model:lbuincexcl("exclude", self.clientdata.item_add_excluded, "add") end + local config = self.model:getconfig() -- This needs to be done /after/ the editing of the config (done earlier in this code) - local status,errors = self.model:getstatus() + local status = self.model:getstatus() + + -- Add submit and other buttons + config["cmd_delete_included"] = cfe({ + name="cmd_delete_included", + value="Delete", + label="Delete selected included-item", + type="submit", + descr="Mark a item in '" .. config.lbu_included.label .. "'-list before pressing [Delete]", + }) + + config["item_add_included"] = cfe({ + name="item_add_included", + label="Item to add to included-list", + }) + + config["cmd_add_included"] = cfe({ + name="cmd_add_included", + value="Add", + label="Add the item into the included-list", + type="submit", + descr="Enter a value in '" .. config.item_add_included.label .. "'-input before pressing [Add]", + }) + + config["cmd_delete_excluded"] = cfe({ + name="cmd_delete_excluded", + value="Delete", + label="Delete selected excluded-item", + type="submit", + descr="Mark a item in '" .. config.lbu_excluded.label .. "'-list before pressing [Delete]", + }) + + config["item_add_excluded"] = cfe({ + name="item_add_excluded", + label="Item to add to excluded-list", + }) + + config["cmd_add_excluded"] = cfe({ + name="cmd_add_excluded", + value="Add", + label="Add the item into the excluded-list", + type="submit", + descr="Enter a value in '" .. config.item_add_excluded.label .. "'-input before pressing [Add]", + }) + + config["config_submit"] = cfe({ + name="config_submit", + value="Apply", + label="Apply above settings", + type="submit", + }) + + -- Disable buttons/commands that is usable for som reason + if (config.lbu_included.option) and (#config.lbu_included.option == 0) then + config.cmd_delete_included.disabled= "yes" + config.cmd_delete_included.descr= "" + end + if (config.lbu_excluded.option) and (#config.lbu_excluded.option == 0) then + config.cmd_delete_excluded.disabled= "yes" + config.cmd_delete_excluded.descr= "" + end + local url = ENV["SCRIPT_NAME"] .. self.conf.prefix .. self.conf.controller return ( {status = status, cmdresult = cmdresult, errors = errors, clientdata = self.clientdata, - config = self.model:getconfig(), + config = config, url = url, } ) end @@ -79,13 +141,37 @@ function commit(self) end local status, errors = self.model:getstatus() - if (errors.last) then +--[[ if (errors.last) then self.conf.action = "config" self.conf.type = "redir" return config(self) end +--]] + -- Add buttons + status["lbusimulate"] = cfe({ + name="lbusimulate", + value="Simulate", + label="Simulate/Test a commit", + type="submit", + }) + + status["lbucommit"] = cfe({ + name="lbucommit", + value="Commit", + label="Actually commit and save changes", + type="submit", + }) + + if (cmderror["-d"]) then + status["lbucleanmedia"] = cfe({ + name="lbucleanmedia", + value="lbucleanmedia", + label="Remove existing apk.ovls from media", + type="checkbox", + }) + end + return ( {status = status, - errors = errors, cmdresult = cmdresult, cmdflag = cmdflag, cmderror = cmderror, @@ -99,9 +185,19 @@ expert = function (self) end local status = self.model.getstatus() + local file = self.model:get_filedetails() + -- Add submit and other buttons + file["cmdsave"] = cfe({ + name="cmdsave", + value="Apply", + label="Apply settings", + type="submit", + }) + local url = ENV["SCRIPT_NAME"] .. self.conf.prefix .. self.conf.controller - return { file = self.model:get_filedetails(), + return { + file = file, status = status, clientdata = self.clientdata, url = url, } |