diff --git a/modules/auth/cms_auth_module_i.e b/modules/auth/cms_auth_module_i.e index d3fdee3..e03e08e 100644 --- a/modules/auth/cms_auth_module_i.e +++ b/modules/auth/cms_auth_module_i.e @@ -16,6 +16,8 @@ inherit CMS_HOOK_MENU_SYSTEM_ALTER + CMS_HOOK_BLOCK_HELPER + SHARED_LOGGER feature {NONE} -- Initialization @@ -86,23 +88,4 @@ feature -- Hooks end end -feature {NONE} -- Helpers - - template_block (a_block_id: READABLE_STRING_8; a_response: CMS_RESPONSE): detachable CMS_SMARTY_TEMPLATE_BLOCK - -- Smarty content block for `a_block_id' - local - p: detachable PATH - do - create p.make_from_string ("templates") - p := p.extended ("block_").appended (a_block_id).appended_with_extension ("tpl") - p := a_response.api.module_theme_resource_location (Current, p) - if p /= Void then - if attached p.entry as e then - create Result.make (a_block_id, Void, p.parent, e) - else - create Result.make (a_block_id, Void, p.parent, p) - end - end - end - end diff --git a/modules/auth/cms_authentication_module.e b/modules/auth/cms_authentication_module.e index 31f1d58..654b9f1 100644 --- a/modules/auth/cms_authentication_module.e +++ b/modules/auth/cms_authentication_module.e @@ -21,6 +21,8 @@ inherit CMS_HOOK_BLOCK + CMS_HOOK_BLOCK_HELPER + CMS_HOOK_MENU_SYSTEM_ALTER SHARED_EXECUTION_ENVIRONMENT @@ -208,7 +210,7 @@ feature -- Handler create {GENERIC_VIEW_CMS_RESPONSE} r.make (req, res, api) create b.make_empty l_user := r.user - if attached template_block ("account_info", r) as l_tpl_block then + if attached template_block (Current, "account_info", api) as l_tpl_block then l_tpl_block.set_weight (-10) r.add_block (l_tpl_block, "content") else @@ -246,7 +248,7 @@ feature -- Handler create {GENERIC_VIEW_CMS_RESPONSE} r.make (req, res, api) create b.make_empty l_user := r.user - if attached template_block ("account_edit", r) as l_tpl_block then + if attached template_block (Current, "account_edit", api) as l_tpl_block then l_tpl_block.set_weight (-10) r.add_block (l_tpl_block, "content") else @@ -921,25 +923,6 @@ feature {NONE} -- Token Generation Result := l_token end -feature {NONE} -- Helpers - - template_block (a_block_id: READABLE_STRING_8; a_response: CMS_RESPONSE): detachable CMS_SMARTY_TEMPLATE_BLOCK - -- Smarty content block for `a_block_id' - local - p: detachable PATH - do - create p.make_from_string ("templates") - p := p.extended ("block_").appended (a_block_id).appended_with_extension ("tpl") - p := a_response.api.module_theme_resource_location (Current, p) - if p /= Void then - if attached p.entry as e then - create Result.make (a_block_id, Void, p.parent, e) - else - create Result.make (a_block_id, Void, p.parent, p) - end - end - end - feature {NONE} -- Block views get_block_view_register (a_block_id: READABLE_STRING_8; a_response: CMS_RESPONSE) @@ -952,7 +935,7 @@ feature {NONE} -- Block views or else a_response.values.has ("error_email") ) then - if attached template_block (a_block_id, a_response) as l_tpl_block then + if attached template_block (Current, a_block_id, a_response.api) as l_tpl_block then -- l_tpl_block.set_value (a_response.values.item ("error_name"), "error_name") -- l_tpl_block.set_value (a_response.values.item ("error_email"), "error_email") -- l_tpl_block.set_value (a_response.values.item ("email"), "email") @@ -968,7 +951,7 @@ feature {NONE} -- Block views end end elseif a_response.request.is_post_request_method then - if attached template_block ("post_register", a_response) as l_tpl_block then + if attached template_block (Current, "post_register", a_response.api) as l_tpl_block then a_response.add_block (l_tpl_block, "content") else debug ("cms") @@ -982,7 +965,7 @@ feature {NONE} -- Block views get_block_view_reactivate (a_block_id: READABLE_STRING_8; a_response: CMS_RESPONSE) do if a_response.request.is_get_request_method then - if attached template_block (a_block_id, a_response) as l_tpl_block then + if attached template_block (Current, a_block_id, a_response.api) as l_tpl_block then a_response.add_block (l_tpl_block, "content") else debug ("cms") @@ -991,7 +974,7 @@ feature {NONE} -- Block views end elseif a_response.request.is_post_request_method then if a_response.values.has ("error_email") or else a_response.values.has ("is_active") then - if attached template_block (a_block_id, a_response) as l_tpl_block then + if attached template_block (Current, a_block_id, a_response.api) as l_tpl_block then -- l_tpl_block.set_value (a_response.values.item ("error_email"), "error_email") -- l_tpl_block.set_value (a_response.values.item ("email"), "email") -- l_tpl_block.set_value (a_response.values.item ("is_active"), "is_active") @@ -1002,7 +985,7 @@ feature {NONE} -- Block views end end else - if attached template_block ("post_reactivate", a_response) as l_tpl_block then + if attached template_block (Current, "post_reactivate", a_response.api) as l_tpl_block then a_response.add_block (l_tpl_block, "content") else debug ("cms") @@ -1016,7 +999,7 @@ feature {NONE} -- Block views get_block_view_new_password (a_block_id: READABLE_STRING_8; a_response: CMS_RESPONSE) do if a_response.request.is_get_request_method then - if attached template_block (a_block_id, a_response) as l_tpl_block then + if attached template_block (Current, a_block_id, a_response.api) as l_tpl_block then a_response.add_block (l_tpl_block, "content") else debug ("cms") @@ -1025,7 +1008,7 @@ feature {NONE} -- Block views end elseif a_response.request.is_post_request_method then if a_response.values.has ("error_email") or else a_response.values.has ("error_username") then - if attached template_block (a_block_id, a_response) as l_tpl_block then + if attached template_block (Current, a_block_id, a_response.api) as l_tpl_block then -- l_tpl_block.set_value (a_response.values.item ("error_email"), "error_email") -- l_tpl_block.set_value (a_response.values.item ("email"), "email") -- l_tpl_block.set_value (a_response.values.item ("error_username"), "error_username") @@ -1037,7 +1020,7 @@ feature {NONE} -- Block views end end else - if attached template_block ("post_password", a_response) as l_tpl_block then + if attached template_block (Current, "post_password", a_response.api) as l_tpl_block then a_response.add_block (l_tpl_block, "content") else debug ("cms") @@ -1051,7 +1034,7 @@ feature {NONE} -- Block views get_block_view_reset_password (a_block_id: READABLE_STRING_8; a_response: CMS_RESPONSE) do if a_response.request.is_get_request_method then - if attached template_block (a_block_id, a_response) as l_tpl_block then + if attached template_block (Current, a_block_id, a_response.api) as l_tpl_block then -- l_tpl_block.set_value (a_response.values.item ("token"), "token") -- l_tpl_block.set_value (a_response.values.item ("error_token"), "error_token") a_response.add_block (l_tpl_block, "content") @@ -1062,7 +1045,7 @@ feature {NONE} -- Block views end elseif a_response.request.is_post_request_method then if a_response.values.has ("error_token") or else a_response.values.has ("error_password") then - if attached template_block (a_block_id, a_response) as l_tpl_block then + if attached template_block (Current, a_block_id, a_response.api) as l_tpl_block then -- l_tpl_block.set_value (a_response.values.item ("error_token"), "error_token") -- l_tpl_block.set_value (a_response.values.item ("error_password"), "error_password") -- l_tpl_block.set_value (a_response.values.item ("token"), "token") @@ -1073,7 +1056,7 @@ feature {NONE} -- Block views end end else - if attached template_block ("post_reset", a_response) as l_tpl_block then + if attached template_block (Current, "post_reset", a_response.api) as l_tpl_block then a_response.add_block (l_tpl_block, "content") else debug ("cms") diff --git a/modules/basic_auth/cms_basic_auth_module.e b/modules/basic_auth/cms_basic_auth_module.e index ce35643..b96aa3b 100644 --- a/modules/basic_auth/cms_basic_auth_module.e +++ b/modules/basic_auth/cms_basic_auth_module.e @@ -118,7 +118,7 @@ feature {NONE} -- Implementation: routes r.add_error_message ("You are already signed in!") r.set_main_content (r.link ("Logout", "account/roc-logout", Void)) else - if attached template_block ("login", r) as l_tpl_block then + if attached template_block (Current, "login", api) as l_tpl_block then r.add_javascript_url (r.url ("module/" + name + "/files/js/roc_basic_auth.js", Void)) create vals.make (1) @@ -170,7 +170,7 @@ feature {NONE} -- Block views local vals: CMS_VALUE_TABLE do - if attached template_block (a_block_id, a_response) as l_tpl_block then + if attached template_block (Current, a_block_id, a_response.api) as l_tpl_block then create vals.make (1) -- add the variable to the block a_response.api.hooks.invoke_value_table_alter (vals, a_response) diff --git a/modules/basic_auth/site/templates/block_login.tpl b/modules/basic_auth/site/templates/block_login.tpl index f5b3eb6..eb3fccf 100644 --- a/modules/basic_auth/site/templates/block_login.tpl +++ b/modules/basic_auth/site/templates/block_login.tpl @@ -1,6 +1,6 @@ {unless isset="$user"}