Merge pull request #5 from jocelyn/hook_20141112
name changes related to CMS HOOK and callers.
This commit is contained in:
@@ -1,5 +1,7 @@
|
|||||||
note
|
note
|
||||||
description: "Marker interface"
|
description: "[
|
||||||
|
Marker interface for CMS Hook
|
||||||
|
]"
|
||||||
date: "$Date$"
|
date: "$Date$"
|
||||||
revision: "$Revision$"
|
revision: "$Revision$"
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
note
|
note
|
||||||
description: "Summary description for {CMS_HOOK_BLOCK}."
|
description: "Summary description for {CMS_HOOK_BLOCK}."
|
||||||
author: ""
|
date: "$Date$"
|
||||||
date: "$Date: 2014-08-28 08:21:49 -0300 (ju. 28 de ago. de 2014) $"
|
revision: "$Revision$"
|
||||||
revision: "$Revision: 95708 $"
|
|
||||||
|
|
||||||
deferred class
|
deferred class
|
||||||
CMS_HOOK_BLOCK
|
CMS_HOOK_BLOCK
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
note
|
note
|
||||||
description: "Describe how to alter a form before it's rendered"
|
description: "[
|
||||||
date: "$Date: 2014-08-28 08:21:49 -0300 (ju. 28 de ago. de 2014) $"
|
Hook providing a way to alter a form.
|
||||||
|
]"
|
||||||
|
date: "$Date$"
|
||||||
|
|
||||||
deferred class
|
deferred class
|
||||||
CMS_HOOK_FORM_ALTER
|
CMS_HOOK_FORM_ALTER
|
||||||
@@ -11,6 +13,8 @@ inherit
|
|||||||
feature -- Hook
|
feature -- Hook
|
||||||
|
|
||||||
form_alter (a_form: CMS_FORM; a_form_data: detachable WSF_FORM_DATA; a_response: CMS_RESPONSE)
|
form_alter (a_form: CMS_FORM; a_form_data: detachable WSF_FORM_DATA; a_response: CMS_RESPONSE)
|
||||||
|
-- Hook execution on form `a_form' and its associated data `a_form_data',
|
||||||
|
-- for related response `a_response'.
|
||||||
deferred
|
deferred
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
note
|
note
|
||||||
description: "Describe how to alter a menu before it's rendered."
|
description: "[
|
||||||
date: "$Date: 2014-08-28 08:21:49 -0300 (ju. 28 de ago. de 2014) $"
|
Hook providing a way to alter a menu
|
||||||
|
]"
|
||||||
|
date: "$Date$"
|
||||||
|
|
||||||
deferred class
|
deferred class
|
||||||
CMS_HOOK_MENU_ALTER
|
CMS_HOOK_MENU_ALTER
|
||||||
@@ -10,7 +12,9 @@ inherit
|
|||||||
|
|
||||||
feature -- Hook
|
feature -- Hook
|
||||||
|
|
||||||
menu_alter (a_menu_system: CMS_MENU_SYSTEM; a_response: CMS_RESPONSE)
|
menu_alter (a_menu: CMS_MENU; a_response: CMS_RESPONSE)
|
||||||
|
-- Hook execution on menu `a_menu'
|
||||||
|
-- for related response `a_response'.
|
||||||
deferred
|
deferred
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
21
cms/src/hooks/cms_hook_menu_system_alter.e
Normal file
21
cms/src/hooks/cms_hook_menu_system_alter.e
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
note
|
||||||
|
description: "[
|
||||||
|
Hook providing a way to alter the CMS menu system.
|
||||||
|
]"
|
||||||
|
date: "$Date$"
|
||||||
|
|
||||||
|
deferred class
|
||||||
|
CMS_HOOK_MENU_SYSTEM_ALTER
|
||||||
|
|
||||||
|
inherit
|
||||||
|
CMS_HOOK
|
||||||
|
|
||||||
|
feature -- Hook
|
||||||
|
|
||||||
|
menu_system_alter (a_menu_system: CMS_MENU_SYSTEM; a_response: CMS_RESPONSE)
|
||||||
|
-- Hook execution on collection of menu contained by `a_menu_system'
|
||||||
|
-- for related response `a_response'.
|
||||||
|
deferred
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
@@ -1,20 +1,22 @@
|
|||||||
note
|
note
|
||||||
description: "Describe how to alter generic values before they are rendered."
|
description: "[
|
||||||
date: "$Date: 2014-10-23 08:30:11 -0300 (ju. 23 de oct. de 2014) $"
|
Hook providing a way to alter the value table for a response.
|
||||||
revision: "$Revision: 95980 $"
|
]"
|
||||||
|
date: "$Date$"
|
||||||
|
revision: "$Revision$"
|
||||||
|
|
||||||
deferred class
|
deferred class
|
||||||
CMS_HOOK_VALUE_ALTER
|
CMS_HOOK_VALUE_TABLE_ALTER
|
||||||
|
|
||||||
inherit
|
inherit
|
||||||
|
|
||||||
CMS_HOOK
|
CMS_HOOK
|
||||||
|
|
||||||
feature -- Hook
|
feature -- Hook
|
||||||
|
|
||||||
value_alter (a_value: CMS_VALUE_TABLE; a_response: CMS_RESPONSE)
|
value_table_alter (a_value: CMS_VALUE_TABLE; a_response: CMS_RESPONSE)
|
||||||
deferred
|
deferred
|
||||||
end
|
end
|
||||||
|
|
||||||
note
|
note
|
||||||
copyright: "2011-2014, Jocelyn Fiat, Eiffel Software and others"
|
copyright: "2011-2014, Jocelyn Fiat, Eiffel Software and others"
|
||||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||||
@@ -1,7 +1,10 @@
|
|||||||
note
|
note
|
||||||
description: "Summary description for {CMS_VALUE_TABLE}."
|
description: "[
|
||||||
date: "$Date: 2014-10-23 08:30:11 -0300 (ju. 23 de oct. de 2014) $"
|
Object containing a collection of values.
|
||||||
revision: "$Revision: 95980 $"
|
It is typically used by `{CMS_RESPONSE}.values' .
|
||||||
|
]"
|
||||||
|
date: "$Date$"
|
||||||
|
revision: "$Revision$"
|
||||||
|
|
||||||
class
|
class
|
||||||
CMS_VALUE_TABLE
|
CMS_VALUE_TABLE
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ feature -- Basic operation
|
|||||||
|
|
||||||
prepare (a_response: CMS_RESPONSE)
|
prepare (a_response: CMS_RESPONSE)
|
||||||
do
|
do
|
||||||
a_response.call_form_alter_hooks (Current, Void)
|
a_response.invoke_form_alter (Current, Void)
|
||||||
end
|
end
|
||||||
|
|
||||||
process (a_response: CMS_RESPONSE)
|
process (a_response: CMS_RESPONSE)
|
||||||
@@ -29,7 +29,7 @@ feature -- Basic operation
|
|||||||
|
|
||||||
on_prepared (a_response: CMS_RESPONSE; fd: WSF_FORM_DATA)
|
on_prepared (a_response: CMS_RESPONSE; fd: WSF_FORM_DATA)
|
||||||
do
|
do
|
||||||
a_response.call_form_alter_hooks (Current, fd)
|
a_response.invoke_form_alter (Current, fd)
|
||||||
end
|
end
|
||||||
|
|
||||||
on_processed (a_response: CMS_RESPONSE; fd: WSF_FORM_DATA)
|
on_processed (a_response: CMS_RESPONSE; fd: WSF_FORM_DATA)
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
note
|
note
|
||||||
description: "Describe the navigation menus."
|
description: "[
|
||||||
date: "$Date: 2014-08-28 08:21:49 -0300 (ju. 28 de ago. de 2014) $"
|
Menu associated with CMS system.
|
||||||
revision: "$Revision: 95708 $"
|
]"
|
||||||
|
date: "$Date$"
|
||||||
|
revision: "$Revision$"
|
||||||
|
|
||||||
class
|
class
|
||||||
CMS_MENU_SYSTEM
|
CMS_MENU_SYSTEM
|
||||||
@@ -20,15 +22,17 @@ feature {NONE} -- Initialization
|
|||||||
do
|
do
|
||||||
to_implement ("Refactor, take the info from a Database or Configuration file.")
|
to_implement ("Refactor, take the info from a Database or Configuration file.")
|
||||||
create items.make (5)
|
create items.make (5)
|
||||||
force (create {CMS_MENU}.make ("primary", 3)) -- primary menu
|
force (create {CMS_MENU}.make ("primary", 3))
|
||||||
force (create {CMS_MENU}.make_with_title ("management", "Management", 3)) -- secondary in admin view.
|
force (create {CMS_MENU}.make_with_title ("management", "Management", 3))
|
||||||
force (create {CMS_MENU}.make_with_title ("secondary", "Navigation", 3)) -- secondary
|
force (create {CMS_MENU}.make_with_title ("secondary", "Navigation", 3))
|
||||||
force (create {CMS_MENU}.make_with_title ("user", "User", 3)) -- first_side_bar
|
force (create {CMS_MENU}.make_with_title ("user", "User", 3))
|
||||||
end
|
end
|
||||||
|
|
||||||
feature -- Access
|
feature -- Access
|
||||||
|
|
||||||
item (n: like {CMS_MENU}.name): CMS_MENU
|
item (n: like {CMS_MENU}.name): CMS_MENU
|
||||||
|
-- Menu associated with name `n',
|
||||||
|
-- if none, it is created.
|
||||||
local
|
local
|
||||||
m: detachable CMS_MENU
|
m: detachable CMS_MENU
|
||||||
do
|
do
|
||||||
@@ -80,6 +84,7 @@ feature -- Access
|
|||||||
feature -- Change
|
feature -- Change
|
||||||
|
|
||||||
force (m: CMS_MENU)
|
force (m: CMS_MENU)
|
||||||
|
-- Add menu `m'.
|
||||||
do
|
do
|
||||||
items.force (m, m.name)
|
items.force (m, m.name)
|
||||||
end
|
end
|
||||||
@@ -94,7 +99,6 @@ feature -- Access
|
|||||||
|
|
||||||
feature {NONE} -- Implementation
|
feature {NONE} -- Implementation
|
||||||
|
|
||||||
items: HASH_TABLE [CMS_MENU, like {CMS_MENU}.name]
|
items: STRING_TABLE [CMS_MENU]
|
||||||
-- items: ARRAYED_LIST [CMS_MENU]
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ inherit
|
|||||||
register_hooks
|
register_hooks
|
||||||
end
|
end
|
||||||
|
|
||||||
CMS_HOOK_MENU_ALTER
|
CMS_HOOK_MENU_SYSTEM_ALTER
|
||||||
|
|
||||||
CMS_HOOK_BLOCK
|
CMS_HOOK_BLOCK
|
||||||
|
|
||||||
@@ -128,8 +128,8 @@ feature -- Hooks
|
|||||||
|
|
||||||
register_hooks (a_response: CMS_RESPONSE)
|
register_hooks (a_response: CMS_RESPONSE)
|
||||||
do
|
do
|
||||||
a_response.add_menu_alter_hook (Current)
|
a_response.subscribe_to_menu_system_alter_hook (Current)
|
||||||
a_response.add_block_hook (Current)
|
a_response.subscribe_to_block_hook (Current)
|
||||||
end
|
end
|
||||||
|
|
||||||
block_list: ITERABLE [like {CMS_BLOCK}.name]
|
block_list: ITERABLE [like {CMS_BLOCK}.name]
|
||||||
@@ -145,7 +145,7 @@ feature -- Hooks
|
|||||||
-- a_response.add_block (b, "sidebar_second")
|
-- a_response.add_block (b, "sidebar_second")
|
||||||
end
|
end
|
||||||
|
|
||||||
menu_alter (a_menu_system: CMS_MENU_SYSTEM; a_response: CMS_RESPONSE)
|
menu_system_alter (a_menu_system: CMS_MENU_SYSTEM; a_response: CMS_RESPONSE)
|
||||||
local
|
local
|
||||||
lnk: CMS_LOCAL_LINK
|
lnk: CMS_LOCAL_LINK
|
||||||
-- perms: detachable ARRAYED_LIST [READABLE_STRING_8]
|
-- perms: detachable ARRAYED_LIST [READABLE_STRING_8]
|
||||||
|
|||||||
@@ -368,7 +368,7 @@ feature -- Blocks
|
|||||||
add_block (l_block, "footer")
|
add_block (l_block, "footer")
|
||||||
end
|
end
|
||||||
|
|
||||||
hook_block_view
|
invoke_block
|
||||||
end
|
end
|
||||||
|
|
||||||
primary_menu_block: detachable CMS_MENU_BLOCK
|
primary_menu_block: detachable CMS_MENU_BLOCK
|
||||||
@@ -478,36 +478,65 @@ feature -- Blocks
|
|||||||
|
|
||||||
feature -- Hook: value alter
|
feature -- Hook: value alter
|
||||||
|
|
||||||
add_value_alter_hook (h: like value_alter_hooks.item)
|
subscribe_to_value_table_alter_hook (h: like value_table_alter_hooks.item)
|
||||||
local
|
local
|
||||||
lst: like value_alter_hooks
|
lst: like value_table_alter_hooks
|
||||||
do
|
do
|
||||||
lst := value_alter_hooks
|
lst := value_table_alter_hooks
|
||||||
if lst = Void then
|
if lst = Void then
|
||||||
create lst.make (1)
|
create lst.make (1)
|
||||||
value_alter_hooks := lst
|
value_table_alter_hooks := lst
|
||||||
end
|
end
|
||||||
if not lst.has (h) then
|
if not lst.has (h) then
|
||||||
lst.force (h)
|
lst.force (h)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
value_alter_hooks: detachable ARRAYED_LIST [CMS_HOOK_VALUE_ALTER]
|
value_table_alter_hooks: detachable ARRAYED_LIST [CMS_HOOK_VALUE_TABLE_ALTER]
|
||||||
|
|
||||||
call_value_alter_hooks (m: CMS_VALUE_TABLE)
|
invoke_value_table_alter (m: CMS_VALUE_TABLE)
|
||||||
do
|
do
|
||||||
if attached value_alter_hooks as lst then
|
if attached value_table_alter_hooks as lst then
|
||||||
across
|
across
|
||||||
lst as c
|
lst as c
|
||||||
loop
|
loop
|
||||||
c.item.value_alter (m, Current)
|
c.item.value_table_alter (m, Current)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
feature -- Hook: menu_system_alter
|
||||||
|
|
||||||
|
subscribe_to_menu_system_alter_hook (h: like menu_system_alter_hooks.item)
|
||||||
|
local
|
||||||
|
lst: like menu_system_alter_hooks
|
||||||
|
do
|
||||||
|
lst := menu_system_alter_hooks
|
||||||
|
if lst = Void then
|
||||||
|
create lst.make (1)
|
||||||
|
menu_system_alter_hooks := lst
|
||||||
|
end
|
||||||
|
if not lst.has (h) then
|
||||||
|
lst.force (h)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
menu_system_alter_hooks: detachable ARRAYED_LIST [CMS_HOOK_MENU_SYSTEM_ALTER]
|
||||||
|
|
||||||
|
invoke_menu_system_alter (m: CMS_MENU_SYSTEM )
|
||||||
|
do
|
||||||
|
if attached menu_system_alter_hooks as lst then
|
||||||
|
across
|
||||||
|
lst as c
|
||||||
|
loop
|
||||||
|
c.item.menu_system_alter (m, Current)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
feature -- Hook: menu_alter
|
feature -- Hook: menu_alter
|
||||||
|
|
||||||
add_menu_alter_hook (h: like menu_alter_hooks.item)
|
subscribe_to_menu_alter_hook (h: like menu_alter_hooks.item)
|
||||||
local
|
local
|
||||||
lst: like menu_alter_hooks
|
lst: like menu_alter_hooks
|
||||||
do
|
do
|
||||||
@@ -523,7 +552,7 @@ feature -- Hook: menu_alter
|
|||||||
|
|
||||||
menu_alter_hooks: detachable ARRAYED_LIST [CMS_HOOK_MENU_ALTER]
|
menu_alter_hooks: detachable ARRAYED_LIST [CMS_HOOK_MENU_ALTER]
|
||||||
|
|
||||||
call_menu_alter_hooks (m: CMS_MENU_SYSTEM )
|
invoke_menu_alter (m: CMS_MENU)
|
||||||
do
|
do
|
||||||
if attached menu_alter_hooks as lst then
|
if attached menu_alter_hooks as lst then
|
||||||
across
|
across
|
||||||
@@ -536,7 +565,7 @@ feature -- Hook: menu_alter
|
|||||||
|
|
||||||
feature -- Hook: form_alter
|
feature -- Hook: form_alter
|
||||||
|
|
||||||
add_form_alter_hook (h: like form_alter_hooks.item)
|
subscribe_to_form_alter_hook (h: like form_alter_hooks.item)
|
||||||
local
|
local
|
||||||
lst: like form_alter_hooks
|
lst: like form_alter_hooks
|
||||||
do
|
do
|
||||||
@@ -552,7 +581,7 @@ feature -- Hook: form_alter
|
|||||||
|
|
||||||
form_alter_hooks: detachable ARRAYED_LIST [CMS_HOOK_FORM_ALTER]
|
form_alter_hooks: detachable ARRAYED_LIST [CMS_HOOK_FORM_ALTER]
|
||||||
|
|
||||||
call_form_alter_hooks (f: CMS_FORM; a_form_data: detachable WSF_FORM_DATA; )
|
invoke_form_alter (f: CMS_FORM; a_form_data: detachable WSF_FORM_DATA)
|
||||||
do
|
do
|
||||||
if attached form_alter_hooks as lst then
|
if attached form_alter_hooks as lst then
|
||||||
across
|
across
|
||||||
@@ -565,7 +594,7 @@ feature -- Hook: form_alter
|
|||||||
|
|
||||||
feature -- Hook: block
|
feature -- Hook: block
|
||||||
|
|
||||||
add_block_hook (h: like block_hooks.item)
|
subscribe_to_block_hook (h: CMS_HOOK_BLOCK)
|
||||||
local
|
local
|
||||||
lst: like block_hooks
|
lst: like block_hooks
|
||||||
do
|
do
|
||||||
@@ -581,7 +610,7 @@ feature -- Hook: block
|
|||||||
|
|
||||||
block_hooks: detachable ARRAYED_LIST [CMS_HOOK_BLOCK]
|
block_hooks: detachable ARRAYED_LIST [CMS_HOOK_BLOCK]
|
||||||
|
|
||||||
hook_block_view
|
invoke_block
|
||||||
do
|
do
|
||||||
if attached block_hooks as lst then
|
if attached block_hooks as lst then
|
||||||
across
|
across
|
||||||
@@ -596,7 +625,6 @@ feature -- Hook: block
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
feature -- Menu: change
|
feature -- Menu: change
|
||||||
|
|
||||||
add_to_main_menu (lnk: CMS_LINK)
|
add_to_main_menu (lnk: CMS_LINK)
|
||||||
@@ -723,7 +751,7 @@ feature -- Generation
|
|||||||
do
|
do
|
||||||
-- Menu
|
-- Menu
|
||||||
add_to_primary_menu (create {CMS_LOCAL_LINK}.make ("Home", "/"))
|
add_to_primary_menu (create {CMS_LOCAL_LINK}.make ("Home", "/"))
|
||||||
call_menu_alter_hooks (menu_system)
|
invoke_menu_system_alter (menu_system)
|
||||||
prepare_menu_system (menu_system)
|
prepare_menu_system (menu_system)
|
||||||
|
|
||||||
-- Blocks
|
-- Blocks
|
||||||
@@ -745,7 +773,7 @@ feature -- Generation
|
|||||||
custom_prepare (page)
|
custom_prepare (page)
|
||||||
|
|
||||||
-- Cms values
|
-- Cms values
|
||||||
call_value_alter_hooks (values)
|
invoke_value_table_alter (values)
|
||||||
|
|
||||||
-- Predefined values
|
-- Predefined values
|
||||||
page.register_variable (page, "page") -- DO NOT REMOVE
|
page.register_variable (page, "page") -- DO NOT REMOVE
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ inherit
|
|||||||
register_hooks
|
register_hooks
|
||||||
end
|
end
|
||||||
|
|
||||||
CMS_HOOK_MENU_ALTER
|
CMS_HOOK_MENU_SYSTEM_ALTER
|
||||||
|
|
||||||
CMS_HOOK_BLOCK
|
CMS_HOOK_BLOCK
|
||||||
|
|
||||||
@@ -45,8 +45,8 @@ feature -- Hooks
|
|||||||
|
|
||||||
register_hooks (a_response: CMS_RESPONSE)
|
register_hooks (a_response: CMS_RESPONSE)
|
||||||
do
|
do
|
||||||
a_response.add_menu_alter_hook (Current)
|
a_response.subscribe_to_menu_system_alter_hook (Current)
|
||||||
a_response.add_block_hook (Current)
|
a_response.subscribe_to_block_hook (Current)
|
||||||
end
|
end
|
||||||
|
|
||||||
block_list: ITERABLE [like {CMS_BLOCK}.name]
|
block_list: ITERABLE [like {CMS_BLOCK}.name]
|
||||||
@@ -56,7 +56,7 @@ feature -- Hooks
|
|||||||
|
|
||||||
get_block_view (a_block_id: READABLE_STRING_8; a_response: CMS_RESPONSE)
|
get_block_view (a_block_id: READABLE_STRING_8; a_response: CMS_RESPONSE)
|
||||||
local
|
local
|
||||||
b: CMS_CONTENT_BLOCK
|
-- b: CMS_CONTENT_BLOCK
|
||||||
mb: CMS_MENU_BLOCK
|
mb: CMS_MENU_BLOCK
|
||||||
m: CMS_MENU
|
m: CMS_MENU
|
||||||
lnk: CMS_LOCAL_LINK
|
lnk: CMS_LOCAL_LINK
|
||||||
@@ -74,7 +74,7 @@ feature -- Hooks
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
menu_alter (a_menu_system: CMS_MENU_SYSTEM; a_response: CMS_RESPONSE)
|
menu_system_alter (a_menu_system: CMS_MENU_SYSTEM; a_response: CMS_RESPONSE)
|
||||||
local
|
local
|
||||||
lnk: CMS_LOCAL_LINK
|
lnk: CMS_LOCAL_LINK
|
||||||
-- perms: detachable ARRAYED_LIST [READABLE_STRING_8]
|
-- perms: detachable ARRAYED_LIST [READABLE_STRING_8]
|
||||||
|
|||||||
Reference in New Issue
Block a user