webmcp

annotate framework/env/execute/filtered_action.lua @ 0:9fdfb27f8e67

Version 1.0.0
author jbe/bsw
date Sun Oct 25 12:00:00 2009 +0100 (2009-10-25)
parents
children eb3e236d261d
rev   line source
jbe/bsw@0 1 --[[--
jbe/bsw@0 2 action_status = -- status code returned by the action (a string)
jbe/bsw@0 3 execute.filtered_action{
jbe/bsw@0 4 module = module, -- module name of the action to be executed
jbe/bsw@0 5 action = action, -- name of the action to be executed
jbe/bsw@0 6 id = id, -- id to be returned by param.get_id(...) during execution
jbe/bsw@0 7 params = params -- parameters to be returned by param.get(...) during execution
jbe/bsw@0 8 }
jbe/bsw@0 9
jbe/bsw@0 10 Executes an action with associated filters.
jbe/bsw@0 11 This function is only used by by the webmcp.lua file in the cgi-bin/ directory.
jbe/bsw@0 12
jbe/bsw@0 13 --]]--
jbe/bsw@0 14
jbe/bsw@0 15 function execute.filtered_action(args)
jbe/bsw@0 16 local filters = {}
jbe/bsw@0 17 local function add_by_path(...)
jbe/bsw@0 18 execute._add_filters_by_path(filters, ...)
jbe/bsw@0 19 end
jbe/bsw@0 20 add_by_path("_filter")
jbe/bsw@0 21 add_by_path("_filter_action")
jbe/bsw@0 22 add_by_path(request.get_app_name(), "_filter")
jbe/bsw@0 23 add_by_path(request.get_app_name(), "_filter_action")
jbe/bsw@0 24 add_by_path(request.get_app_name(), args.module, "_filter")
jbe/bsw@0 25 add_by_path(request.get_app_name(), args.module, "_filter_action")
jbe/bsw@0 26 table.sort(filters)
jbe/bsw@0 27 for idx, filter_name in ipairs(filters) do
jbe/bsw@0 28 filters[idx] = filters[filter_name]
jbe/bsw@0 29 filters[filter_name] = nil
jbe/bsw@0 30 end
jbe/bsw@0 31 local result
jbe/bsw@0 32 execute.multi_wrapped(
jbe/bsw@0 33 filters,
jbe/bsw@0 34 function()
jbe/bsw@0 35 result = execute.action(args)
jbe/bsw@0 36 end
jbe/bsw@0 37 )
jbe/bsw@0 38 return result
jbe/bsw@0 39 end

Impressum / About Us