Simplify CMS_SERVICE initialization, and CMS server (launcher).

Renamed "layout" lib as "app_env" with APPLICATION_ENVIRONMENT interface.
  applied changed to callers.
Added CMS_THEME.has_region (a_name): BOOLEAN to know if a region is declared in a defined theme.
This commit is contained in:
2015-04-29 23:01:42 +02:00
parent 0eb2b70d0f
commit 6ff7a6493c
34 changed files with 214 additions and 154 deletions

View File

@@ -2,6 +2,11 @@
<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="cms" uuid="8CC0D052-57D1-4CAA-AFF1-448FA290734B" library_target="cms">
<target name="cms">
<root all_classes="true"/>
<file_rule>
<exclude>/EIFGENs$</exclude>
<exclude>/CVS$</exclude>
<exclude>/.svn$</exclude>
</file_rule>
<option warning="true" full_class_checking="false" is_attached_by_default="true" void_safety="all" syntax="transitional">
<assertions precondition="true" postcondition="true" check="true" invariant="true" loop="true" supplier_precondition="true"/>
</option>
@@ -11,22 +16,17 @@
<library name="encoder" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\text\encoder\encoder-safe.ecf" readonly="false"/>
<library name="error" location="$ISE_LIBRARY\contrib\library\utility\general\error\error-safe.ecf"/>
<library name="http" location="$ISE_LIBRARY\contrib\library\network\protocol\http\http-safe.ecf"/>
<library name="http_authorization" location="$ISE_LIBRARY\contrib\library\network\authentication\http_authorization\http_authorization-safe.ecf" readonly="false"/>
<library name="json" location="$ISE_LIBRARY\contrib\library\text\parser\json\library\json-safe.ecf" readonly="false"/>
<library name="layout" location=".\library\layout\layout-safe.ecf"/>
<library name="cms_app_env" location=".\library\app_env\app_env-safe.ecf"/>
<library name="cms_model" location=".\library\model\cms_model-safe.ecf" readonly="false"/>
<library name="smarty" location="$ISE_LIBRARY\contrib\library\text\template\smarty\smarty-safe.ecf" readonly="false"/>
<library name="text_filter" location="$ISE_LIBRARY\unstable\library\text\text_filter\text_filter-safe.ecf"/>
<library name="time" location="$ISE_LIBRARY\library\time\time-safe.ecf"/>
<library name="wsf" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\wsf-safe.ecf"/>
<library name="wsf_extension" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\wsf_extension-safe.ecf" readonly="false"/>
<library name="wsf_html" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf_html\wsf_html-safe.ecf" readonly="false"/>
<cluster name="src" location=".\src\" recursive="true">
<file_rule>
<exclude>/EIFGENs$</exclude>
<exclude>/CVS$</exclude>
<exclude>/.svn$</exclude>
</file_rule>
</cluster>
<library name="wsf_extension" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\wsf_extension-safe.ecf" readonly="false"/>
<library name="http_authorization" location="$ISE_LIBRARY\contrib\library\network\authentication\http_authorization\http_authorization-safe.ecf" readonly="false"/>
<cluster name="modules" location=".\modules\" recursive="true"/>
<cluster name="src" location=".\src\" recursive="true"/>
</target>
</system>

View File

@@ -1,5 +1,6 @@
<?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">
<description>Example/demo for Eiffel ROC CMS library</description>
<target name="common" abstract="true">
<file_rule>
<exclude>/EIFGENs$</exclude>
@@ -12,10 +13,10 @@
<setting name="concurrency" value="none"/>
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
<library name="cms" location="..\..\cms-safe.ecf" readonly="false"/>
<library name="cms_demo_module" location="modules\demo\cms_demo_module-safe.ecf" readonly="false"/>
<library name="cms_app_env" location="..\..\library\app_env\app_env-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="layout" location="..\..\library\layout\layout-safe.ecf" readonly="false"/>
<!--
<library name="persistence_mysql" location="..\..\library\persistence\mysql\persistence_mysql-safe.ecf" readonly="false"/>
-->

