webmcp
view framework/env/ui/partial.lua @ 28:ea2e8f3a2776
allow webmcp path to be set in cgi script
this allows another script to include the webmcp script when the cwd is not the cgi-bin. the script needs to set the WEBMCP_PATH variable.
this allows another script to include the webmcp script when the cwd is not the cgi-bin. the script needs to set the WEBMCP_PATH variable.
author | Daniel Poelzleithner <poelzi@poelzi.org> |
---|---|
date | Sun Sep 19 01:36:08 2010 +0200 (2010-09-19) |
parents | f3d3203cd2e4 |
children |
line source
1 --[[--
2 ui.partial{
3 module = module, -- module to be used to reload inner contents
4 view = view, -- view to be used to reload inner contents
5 id = id, -- id to be used to reload inner contents
6 params = params, -- params to be used to reload inner contents
7 target = target, -- id of HTML element containing contents to be replaced
8 content = function()
9 ...
10 end
11 }
13 Calling this function declares that the inner contents can be requested
14 directly via the given module, view, id and params. The parameter "target"
15 specifies the id of the HTML element, which should be replaced when
16 reloading partially.
18 The function has an effect on inner calls of ui.link{..., partial = {...}}
19 and ui.form{..., partial = {...}}.
21 --]]--
23 function ui.partial(args)
24 local old_state = ui._partial_state
25 ui._partial_state = table.new(args)
26 ui._partial_state.param_name_hash = {}
27 if args.param_names then
28 ui.add_partial_param_names(args.param_names)
29 end
30 args.content()
31 ui._partial_state = old_state
32 end