From db9e40cec4dc4934b0e32fe37859152db4033aaf Mon Sep 17 00:00:00 2001 From: Jocelyn Fiat Date: Wed, 14 Jan 2015 18:25:26 +0100 Subject: [PATCH] Updated CMS_SERVICE to make the cms library complete void-safe. Reviewed configuration related feature. Renamed JSON_CONFIGURATION as APPLICATION_JSON_CONFIGURATION_HELPER to avoid confusion. Updated CMS_DEFAULT_SETUP to use configuration from cms configuration library. Added {CMS_API}.module_configuration (a_module_name: READABLE_STRING_GENERAL; a_name: detachable READABLE_STRING_GENERAL): detachable CONFIG_READER to help getting access to configuration of a module (for now, only json and ini are supported, but in the future, this could support database layer directly) Added CMS_HOOK_BLOCK_HELPER to reuse the template_block (..): ... function. Cosmetic Removed CMS_SETUP.smtp_server since for now, there is no need for such general setting. Add header line "X-ServerEWF-App: CMS" as a simple way to know if request is processed by the CMS. --- cms-safe.ecf | 19 +++--- examples/demo/src/ewf_roc_server.e | 4 +- library/configuration/src/config_reader.e | 2 +- library/configuration/src/ini_config.e | 2 +- library/configuration/src/json_config.e | 2 +- .../tests/test_config_reader_set.e | 2 +- ...> application_json_configuration_helper.e} | 8 +-- .../configuration/database_configuration.e | 8 +-- library/src/configuration/cms_default_setup.e | 64 ++++++++++++++++--- .../configuration/cms_json_configuration.e | 8 +-- library/src/configuration/cms_layout.e | 6 +- library/src/configuration/cms_setup.e | 7 +- library/src/hooks/cms_hook_block_helper.e | 29 +++++++++ .../content/cms_smarty_template_block.e | 13 +++- library/src/modules/cms_debug_module.e | 2 +- .../node/handler/node_content_handler.e | 2 +- .../src/modules/node/handler/node_handler.e | 2 +- .../node/handler/node_summary_handler.e | 2 +- .../modules/node/handler/node_title_handler.e | 2 +- library/src/service/cms_api.e | 41 ++++++++++-- library/src/service/cms_service.e | 6 +- library/src/service/filter/cms_error_filter.e | 2 +- .../response/bad_request_error_cms_response.e | 2 +- library/src/service/response/cms_response.e | 35 ++++++---- .../src/service/response/home_cms_response.e | 4 +- .../internal_server_error_cms_response.e | 2 +- library/src/theme/cms_template.e | 4 +- .../missing_theme/missing_cms_template.e | 1 + .../smarty_theme/smarty_cms_page_template.e | 19 +++--- .../src/theme/smarty_theme/smarty_cms_theme.e | 10 ++- .../string_table_of_string_inspector.e | 17 +++-- 31 files changed, 234 insertions(+), 93 deletions(-) rename library/layout/src/configuration/{json_configuration.e => application_json_configuration_helper.e} (95%) create mode 100644 library/src/hooks/cms_hook_block_helper.e diff --git a/cms-safe.ecf b/cms-safe.ecf index 0f3a885..03e697d 100644 --- a/cms-safe.ecf +++ b/cms-safe.ecf @@ -2,27 +2,26 @@ - - - - + + + + + + - - - - - + + - /EIFGENs$ diff --git a/examples/demo/src/ewf_roc_server.e b/examples/demo/src/ewf_roc_server.e index 989b848..3fb8aca 100644 --- a/examples/demo/src/ewf_roc_server.e +++ b/examples/demo/src/ewf_roc_server.e @@ -2,8 +2,8 @@ note description: "[ application service ]" - date: "$Date$" - revision: "$Revision$" + date: "$Date: 2014-11-20 15:03:29 +0100 (jeu., 20 nov. 2014) $" + revision: "$Revision: 96138 $" class EWF_ROC_SERVER diff --git a/library/configuration/src/config_reader.e b/library/configuration/src/config_reader.e index 7e36ffc..8d4563f 100644 --- a/library/configuration/src/config_reader.e +++ b/library/configuration/src/config_reader.e @@ -1,7 +1,7 @@ note description: "Summary description for {CONFIG_READER}." author: "" - date: "$Date: 2014-12-18 12:37:11 -0300 (ju. 18 de dic. de 2014) $" + date: "$Date: 2014-12-18 16:37:11 +0100 (jeu., 18 déc. 2014) $" revision: "$Revision: 96383 $" deferred class diff --git a/library/configuration/src/ini_config.e b/library/configuration/src/ini_config.e index f94845b..9e9ae06 100644 --- a/library/configuration/src/ini_config.e +++ b/library/configuration/src/ini_config.e @@ -44,7 +44,7 @@ note @include=file-to-include ]" - date: "$Date: 2014-12-18 12:37:11 -0300 (ju. 18 de dic. de 2014) $" + date: "$Date: 2014-12-18 16:37:11 +0100 (jeu., 18 déc. 2014) $" revision: "$Revision: 96383 $" class diff --git a/library/configuration/src/json_config.e b/library/configuration/src/json_config.e index e6f026d..4333d26 100644 --- a/library/configuration/src/json_config.e +++ b/library/configuration/src/json_config.e @@ -1,6 +1,6 @@ note description: "Object parsing a JSON configuration file." - date: "$Date: 2014-12-18 12:37:11 -0300 (ju. 18 de dic. de 2014) $" + date: "$Date: 2014-12-18 16:37:11 +0100 (jeu., 18 déc. 2014) $" revision: "$Revision: 96383 $" class diff --git a/library/configuration/tests/test_config_reader_set.e b/library/configuration/tests/test_config_reader_set.e index bfec54c..b975fe5 100644 --- a/library/configuration/tests/test_config_reader_set.e +++ b/library/configuration/tests/test_config_reader_set.e @@ -3,7 +3,7 @@ note Testing suite for CONFIG_READER . ]" author: "$Author: jfiat $" - date: "$Date: 2014-12-18 12:37:11 -0300 (ju. 18 de dic. de 2014) $" + date: "$Date: 2014-12-18 16:37:11 +0100 (jeu., 18 déc. 2014) $" revision: "$Revision: 96383 $" class diff --git a/library/layout/src/configuration/json_configuration.e b/library/layout/src/configuration/application_json_configuration_helper.e similarity index 95% rename from library/layout/src/configuration/json_configuration.e rename to library/layout/src/configuration/application_json_configuration_helper.e index 0c463d9..992e4bf 100644 --- a/library/layout/src/configuration/json_configuration.e +++ b/library/layout/src/configuration/application_json_configuration_helper.e @@ -1,10 +1,10 @@ note description: "Provide access to json configuration" - date: "$Date: 2014-11-20 15:03:29 +0100 (jeu., 20 nov. 2014) $" - revision: "$Revision: 96138 $" + date: "$Date: 2015-01-14 16:13:47 +0100 (mer., 14 janv. 2015) $" + revision: "$Revision: 96454 $" class - JSON_CONFIGURATION + APPLICATION_JSON_CONFIGURATION_HELPER feature -- Application Configuration @@ -113,7 +113,7 @@ feature {NONE} -- JSON end note - copyright: "2011-2014, Javier Velilla, Jocelyn Fiat, Eiffel Software and others" + 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/database_configuration.e b/library/layout/src/configuration/database_configuration.e index e4441f3..028a5dd 100644 --- a/library/layout/src/configuration/database_configuration.e +++ b/library/layout/src/configuration/database_configuration.e @@ -1,7 +1,7 @@ note description: "Object that represent Database configuration settings" - date: "$Date: 2014-08-20 15:21:15 -0300 (mi., 20 ago. 2014) $" - revision: "$Revision: 95678 $" + date: "$Date: 2015-01-14 16:13:47 +0100 (mer., 14 janv. 2015) $" + revision: "$Revision: 96454 $" class DATABASE_CONFIGURATION @@ -25,10 +25,10 @@ feature {NONE} -- Initialization feature -- Access driver: READABLE_STRING_32 - --Database driver. + --Database driver. database_string: READABLE_STRING_32 - -- Database connection. + -- Database connection. connection_string: READABLE_STRING_32 -- Connection string diff --git a/library/src/configuration/cms_default_setup.e b/library/src/configuration/cms_default_setup.e index 9932313..cad0c09 100644 --- a/library/src/configuration/cms_default_setup.e +++ b/library/src/configuration/cms_default_setup.e @@ -2,8 +2,8 @@ note description: "[ Default CMS_SETUP that can be reused easily, and/or redefined to match specific setup. ]" - date: "$Date: 2014-11-19 20:00:19 +0100 (mer., 19 nov. 2014) $" - revision: "$Revision: 96123 $" + date: "$Date: 2015-01-14 16:13:47 +0100 (mer., 14 janv. 2015) $" + revision: "$Revision: 96454 $" class CMS_DEFAULT_SETUP @@ -22,7 +22,7 @@ feature {NONE} -- Initialization -- Create a default setup with `a_layout'. do layout := a_layout - create configuration.make (layout) + create {INI_CONFIG} configuration.make_from_file (layout.cms_config_ini_path) initialize end @@ -37,13 +37,32 @@ feature {NONE} -- Initialization configure do - site_id := configuration.site_id - site_url := configuration.site_url (Void) - site_name := configuration.site_name ("EWF::CMS") - site_email := configuration.site_email ("webmaster") - themes_location := configuration.themes_location - theme_name := configuration.theme_name ("default") - smtp := configuration.smtp + --| Site id, used to identified a site, this could be set to a uuid, or else + site_id := text_item_or_default ("site.id", "_EWF_CMS_NO_ID_") + + -- Site url: optional, but ending with a slash + site_url := string_8_item ("site_url") + if attached site_url as l_url and then not l_url.is_empty then + if l_url[l_url.count] /= '/' then + site_url := l_url + "/" + end + end + -- Site name + site_name := text_item_or_default ("site.name", "EWF::CMS") + + -- Site email for any internal notification + -- Can be also used to precise the "From:" value for email. + site_email := text_item_or_default ("site.email", "webmaster") + + -- Location for theme folders. + if attached text_item ("themes-dir") as s then + create themes_location.make_from_string (s) + else + themes_location := layout.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") @@ -72,11 +91,36 @@ feature {NONE} -- Initialization register_module (m) end +feature {NONE} -- Configuration + + configuration: CONFIG_READER + -- Association configuration file. + feature -- Access modules: CMS_MODULE_COLLECTION -- + text_item (a_name: READABLE_STRING_GENERAL): detachable READABLE_STRING_32 + -- Configuration value associated with `a_name', if any. + do + Result := configuration.resolved_text_item (a_name) + end + + string_8_item (a_name: READABLE_STRING_GENERAL): detachable READABLE_STRING_8 + -- String 8 configuration value associated with `a_name', if any. + local + utf: UTF_CONVERTER + do + if attached text_item (a_name) as s then + if s.is_valid_as_string_8 then + Result := s.as_string_8 + else + Result := utf.escaped_utf_32_string_to_utf_8_string_8 (s) + end + end + end + is_html: BOOLEAN -- do diff --git a/library/src/configuration/cms_json_configuration.e b/library/src/configuration/cms_json_configuration.e index 5ac35b6..8122eaf 100644 --- a/library/src/configuration/cms_json_configuration.e +++ b/library/src/configuration/cms_json_configuration.e @@ -1,15 +1,15 @@ note description: "Summary description for {CMS_JSON_CONFIGURATION}." - date: "$Date$" - revision: "$Revision$" + date: "$Date: 2015-01-14 16:13:47 +0100 (mer., 14 janv. 2015) $" + revision: "$Revision: 96454 $" class CMS_JSON_CONFIGURATION inherit - JSON_CONFIGURATION - + APPLICATION_JSON_CONFIGURATION_HELPER + feature -- Access is_html_mode (a_path: PATH): BOOLEAN diff --git a/library/src/configuration/cms_layout.e b/library/src/configuration/cms_layout.e index 71bcb59..bd3b290 100644 --- a/library/src/configuration/cms_layout.e +++ b/library/src/configuration/cms_layout.e @@ -7,8 +7,8 @@ note - documentation - themes ]" - date: "$Date$" - revision: "$Revision$" + date: "$Date: 2014-12-18 16:37:11 +0100 (jeu., 18 déc. 2014) $" + revision: "$Revision: 96383 $" class CMS_LAYOUT @@ -38,7 +38,7 @@ feature -- Access end cms_config_ini_path: PATH - -- Database Configuration file path. + -- CMS Configuration file path. local p: detachable PATH do diff --git a/library/src/configuration/cms_setup.e b/library/src/configuration/cms_setup.e index a9ad317..e1218e6 100644 --- a/library/src/configuration/cms_setup.e +++ b/library/src/configuration/cms_setup.e @@ -1,7 +1,7 @@ note description: "Class that enable to set basic configuration, application layout, core modules and themes." - date: "$Date: 2014-12-18 12:47:20 -0300 (ju. 18 de dic. de 2014) $" - revision: "$Revision: 96384 $" + date: "$Date: 2015-01-14 18:12:03 +0100 (mer., 14 janv. 2015) $" + revision: "$Revision: 96456 $" deferred class CMS_SETUP @@ -66,9 +66,6 @@ feature -- Access: Site -- Optional path defining the front page. -- By default "" or "/". - smtp: detachable READABLE_STRING_8 - -- Smtp server - feature -- Query text_item (a_name: READABLE_STRING_GENERAL): detachable READABLE_STRING_32 diff --git a/library/src/hooks/cms_hook_block_helper.e b/library/src/hooks/cms_hook_block_helper.e new file mode 100644 index 0000000..b36e12e --- /dev/null +++ b/library/src/hooks/cms_hook_block_helper.e @@ -0,0 +1,29 @@ +note + description: "Summary description for {CMS_HOOK_BLOCK_HELPER}." + author: "" + date: "$Date: 2015-01-14 16:13:47 +0100 (mer., 14 janv. 2015) $" + revision: "$Revision: 96454 $" + +deferred class + CMS_HOOK_BLOCK_HELPER + +feature -- Factory + + template_block (a_module: CMS_MODULE; a_block_id: READABLE_STRING_8; a_response: CMS_RESPONSE): detachable CMS_SMARTY_TEMPLATE_BLOCK + -- Smarty content block for `a_block_id' in the context of `a_module' and `a_response'. + local + p: detachable PATH + 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 (a_module, p) + if p /= Void then + if attached p.entry as e then + create Result.make (a_block_id, Void, p.parent, e) + else + create Result.make (a_block_id, Void, p.parent, p) + end + end + end + +end diff --git a/library/src/kernel/content/cms_smarty_template_block.e b/library/src/kernel/content/cms_smarty_template_block.e index 3f236a1..51c3b9a 100644 --- a/library/src/kernel/content/cms_smarty_template_block.e +++ b/library/src/kernel/content/cms_smarty_template_block.e @@ -2,8 +2,8 @@ note description: "[ CMS block with smarty template file content. ]" - date: "$Date: 2014-11-14 16:11:17 -0300 (vi. 14 de nov. de 2014) $" - revision: "$Revision: 96092 $" + date: "$Date: 2014-12-05 22:39:27 +0100 (ven., 05 déc. 2014) $" + revision: "$Revision: 96260 $" class CMS_SMARTY_TEMPLATE_BLOCK @@ -115,6 +115,7 @@ feature -- Conversion tpl: detachable TEMPLATE_FILE ut: FILE_UTILITIES n: STRING_32 + l_table_inspector: detachable STRING_TABLE_OF_STRING_INSPECTOR do -- Process html generation p := location @@ -134,8 +135,16 @@ feature -- Conversion tpl.add_value (ic.item, ic.key) end + + create l_table_inspector.register (({detachable STRING_TABLE [STRING_8]}).name) + create l_table_inspector.register (({detachable STRING_TABLE [STRING_32]}).name) + create l_table_inspector.register (({detachable STRING_TABLE [READABLE_STRING_8]}).name) + create l_table_inspector.register (({detachable STRING_TABLE [READABLE_STRING_32]}).name) tpl.analyze tpl.get_output + l_table_inspector.unregister +-- l_table32_inspector.unregister + if attached tpl.output as l_output then Result := l_output else diff --git a/library/src/modules/cms_debug_module.e b/library/src/modules/cms_debug_module.e index 2468f48..4be4e28 100644 --- a/library/src/modules/cms_debug_module.e +++ b/library/src/modules/cms_debug_module.e @@ -1,6 +1,6 @@ note description: "Summary description for {CMS_DEBUG_MODULE}." - date: "$Date: 2014-12-18 12:47:20 -0300 (ju. 18 de dic. de 2014) $" + date: "$Date: 2014-12-18 16:47:20 +0100 (jeu., 18 déc. 2014) $" revision: "$Revision: 96384 $" class diff --git a/library/src/modules/node/handler/node_content_handler.e b/library/src/modules/node/handler/node_content_handler.e index 8d20d3d..9355765 100644 --- a/library/src/modules/node/handler/node_content_handler.e +++ b/library/src/modules/node/handler/node_content_handler.e @@ -1,6 +1,6 @@ note description: "Summary description for {NEW_CONTENT_HANDLER}." - date: "$Date: 2014-12-19 10:17:32 -0300 (vi., 19 dic. 2014) $" + date: "$Date: 2014-12-19 14:17:32 +0100 (ven., 19 déc. 2014) $" revision: "$Revision: 96402 $" class diff --git a/library/src/modules/node/handler/node_handler.e b/library/src/modules/node/handler/node_handler.e index b96cba7..0e42283 100644 --- a/library/src/modules/node/handler/node_handler.e +++ b/library/src/modules/node/handler/node_handler.e @@ -1,6 +1,6 @@ note description: "Summary description for {NODE_HANDLER}." - date: "$Date: 2014-12-19 10:17:32 -0300 (vi., 19 dic. 2014) $" + date: "$Date: 2014-12-19 14:17:32 +0100 (ven., 19 déc. 2014) $" revision: "$Revision: 96402 $" class diff --git a/library/src/modules/node/handler/node_summary_handler.e b/library/src/modules/node/handler/node_summary_handler.e index a94552f..8846379 100644 --- a/library/src/modules/node/handler/node_summary_handler.e +++ b/library/src/modules/node/handler/node_summary_handler.e @@ -1,6 +1,6 @@ note description: "Summary description for {NODE_SUMMARY_HANDLER}." - date: "$Date: 2014-12-19 10:17:32 -0300 (vi., 19 dic. 2014) $" + date: "$Date: 2014-12-19 14:17:32 +0100 (ven., 19 déc. 2014) $" revision: "$Revision: 96402 $" class diff --git a/library/src/modules/node/handler/node_title_handler.e b/library/src/modules/node/handler/node_title_handler.e index 3e5d062..cab8841 100644 --- a/library/src/modules/node/handler/node_title_handler.e +++ b/library/src/modules/node/handler/node_title_handler.e @@ -1,6 +1,6 @@ note description: "Summary description for {NODE_TITLE_HANDLER}." - date: "$Date: 2014-12-19 10:17:32 -0300 (vi., 19 dic. 2014) $" + date: "$Date: 2014-12-19 14:17:32 +0100 (ven., 19 déc. 2014) $" revision: "$Revision: 96402 $" class diff --git a/library/src/service/cms_api.e b/library/src/service/cms_api.e index 56a372f..7476eb4 100644 --- a/library/src/service/cms_api.e +++ b/library/src/service/cms_api.e @@ -1,7 +1,7 @@ note description: "API for a CMS" - date: "$Date$" - revision: "$Revision$" + date: "$Date: 2015-01-14 16:13:47 +0100 (mer., 14 janv. 2015) $" + revision: "$Revision: 96454 $" class CMS_API @@ -38,7 +38,7 @@ feature -- Initialize do if not retried then to_implement ("Refactor database setup") - if attached (create {JSON_CONFIGURATION}).new_database_configuration (setup.layout.application_config_path) as l_database_config then + if attached (create {APPLICATION_JSON_CONFIGURATION_HELPER}).new_database_configuration (setup.layout.application_config_path) as l_database_config then create {DATABASE_CONNECTION_MYSQL} l_database.login_with_connection_string (l_database_config.connection_string) create {CMS_STORAGE_MYSQL} storage.make (l_database) else @@ -207,12 +207,43 @@ feature -- Change User end end +feature -- Layout + + 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'. + local + p, l_path: PATH + ut: FILE_UTILITIES + do + p := setup.layout.config_path.extended ("modules").extended (a_module_name) + if a_name = Void then + p := p.extended (a_module_name) + else + p := p.extended (a_name) + end + l_path := p.appended_with_extension ("json") + if ut.file_path_exists (l_path) then + create {JSON_CONFIG} Result.make_from_file (l_path) + else + l_path := p.appended_with_extension ("ini") + if ut.file_path_exists (l_path) then + create {INI_CONFIG} Result.make_from_file (l_path) + end + 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 + Result := cfg.sub_config (a_name) + else + -- Maybe try to use the global cms.ini ? + end + end + end feature {NONE} -- Implemenataion - storage: CMS_STORAGE - -- Persistence storage. + -- Persistence storage. end diff --git a/library/src/service/cms_service.e b/library/src/service/cms_service.e index dca91e0..79e3576 100644 --- a/library/src/service/cms_service.e +++ b/library/src/service/cms_service.e @@ -57,8 +57,11 @@ feature {NONE} -- Initialization initialize_users initialize_auth_engine initialize_mailer + -- initialize_router + -- initialize_filter: expanded here, for void-safety concern. + create_filter initialize_router - initialize_filter + setup_filter end initialize_modules @@ -155,6 +158,7 @@ feature -- Execute Filter -- Execute the filter. do res.put_header_line ("Date: " + (create {HTTP_DATE}.make_now_utc).string) + res.put_header_line ("X-EWF-Server: CMS_v1.0") execute_service (req, res) end diff --git a/library/src/service/filter/cms_error_filter.e b/library/src/service/filter/cms_error_filter.e index 07ad85c..297ba91 100644 --- a/library/src/service/filter/cms_error_filter.e +++ b/library/src/service/filter/cms_error_filter.e @@ -1,6 +1,6 @@ note description: "Summary description for {CMS_ERROR_FILTER}." - date: "$Date: 2014-12-19 10:17:32 -0300 (vi., 19 dic. 2014) $" + date: "$Date: 2014-12-19 14:17:32 +0100 (ven., 19 déc. 2014) $" revision: "$Revision: 96402 $" class diff --git a/library/src/service/response/bad_request_error_cms_response.e b/library/src/service/response/bad_request_error_cms_response.e index 98af2b5..4c15239 100644 --- a/library/src/service/response/bad_request_error_cms_response.e +++ b/library/src/service/response/bad_request_error_cms_response.e @@ -1,6 +1,6 @@ note description: "Summary description for {BAD_REQUEST_ERROR_CMS_RESPONSE}." - date: "$Date: 2014-12-19 10:17:32 -0300 (vi., 19 dic. 2014) $" + date: "$Date: 2014-12-19 14:17:32 +0100 (ven., 19 déc. 2014) $" revision: "$Revision: 96402 $" class diff --git a/library/src/service/response/cms_response.e b/library/src/service/response/cms_response.e index 61ffc84..4bd77ee 100644 --- a/library/src/service/response/cms_response.e +++ b/library/src/service/response/cms_response.e @@ -1,7 +1,7 @@ note description: "Generic CMS Response.It builds the content to get process to render the output" - date: "$Date$" - revision: "$Revision$" + date: "$Date: 2014-12-15 21:43:38 +0100 (lun., 15 déc. 2014) $" + revision: "$Revision: 96346 $" deferred class CMS_RESPONSE @@ -379,12 +379,6 @@ feature -- Blocks add_block (header_block, "header") if attached message_block as m then add_block (m, "content") - end - -- FIXME: avoid hardcoded html! should be only in theme. - add_block (create {CMS_CONTENT_BLOCK}.make_raw ("top_content_anchor", Void, "%N", formats.full_html), "content") - if attached page_title as l_page_title then - -- FIXME: avoid hardcoded html! should be only in theme. - add_block (create {CMS_CONTENT_BLOCK}.make_raw ("page_title", Void, "

