diff options
author | Ted Trask <ttrask01@yahoo.com> | 2009-12-18 09:44:42 +0000 |
---|---|---|
committer | Ted Trask <ttrask01@yahoo.com> | 2009-12-18 09:44:42 +0000 |
commit | b5b8c138deb5d4b4216c9186e3d528792edc70b2 (patch) | |
tree | 9443d94bc41e0a6e4f4333a3642efa16139983bf /lib | |
parent | 1b8a047f7d1c71a1efd0bd34b5f887086a857b20 (diff) | |
download | acf-core-b5b8c138deb5d4b4216c9186e3d528792edc70b2.tar.bz2 acf-core-b5b8c138deb5d4b4216c9186e3d528792edc70b2.tar.xz |
Made command-line client work.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/controllerfunctions.lua | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/controllerfunctions.lua b/lib/controllerfunctions.lua index ef910d2..bccd847 100644 --- a/lib/controllerfunctions.lua +++ b/lib/controllerfunctions.lua @@ -20,6 +20,15 @@ function handle_clientdata(form, clientdata) if value.type == "boolean" then value.value = (clientdata[name] ~= nil) elseif value.type == "multi" then + if clientdata[name] == nil then + -- for cli we use name[num] as the name + clientdata[name] = {} + for n,val in pairs(clientdata) do + if string.find(n, "^"..name.."%[%d+%]$") then + clientdata[name][tonumber(string.match(n, "%[(%d+)%]$"))] = val + end + end + end -- FIXME this is because multi selects don't work in haserl local oldtable = clientdata[name] or {} -- Assume it's a sparse array, and remove blanks @@ -33,9 +42,17 @@ function handle_clientdata(form, clientdata) elseif value.type == "list" then value.value = {} if clientdata[name] and clientdata[name] ~= "" then + -- for www we use \r separated list for ip in string.gmatch(clientdata[name].."\n", "%s*(%S[^\n]*%S)%s*\n") do table.insert(value.value, ip) end + else + -- for cli we use name[num] as the name + for n,val in pairs(clientdata) do + if string.find(n, "^"..name.."%[%d+%]$") then + value.value[tonumber(string.match(n, "%[(%d+)%]$"))] = val + end + end end else value.value = clientdata[name] or value.value |