Updated CMS_HOOK_BLOCK, to provide a better block_identifiers (CMS_RESPONSE): detachable ITERABLE [READABLE_STRING_8] query, to be implemented by CMS_HOOK_RESPONSE_BLOCK descendants.
Added CONFIG_READER.table_keys: detachable LIST [READABLE_STRING_32].
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
note
|
||||
description: "[
|
||||
Hook providing a way to alter a block.
|
||||
Hook providing a way to provide blocks.
|
||||
]"
|
||||
date: "$Date: 2014-11-19 20:00:19 +0100 (mer., 19 nov. 2014) $"
|
||||
revision: "$Revision: 96123 $"
|
||||
@@ -13,13 +13,21 @@ inherit
|
||||
|
||||
feature -- Hook
|
||||
|
||||
block_list: ITERABLE [like {CMS_BLOCK}.name]
|
||||
block_list: detachable ITERABLE [like {CMS_BLOCK}.name]
|
||||
-- List of block names, managed by current object.
|
||||
-- If prefixed by "?", condition will be check
|
||||
-- If prefixed by "?", condition will be checked
|
||||
-- to determine if it should be displayed (and computed) or not.
|
||||
deferred
|
||||
end
|
||||
|
||||
block_identifiers (a_response: detachable CMS_RESPONSE): detachable ITERABLE [like {CMS_BLOCK}.name]
|
||||
-- List of block names, managed by current object, in the context of `a_response' if set.
|
||||
-- If prefixed by "?", condition will be checked
|
||||
-- to determine if it should be displayed (and computed) or not.
|
||||
do
|
||||
Result := block_list
|
||||
end
|
||||
|
||||
get_block_view (a_block_id: READABLE_STRING_8; a_response: CMS_RESPONSE)
|
||||
-- Get block object identified by `a_block_id' and associate with `a_response'.
|
||||
deferred
|
||||
|
||||
@@ -150,9 +150,12 @@ feature -- Hook: block
|
||||
across
|
||||
lst as c
|
||||
loop
|
||||
if attached {CMS_HOOK_BLOCK} c.item as h then
|
||||
if
|
||||
attached {CMS_HOOK_BLOCK} c.item as h and then
|
||||
attached h.block_identifiers (a_response) as l_names
|
||||
then
|
||||
across
|
||||
h.block_list as blst
|
||||
l_names as blst
|
||||
loop
|
||||
bl := blst.item
|
||||
bl_optional := bl.count > 0 and bl[1] = '?'
|
||||
@@ -252,6 +255,6 @@ feature -- Hook: export
|
||||
end
|
||||
|
||||
note
|
||||
copyright: "2011-2015, Jocelyn Fiat, Javier Velilla, Eiffel Software and others"
|
||||
copyright: "2011-2016, Jocelyn Fiat, Javier Velilla, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
end
|
||||
|
||||
45
src/hooks/cms_hook_response_block.e
Normal file
45
src/hooks/cms_hook_response_block.e
Normal file
@@ -0,0 +1,45 @@
|
||||
note
|
||||
description: "[
|
||||
Hook providing a way to provide blocks,
|
||||
within the context of a response.
|
||||
]"
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
deferred class
|
||||
CMS_HOOK_RESPONSE_BLOCK
|
||||
|
||||
inherit
|
||||
CMS_HOOK_BLOCK
|
||||
rename
|
||||
block_identifiers as old_block_identifiers
|
||||
redefine
|
||||
old_block_identifiers
|
||||
end
|
||||
|
||||
feature -- Hook
|
||||
|
||||
frozen block_list: detachable ITERABLE [like {CMS_BLOCK}.name]
|
||||
-- List of block names, managed by current object.
|
||||
-- If prefixed by "?", condition will be checked
|
||||
-- to determine if it should be displayed (and computed) or not.
|
||||
do
|
||||
Result := block_identifiers (Void)
|
||||
end
|
||||
|
||||
frozen old_block_identifiers (a_response: detachable CMS_RESPONSE): detachable ITERABLE [like {CMS_BLOCK}.name]
|
||||
do
|
||||
Result := block_identifiers (a_response)
|
||||
end
|
||||
|
||||
block_identifiers (a_response: detachable CMS_RESPONSE): detachable ITERABLE [like {CMS_BLOCK}.name]
|
||||
-- List of block names, managed by current object, in the context of `a_response' if set.
|
||||
-- If prefixed by "?", condition will be checked
|
||||
-- to determine if it should be displayed (and computed) or not.
|
||||
deferred
|
||||
end
|
||||
|
||||
note
|
||||
copyright: "2011-2016, Jocelyn Fiat, Javier Velilla, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
end
|
||||
@@ -15,7 +15,7 @@ create
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make (a_exp: READABLE_STRING_8)
|
||||
make (a_exp: READABLE_STRING_GENERAL)
|
||||
do
|
||||
expression := a_exp
|
||||
end
|
||||
@@ -30,18 +30,18 @@ feature -- Access
|
||||
description: STRING_32
|
||||
do
|
||||
create Result.make_from_string_general ("Expression: %"")
|
||||
Result.append_string_general (expression)
|
||||
Result.append_string_general (expression.as_string_32)
|
||||
Result.append_character ('%"')
|
||||
end
|
||||
|
||||
expression: STRING
|
||||
expression: READABLE_STRING_GENERAL
|
||||
|
||||
feature -- Evaluation
|
||||
|
||||
satisfied_for_response (res: CMS_RESPONSE): BOOLEAN
|
||||
local
|
||||
exp: like expression
|
||||
l_path: READABLE_STRING_8
|
||||
l_path: READABLE_STRING_GENERAL
|
||||
kmp: KMP_WILD
|
||||
do
|
||||
exp := expression
|
||||
@@ -61,12 +61,12 @@ feature -- Evaluation
|
||||
Result := kmp.pattern_matches
|
||||
end
|
||||
else
|
||||
Result := res.location.same_string (l_path)
|
||||
Result := l_path.same_string (res.location)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
note
|
||||
copyright: "2011-2015, Jocelyn Fiat, Javier Velilla, Eiffel Software and others"
|
||||
copyright: "2011-2016, Jocelyn Fiat, Javier Velilla, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
end
|
||||
|
||||
@@ -994,7 +994,7 @@ feature -- Message
|
||||
|
||||
add_debug_message (a_msg: READABLE_STRING_8)
|
||||
do
|
||||
if api.is_debug_enabled then
|
||||
if api.is_debug then
|
||||
add_message (a_msg, "debug")
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user