View File

@@ -41,26 +41,24 @@ feature {NONE} -- Initialization
initialize
-- Initialize current service.
do
-- Launcher
Precursor
create {WSF_SERVICE_LAUNCHER_OPTIONS_FROM_INI} service_options.make_from_file ("demo.ini")
initialize_cms (cms_setup)
-- CMS
initialize_cms
end
feature -- Service
cms_service: CMS_SERVICE
-- cms service.
-- cms service.
execute (req: WSF_REQUEST; res: WSF_RESPONSE)
do
cms_service.execute (req, res)
end
feature -- Layout
layout: CMS_LAYOUT
-- cms layout.
feature {NONE} -- Launch operation
launcher: APPLICATION_LAUNCHER
@@ -91,7 +89,7 @@ feature {NONE} -- Launch operation
l_message.append ("The application crash without available information")
l_message.append ("%N%N")
end
-- send email shutdown
-- notify shutdown
write_debug_log (generator + ".launch shutdown")
end
rescue
@@ -101,31 +99,31 @@ feature {NONE} -- Launch operation
feature -- CMS Initialization
cms_setup: CMS_DEFAULT_SETUP
initialize_cms
local
l_setup: CMS_DEFAULT_SETUP
utf: UTF_CONVERTER
cms_env: CMS_ENVIRONMENT
do
if attached execution_environment.arguments.separate_character_option_value ('d') as l_dir then
create layout.make_with_directory_name (l_dir)
else
create layout.make_default
end
initialize_logger (layout)
write_debug_log (generator + ".cms_setup based directory %"" + utf.escaped_utf_32_string_to_utf_8_string_8 (layout.path.name) + "%"")
create Result.make (layout)
setup_storage (Result)
end
write_debug_log (generator + ".initialize_cms / Environment")
initialize_cms (a_setup: CMS_SETUP)
local
cms: CMS_SERVICE
api: CMS_API
do
write_debug_log (generator + ".initialize_cms")
setup_modules (a_setup)
create api.make (a_setup)
create cms.make (api)
cms_service := cms
-- Application Environment initialization
if attached execution_environment.arguments.separate_character_option_value ('d') as l_dir then
create cms_env.make_with_directory_name (l_dir)
else
create cms_env.make_default
end
initialize_logger (cms_env)
-- CMS Setup
write_debug_log (generator + ".initialize_cms / SETUP based directory=%"" + utf.escaped_utf_32_string_to_utf_8_string_8 (cms_env.path.name) + "%"")
create l_setup.make (cms_env)
-- CMS
write_debug_log (generator + ".initialize_cms / CMS")
setup_storage (l_setup)
setup_modules (l_setup)
create cms_service.make (l_setup)
end
feature -- CMS setup
@@ -141,6 +139,10 @@ feature -- CMS setup
a_setup.register_module (m)
end
create {CMS_DEBUG_MODULE} m.make
m.enable
a_setup.register_module (m)
create {CMS_DEMO_MODULE} m.make
m.enable
a_setup.register_module (m)
@@ -151,11 +153,9 @@ feature -- CMS setup
end
setup_storage (a_setup: CMS_SETUP)
-- Setup storage by declaring storage builder.
do
debug ("refactor_fixme")
to_implement ("To implement custom storage")
end
-- a_setup.storage_drivers.force (create {CMS_STORAGE_MYSQL_BUILDER}.make, "mysql")
a_setup.storage_drivers.force (create {CMS_STORAGE_MYSQL_BUILDER}.make, "mysql")
a_setup.storage_drivers.force (create {CMS_STORAGE_SQLITE_BUILDER}.make, "sqlite")
end

13
library/app_env/Readme.md Normal file
View File

@@ -0,0 +1,13 @@
Application Environment Library
===============================
Define a generic application environment to be re-used by different applications.
site/
doc/
logs/
www/
assets
template
theme
config/

View File

