Moved all location related queries into CMS_API, instead of CMS_SETUP.
Note that CMS_SETUP provides locations set by default or from configuration file. Now theme related resources can be found under site/modules/$mod_name/... or site/themes/$theme/modules/... so only theme related resources can be overriden for now.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-13-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-13-0 http://www.eiffel.com/developers/xml/configuration-1-13-0.xsd" name="demo" uuid="3643E657-BCBE-46AA-931B-71EAEA877A18" library_target="demo">
|
||||
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-14-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-14-0 http://www.eiffel.com/developers/xml/configuration-1-14-0.xsd" name="demo" uuid="3643E657-BCBE-46AA-931B-71EAEA877A18" library_target="demo">
|
||||
<description>Example/demo for Eiffel ROC CMS library</description>
|
||||
<target name="common" abstract="true">
|
||||
<file_rule>
|
||||
@@ -14,11 +14,11 @@
|
||||
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
|
||||
<library name="cms" location="..\..\cms-safe.ecf" readonly="false"/>
|
||||
<library name="cms_app_env" location="..\..\library\app_env\app_env-safe.ecf" readonly="false"/>
|
||||
<library name="cms_auth_module" location="..\..\modules\auth\auth-safe.ecf" readonly="false"/>
|
||||
<library name="cms_basic_auth_module" location="..\..\modules\basic_auth\basic_auth-safe.ecf" readonly="false"/>
|
||||
<library name="cms_blog_module" location="modules\blog\cms_blog_module-safe.ecf" readonly="false"/>
|
||||
<library name="cms_demo_module" location="modules\demo\cms_demo_module-safe.ecf" readonly="false"/>
|
||||
<library name="cms_model" location="..\..\library\model\cms_model-safe.ecf" readonly="false"/>
|
||||
<library name="cms_auth_module" location="..\..\modules\auth\auth-safe.ecf" readonly="false"/>
|
||||
<library name="cms_node_module" location="..\..\modules\node\node-safe.ecf" readonly="false"/>
|
||||
<!--
|
||||
<library name="persistence_store_mysql" location="..\..\library\persistence\store_mysql\store_mysql-safe.ecf" readonly="false"/>
|
||||
@@ -42,8 +42,8 @@
|
||||
<option debug="true">
|
||||
<debug name="dbglog" enabled="true"/>
|
||||
</option>
|
||||
<variable name="httpd_ssl_disabled" value="true"/><!-- for now ... due to issue with libcurl+eiffelnet ssl -->
|
||||
<setting name="concurrency" value="thread"/>
|
||||
<variable name="httpd_ssl_disabled" value="true"/>
|
||||
<library name="default_standalone" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\default\standalone-safe.ecf"/>
|
||||
<cluster name="launcher" location=".\launcher\default\" recursive="true"/>
|
||||
<cluster name="src" location=".\src\" recursive="true"/>
|
||||
|
||||
@@ -117,18 +117,18 @@ feature -- Access: router
|
||||
|
||||
-- Let the class BLOG_HANDLER handle the requests on "/blogs"
|
||||
create l_uri_mapping.make_trailing_slash_ignored ("/blogs", l_blog_handler)
|
||||
a_router.map_with_request_methods (l_uri_mapping, a_router.methods_get)
|
||||
a_router.map (l_uri_mapping, a_router.methods_get)
|
||||
|
||||
-- We can add a page number after /blogs/ to get older posts
|
||||
a_router.handle_with_request_methods ("/blogs/page/{page}", l_blog_handler, a_router.methods_get)
|
||||
a_router.handle ("/blogs/page/{page}", l_blog_handler, a_router.methods_get)
|
||||
|
||||
-- If a user id is given route with blog user handler
|
||||
--| FIXME: maybe /user/{user}/blogs/ would be better.
|
||||
a_router.handle_with_request_methods ("/blogs/user/{user}", l_blog_user_handler, a_router.methods_get)
|
||||
a_router.handle ("/blogs/user/{user}", l_blog_user_handler, a_router.methods_get)
|
||||
|
||||
-- If a user id is given we also want to allow different pages
|
||||
--| FIXME: what about /user/{user}/blogs/?page={page} ?
|
||||
a_router.handle_with_request_methods ("/blogs/user/{user}/page/{page}", l_blog_user_handler, a_router.methods_get)
|
||||
a_router.handle ("/blogs/user/{user}/page/{page}", l_blog_user_handler, a_router.methods_get)
|
||||
|
||||
end
|
||||
|
||||
|
||||
@@ -86,8 +86,6 @@ feature -- Query
|
||||
-- User id from path /blogs/{user}.
|
||||
-- Unsigned integer since negative ids are not allowed.
|
||||
-- If no valid id can be read it returns -1
|
||||
local
|
||||
s: STRING
|
||||
do
|
||||
Result := -1
|
||||
if attached {WSF_STRING} req.path_parameter ("user") as l_user_id then
|
||||
|
||||
@@ -83,8 +83,8 @@ feature -- Access: router
|
||||
setup_router (a_router: WSF_ROUTER; a_api: CMS_API)
|
||||
-- <Precursor>
|
||||
do
|
||||
map_uri_template_agent (a_router, "/demo/", agent handle_demo (?,?,a_api))
|
||||
map_uri_template_agent (a_router, "/demo/{id}", agent handle_demo_entry (?,?,a_api))
|
||||
map_uri_template_agent (a_router, "/demo/", agent handle_demo (?,?,a_api), Void)
|
||||
map_uri_template_agent (a_router, "/demo/{id}", agent handle_demo_entry (?,?,a_api), Void)
|
||||
end
|
||||
|
||||
feature -- Hooks
|
||||
@@ -144,42 +144,24 @@ feature -- Handler
|
||||
|
||||
feature -- Mapping helper: uri template
|
||||
|
||||
map_uri_template (a_router: WSF_ROUTER; a_tpl: STRING; h: WSF_URI_TEMPLATE_HANDLER)
|
||||
-- Map `h' as handler for `a_tpl'
|
||||
require
|
||||
a_tpl_attached: a_tpl /= Void
|
||||
h_attached: h /= Void
|
||||
do
|
||||
map_uri_template_with_request_methods (a_router, a_tpl, h, Void)
|
||||
end
|
||||
|
||||
map_uri_template_with_request_methods (a_router: WSF_ROUTER; a_tpl: READABLE_STRING_8; h: WSF_URI_TEMPLATE_HANDLER; rqst_methods: detachable WSF_REQUEST_METHODS)
|
||||
map_uri_template (a_router: WSF_ROUTER; a_tpl: READABLE_STRING_8; h: WSF_URI_TEMPLATE_HANDLER; rqst_methods: detachable WSF_REQUEST_METHODS)
|
||||
-- Map `h' as handler for `a_tpl' for request methods `rqst_methods'.
|
||||
require
|
||||
a_tpl_attached: a_tpl /= Void
|
||||
h_attached: h /= Void
|
||||
do
|
||||
a_router.map_with_request_methods (create {WSF_URI_TEMPLATE_MAPPING}.make (a_tpl, h), rqst_methods)
|
||||
a_router.map (create {WSF_URI_TEMPLATE_MAPPING}.make (a_tpl, h), rqst_methods)
|
||||
end
|
||||
|
||||
feature -- Mapping helper: uri template agent
|
||||
|
||||
map_uri_template_agent (a_router: WSF_ROUTER; a_tpl: READABLE_STRING_8; proc: PROCEDURE [ANY, TUPLE [req: WSF_REQUEST; res: WSF_RESPONSE]])
|
||||
-- Map `proc' as handler for `a_tpl'
|
||||
require
|
||||
a_tpl_attached: a_tpl /= Void
|
||||
proc_attached: proc /= Void
|
||||
do
|
||||
map_uri_template_agent_with_request_methods (a_router, a_tpl, proc, Void)
|
||||
end
|
||||
|
||||
map_uri_template_agent_with_request_methods (a_router: WSF_ROUTER; a_tpl: READABLE_STRING_8; proc: PROCEDURE [ANY, TUPLE [req: WSF_REQUEST; res: WSF_RESPONSE]]; rqst_methods: detachable WSF_REQUEST_METHODS)
|
||||
map_uri_template_agent (a_router: WSF_ROUTER; a_tpl: READABLE_STRING_8; proc: PROCEDURE [ANY, TUPLE [req: WSF_REQUEST; res: WSF_RESPONSE]]; rqst_methods: detachable WSF_REQUEST_METHODS)
|
||||
-- Map `proc' as handler for `a_tpl' for request methods `rqst_methods'.
|
||||
require
|
||||
a_tpl_attached: a_tpl /= Void
|
||||
proc_attached: proc /= Void
|
||||
do
|
||||
map_uri_template_with_request_methods (a_router, a_tpl, create {WSF_URI_TEMPLATE_AGENT_HANDLER}.make (proc), rqst_methods)
|
||||
map_uri_template (a_router, a_tpl, create {WSF_URI_TEMPLATE_AGENT_HANDLER}.make (proc), rqst_methods)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
[layout]
|
||||
root-dir=site/www
|
||||
themes-dir=site/themes
|
||||
#themes-dir=site/themes
|
||||
#modules-dir=site/modules
|
||||
|
||||
[site]
|
||||
name=Eiffel CMS
|
||||
|
||||
@@ -31,7 +31,7 @@ feature {NONE} -- Initialization
|
||||
admin_email := l_site_name + " <" + admin_email +">"
|
||||
end
|
||||
|
||||
if attached {CONFIG_READER} a_cms_api.module_configuration ("login", Void) as cfg then
|
||||
if attached {CONFIG_READER} a_cms_api.module_configuration_by_name ("login", Void) as cfg then
|
||||
if attached cfg.text_item ("smtp") as l_smtp then
|
||||
-- Overwrite global smtp setting if any.
|
||||
smtp_server := utf.utf_32_string_to_utf_8_string_8 (l_smtp)
|
||||
|
||||
@@ -529,7 +529,8 @@ feature {NONE} -- Helpers
|
||||
do
|
||||
create p.make_from_string ("templates")
|
||||
p := p.extended ("block_").appended (a_block_id).appended_with_extension ("tpl")
|
||||
p := a_response.module_resource_path (Current, p)
|
||||
|
||||
p := a_response.api.module_theme_resource_location (Current, p)
|
||||
if p /= Void then
|
||||
if attached p.entry as e then
|
||||
create Result.make (a_block_id, Void, p.parent, e)
|
||||
|
||||
@@ -149,26 +149,26 @@ feature -- Access: router
|
||||
-- TODO: for now, focused only on web interface, add REST api later. [2015-April-29]
|
||||
create l_node_handler.make (a_api, a_node_api)
|
||||
create l_uri_mapping.make_trailing_slash_ignored ("/node", l_node_handler)
|
||||
a_router.map_with_request_methods (l_uri_mapping, a_router.methods_get_post)
|
||||
a_router.map (l_uri_mapping, a_router.methods_get_post)
|
||||
|
||||
a_router.handle_with_request_methods ("/node/add/{type}", l_node_handler, a_router.methods_get_post)
|
||||
a_router.handle_with_request_methods ("/node/{id}/edit", l_node_handler, a_router.methods_get_post)
|
||||
a_router.handle_with_request_methods ("/node/{id}/delete", l_node_handler, a_router.methods_get_post)
|
||||
a_router.handle_with_request_methods ("/node/{id}/trash", l_node_handler, a_router.methods_get_post)
|
||||
a_router.handle ("/node/add/{type}", l_node_handler, a_router.methods_get_post)
|
||||
a_router.handle ("/node/{id}/edit", l_node_handler, a_router.methods_get_post)
|
||||
a_router.handle ("/node/{id}/delete", l_node_handler, a_router.methods_get_post)
|
||||
a_router.handle ("/node/{id}/trash", l_node_handler, a_router.methods_get_post)
|
||||
|
||||
a_router.handle_with_request_methods ("/node/{id}", l_node_handler, a_router.methods_get)
|
||||
a_router.handle ("/node/{id}", l_node_handler, a_router.methods_get)
|
||||
-- For now: no REST API handling... a_router.methods_get_put_delete + a_router.methods_get_post)
|
||||
|
||||
-- Nodes
|
||||
create l_nodes_handler.make (a_api, a_node_api)
|
||||
create l_uri_mapping.make_trailing_slash_ignored ("/nodes", l_nodes_handler)
|
||||
a_router.map_with_request_methods (l_uri_mapping, a_router.methods_get)
|
||||
a_router.map (l_uri_mapping, a_router.methods_get)
|
||||
|
||||
--Trash
|
||||
|
||||
create l_trash_handler.make (a_api, a_node_api)
|
||||
create l_uri_mapping.make_trailing_slash_ignored ("/trash", l_trash_handler)
|
||||
a_router.map_with_request_methods (l_uri_mapping, a_router.methods_get)
|
||||
a_router.map (l_uri_mapping, a_router.methods_get)
|
||||
|
||||
end
|
||||
|
||||
|
||||
@@ -61,11 +61,18 @@ feature {NONE} -- Initialization
|
||||
-- Can be also used to precise the "From:" value for email.
|
||||
site_email := text_item_or_default ("site.email", "webmaster")
|
||||
|
||||
-- Location for theme folders.
|
||||
-- Location for modules folders.
|
||||
if attached text_item ("modules-dir") as s then
|
||||
create modules_location.make_from_string (s)
|
||||
else
|
||||
modules_location := environment.modules_path
|
||||
end
|
||||
|
||||
-- Location for themes folders.
|
||||
if attached text_item ("themes-dir") as s then
|
||||
create themes_location.make_from_string (s)
|
||||
else
|
||||
themes_location := environment.www_path.extended ("themes")
|
||||
themes_location := environment.themes_path
|
||||
end
|
||||
|
||||
-- Selected theme's name
|
||||
@@ -76,7 +83,6 @@ feature {NONE} -- Initialization
|
||||
end
|
||||
|
||||
compute_theme_location
|
||||
compute_theme_assets_location
|
||||
end
|
||||
|
||||
initialize_storages
|
||||
@@ -163,15 +169,4 @@ feature -- Theme: Compute location
|
||||
theme_location := themes_location.extended (theme_name)
|
||||
end
|
||||
|
||||
compute_theme_assets_location
|
||||
-- assets (js, css, images, etc)
|
||||
-- Not used at the moment.
|
||||
do
|
||||
debug ("refactor_fixme")
|
||||
fixme ("Check if we really need it")
|
||||
end
|
||||
-- Check how to get this path from the CMS_THEME information.
|
||||
theme_assets_location := theme_location.extended ("assets")
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -23,15 +23,35 @@ create
|
||||
|
||||
feature -- Access
|
||||
|
||||
theme_path: PATH
|
||||
site_path: PATH
|
||||
-- Directory containing the site.
|
||||
--| For now, an alias for `path'.
|
||||
do
|
||||
Result := path
|
||||
end
|
||||
|
||||
modules_path: PATH
|
||||
-- Directory for templates (HTML, etc).
|
||||
local
|
||||
p: detachable PATH
|
||||
do
|
||||
p := internal_theme_path
|
||||
p := internal_modules_path
|
||||
if p = Void then
|
||||
p := www_path.extended ("theme")
|
||||
internal_theme_path := p
|
||||
p := site_path.extended ("modules")
|
||||
internal_modules_path := p
|
||||
end
|
||||
Result := p
|
||||
end
|
||||
|
||||
themes_path: PATH
|
||||
-- Directory for cms themes.
|
||||
local
|
||||
p: detachable PATH
|
||||
do
|
||||
p := internal_themes_path
|
||||
if p = Void then
|
||||
p := site_path.extended ("themes")
|
||||
internal_themes_path := p
|
||||
end
|
||||
Result := p
|
||||
end
|
||||
@@ -58,7 +78,9 @@ feature -- Access
|
||||
|
||||
feature {NONE} -- Implementation
|
||||
|
||||
internal_theme_path: detachable like theme_path
|
||||
internal_modules_path: detachable like modules_path
|
||||
|
||||
internal_themes_path: detachable like themes_path
|
||||
|
||||
internal_cms_config_ini_path: detachable like cms_config_ini_path
|
||||
|
||||
|
||||
@@ -92,15 +92,15 @@ feature -- Query
|
||||
|
||||
feature -- Access: Theme
|
||||
|
||||
modules_location: PATH
|
||||
-- Path to modules.
|
||||
|
||||
themes_location: PATH
|
||||
-- Path to themes.
|
||||
|
||||
theme_location: PATH
|
||||
-- Path to a active theme.
|
||||
|
||||
theme_assets_location: PATH
|
||||
-- Path to a active theme assets folder.
|
||||
|
||||
theme_information_location: PATH
|
||||
-- Active theme informations.
|
||||
do
|
||||
|
||||
@@ -152,11 +152,8 @@ feature -- Query: module
|
||||
-- Enabled module typed `a_type', if any.
|
||||
--| usage: if attached module ({FOO_MODULE}) as mod then ...
|
||||
local
|
||||
-- t: STRING_8
|
||||
l_type: TYPE [detachable CMS_MODULE]
|
||||
do
|
||||
-- t := type_name_without_annotation (a_type)
|
||||
|
||||
across
|
||||
setup.modules as ic
|
||||
until
|
||||
@@ -173,8 +170,6 @@ feature -- Query: module
|
||||
attached a_type.attempt (Result) and then attached l_type.generating_type.attempt (a_type)
|
||||
then
|
||||
-- Found
|
||||
-- elseif t.same_string (type_name_without_annotation (l_type)) then
|
||||
-- -- Found
|
||||
else
|
||||
Result := Void
|
||||
end
|
||||
@@ -322,55 +317,41 @@ feature {NONE}-- Implemenation
|
||||
internal_user_api: detachable like user_api
|
||||
-- Cached value for `user_api'.
|
||||
|
||||
type_name_without_annotation (a_type: TYPE [detachable ANY]): STRING
|
||||
-- Type name for `a_type, without any annotation.
|
||||
-- Used by `module' to search by type.
|
||||
local
|
||||
i,j,n: INTEGER
|
||||
c: CHARACTER
|
||||
feature -- Environment/ theme
|
||||
|
||||
theme_location: PATH
|
||||
-- Active theme location.
|
||||
do
|
||||
create Result.make_from_string (a_type.name)
|
||||
from
|
||||
i := 1
|
||||
n := Result.count
|
||||
until
|
||||
i > n
|
||||
loop
|
||||
c := Result[i]
|
||||
if c = '!' or c = '?' then
|
||||
Result.remove (i)
|
||||
n := n - 1
|
||||
elseif c.is_lower then
|
||||
j := Result.index_of (' ', i + 1)
|
||||
if j > 0 then
|
||||
Result.remove_substring (i, j)
|
||||
n := n - (j - i)
|
||||
end
|
||||
else
|
||||
i := i + 1
|
||||
end
|
||||
end
|
||||
if Result.starts_with ("!") or Result.starts_with ("?") then
|
||||
Result.remove_head (1)
|
||||
elseif Result.starts_with ("detachable ") then
|
||||
Result.remove_head (11)
|
||||
end
|
||||
Result := setup.theme_location
|
||||
end
|
||||
|
||||
feature -- Environment
|
||||
theme_assets_location: PATH
|
||||
-- assets (js, css, images, etc).
|
||||
do
|
||||
debug ("refactor_fixme")
|
||||
fixme ("Check if we really need it")
|
||||
end
|
||||
-- Check how to get this path from the CMS_THEME information.
|
||||
Result := theme_location.extended ("assets")
|
||||
end
|
||||
|
||||
module_configuration (a_module_name: READABLE_STRING_GENERAL; a_name: detachable READABLE_STRING_GENERAL): detachable CONFIG_READER
|
||||
feature -- Environment/ module
|
||||
|
||||
module_configuration_by_name (a_module_name: READABLE_STRING_GENERAL; a_name: detachable READABLE_STRING_GENERAL): detachable CONFIG_READER
|
||||
-- Configuration reader for `a_module', and if `a_name' is set, using name `a_name'.
|
||||
local
|
||||
p, l_path: PATH
|
||||
p, l_path: detachable PATH
|
||||
l_name: READABLE_STRING_GENERAL
|
||||
ut: FILE_UTILITIES
|
||||
do
|
||||
p := setup.environment.config_path.extended ("modules").extended (a_module_name)
|
||||
if a_name = Void then
|
||||
p := p.extended (a_module_name)
|
||||
l_name := a_module_name
|
||||
else
|
||||
p := p.extended (a_name)
|
||||
l_name := a_name
|
||||
end
|
||||
|
||||
p := module_location_by_name (a_module_name).extended ("config").extended (l_name)
|
||||
|
||||
l_path := p.appended_with_extension ("json")
|
||||
if ut.file_path_exists (l_path) then
|
||||
create {JSON_CONFIG} Result.make_from_file (l_path)
|
||||
@@ -382,7 +363,7 @@ feature -- Environment
|
||||
end
|
||||
if Result = Void and a_name /= Void then
|
||||
-- Use sub config from default?
|
||||
if attached {CONFIG_READER} module_configuration (a_module_name, Void) as cfg then
|
||||
if attached {CONFIG_READER} module_configuration_by_name (a_module_name, Void) as cfg then
|
||||
Result := cfg.sub_config (a_name)
|
||||
else
|
||||
-- Maybe try to use the global cms.ini ?
|
||||
@@ -390,5 +371,64 @@ feature -- Environment
|
||||
end
|
||||
end
|
||||
|
||||
modules_location: PATH
|
||||
-- Directory containing cms modules.
|
||||
do
|
||||
Result := setup.modules_location
|
||||
end
|
||||
|
||||
module_location (a_module: CMS_MODULE): PATH
|
||||
-- Location associated with `a_module'.
|
||||
do
|
||||
Result := module_location_by_name (a_module.name)
|
||||
end
|
||||
|
||||
module_location_by_name (a_module_name: READABLE_STRING_GENERAL): PATH
|
||||
-- Location associated with `a_module_name'.
|
||||
do
|
||||
Result := modules_location.extended (a_module_name)
|
||||
end
|
||||
|
||||
module_resource_location (a_module: CMS_MODULE; a_resource: PATH): PATH
|
||||
-- Location of resource `a_resource' for `a_module'.
|
||||
do
|
||||
--| site/modules/$modname/$a_name.json
|
||||
Result := module_location (a_module).extended_path (a_resource)
|
||||
end
|
||||
|
||||
feature -- Environment/ modules and theme
|
||||
|
||||
module_theme_resource_location (a_module: CMS_MODULE; a_resource: PATH): detachable PATH
|
||||
-- Theme resource location of `a_resource' for module `a_module', if exists.
|
||||
-- By default, located under the module location folder, but could be overriden
|
||||
-- from files located under modules subfolder of active `theme_location'.
|
||||
--| First search in themes/$theme/modules/$a_module.name/$a_resource,
|
||||
--| and if not found then search in
|
||||
--| modules/$a_module_name/$a_resource.
|
||||
local
|
||||
ut: FILE_UTILITIES
|
||||
do
|
||||
-- Check first in selected theme folder.
|
||||
Result := module_theme_location (a_module).extended_path (a_resource)
|
||||
if not ut.file_path_exists (Result) then
|
||||
-- And if not found, look into site/modules/$a_module.name/.... folders.
|
||||
Result := module_resource_location (a_module, a_resource)
|
||||
if not ut.file_path_exists (Result) then
|
||||
Result := Void
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
module_theme_location (a_module: CMS_MODULE): PATH
|
||||
-- Location for overriden files associated with `a_module_name'.
|
||||
do
|
||||
Result := theme_location.extended ("modules").extended (a_module.name)
|
||||
end
|
||||
|
||||
module_configuration (a_module: CMS_MODULE; a_name: detachable READABLE_STRING_GENERAL): detachable CONFIG_READER
|
||||
do
|
||||
Result := module_configuration_by_name (a_module.name, a_name)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
@@ -156,7 +156,7 @@ feature -- Settings: router
|
||||
do
|
||||
api.logger.put_information (generator + ".configure_api_file_handler", Void)
|
||||
|
||||
create fhdl.make_hidden_with_path (setup.theme_assets_location)
|
||||
create fhdl.make_hidden_with_path (api.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
|
||||
@@ -253,7 +253,7 @@ feature -- Execution
|
||||
r: NOT_FOUND_ERROR_CMS_RESPONSE
|
||||
f: WSF_FILE_RESPONSE
|
||||
do
|
||||
p := api.setup.theme_assets_location.extended ("favicon.ico")
|
||||
p := api.theme_assets_location.extended ("favicon.ico")
|
||||
if ut.file_path_exists (p) then
|
||||
create f.make_with_path (p)
|
||||
res.send (f)
|
||||
|
||||
@@ -152,39 +152,6 @@ feature -- API
|
||||
Result := api.formats
|
||||
end
|
||||
|
||||
feature -- Module
|
||||
|
||||
module_resource_path (a_module: CMS_MODULE; a_resource: PATH): detachable PATH
|
||||
-- Resource path of `a_resource' for module `a_module', if resource exists.
|
||||
local
|
||||
rp: PATH
|
||||
ut: FILE_UTILITIES
|
||||
do
|
||||
-- Check first in selected theme folder.
|
||||
rp := module_assets_theme_location (a_module)
|
||||
Result := rp.extended_path (a_resource)
|
||||
if not ut.file_path_exists (Result) then
|
||||
-- And if not found, look into site/modules/$a_module.name/.... folders.
|
||||
rp := module_assets_location (a_module)
|
||||
Result := rp.extended_path (a_resource)
|
||||
if not ut.file_path_exists (Result) then
|
||||
Result := Void
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
module_assets_location (a_module: CMS_MODULE): PATH
|
||||
-- Location for the assets associated with `a_module'.
|
||||
do
|
||||
Result := setup.environment.path.extended ("modules").extended (a_module.name)
|
||||
end
|
||||
|
||||
module_assets_theme_location (a_module: CMS_MODULE): PATH
|
||||
-- Location for the assets associated with `a_module'.
|
||||
do
|
||||
Result := setup.theme_location.extended ("modules").extended (a_module.name)
|
||||
end
|
||||
|
||||
feature -- URL utilities
|
||||
|
||||
is_front: BOOLEAN
|
||||
|
||||
Reference in New Issue
Block a user