Added support for log stored in CMS_STORAGE.

Added support for custom value stored in CMS_STORAGE.
Added optional css classes addition to CMS_BLOCK output.
Refactored storage, to manage node from node module code only (or mostly).

TODO: improved view for a cms node, for now hardcoded.
This commit is contained in:
2015-04-15 16:39:03 +02:00
parent 2b25c23977
commit f2bb061488
59 changed files with 1693 additions and 414 deletions

View File

@@ -47,6 +47,10 @@ feature {NONE} -- Initialize
setup.enabled_modules as ic
loop
l_module := ic.item
-- FIXME: should we initialize first, and then install
-- or the reverse, or merge installation and initialization
-- and leave the responsability to the module to know
-- if this is installed or not...
if not l_module.is_installed (Current) then
l_module.install (Current)
end
@@ -72,6 +76,11 @@ feature -- Formats
create Result
end
format (a_format_name: detachable READABLE_STRING_GENERAL): detachable CONTENT_FORMAT
do
Result := formats.item (a_format_name)
end
feature -- Status Report
has_error: BOOLEAN
@@ -86,6 +95,47 @@ feature -- Status Report
Result := error_handler.as_string_representation
end
feature -- Logging
log (a_category: READABLE_STRING_8; a_message: READABLE_STRING_8; a_level: INTEGER; a_link: detachable CMS_LINK)
local
l_log: CMS_LOG
m: STRING
do
create l_log.make (a_category, a_message, a_level, Void)
if a_link /= Void then
l_log.set_link (a_link)
end
storage.save_log (l_log)
create m.make_from_string ("[" + a_category + "] ")
m.append (a_message)
if a_link /= Void then
m.append (" [" + url_encoded (a_link.title) + "]("+ a_link.location +")")
end
inspect a_level
when {CMS_LOG}.level_emergency then
logger.put_alert (m, Void)
when {CMS_LOG}.level_alert then
logger.put_alert (m, Void)
when {CMS_LOG}.level_critical then
logger.put_critical (m, Void)
when {CMS_LOG}.level_error then
logger.put_error (m, Void)
when {CMS_LOG}.level_warning then
logger.put_warning (m, Void)
when {CMS_LOG}.level_notice then
logger.put_information (m, Void)
when {CMS_LOG}.level_info then
logger.put_information (m, Void)
when {CMS_LOG}.level_debug then
logger.put_debug (m, Void)
else
logger.put_debug (m, Void)
end
end
feature -- Permissions system
user_has_permission (a_user: detachable CMS_USER; a_permission: detachable READABLE_STRING_GENERAL): BOOLEAN
@@ -114,6 +164,16 @@ feature -- Query: module
Result := Void
end
end
ensure
Result /= Void implies (Result.is_enabled and Result.generating_type ~ a_type)
end
module_api (a_type: TYPE [CMS_MODULE]): detachable CMS_MODULE_API
-- Enabled module API associated with module typed `a_type'.
do
if attached module (a_type) as mod then
Result := mod.module_api
end
end
module_by_name (a_name: READABLE_STRING_GENERAL): detachable CMS_MODULE
@@ -133,7 +193,15 @@ feature -- Query: module
end
end
ensure
Result /= Void implies Result.name.is_case_insensitive_equal_general (a_name)
Result /= Void implies (Result.is_enabled and Result.name.is_case_insensitive_equal_general (a_name))
end
module_api_by_name (a_name: READABLE_STRING_GENERAL): detachable CMS_MODULE_API
-- Enabled module API associated with module named `a_name'.
do
if attached module_by_name (a_name) as mod then
Result := mod.module_api
end
end
feature -- Query: API