@@ -0,0 +1,22 @@
<?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="app_env" uuid="7AE9E48B-5A15-43F8-B99A-04F4185DED6B" library_target="app_env">
<description>Application Environment (layout, configuration, logger, database, ...)</description>
<target name="app_env">
<root all_classes="true"/>
<option warning="true" void_safety="all">
<assertions precondition="true" postcondition="true" check="true" invariant="true" loop="true" supplier_precondition="true"/>
</option>
<setting name="console_application" value="true"/>
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
<library name="json" location="$ISE_LIBRARY\contrib\library\text\parser\json\library\json-safe.ecf" readonly="false"/>
<library name="logging" location="$ISE_LIBRARY\library\runtime\logging\logging-safe.ecf"/>
<library name="thread" location="$ISE_LIBRARY\library\thread\thread-safe.ecf"/>
<cluster name="src" location=".\src\" recursive="true">
<file_rule>
<exclude>/EIFGENs$</exclude>
<exclude>/CVS$</exclude>
<exclude>/.svn$</exclude>
</file_rule>
</cluster>
</target>
</system>

View File

@@ -0,0 +1,22 @@
<?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="app_env" uuid="7AE9E48B-5A15-43F8-B99A-04F4185DED6B" library_target="app_env">
<description>Application Environment (layout, configuration, logger, database, ...)</description>
<target name="app_env">
<root all_classes="true"/>
<option warning="true" void_safety="none">
<assertions precondition="true" postcondition="true" check="true" invariant="true" loop="true" supplier_precondition="true"/>
</option>
<setting name="console_application" value="true"/>
<library name="base" location="$ISE_LIBRARY\library\base\base.ecf"/>
<library name="json" location="$ISE_LIBRARY\contrib\library\text\parser\json\library\json.ecf" readonly="false"/>
<library name="logging" location="$ISE_LIBRARY\library\runtime\logging\logging.ecf"/>
<library name="thread" location="$ISE_LIBRARY\library\thread\thread.ecf"/>
<cluster name="src" location=".\src\" recursive="true">
<file_rule>
<exclude>/EIFGENs$</exclude>
<exclude>/CVS$</exclude>
<exclude>/.svn$</exclude>
</file_rule>
</cluster>
</target>
</system>

View File

@@ -1,6 +1,6 @@
note
description: "[
Application layout
Application environment (layout, ...)
Related to file system locations such as
- configuration locations
- application
@@ -15,7 +15,7 @@ note
revision: "$Revision: 96584 $"
class
APPLICATION_LAYOUT
APPLICATION_ENVIRONMENT
inherit
SHARED_EXECUTION_ENVIRONMENT

View File

@@ -0,0 +1,23 @@
note
description: "See {APPLICATION_ENVIRONMENT}."
date: "$Date$"
revision: "$Revision$"
class
APPLICATION_LAYOUT
obsolete
"Use APPLICATION_ENVIRONMENT [April/2015]"
inherit
APPLICATION_ENVIRONMENT
create
make_default,
make_with_path,
make_with_directory_name
note
copyright: "2011-2015, Javier Velilla, Jocelyn Fiat, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
end

View File

