webmcp
diff framework/cgi-bin/webmcp.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
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 | 72860d232f32 |
line diff
1.1 --- a/framework/cgi-bin/webmcp.lua Sun Oct 25 12:00:00 2009 +0100 1.2 +++ b/framework/cgi-bin/webmcp.lua Tue Nov 17 12:00:00 2009 +0100 1.3 @@ -1,5 +1,7 @@ 1.4 #!/usr/bin/env lua 1.5 1.6 +_WEBMCP_VERSION = "1.0.1" 1.7 + 1.8 -- include "../lib/" in search path for libraries 1.9 do 1.10 package.path = '../lib/?.lua;' .. package.path 1.11 @@ -430,16 +432,14 @@ 1.12 cgi.set_status(http_status) 1.13 end 1.14 1.15 - -- ajax 1.16 - if request.is_ajax() then 1.17 - cgi.set_content_type('text/html') 1.18 - for i, slot_ident in ipairs{'main', 'actions', 'title', 'topnav', 'sidenav', 'debug', 'notice', 'warning', 'error'} do 1.19 - local html = slot.get_content(slot_ident) 1.20 - if html then 1.21 - cgi.send_data("document.getElementById('" .. slot_ident .. "').innerHTML=" .. encode.json(html or ' ') .. ";") 1.22 - end 1.23 + local json_request_slots = request.get_json_request_slots() 1.24 + if json_request_slots then 1.25 + cgi.set_content_type('application/json') 1.26 + local data = {} 1.27 + for idx, slot_ident in ipairs(json_request_slots) do 1.28 + data[slot_ident] = slot.get_content(slot_ident) 1.29 end 1.30 - -- oder ganz herkoemmlich 1.31 + cgi.send_data(encode.json(data)) 1.32 else 1.33 cgi.set_content_type(slot.get_content_type()) 1.34 cgi.send_data(slot.render_layout())