Cleaned up hooks related code, and always go via CMS_RESPONSE.hooks
This commit is contained in:
@@ -84,7 +84,7 @@ feature -- Process Edit
|
|||||||
do
|
do
|
||||||
create b.make_empty
|
create b.make_empty
|
||||||
f := new_edit_form (a_role, url (request.percent_encoded_path_info, Void), "edit-user")
|
f := new_edit_form (a_role, url (request.percent_encoded_path_info, Void), "edit-user")
|
||||||
invoke_form_alter (f, fd)
|
hooks.invoke_form_alter (f, fd, Current)
|
||||||
if request.is_post_request_method then
|
if request.is_post_request_method then
|
||||||
f.validation_actions.extend (agent edit_form_validate(?,a_role, b))
|
f.validation_actions.extend (agent edit_form_validate(?,a_role, b))
|
||||||
f.submit_actions.extend (agent edit_form_submit(?, a_role, b))
|
f.submit_actions.extend (agent edit_form_submit(?, a_role, b))
|
||||||
@@ -117,7 +117,7 @@ feature -- Process Delete
|
|||||||
do
|
do
|
||||||
create b.make_empty
|
create b.make_empty
|
||||||
f := new_delete_form (a_role, url (request.percent_encoded_path_info, Void), "edit-user")
|
f := new_delete_form (a_role, url (request.percent_encoded_path_info, Void), "edit-user")
|
||||||
invoke_form_alter (f, fd)
|
hooks.invoke_form_alter (f, fd, Current)
|
||||||
if request.is_post_request_method then
|
if request.is_post_request_method then
|
||||||
f.process (Current)
|
f.process (Current)
|
||||||
fd := f.last_data
|
fd := f.last_data
|
||||||
@@ -149,7 +149,7 @@ feature -- Process New
|
|||||||
do
|
do
|
||||||
create b.make_empty
|
create b.make_empty
|
||||||
f := new_edit_form (l_role, url (request.percent_encoded_path_info, Void), "create-role")
|
f := new_edit_form (l_role, url (request.percent_encoded_path_info, Void), "create-role")
|
||||||
invoke_form_alter (f, fd)
|
hooks.invoke_form_alter (f, fd, Current)
|
||||||
if request.is_post_request_method then
|
if request.is_post_request_method then
|
||||||
f.validation_actions.extend (agent new_form_validate(?, b))
|
f.validation_actions.extend (agent new_form_validate(?, b))
|
||||||
f.submit_actions.extend (agent edit_form_submit(?, l_role, b))
|
f.submit_actions.extend (agent edit_form_submit(?, l_role, b))
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ feature -- Process Edit
|
|||||||
do
|
do
|
||||||
create b.make_empty
|
create b.make_empty
|
||||||
f := new_edit_form (a_user, url (location, Void), "edit-user")
|
f := new_edit_form (a_user, url (location, Void), "edit-user")
|
||||||
invoke_form_alter (f, fd)
|
hooks.invoke_form_alter (f, fd, Current)
|
||||||
if request.is_post_request_method then
|
if request.is_post_request_method then
|
||||||
f.submit_actions.extend (agent edit_form_submit (?, a_user, b))
|
f.submit_actions.extend (agent edit_form_submit (?, a_user, b))
|
||||||
f.process (Current)
|
f.process (Current)
|
||||||
@@ -118,7 +118,7 @@ feature -- Process Delete
|
|||||||
do
|
do
|
||||||
create b.make_empty
|
create b.make_empty
|
||||||
f := new_delete_form (a_user, url (location, Void), "edit-user")
|
f := new_delete_form (a_user, url (location, Void), "edit-user")
|
||||||
invoke_form_alter (f, fd)
|
hooks.invoke_form_alter (f, fd, Current)
|
||||||
if request.is_post_request_method then
|
if request.is_post_request_method then
|
||||||
f.process (Current)
|
f.process (Current)
|
||||||
fd := f.last_data
|
fd := f.last_data
|
||||||
@@ -151,7 +151,7 @@ feature -- Process New
|
|||||||
do
|
do
|
||||||
create b.make_empty
|
create b.make_empty
|
||||||
f := new_edit_form (l_user, url (location, Void), "create-user")
|
f := new_edit_form (l_user, url (location, Void), "create-user")
|
||||||
invoke_form_alter (f, fd)
|
hooks.invoke_form_alter (f, fd, Current)
|
||||||
if request.is_post_request_method then
|
if request.is_post_request_method then
|
||||||
f.validation_actions.extend (agent new_form_validate (?, b))
|
f.validation_actions.extend (agent new_form_validate (?, b))
|
||||||
f.submit_actions.extend (agent edit_form_submit (?, l_user, b))
|
f.submit_actions.extend (agent edit_form_submit (?, l_user, b))
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ feature -- Execution
|
|||||||
node_api.has_permission_for_action_on_node ("edit", l_node, user)
|
node_api.has_permission_for_action_on_node ("edit", l_node, user)
|
||||||
then
|
then
|
||||||
f := new_edit_form (l_node, url (location, Void), "edit-" + l_type.name, l_type)
|
f := new_edit_form (l_node, url (location, Void), "edit-" + l_type.name, l_type)
|
||||||
invoke_form_alter (f, fd)
|
hooks.invoke_form_alter (f, fd, Current)
|
||||||
if request.is_post_request_method then
|
if request.is_post_request_method then
|
||||||
f.validation_actions.extend (agent edit_form_validate (?, b))
|
f.validation_actions.extend (agent edit_form_validate (?, b))
|
||||||
f.submit_actions.extend (agent edit_form_submit (?, l_node, l_type, b))
|
f.submit_actions.extend (agent edit_form_submit (?, l_node, l_type, b))
|
||||||
@@ -80,7 +80,7 @@ feature -- Execution
|
|||||||
node_api.has_permission_for_action_on_node ("delete", l_node, user)
|
node_api.has_permission_for_action_on_node ("delete", l_node, user)
|
||||||
then
|
then
|
||||||
f := new_delete_form (l_node, url (location, Void), "delete-" + l_type.name, l_type)
|
f := new_delete_form (l_node, url (location, Void), "delete-" + l_type.name, l_type)
|
||||||
invoke_form_alter (f, fd)
|
hooks.invoke_form_alter (f, fd, Current)
|
||||||
if request.is_post_request_method then
|
if request.is_post_request_method then
|
||||||
f.process (Current)
|
f.process (Current)
|
||||||
fd := f.last_data
|
fd := f.last_data
|
||||||
@@ -104,7 +104,7 @@ feature -- Execution
|
|||||||
node_api.has_permission_for_action_on_node ("trash", l_node, user)
|
node_api.has_permission_for_action_on_node ("trash", l_node, user)
|
||||||
then
|
then
|
||||||
f := new_trash_form (l_node, url (location, Void), "trash-" + l_type.name, l_type)
|
f := new_trash_form (l_node, url (location, Void), "trash-" + l_type.name, l_type)
|
||||||
invoke_form_alter (f, fd)
|
hooks.invoke_form_alter (f, fd, Current)
|
||||||
if request.is_post_request_method then
|
if request.is_post_request_method then
|
||||||
f.process (Current)
|
f.process (Current)
|
||||||
fd := f.last_data
|
fd := f.last_data
|
||||||
@@ -137,7 +137,7 @@ feature -- Execution
|
|||||||
if has_permissions (<<"create any", "create " + l_type.name>>) then
|
if has_permissions (<<"create any", "create " + l_type.name>>) then
|
||||||
if attached l_type.new_node (Void) as l_node then
|
if attached l_type.new_node (Void) as l_node then
|
||||||
f := new_edit_form (l_node, url (location, Void), "edit-" + l_type.name, l_type)
|
f := new_edit_form (l_node, url (location, Void), "edit-" + l_type.name, l_type)
|
||||||
invoke_form_alter (f, fd)
|
hooks.invoke_form_alter (f, fd, Current)
|
||||||
if request.is_post_request_method then
|
if request.is_post_request_method then
|
||||||
f.validation_actions.extend (agent edit_form_validate (?, b))
|
f.validation_actions.extend (agent edit_form_validate (?, b))
|
||||||
f.submit_actions.extend (agent edit_form_submit (?, l_node, l_type, b))
|
f.submit_actions.extend (agent edit_form_submit (?, l_node, l_type, b))
|
||||||
|
|||||||
@@ -56,7 +56,6 @@ feature -- Execution
|
|||||||
process
|
process
|
||||||
-- Computed response message.
|
-- Computed response message.
|
||||||
local
|
local
|
||||||
b: detachable STRING_8
|
|
||||||
nid: INTEGER_64
|
nid: INTEGER_64
|
||||||
l_node: like node
|
l_node: like node
|
||||||
do
|
do
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ feature -- Basic operation
|
|||||||
|
|
||||||
prepare (a_response: CMS_RESPONSE)
|
prepare (a_response: CMS_RESPONSE)
|
||||||
do
|
do
|
||||||
a_response.invoke_form_alter (Current, Void)
|
a_response.hooks.invoke_form_alter (Current, Void, a_response)
|
||||||
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.invoke_form_alter (Current, fd)
|
a_response.hooks.invoke_form_alter (Current, fd, a_response)
|
||||||
end
|
end
|
||||||
|
|
||||||
on_processed (a_response: CMS_RESPONSE; fd: WSF_FORM_DATA)
|
on_processed (a_response: CMS_RESPONSE; fd: WSF_FORM_DATA)
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ feature -- Hooks configuration
|
|||||||
-- Module hooks configuration.
|
-- Module hooks configuration.
|
||||||
do
|
do
|
||||||
auto_subscribe_to_hooks (a_response)
|
auto_subscribe_to_hooks (a_response)
|
||||||
a_response.subscribe_to_block_hook (Current)
|
a_response.hooks.subscribe_to_block_hook (Current)
|
||||||
end
|
end
|
||||||
|
|
||||||
feature -- Hooks
|
feature -- Hooks
|
||||||
|
|||||||
@@ -483,7 +483,7 @@ feature -- Blocks
|
|||||||
add_block (l_block, "sidebar_second")
|
add_block (l_block, "sidebar_second")
|
||||||
end
|
end
|
||||||
|
|
||||||
invoke_block
|
hooks.invoke_block (Current)
|
||||||
debug ("cms")
|
debug ("cms")
|
||||||
add_block (create {CMS_CONTENT_BLOCK}.make ("made_with", Void, "Made with <a href=%"http://www.eiffel.com/%">EWF</a>", Void), "footer")
|
add_block (create {CMS_CONTENT_BLOCK}.make ("made_with", Void, "Made with <a href=%"http://www.eiffel.com/%">EWF</a>", Void), "footer")
|
||||||
end
|
end
|
||||||
@@ -599,90 +599,6 @@ feature -- Hooks
|
|||||||
hooks: CMS_HOOK_CORE_MANAGER
|
hooks: CMS_HOOK_CORE_MANAGER
|
||||||
-- Manager handling hook subscriptions.
|
-- 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
|
|
||||||
-- 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
|
|
||||||
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
|
|
||||||
-- hooks.subscribe_to_response_alter_hook (h)
|
|
||||||
-- end
|
|
||||||
|
|
||||||
invoke_response_alter (a_response: CMS_RESPONSE)
|
|
||||||
-- Invoke response alter hook for response `a_response'.
|
|
||||||
do
|
|
||||||
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
|
|
||||||
-- 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
|
|
||||||
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
|
|
||||||
-- hooks.subscribe_to_menu_alter_hook (h)
|
|
||||||
-- end
|
|
||||||
|
|
||||||
invoke_menu_alter (a_menu: CMS_MENU)
|
|
||||||
-- Invoke menu alter hook for menu `a_menu'.
|
|
||||||
do
|
|
||||||
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
|
|
||||||
-- 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
|
|
||||||
hooks.invoke_form_alter (a_form, a_form_data, Current)
|
|
||||||
end
|
|
||||||
|
|
||||||
feature -- Hook: block
|
|
||||||
|
|
||||||
subscribe_to_block_hook (h: CMS_HOOK_BLOCK)
|
|
||||||
-- Add `h' as subscriber of hooks CMS_HOOK_BLOCK.
|
|
||||||
do
|
|
||||||
hooks.subscribe_to_hook (h, {CMS_HOOK_BLOCK})
|
|
||||||
end
|
|
||||||
|
|
||||||
invoke_block
|
|
||||||
-- Invoke block hook in order to get block from modules.
|
|
||||||
do
|
|
||||||
hooks.invoke_block (Current)
|
|
||||||
end
|
|
||||||
|
|
||||||
feature -- Menu: change
|
feature -- Menu: change
|
||||||
|
|
||||||
add_to_main_menu (lnk: CMS_LINK)
|
add_to_main_menu (lnk: CMS_LINK)
|
||||||
@@ -704,9 +620,6 @@ feature -- Menu: change
|
|||||||
|
|
||||||
add_to_menu (lnk: CMS_LINK; m: CMS_MENU)
|
add_to_menu (lnk: CMS_LINK; m: CMS_MENU)
|
||||||
do
|
do
|
||||||
-- if attached {CMS_LOCAL_LINK} lnk as l_local then
|
|
||||||
-- l_local.get_is_active (request)
|
|
||||||
-- end
|
|
||||||
m.extend (lnk)
|
m.extend (lnk)
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -821,7 +734,7 @@ feature -- Generation
|
|||||||
create {CMS_LOCAL_LINK} lnk.make ("Home", "")
|
create {CMS_LOCAL_LINK} lnk.make ("Home", "")
|
||||||
lnk.set_weight (-10)
|
lnk.set_weight (-10)
|
||||||
add_to_primary_menu (lnk)
|
add_to_primary_menu (lnk)
|
||||||
invoke_menu_system_alter (menu_system)
|
hooks.invoke_menu_system_alter (menu_system, Current)
|
||||||
|
|
||||||
if api.enabled_modules.count = 0 then
|
if api.enabled_modules.count = 0 then
|
||||||
add_to_primary_menu (create {CMS_LOCAL_LINK}.make ("Install", "admin/install"))
|
add_to_primary_menu (create {CMS_LOCAL_LINK}.make ("Install", "admin/install"))
|
||||||
@@ -864,10 +777,10 @@ feature -- Generation
|
|||||||
custom_prepare (page)
|
custom_prepare (page)
|
||||||
|
|
||||||
-- Cms response
|
-- Cms response
|
||||||
invoke_response_alter (Current)
|
hooks.invoke_response_alter (Current)
|
||||||
|
|
||||||
-- Cms values
|
-- Cms values
|
||||||
invoke_value_table_alter (values)
|
hooks.invoke_value_table_alter (values, Current)
|
||||||
|
|
||||||
-- Predefined values
|
-- Predefined values
|
||||||
page.register_variable (page, "page") -- DO NOT REMOVE
|
page.register_variable (page, "page") -- DO NOT REMOVE
|
||||||
|
|||||||
Reference in New Issue
Block a user