@@ -21,6 +21,7 @@ inherit
create
make,
make_with_environment,
make_with_layout
feature {NONE} -- Initialization
@@ -31,16 +32,24 @@ feature {NONE} -- Initialization
create log.make
end
make_with_layout (app: APPLICATION_LAYOUT)
-- Initialize a logger object with an application layout `app'.
make_with_environment (app: APPLICATION_ENVIRONMENT)
-- Initialize a logger object with an application environment `app'.
do
make
apply_layout (app)
apply_environment (app)
end
make_with_layout (app: APPLICATION_ENVIRONMENT)
-- Initialize a logger object with an application layout `app'.
obsolete
"Use make_with_environment"
do
make_with_environment (app)
end
feature -- Change
apply_layout (app: APPLICATION_LAYOUT)
apply_environment (app: APPLICATION_ENVIRONMENT)
do
initialize_logger (app, log)
end
@@ -89,7 +98,7 @@ feature -- Logging
feature {NONE} -- Implementation
initialize_logger (app: APPLICATION_LAYOUT; a_log: like log)
initialize_logger (app: APPLICATION_ENVIRONMENT; a_log: like log)
local
l_log_writer_file: LOG_ROLLING_WRITER_FILE
l_log_writer: LOG_WRITER

View File

@@ -98,11 +98,11 @@ feature {NONE} -- Logger: separate implementation
feature {NONE} -- Implementation
initialize_logger (app: APPLICATION_LAYOUT)
initialize_logger (app: APPLICATION_ENVIRONMENT)
local
l_logger: LOGGER
do
create l_logger.make_with_layout (app)
create l_logger.make_with_environment (app)
set_logger_to (l_logger, logger_cell)
end

View File

@@ -1,13 +0,0 @@
Layout Library
==============
Define a generic layout to be re-used by different applications.
site/
doc/
logs/
www/
assets
template
theme
config/

View File

@@ -1,21 +1,3 @@
<?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="layout" uuid="7AE9E48B-5A15-43F8-B99A-04F4185DED6B" library_target="layout">
<target name="layout">
<root all_classes="true"/>
<option warning="true" void_safety="all">
<assertions precondition="true" postcondition="true" check="true" invariant="true" loop="true" supplier_precondition="true"/>
</option>
<setting name="console_application" value="true"/>
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
<library name="json" location="$ISE_LIBRARY\contrib\library\text\parser\json\library\json-safe.ecf" readonly="false"/>
<library name="logging" location="$ISE_LIBRARY\library\runtime\logging\logging-safe.ecf"/>
<library name="thread" location="$ISE_LIBRARY\library\thread\thread-safe.ecf"/>
<cluster name="src" location=".\src\" recursive="true">
<file_rule>
<exclude>/EIFGENs$</exclude>
<exclude>/CVS$</exclude>
<exclude>/.svn$</exclude>
</file_rule>
</cluster>
</target>
</system>
<redirection 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" uuid="7AE9E48B-5A15-43F8-B99A-04F4185DED6B" location="..\app_env\app_env-safe.ecf">
</redirection>

View File

@@ -1,21 +1,3 @@
<?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="layout" uuid="7AE9E48B-5A15-43F8-B99A-04F4185DED6B" library_target="layout">
<target name="layout">
<root all_classes="true"/>
<option warning="true" void_safety="none">
<assertions precondition="true" postcondition="true" check="true" invariant="true" loop="true" supplier_precondition="true"/>
</option>
<setting name="console_application" value="true"/>
<library name="base" location="$ISE_LIBRARY\library\base\base.ecf"/>
<library name="json" location="$ISE_LIBRARY\contrib\library\text\parser\json\library\json.ecf" readonly="false"/>
<library name="logging" location="$ISE_LIBRARY\library\runtime\logging\logging.ecf"/>
<library name="thread" location="$ISE_LIBRARY\library\thread\thread.ecf"/>
<cluster name="src" location=".\src\" recursive="true">
<file_rule>
<exclude>/EIFGENs$</exclude>
<exclude>/CVS$</exclude>
<exclude>/.svn$</exclude>
</file_rule>
</cluster>
</target>
</system>
<redirection 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" uuid="7AE9E48B-5A15-43F8-B99A-04F4185DED6B" location="..\app_env\app_env.ecf">
</redirection>

View File

@@ -8,11 +8,11 @@
<setting name="console_application" value="true"/>
<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="..\..\app_env\app_env-safe.ecf"/>
<library name="crypto" location="$ISE_LIBRARY\unstable\library\text\encryption\crypto\crypto-safe.ecf"/>
<library name="encoder" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\text\encoder\encoder-safe.ecf"/>
<library name="error" location="$ISE_LIBRARY\contrib\library\utility\general\error\error-safe.ecf"/>
<library name="json" location="$ISE_LIBRARY\contrib\library\text\parser\json\library\json-safe.ecf" readonly="false"/>
<library name="layout" location="..\..\layout\layout-safe.ecf"/>
<library name="logging" location="$ISE_LIBRARY\library\runtime\logging\logging-safe.ecf"/>
<library name="model" location="..\..\model\cms_model-safe.ecf"/>
<library name="mysql" location="$ISE_LIBRARY\library\store\dbms\rdbms\mysql\mysql-safe.ecf"/>

View File

@@ -28,7 +28,7 @@ feature -- Factory
local
conn: DATABASE_CONNECTION
do
if attached (create {APPLICATION_JSON_CONFIGURATION_HELPER}).new_database_configuration (a_setup.layout.application_config_path) as l_database_config then
if attached (create {APPLICATION_JSON_CONFIGURATION_HELPER}).new_database_configuration (a_setup.environment.application_config_path) as l_database_config then
create {DATABASE_CONNECTION_MYSQL} conn.login_with_connection_string (l_database_config.connection_string)
if conn.is_connected then
create Result.make (conn)

View File

@@ -8,11 +8,11 @@
<setting name="console_application" value="true"/>
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
<library name="cms" location="..\..\..\cms-safe.ecf"/>
<library name="cms_app_env" location="..\..\app_env\app_env-safe.ecf"/>
<library name="crypto" location="$ISE_LIBRARY\unstable\library\text\encryption\crypto\crypto-safe.ecf"/>
<library name="encoder" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\text\encoder\encoder-safe.ecf"/>
<library name="error" location="$ISE_LIBRARY\contrib\library\utility\general\error\error-safe.ecf"/>
<library name="json" location="$ISE_LIBRARY\contrib\library\text\parser\json\library\json-safe.ecf" readonly="false"/>
<library name="layout" location="..\..\layout\layout-safe.ecf"/>
<library name="logging" location="$ISE_LIBRARY\library\runtime\logging\logging-safe.ecf"/>
<library name="model" location="..\..\model\cms_model-safe.ecf"/>
<library name="odbc" location="$ISE_LIBRARY\library\store\dbms\rdbms\odbc\odbc-safe.ecf"/>

View File

@@ -28,7 +28,7 @@ feature -- Factory
local
s: STRING
do
if attached (create {APPLICATION_JSON_CONFIGURATION_HELPER}).new_database_configuration (a_setup.layout.application_config_path) as l_database_config then
if attached (create {APPLICATION_JSON_CONFIGURATION_HELPER}).new_database_configuration (a_setup.environment.application_config_path) as l_database_config then
s := "Driver=SQLite3 ODBC Driver;Database="
if attached l_database_config.database_name as db_name then
s.append (db_name)
@@ -50,7 +50,7 @@ feature -- Factory
r: CMS_USER_ROLE
do
-- Schema
a_storage.sql_execute_file_script (a_setup.layout.path.extended ("scripts").extended ("core.sql"))
a_storage.sql_execute_file_script (a_setup.environment.path.extended ("scripts").extended ("core.sql"))
-- Data
-- Users

1
modules/README.md Normal file
View File

@@ -0,0 +1 @@
Location for contributed CMS modules.

View File

@@ -18,11 +18,11 @@ create
feature {NONE} -- Initialization
make (a_layout: CMS_LAYOUT)
-- Create a default setup with `a_layout'.
make (a_env: CMS_ENVIRONMENT)
-- Create a default setup with `a_env'.
do
layout := a_layout
create {INI_CONFIG} configuration.make_from_file (layout.cms_config_ini_path)
environment := a_env
create {INI_CONFIG} configuration.make_from_file (a_env.cms_config_ini_path)
initialize
end
@@ -61,14 +61,14 @@ feature {NONE} -- Initialization
if attached text_item ("themes-dir") as s then
create themes_location.make_from_string (s)
else
themes_location := layout.www_path.extended ("themes")
themes_location := environment.www_path.extended ("themes")
end
-- Selected theme's name
theme_name := text_item_or_default ("theme", "default")
debug ("refactor_fixme")
fixme ("Review export clause for configuration and layout")
fixme ("Review export clause for configuration and environment")
end
compute_theme_location

View File

@@ -1,6 +1,6 @@
note
description: "[
CMS Layout providing file system locations for
CMS Environment providing file system locations for
- config
- application
- logs
@@ -11,11 +11,10 @@ note
revision: "$Revision: 96797 $"
class
CMS_LAYOUT
CMS_ENVIRONMENT
inherit
APPLICATION_LAYOUT
APPLICATION_ENVIRONMENT
create
make_default,

View File

@@ -1,6 +1,6 @@
note
description: "[
Class that enable to set basic configuration, application layout, core modules and themes.
Class that enable to set basic configuration, application environment, core modules and themes.
]"
date: "$Date: 2015-02-13 13:08:13 +0100 (ven., 13 févr. 2015) $"
revision: "$Revision: 96616 $"
@@ -13,8 +13,15 @@ inherit
feature -- Access
layout: CMS_LAYOUT
-- CMS layout.
environment: CMS_ENVIRONMENT
-- CMS environment.
layout: CMS_ENVIRONMENT
-- CMS environment.
obsolete "use `environment' [april-2015]"
do
Result := environment
end
enabled_modules: CMS_MODULE_COLLECTION
-- List of enabled modules.
@@ -122,7 +129,7 @@ feature -- Access: storage
if not retried then
to_implement ("Refactor database setup")
if
attached (create {APPLICATION_JSON_CONFIGURATION_HELPER}).new_database_configuration (layout.application_config_path) as l_database_config and then
attached (create {APPLICATION_JSON_CONFIGURATION_HELPER}).new_database_configuration (environment.application_config_path) as l_database_config and then
attached storage_drivers.item (l_database_config.driver) as l_builder
then
Result := l_builder.storage (Current)

