Renamed {CMS_SETUP} theme_resource_location as theme_assets_location

Added missing known hook in auto register hook.
Implemented /theme/* file system response.
Implemented $page.type for the smarty template.
Added CMS_DEBUG_MODULE .
Added NOT_FOUND_ERROR_CMS_RESPONSE .
This commit is contained in:
2014-11-13 19:25:01 +01:00
parent 44a1dd62cb
commit 76bdbeaa2a
9 changed files with 216 additions and 10 deletions

View File

@@ -144,6 +144,16 @@ feature -- Settings: router
fhdl: WSF_FILE_SYSTEM_HANDLER
do
log.write_debug (generator + ".configure_api_file_handler")
create fhdl.make_hidden_with_path (setup.theme_assets_location)
fhdl.disable_index
fhdl.set_not_found_handler (agent (ia_uri: READABLE_STRING_8; ia_req: WSF_REQUEST; ia_res: WSF_RESPONSE)
do
execute_default (ia_req, ia_res)
end)
a_router.handle_with_request_methods ("/theme/", fhdl, router.methods_GET)
create fhdl.make_hidden_with_path (setup.layout.www_path)
fhdl.disable_index
fhdl.set_not_found_handler (agent (ia_uri: READABLE_STRING_8; ia_req: WSF_REQUEST; ia_res: WSF_RESPONSE)
@@ -244,8 +254,12 @@ feature -- Execution
execute_default (req: WSF_REQUEST; res: WSF_RESPONSE)
-- Default request handler if no other are relevant
local
r: NOT_FOUND_ERROR_CMS_RESPONSE
do
to_implement ("Default response for CMS_SERVICE")
create r.make (req, res, api)
r.execute
end
note

View File

@@ -88,7 +88,7 @@ feature -- URL utilities
local
l_path_info: READABLE_STRING_8
do
l_path_info := request.path_info
l_path_info := request.percent_encoded_path_info
if attached setup.front_page_path as l_front_page_path then
Result := l_front_page_path.same_string (l_path_info)
else
@@ -964,8 +964,13 @@ feature {NONE} -- Execution
local
cms_page: CMS_HTML_PAGE
page: CMS_HTML_PAGE_RESPONSE
utf: UTF_CONVERTER
do
create cms_page.make
if attached {READABLE_STRING_GENERAL} values.item ("optional_content_type") as l_type then
create cms_page.make_typed (utf.utf_32_string_to_utf_8_string_8 (l_type))
else
create cms_page.make
end
prepare (cms_page)
create page.make (theme.page_html (cms_page))
page.set_status_code (status_code)

View File

@@ -0,0 +1,38 @@
note
description: "Summary description for {NOT_FOUND_ERROR_CMS_RESPONSE}."
date: "$Date$"
revision: "$Revision$"
class
NOT_FOUND_ERROR_CMS_RESPONSE
inherit
CMS_RESPONSE
redefine
custom_prepare
end
create
make
feature -- Generation
custom_prepare (page: CMS_HTML_PAGE)
do
page.register_variable (request.absolute_script_url (request.path_info), "request")
page.set_status_code ({HTTP_STATUS_CODE}.not_found)
page.register_variable (page.status_code.out, "code")
end
feature -- Execution
process
-- Computed response message.
do
set_title ("Not Found")
set_page_title ("Not Found")
set_main_content ("<em>The requested page could not be found.</em>")
end
end

View File

@@ -21,8 +21,8 @@ feature -- Generation
custom_prepare (page: CMS_HTML_PAGE)
do
page.register_variable (request.absolute_script_url (request.path_info), "request")
page.register_variable ("501", "code")
page.set_status_code (501)
page.set_status_code ({HTTP_STATUS_CODE}.not_implemented)
page.register_variable (page.status_code.out, "code")
end
feature -- Execution
@@ -32,6 +32,7 @@ feature -- Execution
do
set_title ("Not Implemented")
set_page_title (Void)
set_main_content (request.percent_encoded_path_info + " is not implemented!")
end
end