webmcp
diff framework/env/encode/url.lua @ 79:3a6962b9121c
Anchor support for encode.url{...}, ui.link{...} and ui.paginate{...}
author | jbe |
---|---|
date | Wed Jun 27 18:57:53 2012 +0200 (2012-06-27) |
parents | d76a8857ba62 |
children | ca3f7b001014 |
line diff
1.1 --- a/framework/env/encode/url.lua Thu Jun 21 17:18:44 2012 +0200 1.2 +++ b/framework/env/encode/url.lua Wed Jun 27 18:57:53 2012 +0200 1.3 @@ -8,7 +8,8 @@ 1.4 view = view, -- a view name of the WebMCP application 1.5 action = action, -- an action name of the WebMCP application 1.6 id = id, -- optional id to be passed to the view or action to select a particular data record 1.7 - params = params -- optional parameters to be passed to the view or action 1.8 + params = params, -- optional parameters to be passed to the view or action 1.9 + anchor = anchor -- anchor in URL 1.10 } 1.11 1.12 This function creates URLs to external locations, to static files within the WebMCP application or to a certain view or action inside a module. 1.13 @@ -92,5 +93,12 @@ 1.14 end 1.15 result[#result] = nil -- remove last '&' or '?' 1.16 end 1.17 - return table.concat(result) 1.18 + local string_result = table.concat(result) 1.19 + if anchor ~= nil then 1.20 + string_result = string.match(string_result, "^[^#]*") 1.21 + if anchor then 1.22 + string_result = string_result .. anchor 1.23 + end 1.24 + end 1.25 + return string_result 1.26 end