View File

@@ -12,7 +12,7 @@ inherit
register_hooks
end
-- CMS_HOOK_BLOCK
CMS_HOOK_BLOCK
CMS_HOOK_AUTO_REGISTER
@@ -49,23 +49,30 @@ feature -- Hooks configuration
-- Module hooks configuration.
do
auto_subscribe_to_hooks (a_response)
-- a_response.subscribe_to_block_hook (Current)
a_response.subscribe_to_block_hook (Current)
end
feature -- Hooks
-- block_list: ITERABLE [like {CMS_BLOCK}.name]
-- do
-- Result := <<"debug-info">>
-- end
block_list: ITERABLE [like {CMS_BLOCK}.name]
do
Result := <<"debug-info">>
end
-- get_block_view (a_block_id: READABLE_STRING_8; a_response: CMS_RESPONSE)
-- local
-- b: CMS_CONTENT_BLOCK
-- do
-- create b.make ("debug-info", "Debug", "... ", a_response.formats.plain_text)
-- a_response.add_block (b, Void)
-- end
get_block_view (a_block_id: READABLE_STRING_8; a_response: CMS_RESPONSE)
local
b: CMS_CONTENT_BLOCK
dbg: WSF_DEBUG_INFORMATION
s: STRING
do
if a_response.theme.has_region ("debug") then
create dbg.make
create s.make_empty
dbg.append_information_to (a_response.request, a_response.response, s)
create b.make ("debug-info", "Debug", s, a_response.api.formats.plain_text)
a_response.add_block (b, "footer")
end
end
feature -- Handler
@@ -82,7 +89,7 @@ feature -- Handler
append_info_to ("Name", api.setup.site_name, r, s)
append_info_to ("Url", api.setup.site_url, r, s)
if attached api.setup.layout.cms_config_ini_path as l_loc then
if attached api.setup.environment.cms_config_ini_path as l_loc then
s.append ("<hr/>")
append_info_to ("Configuration file", l_loc.name, r, s)
end
@@ -93,10 +100,10 @@ feature -- Handler
-- append_info_to ("Base url", cms.base_url, r, s)
-- append_info_to ("Script url", cms.script_url, r, s)
s.append ("<hr/>")
append_info_to ("Site dir", api.setup.layout.path.utf_8_name, r, s)
append_info_to ("Www dir", api.setup.layout.www_path.utf_8_name, r, s)
append_info_to ("Assets dir", api.setup.layout.assets_path.utf_8_name, r, s)
append_info_to ("Config dir", api.setup.layout.config_path.utf_8_name, r, s)
append_info_to ("Site dir", api.setup.environment.path.utf_8_name, r, s)
append_info_to ("Www dir", api.setup.environment.www_path.utf_8_name, r, s)
append_info_to ("Assets dir", api.setup.environment.assets_path.utf_8_name, r, s)
append_info_to ("Config dir", api.setup.environment.config_path.utf_8_name, r, s)
s.append ("<hr/>")
append_info_to ("Theme", api.setup.theme_name, r, s)
append_info_to ("Theme location", api.setup.themes_location.utf_8_name, r, s)

