From 6ff7a6493c0a16ffcc6f7632b4dae1815b158e65 Mon Sep 17 00:00:00 2001 From: Jocelyn Fiat Date: Wed, 29 Apr 2015 23:01:42 +0200 Subject: [PATCH] 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. --- cms-safe.ecf | 20 +++--- examples/demo/demo-safe.ecf | 5 +- examples/demo/src/ewf_roc_server.e | 66 +++++++++---------- library/app_env/Readme.md | 13 ++++ library/app_env/app_env-safe.ecf | 22 +++++++ library/app_env/app_env.ecf | 22 +++++++ library/{layout => app_env}/license.lic | 0 .../src/application_environment.e} | 4 +- library/app_env/src/application_layout.e | 23 +++++++ .../application_json_configuration_helper.e | 0 .../configuration/database_configuration.e | 0 .../src/configuration/logger_configuration.e | 0 .../src/error/basic_error_handler.e | 0 .../src/error/shared_error.e | 0 .../{layout => app_env}/src/logger/logger.e | 19 ++++-- .../src/logger/logging_facility.e | 0 .../src/logger/shared_logger.e | 4 +- library/layout/Readme.md | 13 ---- library/layout/layout-safe.ecf | 22 +------ library/layout/layout.ecf | 22 +------ .../mysql/persistence_mysql-safe.ecf | 2 +- .../mysql/src/cms_storage_mysql_builder.e | 2 +- .../sqlite/persistence_sqlite-safe.ecf | 2 +- .../sqlite/src/cms_storage_sqlite_builder.e | 4 +- modules/README.md | 1 + src/configuration/cms_default_setup.e | 12 ++-- .../{cms_layout.e => cms_environment.e} | 7 +- src/configuration/cms_setup.e | 15 +++-- src/modules/cms_debug_module.e | 43 +++++++----- src/modules/node/node_module.e | 3 +- src/service/cms_api.e | 4 +- src/service/cms_service.e | 8 +-- src/service/response/cms_response.e | 2 +- src/theme/cms_theme.e | 8 +++ 34 files changed, 214 insertions(+), 154 deletions(-) create mode 100644 library/app_env/Readme.md create mode 100644 library/app_env/app_env-safe.ecf create mode 100644 library/app_env/app_env.ecf rename library/{layout => app_env}/license.lic (100%) rename library/{layout/src/application_layout.e => app_env/src/application_environment.e} (98%) create mode 100644 library/app_env/src/application_layout.e rename library/{layout => app_env}/src/configuration/application_json_configuration_helper.e (100%) rename library/{layout => app_env}/src/configuration/database_configuration.e (100%) rename library/{layout => app_env}/src/configuration/logger_configuration.e (100%) rename library/{layout => app_env}/src/error/basic_error_handler.e (100%) rename library/{layout => app_env}/src/error/shared_error.e (100%) rename library/{layout => app_env}/src/logger/logger.e (91%) rename library/{layout => app_env}/src/logger/logging_facility.e (100%) rename library/{layout => app_env}/src/logger/shared_logger.e (95%) delete mode 100644 library/layout/Readme.md create mode 100644 modules/README.md rename src/configuration/{cms_layout.e => cms_environment.e} (91%) diff --git a/cms-safe.ecf b/cms-safe.ecf index 3cabebe..046edc8 100644 --- a/cms-safe.ecf +++ b/cms-safe.ecf @@ -2,6 +2,11 @@ + + /EIFGENs$ + /CVS$ + /.svn$ + @@ -11,22 +16,17 @@ - - + - - - - /EIFGENs$ - /CVS$ - /.svn$ - - + + + + diff --git a/examples/demo/demo-safe.ecf b/examples/demo/demo-safe.ecf index ed0a235..9ff0b14 100644 --- a/examples/demo/demo-safe.ecf +++ b/examples/demo/demo-safe.ecf @@ -1,5 +1,6 @@ + Example/demo for Eiffel ROC CMS library /EIFGENs$ @@ -12,10 +13,10 @@ - + + - diff --git a/examples/demo/src/ewf_roc_server.e b/examples/demo/src/ewf_roc_server.e index 8330042..c78e2b6 100644 --- a/examples/demo/src/ewf_roc_server.e +++ b/examples/demo/src/ewf_roc_server.e @@ -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 diff --git a/library/app_env/Readme.md b/library/app_env/Readme.md new file mode 100644 index 0000000..8b1c42a --- /dev/null +++ b/library/app_env/Readme.md @@ -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/ diff --git a/library/app_env/app_env-safe.ecf b/library/app_env/app_env-safe.ecf new file mode 100644 index 0000000..462c9c3 --- /dev/null +++ b/library/app_env/app_env-safe.ecf @@ -0,0 +1,22 @@ + + + Application Environment (layout, configuration, logger, database, ...) + + + + + + + + + + + /EIFGENs$ + /CVS$ + /.svn$ + + + + diff --git a/library/app_env/app_env.ecf b/library/app_env/app_env.ecf new file mode 100644 index 0000000..f7c8062 --- /dev/null +++ b/library/app_env/app_env.ecf @@ -0,0 +1,22 @@ + + + Application Environment (layout, configuration, logger, database, ...) + + + + + + + + + + + /EIFGENs$ + /CVS$ + /.svn$ + + + + diff --git a/library/layout/license.lic b/library/app_env/license.lic similarity index 100% rename from library/layout/license.lic rename to library/app_env/license.lic diff --git a/library/layout/src/application_layout.e b/library/app_env/src/application_environment.e similarity index 98% rename from library/layout/src/application_layout.e rename to library/app_env/src/application_environment.e index 6846ede..fa897b2 100644 --- a/library/layout/src/application_layout.e +++ b/library/app_env/src/application_environment.e @@ -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 diff --git a/library/app_env/src/application_layout.e b/library/app_env/src/application_layout.e new file mode 100644 index 0000000..32731ce --- /dev/null +++ b/library/app_env/src/application_layout.e @@ -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 diff --git a/library/layout/src/configuration/application_json_configuration_helper.e b/library/app_env/src/configuration/application_json_configuration_helper.e similarity index 100% rename from library/layout/src/configuration/application_json_configuration_helper.e rename to library/app_env/src/configuration/application_json_configuration_helper.e diff --git a/library/layout/src/configuration/database_configuration.e b/library/app_env/src/configuration/database_configuration.e similarity index 100% rename from library/layout/src/configuration/database_configuration.e rename to library/app_env/src/configuration/database_configuration.e diff --git a/library/layout/src/configuration/logger_configuration.e b/library/app_env/src/configuration/logger_configuration.e similarity index 100% rename from library/layout/src/configuration/logger_configuration.e rename to library/app_env/src/configuration/logger_configuration.e diff --git a/library/layout/src/error/basic_error_handler.e b/library/app_env/src/error/basic_error_handler.e similarity index 100% rename from library/layout/src/error/basic_error_handler.e rename to library/app_env/src/error/basic_error_handler.e diff --git a/library/layout/src/error/shared_error.e b/library/app_env/src/error/shared_error.e similarity index 100% rename from library/layout/src/error/shared_error.e rename to library/app_env/src/error/shared_error.e diff --git a/library/layout/src/logger/logger.e b/library/app_env/src/logger/logger.e similarity index 91% rename from library/layout/src/logger/logger.e rename to library/app_env/src/logger/logger.e index 3e50e72..2a77068 100644 --- a/library/layout/src/logger/logger.e +++ b/library/app_env/src/logger/logger.e @@ -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 diff --git a/library/layout/src/logger/logging_facility.e b/library/app_env/src/logger/logging_facility.e similarity index 100% rename from library/layout/src/logger/logging_facility.e rename to library/app_env/src/logger/logging_facility.e diff --git a/library/layout/src/logger/shared_logger.e b/library/app_env/src/logger/shared_logger.e similarity index 95% rename from library/layout/src/logger/shared_logger.e rename to library/app_env/src/logger/shared_logger.e index 8d32052..1c05aba 100644 --- a/library/layout/src/logger/shared_logger.e +++ b/library/app_env/src/logger/shared_logger.e @@ -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 diff --git a/library/layout/Readme.md b/library/layout/Readme.md deleted file mode 100644 index 3db66b3..0000000 --- a/library/layout/Readme.md +++ /dev/null @@ -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/ \ No newline at end of file diff --git a/library/layout/layout-safe.ecf b/library/layout/layout-safe.ecf index 5d11424..4277dde 100644 --- a/library/layout/layout-safe.ecf +++ b/library/layout/layout-safe.ecf @@ -1,21 +1,3 @@ - - - - - - - - - - - - /EIFGENs$ - /CVS$ - /.svn$ - - - - + + diff --git a/library/layout/layout.ecf b/library/layout/layout.ecf index 447d64e..4c9e4fc 100644 --- a/library/layout/layout.ecf +++ b/library/layout/layout.ecf @@ -1,21 +1,3 @@ - - - - - - - - - - - - /EIFGENs$ - /CVS$ - /.svn$ - - - - + + diff --git a/library/persistence/mysql/persistence_mysql-safe.ecf b/library/persistence/mysql/persistence_mysql-safe.ecf index 43e48a5..77f0d6b 100644 --- a/library/persistence/mysql/persistence_mysql-safe.ecf +++ b/library/persistence/mysql/persistence_mysql-safe.ecf @@ -8,11 +8,11 @@ + - diff --git a/library/persistence/mysql/src/cms_storage_mysql_builder.e b/library/persistence/mysql/src/cms_storage_mysql_builder.e index 943e1af..4889f73 100644 --- a/library/persistence/mysql/src/cms_storage_mysql_builder.e +++ b/library/persistence/mysql/src/cms_storage_mysql_builder.e @@ -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) diff --git a/library/persistence/sqlite/persistence_sqlite-safe.ecf b/library/persistence/sqlite/persistence_sqlite-safe.ecf index 8d3d9ec..ea2d754 100644 --- a/library/persistence/sqlite/persistence_sqlite-safe.ecf +++ b/library/persistence/sqlite/persistence_sqlite-safe.ecf @@ -8,11 +8,11 @@ + - diff --git a/library/persistence/sqlite/src/cms_storage_sqlite_builder.e b/library/persistence/sqlite/src/cms_storage_sqlite_builder.e index 01b4241..0e94aaa 100644 --- a/library/persistence/sqlite/src/cms_storage_sqlite_builder.e +++ b/library/persistence/sqlite/src/cms_storage_sqlite_builder.e @@ -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 diff --git a/modules/README.md b/modules/README.md new file mode 100644 index 0000000..167ed85 --- /dev/null +++ b/modules/README.md @@ -0,0 +1 @@ +Location for contributed CMS modules. diff --git a/src/configuration/cms_default_setup.e b/src/configuration/cms_default_setup.e index 95fc661..2bc235d 100644 --- a/src/configuration/cms_default_setup.e +++ b/src/configuration/cms_default_setup.e @@ -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 diff --git a/src/configuration/cms_layout.e b/src/configuration/cms_environment.e similarity index 91% rename from src/configuration/cms_layout.e rename to src/configuration/cms_environment.e index 5c0e23d..2feeceb 100644 --- a/src/configuration/cms_layout.e +++ b/src/configuration/cms_environment.e @@ -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, diff --git a/src/configuration/cms_setup.e b/src/configuration/cms_setup.e index 16fb594..792f84e 100644 --- a/src/configuration/cms_setup.e +++ b/src/configuration/cms_setup.e @@ -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) diff --git a/src/modules/cms_debug_module.e b/src/modules/cms_debug_module.e index 4be4e28..fc23343 100644 --- a/src/modules/cms_debug_module.e +++ b/src/modules/cms_debug_module.e @@ -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 ("
") 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 ("
") - 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 ("
") append_info_to ("Theme", api.setup.theme_name, r, s) append_info_to ("Theme location", api.setup.themes_location.utf_8_name, r, s) diff --git a/src/modules/node/node_module.e b/src/modules/node/node_module.e index 5ca00ec..ba6ca2d 100644 --- a/src/modules/node/node_module.e +++ b/src/modules/node/node_module.e @@ -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] diff --git a/src/service/cms_api.e b/src/service/cms_api.e index cbfb7f7..befdb1f 100644 --- a/src/service/cms_api.e +++ b/src/service/cms_api.e @@ -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 diff --git a/src/service/cms_service.e b/src/service/cms_service.e index af717c0..7153654 100644 --- a/src/service/cms_service.e +++ b/src/service/cms_service.e @@ -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 diff --git a/src/service/response/cms_response.e b/src/service/response/cms_response.e index e6e524f..bbd8382 100644 --- a/src/service/response/cms_response.e +++ b/src/service/response/cms_response.e @@ -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 diff --git a/src/theme/cms_theme.e b/src/theme/cms_theme.e index 8093433..d90c625 100644 --- a/src/theme/cms_theme.e +++ b/src/theme/cms_theme.e @@ -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