webmcp

annotate framework/env/slot/restore_all.lua @ 1:985024b16520

Version 1.0.1

New feature: JSON requests

Changes in ui.paginate: Current page setting is directly fetched from CGI params, instead of view params

Changed behavior of load methods of atom library to accept nil as input

Bugfixes in mondelefant_atom_connector timestamp(tz) loaders

Added global constant _WEBMCP_VERSION containing a version string
author jbe
date Tue Nov 17 12:00:00 2009 +0100 (2009-11-17)
parents 9fdfb27f8e67
children
rev   line source
jbe/bsw@0 1 --[[--
jbe/bsw@0 2 slot.restore_all(
jbe/bsw@0 3 blob -- string as returned by slot.dump_all()
jbe/bsw@0 4 )
jbe/bsw@0 5
jbe/bsw@0 6 Restores all slots using a string created by slot.dump_all().
jbe/bsw@0 7
jbe/bsw@0 8 --]]--
jbe/bsw@0 9
jbe/bsw@0 10 local function decode(str)
jbe/bsw@0 11 return (
jbe/bsw@0 12 string.gsub(
jbe/bsw@0 13 str,
jbe/bsw@0 14 "%[[a-z]+%]",
jbe/bsw@0 15 function(char)
jbe/bsw@0 16 if char == "[eq]" then return "="
jbe/bsw@0 17 elseif char == "[s]" then return ";"
jbe/bsw@0 18 elseif char == "[o]" then return "["
jbe/bsw@0 19 elseif char == "[c]" then return "]"
jbe/bsw@0 20 else end
jbe/bsw@0 21 end
jbe/bsw@0 22 )
jbe/bsw@0 23 )
jbe/bsw@0 24 end
jbe/bsw@0 25
jbe/bsw@0 26 function slot.restore_all(blob)
jbe/bsw@0 27 slot.reset_all()
jbe/bsw@0 28 for encoded_key, encoded_value in string.gmatch(blob, "([^=;]*)=([^=;]*)") do
jbe/bsw@0 29 local key, value = decode(encoded_key), decode(encoded_value)
jbe/bsw@0 30 slot._data[key].string_fragments = { value }
jbe/bsw@0 31 end
jbe/bsw@0 32 end

Impressum / About Us