View File

@@ -98,7 +98,7 @@ feature {CMS_API} -- Module management
do
-- Schema
if attached {CMS_STORAGE_SQL_I} api.storage as l_sql_storage then
l_sql_storage.sql_execute_file_script (api.setup.layout.path.extended ("scripts").extended (name).appended_with_extension ("sql"))
l_sql_storage.sql_execute_file_script (api.setup.environment.path.extended ("scripts").extended (name).appended_with_extension ("sql"))
end
end
@@ -127,7 +127,6 @@ feature -- Access: router
local
l_node_handler: NODE_HANDLER
l_nodes_handler: NODES_HANDLER
l_methods: WSF_REQUEST_METHODS
l_uri_mapping: WSF_URI_MAPPING
do
-- TODO: for now, focused only on web interface, add REST api later. [2015-April-29]

View File

@@ -246,7 +246,7 @@ feature {NONE}-- Implemenation
internal_user_api: detachable like user_api
-- Cached value for `user_api'.
feature -- Layout
feature -- Environment
module_configuration (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'.
@@ -254,7 +254,7 @@ feature -- Layout
p, l_path: PATH
ut: FILE_UTILITIES
do
p := setup.layout.config_path.extended ("modules").extended (a_module_name)
p := setup.environment.config_path.extended ("modules").extended (a_module_name)
if a_name = Void then
p := p.extended (a_module_name)
else

View File

@@ -41,13 +41,11 @@ create
feature {NONE} -- Initialization
make (a_api: CMS_API)
make (a_setup: CMS_SETUP)
-- Build a CMS service with `a_api'
do
api := a_api
create api.make (a_setup)
initialize
ensure
api_set: api = a_api
end
initialize
@@ -138,7 +136,7 @@ feature -- Settings: router
a_router.handle_with_request_methods ("/theme/", fhdl, router.methods_GET)
create fhdl.make_hidden_with_path (setup.layout.www_path)
create fhdl.make_hidden_with_path (setup.environment.www_path)
fhdl.disable_index
fhdl.set_not_found_handler (agent (ia_uri: READABLE_STRING_8; ia_req: WSF_REQUEST; ia_res: WSF_RESPONSE)
do

View File

@@ -107,7 +107,7 @@ feature -- Module
module_assets_location (a_module: CMS_MODULE): PATH
-- Location for the assets associated with `a_module'.
do
Result := setup.layout.path.extended ("modules").extended (a_module.name)
Result := setup.environment.path.extended ("modules").extended (a_module.name)
end
module_assets_theme_location (a_module: CMS_MODULE): PATH

View File

@@ -33,6 +33,14 @@ feature -- Access
deferred
end
feature -- Status report
has_region (a_region_name: READABLE_STRING_GENERAL): BOOLEAN
-- Current theme has region `a_region_name' declared?
do
Result := across regions as ic some a_region_name.is_case_insensitive_equal (ic.item) end
end
feature -- Conversion
menu_html (a_menu: CMS_MENU; is_horizontal: BOOLEAN; a_options: detachable CMS_HTML_OPTIONS): STRING_8