webmcp

diff framework/env/execute/filtered_view.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
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/framework/env/execute/filtered_view.lua	Sun Oct 25 12:00:00 2009 +0100
     1.3 @@ -0,0 +1,34 @@
     1.4 +--[[--
     1.5 +execute.filtered_view{
     1.6 +  module = module,  -- module name of the view to be executed
     1.7 +  view   = view     -- name of the view to be executed
     1.8 +}
     1.9 +
    1.10 +Executes a view with associated filters.
    1.11 +This function is only used by by the webmcp.lua file in the cgi-bin/ directory.
    1.12 +
    1.13 +--]]--
    1.14 +
    1.15 +function execute.filtered_view(args)
    1.16 +  local filters = {}
    1.17 +  local function add_by_path(...)
    1.18 +    execute._add_filters_by_path(filters, ...)
    1.19 +  end
    1.20 +  add_by_path("_filter")
    1.21 +  add_by_path("_filter_view")
    1.22 +  add_by_path(request.get_app_name(), "_filter")
    1.23 +  add_by_path(request.get_app_name(), "_filter_view")
    1.24 +  add_by_path(request.get_app_name(), args.module, "_filter")
    1.25 +  add_by_path(request.get_app_name(), args.module, "_filter_view")
    1.26 +  table.sort(filters)
    1.27 +  for idx, filter_name in ipairs(filters) do
    1.28 +    filters[idx] = filters[filter_name]
    1.29 +    filters[filter_name] = nil
    1.30 +  end
    1.31 +  execute.multi_wrapped(
    1.32 +    filters,
    1.33 +    function()
    1.34 +      execute.view(args)
    1.35 +    end
    1.36 +  )
    1.37 +end

Impressum / About Us