"+ l_page_title +"

%N", formats.full_html), "content") end if attached primary_tabs_block as m then add_block (m, "content") @@ -447,7 +441,7 @@ feature -- Blocks s: STRING do create s.make_empty - create Result.make ("page_top", Void, s, formats.full_html) + create Result.make ("page_top", Void, s, Void) Result.set_is_raw (True) end @@ -458,7 +452,7 @@ feature -- Blocks do create s.make_from_string (theme.menu_html (primary_menu, True)) create l_hb.make_empty - create Result.make ("header", Void, l_hb, formats.full_html) + create Result.make ("header", Void, l_hb, Void) Result.set_is_raw (True) end @@ -480,7 +474,7 @@ feature -- Blocks message_block: detachable CMS_CONTENT_BLOCK do if attached message as m and then not m.is_empty then - create Result.make ("message", Void, "
" + m + "
", formats.full_html) + create Result.make ("message", Void, "
" + m + "
", Void) Result.set_is_raw (True) end end @@ -497,7 +491,7 @@ feature -- Blocks s := "No Content" end end - create Result.make ("content", Void, s, formats.full_html) + create Result.make ("content", Void, s, Void) Result.set_is_raw (True) end @@ -862,6 +856,11 @@ feature -- Generation -- Menu... page.register_variable (horizontal_primary_menu_html, "primary_nav") + + -- Page related + if attached page_title as l_page_title then + page.register_variable (l_page_title, "page_title") + end end custom_prepare (page: CMS_HTML_PAGE) @@ -911,7 +910,11 @@ feature -- Generation -- Update the active status recursively on `a_comp'. local ln: CMS_LINK + l_comp_link: detachable CMS_LOCAL_LINK do + if attached {CMS_LOCAL_LINK} a_comp as lnk then + l_comp_link := lnk + end if attached a_comp.items as l_items then across l_items as ic @@ -923,8 +926,16 @@ feature -- Generation if (ln.is_expanded or ln.is_collapsed) and then attached {CMS_LINK_COMPOSITE} ln as l_comp then recursive_get_active (l_comp, req) end + if l_comp_link /= Void then + if ln.is_expanded or (not ln.is_expandable and ln.is_active) then + l_comp_link.set_expanded (True) + end + end end end + if l_comp_link /= Void and then l_comp_link.is_active then + l_comp_link.set_expanded (True) + end end get_local_link_active_status (a_lnk: CMS_LOCAL_LINK) diff --git a/library/src/service/response/home_cms_response.e b/library/src/service/response/home_cms_response.e index 7985506..6511f30 100644 --- a/library/src/service/response/home_cms_response.e +++ b/library/src/service/response/home_cms_response.e @@ -1,7 +1,7 @@ note description: "Summary description for {HOME_CMS_RESPONSE}." - date: "$Date$" - revision: "$Revision$" + date: "$Date: 2014-12-17 13:14:43 +0100 (mer., 17 déc. 2014) $" + revision: "$Revision: 96367 $" class HOME_CMS_RESPONSE diff --git a/library/src/service/response/internal_server_error_cms_response.e b/library/src/service/response/internal_server_error_cms_response.e index 06abb43..43eb930 100644 --- a/library/src/service/response/internal_server_error_cms_response.e +++ b/library/src/service/response/internal_server_error_cms_response.e @@ -1,6 +1,6 @@ note description: "Summary description for {INTERNAL_SERVER_ERROR_CMS_RESPONSE}." - date: "$Date: 2014-12-19 10:17:32 -0300 (vi., 19 dic. 2014) $" + date: "$Date: 2014-12-19 14:17:32 +0100 (ven., 19 déc. 2014) $" revision: "$Revision: 96402 $" class diff --git a/library/src/theme/cms_template.e b/library/src/theme/cms_template.e index f088368..63cb5b4 100644 --- a/library/src/theme/cms_template.e +++ b/library/src/theme/cms_template.e @@ -2,8 +2,8 @@ note description: "[ Abstract interface for a CMS Template, as part of the theme design. ]" - date: "$Date$" - revision: "$Revision$" + date: "$Date: 2014-11-20 15:03:29 +0100 (jeu., 20 nov. 2014) $" + revision: "$Revision: 96138 $" deferred class CMS_TEMPLATE diff --git a/library/src/theme/missing_theme/missing_cms_template.e b/library/src/theme/missing_theme/missing_cms_template.e index 219314c..e228bcc 100644 --- a/library/src/theme/missing_theme/missing_cms_template.e +++ b/library/src/theme/missing_theme/missing_cms_template.e @@ -9,6 +9,7 @@ class MISSING_CMS_TEMPLATE inherit + CMS_TEMPLATE create diff --git a/library/src/theme/smarty_theme/smarty_cms_page_template.e b/library/src/theme/smarty_theme/smarty_cms_page_template.e index d5b45ab..ff056f0 100644 --- a/library/src/theme/smarty_theme/smarty_cms_page_template.e +++ b/library/src/theme/smarty_theme/smarty_cms_page_template.e @@ -1,7 +1,7 @@ note description: "Summary description for {CMS_PAGE_TEMPLATE}." - date: "$Date$" - revision: "$Revision$" + date: "$Date: 2015-01-14 16:13:47 +0100 (mer., 14 janv. 2015) $" + revision: "$Revision: 96454 $" class SMARTY_CMS_PAGE_TEMPLATE @@ -75,26 +75,29 @@ feature -- Access debug ("smarty") template_context.enable_verbose end - p := template_context.template_folder - if p = Void then - create p.make_current - end + if attached page.type as l_page_type then create n.make_from_string_general (l_page_type) n.append_character ('-') n.append_string_general (template_name) n.append_string_general (".tpl") - if ut.file_path_exists (p.extended (n)) then + + p := template_context.template_file (n) + + if ut.file_path_exists (p) then create tpl.make_from_file (n) end end if tpl = Void then create n.make_from_string_general (template_name) n.append_string_general (".tpl") - if ut.file_path_exists (p.extended (n)) then + + p := template_context.template_file (n) + if ut.file_path_exists (p) then create tpl.make_from_file (n) end end + if tpl /= Void then across variables as ic diff --git a/library/src/theme/smarty_theme/smarty_cms_theme.e b/library/src/theme/smarty_theme/smarty_cms_theme.e index 638f1cd..0632dd4 100644 --- a/library/src/theme/smarty_theme/smarty_cms_theme.e +++ b/library/src/theme/smarty_theme/smarty_cms_theme.e @@ -1,7 +1,7 @@ note description: "Smarty template CMS theme." - date: "$Date$" - revision: "$Revision$" + date: "$Date: 2014-12-05 22:39:27 +0100 (ven., 05 déc. 2014) $" + revision: "$Revision: 96260 $" class SMARTY_CMS_THEME @@ -101,7 +101,11 @@ feature -- Conversion end end - create l_table_inspector.register (({detachable STRING_TABLE [STRING]}).name) + create l_table_inspector.register (({detachable STRING_TABLE [STRING_8]}).name) + create l_table_inspector.register (({detachable STRING_TABLE [STRING_32]}).name) + create l_table_inspector.register (({detachable STRING_TABLE [READABLE_STRING_8]}).name) + create l_table_inspector.register (({detachable STRING_TABLE [READABLE_STRING_32]}).name) + page_template.prepare (page) Result := page_template.to_html (page) diff --git a/library/src/theme/smarty_theme/string_table_of_string_inspector.e b/library/src/theme/smarty_theme/string_table_of_string_inspector.e index 4a61134..8584f5b 100644 --- a/library/src/theme/smarty_theme/string_table_of_string_inspector.e +++ b/library/src/theme/smarty_theme/string_table_of_string_inspector.e @@ -1,8 +1,8 @@ note description: "Summary description for {STRING_TABLE_OF_STRING_INSPECTOR}." author: "" - date: "$Date: 2014-11-06 17:59:12 -0300 (ju. 06 de nov. de 2014) $" - revision: "$Revision: 96040 $" + date: "$Date: 2014-12-05 22:39:27 +0100 (ven., 05 déc. 2014) $" + revision: "$Revision: 96260 $" class STRING_TABLE_OF_STRING_INSPECTOR @@ -23,13 +23,22 @@ feature {TEMPLATE_ROUTINES} -- If not handled by this inspector, return Void local l_fn: STRING + utf: UTF_CONVERTER do - if attached {STRING_TABLE [STRING]} obj as l_regions then + if attached {STRING_TABLE [detachable READABLE_STRING_GENERAL]} obj as l_regions then l_fn := field_name.as_lower if l_fn.is_case_insensitive_equal ("count") then Result := cell_of (l_regions.count) elseif attached l_regions.item (l_fn) as v then - Result := cell_of (v) + if attached {READABLE_STRING_32} v as v32 then + if attached v32.is_valid_as_string_8 then + Result := cell_of (v.to_string_8) + else + Result := cell_of (utf.escaped_utf_32_string_to_utf_8_string_8 (v32)) + end + else + Result := cell_of (v.to_string_8) + end end end end