Added recent_changes module.
Revisited hooks management, and added new CMS_HOOK_MANAGER. Added admin, and other link into navigation menu that goes into first sidebar. Fixed theme info, and template for sidebar ids. Better css class name for cms node content.
This commit is contained in:
@@ -8,4 +8,7 @@ note
|
||||
deferred class
|
||||
CMS_HOOK
|
||||
|
||||
note
|
||||
copyright: "2011-2015, Jocelyn Fiat, Javier Velilla, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
end
|
||||
|
||||
@@ -17,24 +17,27 @@ inherit
|
||||
feature -- Hook
|
||||
|
||||
auto_subscribe_to_hooks (a_response: CMS_RESPONSE)
|
||||
local
|
||||
l_manager: CMS_HOOK_CORE_MANAGER
|
||||
do
|
||||
l_manager := a_response.hooks
|
||||
if attached {CMS_HOOK_MENU_SYSTEM_ALTER} Current as h_menu_system_alter then
|
||||
a_response.subscribe_to_menu_system_alter_hook (h_menu_system_alter)
|
||||
l_manager.subscribe_to_menu_system_alter_hook (h_menu_system_alter)
|
||||
end
|
||||
if attached {CMS_HOOK_MENU_ALTER} Current as h_menu_alter then
|
||||
a_response.subscribe_to_menu_alter_hook (h_menu_alter)
|
||||
l_manager.subscribe_to_menu_alter_hook (h_menu_alter)
|
||||
end
|
||||
if attached {CMS_HOOK_BLOCK} Current as h_block then
|
||||
a_response.subscribe_to_block_hook (h_block)
|
||||
l_manager.subscribe_to_block_hook (h_block)
|
||||
end
|
||||
if attached {CMS_HOOK_FORM_ALTER} Current as h_form then
|
||||
a_response.subscribe_to_form_alter_hook (h_form)
|
||||
l_manager.subscribe_to_form_alter_hook (h_form)
|
||||
end
|
||||
if attached {CMS_HOOK_VALUE_TABLE_ALTER} Current as h_value then
|
||||
a_response.subscribe_to_value_table_alter_hook (h_value)
|
||||
l_manager.subscribe_to_value_table_alter_hook (h_value)
|
||||
end
|
||||
if attached {CMS_HOOK_RESPONSE_ALTER} Current as h_resp then
|
||||
a_response.subscribe_to_response_alter_hook (h_resp)
|
||||
l_manager.subscribe_to_response_alter_hook (h_resp)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
160
src/hooks/cms_hook_core_manager.e
Normal file
160
src/hooks/cms_hook_core_manager.e
Normal file
@@ -0,0 +1,160 @@
|
||||
note
|
||||
description: "[
|
||||
Hook manager specific for Core hooks.
|
||||
- Value Table Alter
|
||||
-
|
||||
]"
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
CMS_HOOK_CORE_MANAGER
|
||||
|
||||
inherit
|
||||
CMS_HOOK_MANAGER
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature -- Hook: value alter
|
||||
|
||||
subscribe_to_value_table_alter_hook (h: CMS_HOOK_VALUE_TABLE_ALTER)
|
||||
-- Add `h' as subscriber of value table alter hooks CMS_HOOK_VALUE_TABLE_ALTER.
|
||||
do
|
||||
subscribe_to_hook (h, {CMS_HOOK_VALUE_TABLE_ALTER})
|
||||
end
|
||||
|
||||
invoke_value_table_alter (a_table: CMS_VALUE_TABLE; a_response: CMS_RESPONSE)
|
||||
-- Invoke value table alter hook for table `a_table'.
|
||||
do
|
||||
if attached subscribers ({CMS_HOOK_VALUE_TABLE_ALTER}) as lst then
|
||||
across
|
||||
lst as ic
|
||||
loop
|
||||
if attached {CMS_HOOK_VALUE_TABLE_ALTER} ic.item as h then
|
||||
h.value_table_alter (a_table, a_response)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
feature -- Hook: response
|
||||
|
||||
subscribe_to_response_alter_hook (h: CMS_HOOK_RESPONSE_ALTER)
|
||||
-- Add `h' as subscriber of response alter hooks CMS_HOOK_RESPONSE_ALTER.
|
||||
do
|
||||
subscribe_to_hook (h, {CMS_HOOK_RESPONSE_ALTER})
|
||||
end
|
||||
|
||||
invoke_response_alter (a_response: CMS_RESPONSE)
|
||||
-- Invoke response alter hook for response `a_response'.
|
||||
do
|
||||
if attached subscribers ({CMS_HOOK_RESPONSE_ALTER}) as lst then
|
||||
across
|
||||
lst as ic
|
||||
loop
|
||||
if attached {CMS_HOOK_RESPONSE_ALTER} ic.item as h then
|
||||
h.response_alter (a_response)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
feature -- Hook: menu_system_alter
|
||||
|
||||
subscribe_to_menu_system_alter_hook (h: CMS_HOOK_MENU_SYSTEM_ALTER)
|
||||
-- Add `h' as subscriber of menu system alter hooks CMS_HOOK_MENU_SYSTEM_ALTER.
|
||||
do
|
||||
subscribe_to_hook (h, {CMS_HOOK_MENU_SYSTEM_ALTER})
|
||||
end
|
||||
|
||||
invoke_menu_system_alter (a_menu_system: CMS_MENU_SYSTEM; a_response: CMS_RESPONSE)
|
||||
-- Invoke menu system alter hook for menu `a_menu_system', and response `a_response'.
|
||||
do
|
||||
if attached subscribers ({CMS_HOOK_MENU_SYSTEM_ALTER}) as lst then
|
||||
across
|
||||
lst as ic
|
||||
loop
|
||||
if attached {CMS_HOOK_MENU_SYSTEM_ALTER} ic.item as h then
|
||||
h.menu_system_alter (a_menu_system, a_response)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
feature -- Hook: menu_alter
|
||||
|
||||
subscribe_to_menu_alter_hook (h: CMS_HOOK_MENU_ALTER)
|
||||
-- Add `h' as subscriber of menu alter hooks CMS_HOOK_MENU_ALTER.
|
||||
do
|
||||
subscribe_to_hook (h, {CMS_HOOK_MENU_ALTER})
|
||||
end
|
||||
|
||||
invoke_menu_alter (a_menu: CMS_MENU; a_response: CMS_RESPONSE)
|
||||
-- Invoke menu alter hook for menu `a_menu', and response `a_response'.
|
||||
do
|
||||
if attached subscribers ({CMS_HOOK_MENU_ALTER}) as lst then
|
||||
across
|
||||
lst as c
|
||||
loop
|
||||
if attached {CMS_HOOK_MENU_ALTER} c.item as h then
|
||||
h.menu_alter (a_menu, a_response)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
feature -- Hook: form_alter
|
||||
|
||||
subscribe_to_form_alter_hook (h: CMS_HOOK_FORM_ALTER)
|
||||
-- Add `h' as subscriber of form alter hooks CMS_HOOK_FORM_ALTER,
|
||||
-- and response `a_response'.
|
||||
do
|
||||
subscribe_to_hook (h, {CMS_HOOK_MENU_ALTER})
|
||||
end
|
||||
|
||||
invoke_form_alter (a_form: CMS_FORM; a_form_data: detachable WSF_FORM_DATA; a_response: CMS_RESPONSE)
|
||||
-- Invoke form alter hook for form `a_form' and associated data `a_form_data'
|
||||
do
|
||||
if attached subscribers ({CMS_HOOK_FORM_ALTER}) as lst then
|
||||
across
|
||||
lst as c
|
||||
loop
|
||||
if attached {CMS_HOOK_FORM_ALTER} c.item as h then
|
||||
h.form_alter (a_form, a_form_data, a_response)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
feature -- Hook: block
|
||||
|
||||
subscribe_to_block_hook (h: CMS_HOOK_BLOCK)
|
||||
-- Add `h' as subscriber of hooks CMS_HOOK_BLOCK.
|
||||
do
|
||||
subscribe_to_hook (h, {CMS_HOOK_BLOCK})
|
||||
end
|
||||
|
||||
invoke_block (a_response: CMS_RESPONSE)
|
||||
-- Invoke block hook for response `a_response' in order to get block from modules.
|
||||
do
|
||||
if attached subscribers ({CMS_HOOK_BLOCK}) as lst then
|
||||
across
|
||||
lst as c
|
||||
loop
|
||||
if attached {CMS_HOOK_BLOCK} c.item as h then
|
||||
across
|
||||
h.block_list as blst
|
||||
loop
|
||||
h.get_block_view (blst.item, a_response)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
note
|
||||
copyright: "2011-2015, Jocelyn Fiat, Javier Velilla, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
end
|
||||
55
src/hooks/cms_hook_manager.e
Normal file
55
src/hooks/cms_hook_manager.e
Normal file
@@ -0,0 +1,55 @@
|
||||
note
|
||||
description: "Hooks manager."
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
CMS_HOOK_MANAGER
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make
|
||||
do
|
||||
create all_subscribers.make (0)
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
subscribers (a_type: TYPE [CMS_HOOK]): detachable LIST [CMS_HOOK]
|
||||
-- Subscribers of hook typed `a_type'.
|
||||
do
|
||||
Result := all_subscribers.item (a_type)
|
||||
end
|
||||
|
||||
feature -- Change
|
||||
|
||||
subscribe_to_hook (h: CMS_HOOK; a_hook_type: TYPE [CMS_HOOK])
|
||||
-- Subscribe `h' to hooks identified by `a_hook_type'.
|
||||
local
|
||||
lst: detachable LIST [CMS_HOOK]
|
||||
do
|
||||
lst := all_subscribers.item (a_hook_type)
|
||||
if lst = Void then
|
||||
create {ARRAYED_LIST [CMS_HOOK]} lst.make (1)
|
||||
all_subscribers.force (lst, a_hook_type)
|
||||
end
|
||||
if not lst.has (h) then
|
||||
lst.force (h)
|
||||
end
|
||||
end
|
||||
|
||||
feature {NONE} -- Implementation
|
||||
|
||||
all_subscribers: HASH_TABLE [LIST [CMS_HOOK], TYPE [CMS_HOOK]]
|
||||
|
||||
invariant
|
||||
all_subscribers /= Void
|
||||
|
||||
note
|
||||
copyright: "2011-2015, Jocelyn Fiat, Javier Velilla, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
end
|
||||
|
||||
@@ -39,4 +39,7 @@ feature -- Basic operation
|
||||
end
|
||||
end
|
||||
|
||||
note
|
||||
copyright: "2011-2015, Jocelyn Fiat, Javier Velilla, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
end
|
||||
|
||||
@@ -33,7 +33,7 @@ feature {NONE} -- Initialization
|
||||
get_theme
|
||||
create menu_system.make
|
||||
initialize_block_region_settings
|
||||
create hook_subscribers.make (0)
|
||||
create hooks.make
|
||||
register_hooks
|
||||
end
|
||||
|
||||
@@ -409,9 +409,9 @@ feature -- Blocks initialization
|
||||
l_table["help"] := "help"
|
||||
l_table["content"] := "content"
|
||||
l_table["footer"] := "footer"
|
||||
l_table["management"] := "first_sidebar"
|
||||
l_table["navigation"] := "first_sidebar"
|
||||
l_table["user"] := "first_sidebar"
|
||||
l_table["management"] := "sidebar_first"
|
||||
l_table["navigation"] := "sidebar_first"
|
||||
l_table["user"] := "sidebar_first"
|
||||
l_table["bottom"] := "page_bottom"
|
||||
block_region_settings := l_table
|
||||
end
|
||||
@@ -474,13 +474,13 @@ feature -- Blocks
|
||||
add_block (content_block, "content")
|
||||
|
||||
if attached management_menu_block as l_block then
|
||||
add_block (l_block, "first_sidebar")
|
||||
add_block (l_block, "sidebar_first")
|
||||
end
|
||||
if attached navigation_menu_block as l_block then
|
||||
add_block (l_block, "first_sidebar")
|
||||
add_block (l_block, "sidebar_first")
|
||||
end
|
||||
if attached user_menu_block as l_block then
|
||||
add_block (l_block, "first_sidebar")
|
||||
add_block (l_block, "sidebar_second")
|
||||
end
|
||||
|
||||
invoke_block
|
||||
@@ -596,132 +596,77 @@ feature -- Blocks
|
||||
|
||||
feature -- Hooks
|
||||
|
||||
hook_subscribers: HASH_TABLE [LIST [CMS_HOOK], TYPE [CMS_HOOK]]
|
||||
-- Hook indexed by hook identifier.
|
||||
|
||||
subscribe_to_hook (h: CMS_HOOK; a_hook_type: TYPE [CMS_HOOK])
|
||||
-- Subscribe `h' to hooks identified by `a_hook_type'.
|
||||
local
|
||||
lst: detachable LIST [CMS_HOOK]
|
||||
do
|
||||
lst := hook_subscribers.item (a_hook_type)
|
||||
if lst = Void then
|
||||
create {ARRAYED_LIST [CMS_HOOK]} lst.make (1)
|
||||
hook_subscribers.force (lst, a_hook_type)
|
||||
end
|
||||
if not lst.has (h) then
|
||||
lst.force (h)
|
||||
end
|
||||
end
|
||||
hooks: CMS_HOOK_CORE_MANAGER
|
||||
-- Manager handling hook subscriptions.
|
||||
|
||||
feature -- Hook: value alter
|
||||
|
||||
subscribe_to_value_table_alter_hook (h: CMS_HOOK_VALUE_TABLE_ALTER)
|
||||
-- Add `h' as subscriber of value table alter hooks CMS_HOOK_VALUE_TABLE_ALTER.
|
||||
do
|
||||
subscribe_to_hook (h, {CMS_HOOK_VALUE_TABLE_ALTER})
|
||||
end
|
||||
-- subscribe_to_value_table_alter_hook (h: CMS_HOOK_VALUE_TABLE_ALTER)
|
||||
-- -- Add `h' as subscriber of value table alter hooks CMS_HOOK_VALUE_TABLE_ALTER.
|
||||
-- do
|
||||
-- hooks.subscribe_to_value_table_alter_hook (h)
|
||||
-- end
|
||||
|
||||
invoke_value_table_alter (a_table: CMS_VALUE_TABLE)
|
||||
-- Invoke value table alter hook for table `a_table'.
|
||||
do
|
||||
if attached hook_subscribers.item ({CMS_HOOK_VALUE_TABLE_ALTER}) as lst then
|
||||
across
|
||||
lst as c
|
||||
loop
|
||||
if attached {CMS_HOOK_VALUE_TABLE_ALTER} c.item as h then
|
||||
h.value_table_alter (a_table, Current)
|
||||
end
|
||||
end
|
||||
end
|
||||
hooks.invoke_value_table_alter (a_table, Current)
|
||||
end
|
||||
|
||||
feature -- Hook: response
|
||||
|
||||
subscribe_to_response_alter_hook (h: CMS_HOOK_RESPONSE_ALTER)
|
||||
-- Add `h' as subscriber of response alter hooks CMS_HOOK_RESPONSE_ALTER.
|
||||
do
|
||||
subscribe_to_hook (h, {CMS_HOOK_RESPONSE_ALTER})
|
||||
end
|
||||
-- subscribe_to_response_alter_hook (h: CMS_HOOK_RESPONSE_ALTER)
|
||||
-- -- Add `h' as subscriber of response alter hooks CMS_HOOK_RESPONSE_ALTER.
|
||||
-- do
|
||||
-- hooks.subscribe_to_response_alter_hook (h)
|
||||
-- end
|
||||
|
||||
invoke_response_alter (a_response: CMS_RESPONSE)
|
||||
-- Invoke value table alter hook for table `a_table'.
|
||||
-- Invoke response alter hook for response `a_response'.
|
||||
do
|
||||
if attached hook_subscribers.item ({CMS_HOOK_RESPONSE_ALTER}) as lst then
|
||||
across
|
||||
lst as c
|
||||
loop
|
||||
if attached {CMS_HOOK_RESPONSE_ALTER} c.item as h then
|
||||
h.response_alter (a_response)
|
||||
end
|
||||
end
|
||||
end
|
||||
hooks.invoke_response_alter (a_response)
|
||||
end
|
||||
|
||||
feature -- Hook: menu_system_alter
|
||||
|
||||
subscribe_to_menu_system_alter_hook (h: CMS_HOOK_MENU_SYSTEM_ALTER)
|
||||
-- Add `h' as subscriber of menu system alter hooks CMS_HOOK_MENU_SYSTEM_ALTER.
|
||||
do
|
||||
subscribe_to_hook (h, {CMS_HOOK_MENU_SYSTEM_ALTER})
|
||||
end
|
||||
-- subscribe_to_menu_system_alter_hook (h: CMS_HOOK_MENU_SYSTEM_ALTER)
|
||||
-- -- Add `h' as subscriber of menu system alter hooks CMS_HOOK_MENU_SYSTEM_ALTER.
|
||||
-- do
|
||||
-- hooks.subscribe_to_menu_system_alter_hook (h)
|
||||
-- end
|
||||
|
||||
invoke_menu_system_alter (a_menu_system: CMS_MENU_SYSTEM)
|
||||
-- Invoke menu system alter hook for menu `a_menu_system'.
|
||||
do
|
||||
if attached hook_subscribers.item ({CMS_HOOK_MENU_SYSTEM_ALTER}) as lst then
|
||||
across
|
||||
lst as c
|
||||
loop
|
||||
if attached {CMS_HOOK_MENU_SYSTEM_ALTER} c.item as h then
|
||||
h.menu_system_alter (a_menu_system, Current)
|
||||
end
|
||||
end
|
||||
end
|
||||
hooks.invoke_menu_system_alter (menu_system, Current)
|
||||
end
|
||||
|
||||
feature -- Hook: menu_alter
|
||||
|
||||
subscribe_to_menu_alter_hook (h: CMS_HOOK_MENU_ALTER)
|
||||
-- Add `h' as subscriber of menu alter hooks CMS_HOOK_MENU_ALTER.
|
||||
do
|
||||
subscribe_to_hook (h, {CMS_HOOK_MENU_ALTER})
|
||||
end
|
||||
-- subscribe_to_menu_alter_hook (h: CMS_HOOK_MENU_ALTER)
|
||||
-- -- Add `h' as subscriber of menu alter hooks CMS_HOOK_MENU_ALTER.
|
||||
-- do
|
||||
-- hooks.subscribe_to_menu_alter_hook (h)
|
||||
-- end
|
||||
|
||||
invoke_menu_alter (a_menu: CMS_MENU)
|
||||
-- Invoke menu alter hook for menu `a_menu'.
|
||||
do
|
||||
if attached hook_subscribers.item ({CMS_HOOK_MENU_ALTER}) as lst then
|
||||
across
|
||||
lst as c
|
||||
loop
|
||||
if attached {CMS_HOOK_MENU_ALTER} c.item as h then
|
||||
h.menu_alter (a_menu, Current)
|
||||
end
|
||||
end
|
||||
end
|
||||
hooks.invoke_menu_alter (a_menu, Current)
|
||||
end
|
||||
|
||||
feature -- Hook: form_alter
|
||||
|
||||
subscribe_to_form_alter_hook (h: CMS_HOOK_FORM_ALTER)
|
||||
-- Add `h' as subscriber of form alter hooks CMS_HOOK_FORM_ALTER.
|
||||
do
|
||||
subscribe_to_hook (h, {CMS_HOOK_MENU_ALTER})
|
||||
end
|
||||
-- subscribe_to_form_alter_hook (h: CMS_HOOK_FORM_ALTER)
|
||||
-- -- Add `h' as subscriber of form alter hooks CMS_HOOK_FORM_ALTER.
|
||||
-- do
|
||||
-- hooks.subscribe_to_form_alter_hook (h)
|
||||
-- end
|
||||
|
||||
invoke_form_alter (a_form: CMS_FORM; a_form_data: detachable WSF_FORM_DATA)
|
||||
-- Invoke form alter hook for form `a_form' and associated data `a_form_data'
|
||||
do
|
||||
if attached hook_subscribers.item ({CMS_HOOK_FORM_ALTER}) as lst then
|
||||
across
|
||||
lst as c
|
||||
loop
|
||||
if attached {CMS_HOOK_FORM_ALTER} c.item as h then
|
||||
h.form_alter (a_form, a_form_data, Current)
|
||||
end
|
||||
end
|
||||
end
|
||||
hooks.invoke_form_alter (a_form, a_form_data, Current)
|
||||
end
|
||||
|
||||
feature -- Hook: block
|
||||
@@ -729,25 +674,13 @@ feature -- Hook: block
|
||||
subscribe_to_block_hook (h: CMS_HOOK_BLOCK)
|
||||
-- Add `h' as subscriber of hooks CMS_HOOK_BLOCK.
|
||||
do
|
||||
subscribe_to_hook (h, {CMS_HOOK_BLOCK})
|
||||
hooks.subscribe_to_hook (h, {CMS_HOOK_BLOCK})
|
||||
end
|
||||
|
||||
invoke_block
|
||||
-- Invoke block hook in order to get block from modules.
|
||||
do
|
||||
if attached hook_subscribers.item ({CMS_HOOK_BLOCK}) as lst then
|
||||
across
|
||||
lst as c
|
||||
loop
|
||||
if attached {CMS_HOOK_BLOCK} c.item as h then
|
||||
across
|
||||
h.block_list as blst
|
||||
loop
|
||||
h.get_block_view (blst.item, Current)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
hooks.invoke_block (Current)
|
||||
end
|
||||
|
||||
feature -- Menu: change
|
||||
|
||||
Reference in New Issue
Block a user