webmcp

annotate framework/env/ui/script.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 5e32ef998acf
rev   line source
jbe/bsw@0 1 --[[--
jbe/bsw@0 2 ui.script{
jbe/bsw@0 3 noscript_attr = noscript_attr, -- HTML attributes for noscript tag
jbe/bsw@0 4 noscript = noscript, -- string or function for noscript content
jbe/bsw@0 5 attr = attr, -- extra HTML attributes for script tag
jbe/bsw@0 6 type = type, -- type of script, defaults to "text/javascript"
jbe/bsw@0 7 script = script, -- string or function for script content
jbe/bsw@0 8 }
jbe/bsw@0 9
jbe/bsw@0 10 This function is used to insert a script into the active slot. It is currently not XML compliant and the script must not contain a closing script tag.
jbe/bsw@0 11
jbe/bsw@0 12 --]]--
jbe/bsw@0 13
jbe/bsw@0 14 -- TODO: CDATA or SGML comment?
jbe/bsw@0 15
jbe/bsw@0 16 function ui.script(args)
jbe/bsw@0 17 local args = args or {}
jbe/bsw@0 18 local noscript_attr = args.noscript_attr
jbe/bsw@0 19 local noscript = args.noscript
jbe/bsw@0 20 local attr = table.new(args.attr)
jbe/bsw@0 21 attr.type = attr.type or args.type or "text/javascript"
jbe/bsw@0 22 local script = args.script
jbe/bsw@0 23 if script and type(script) ~= "function" then
jbe/bsw@0 24 -- disable HTML entity escaping
jbe/bsw@0 25 script = function()
jbe/bsw@0 26 slot.put(args.script)
jbe/bsw@0 27 end
jbe/bsw@0 28 end
jbe/bsw@0 29 if noscript then
jbe/bsw@0 30 ui.tag{ tag = "noscript", attr = attr, content = noscript }
jbe/bsw@0 31 end
jbe/bsw@0 32 if script then
jbe/bsw@0 33 ui.tag{ tag = "script", attr = attr, content = script }
jbe/bsw@0 34 end
jbe/bsw@0 35 end

Impressum / About Us