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.
This commit is contained in:
19
cms-safe.ecf
19
cms-safe.ecf
@@ -2,27 +2,26 @@
|
||||
<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"/>
|
||||
<option warning="true" full_class_checking="false" is_attached_by_default="true" void_safety="transitional" syntax="transitional">
|
||||
<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>
|
||||
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
|
||||
<library name="crypto" location="$ISE_LIBRARY\unstable\library\text\encryption\crypto\crypto-safe.ecf"/>
|
||||
<library name="http" location="$ISE_LIBRARY\contrib\library\network\protocol\http\http-safe.ecf"/>
|
||||
<library name="json" location="$ISE_LIBRARY\contrib\library\text\parser\json\library\json-safe.ecf" readonly="false"/>
|
||||
<library name="config" location=".\library\configuration\config-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" 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="model" location=".\library\model\cms_model-safe.ecf" readonly="false"/>
|
||||
<library name="encoder" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\text\encoder\encoder-safe.ecf" readonly="false"/>
|
||||
<library name="text_filter" location="$ISE_LIBRARY\unstable\library\text\text_filter\text_filter-safe.ecf"/>
|
||||
|
||||
<library name="error" location="$ISE_LIBRARY\contrib\library\utility\general\error\error-safe.ecf"/>
|
||||
<library name="http_authorization" location="$ISE_LIBRARY\contrib\library\network\authentication\http_authorization\http_authorization-safe.ecf" readonly="false"/>
|
||||
<library name="persistence_mysql" location=".\library\persistence\implementation\mysql\persistence_mysql-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"/>
|
||||
<library name="time" location="$ISE_LIBRARY\library\time\time-safe.ecf"/>
|
||||
<cluster name="src" location=".\library\src\" recursive="true">
|
||||
<file_rule>
|
||||
<exclude>/EIFGENs$</exclude>
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
-- <Precursor>
|
||||
|
||||
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
|
||||
-- <Precursor>
|
||||
do
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
29
library/src/hooks/cms_hook_block_helper.e
Normal file
29
library/src/hooks/cms_hook_block_helper.e
Normal file
@@ -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
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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, "<a id=%"main-content%"></a>%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, "<h1 id=%"page-title%" class=%"title%">"+ l_page_title +"</h1>%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, "<div id=%"message%">" + m + "</div>", formats.full_html)
|
||||
create Result.make ("message", Void, "<div id=%"message%">" + m + "</div>", 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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -9,6 +9,7 @@ class
|
||||
MISSING_CMS_TEMPLATE
|
||||
|
||||
inherit
|
||||
|
||||
CMS_TEMPLATE
|
||||
|
||||
create
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user