webmcp

diff framework/env/request/get_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 2f8d8edd1836
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/framework/env/request/get_view.lua	Sun Oct 25 12:00:00 2009 +0100
     1.3 @@ -0,0 +1,26 @@
     1.4 +--[[--
     1.5 +view_name =
     1.6 +request.get_view()
     1.7 +
     1.8 +Returns the name of the currently requested view, or nil in case of an action.
     1.9 +
    1.10 +--]]--
    1.11 +
    1.12 +function request.get_view()
    1.13 +  if request._forward_processed then
    1.14 +    return request._forward.view or 'index'
    1.15 +  else
    1.16 +    if cgi.params._webmcp_view then
    1.17 +      local suffix = cgi.params._webmcp_suffix or "html"
    1.18 +      if suffix == "html" then
    1.19 +        return cgi.params._webmcp_view
    1.20 +      else
    1.21 +        return cgi.params._webmcp_view .. "." .. suffix
    1.22 +      end
    1.23 +    elseif not cgi.params._webmcp_action then
    1.24 +      return 'index'
    1.25 +    else
    1.26 +      return nil
    1.27 +    end
    1.28 +  end
    1.29 +end

Impressum / About Us