webmcp
annotate framework/env/slot/restore_all.lua @ 11:d76a8857ba62
Added ui.partial and other functions, which allow partial content replacement using XMLHttpRequests; Image support for ui.link
Also includes following changes:
- Fix for rocketcgi library to accept POST data content-types, which contain additional charset information.
- Support arrays passed as params to encode.url (only for keys ending with "[]")
- Version information changed to "1.0.7"
Documentation for added functions is not yet complete.
Also includes following changes:
- Fix for rocketcgi library to accept POST data content-types, which contain additional charset information.
- Support arrays passed as params to encode.url (only for keys ending with "[]")
- Version information changed to "1.0.7"
Documentation for added functions is not yet complete.
| author | jbe/bsw |
|---|---|
| date | Fri Feb 12 18:40:22 2010 +0100 (2010-02-12) |
| 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 |