Reuse improved CMS_HOOK_BLOCK_HELPER to help creation of block templates.
Fixed typo in basic auth login form.
This commit is contained in:
@@ -16,6 +16,8 @@ inherit
|
|||||||
|
|
||||||
CMS_HOOK_MENU_SYSTEM_ALTER
|
CMS_HOOK_MENU_SYSTEM_ALTER
|
||||||
|
|
||||||
|
CMS_HOOK_BLOCK_HELPER
|
||||||
|
|
||||||
SHARED_LOGGER
|
SHARED_LOGGER
|
||||||
|
|
||||||
feature {NONE} -- Initialization
|
feature {NONE} -- Initialization
|
||||||
@@ -86,23 +88,4 @@ feature -- Hooks
|
|||||||
end
|
end
|
||||||
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
|
end
|
||||||
|
|||||||
@@ -21,6 +21,8 @@ inherit
|
|||||||
|
|
||||||
CMS_HOOK_BLOCK
|
CMS_HOOK_BLOCK
|
||||||
|
|
||||||
|
CMS_HOOK_BLOCK_HELPER
|
||||||
|
|
||||||
CMS_HOOK_MENU_SYSTEM_ALTER
|
CMS_HOOK_MENU_SYSTEM_ALTER
|
||||||
|
|
||||||
SHARED_EXECUTION_ENVIRONMENT
|
SHARED_EXECUTION_ENVIRONMENT
|
||||||
@@ -208,7 +210,7 @@ feature -- Handler
|
|||||||
create {GENERIC_VIEW_CMS_RESPONSE} r.make (req, res, api)
|
create {GENERIC_VIEW_CMS_RESPONSE} r.make (req, res, api)
|
||||||
create b.make_empty
|
create b.make_empty
|
||||||
l_user := r.user
|
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)
|
l_tpl_block.set_weight (-10)
|
||||||
r.add_block (l_tpl_block, "content")
|
r.add_block (l_tpl_block, "content")
|
||||||
else
|
else
|
||||||
@@ -246,7 +248,7 @@ feature -- Handler
|
|||||||
create {GENERIC_VIEW_CMS_RESPONSE} r.make (req, res, api)
|
create {GENERIC_VIEW_CMS_RESPONSE} r.make (req, res, api)
|
||||||
create b.make_empty
|
create b.make_empty
|
||||||
l_user := r.user
|
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)
|
l_tpl_block.set_weight (-10)
|
||||||
r.add_block (l_tpl_block, "content")
|
r.add_block (l_tpl_block, "content")
|
||||||
else
|
else
|
||||||
@@ -921,25 +923,6 @@ feature {NONE} -- Token Generation
|
|||||||
Result := l_token
|
Result := l_token
|
||||||
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
|
|
||||||
|
|
||||||
feature {NONE} -- Block views
|
feature {NONE} -- Block views
|
||||||
|
|
||||||
get_block_view_register (a_block_id: READABLE_STRING_8; a_response: CMS_RESPONSE)
|
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")
|
or else a_response.values.has ("error_email")
|
||||||
)
|
)
|
||||||
then
|
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_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 ("error_email"), "error_email")
|
||||||
-- l_tpl_block.set_value (a_response.values.item ("email"), "email")
|
-- l_tpl_block.set_value (a_response.values.item ("email"), "email")
|
||||||
@@ -968,7 +951,7 @@ feature {NONE} -- Block views
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
elseif a_response.request.is_post_request_method then
|
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")
|
a_response.add_block (l_tpl_block, "content")
|
||||||
else
|
else
|
||||||
debug ("cms")
|
debug ("cms")
|
||||||
@@ -982,7 +965,7 @@ feature {NONE} -- Block views
|
|||||||
get_block_view_reactivate (a_block_id: READABLE_STRING_8; a_response: CMS_RESPONSE)
|
get_block_view_reactivate (a_block_id: READABLE_STRING_8; a_response: CMS_RESPONSE)
|
||||||
do
|
do
|
||||||
if a_response.request.is_get_request_method then
|
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")
|
a_response.add_block (l_tpl_block, "content")
|
||||||
else
|
else
|
||||||
debug ("cms")
|
debug ("cms")
|
||||||
@@ -991,7 +974,7 @@ feature {NONE} -- Block views
|
|||||||
end
|
end
|
||||||
elseif a_response.request.is_post_request_method then
|
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 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 ("error_email"), "error_email")
|
||||||
-- l_tpl_block.set_value (a_response.values.item ("email"), "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")
|
-- l_tpl_block.set_value (a_response.values.item ("is_active"), "is_active")
|
||||||
@@ -1002,7 +985,7 @@ feature {NONE} -- Block views
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
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")
|
a_response.add_block (l_tpl_block, "content")
|
||||||
else
|
else
|
||||||
debug ("cms")
|
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)
|
get_block_view_new_password (a_block_id: READABLE_STRING_8; a_response: CMS_RESPONSE)
|
||||||
do
|
do
|
||||||
if a_response.request.is_get_request_method then
|
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")
|
a_response.add_block (l_tpl_block, "content")
|
||||||
else
|
else
|
||||||
debug ("cms")
|
debug ("cms")
|
||||||
@@ -1025,7 +1008,7 @@ feature {NONE} -- Block views
|
|||||||
end
|
end
|
||||||
elseif a_response.request.is_post_request_method then
|
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 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 ("error_email"), "error_email")
|
||||||
-- l_tpl_block.set_value (a_response.values.item ("email"), "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")
|
-- l_tpl_block.set_value (a_response.values.item ("error_username"), "error_username")
|
||||||
@@ -1037,7 +1020,7 @@ feature {NONE} -- Block views
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
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")
|
a_response.add_block (l_tpl_block, "content")
|
||||||
else
|
else
|
||||||
debug ("cms")
|
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)
|
get_block_view_reset_password (a_block_id: READABLE_STRING_8; a_response: CMS_RESPONSE)
|
||||||
do
|
do
|
||||||
if a_response.request.is_get_request_method then
|
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 ("token"), "token")
|
||||||
-- l_tpl_block.set_value (a_response.values.item ("error_token"), "error_token")
|
-- l_tpl_block.set_value (a_response.values.item ("error_token"), "error_token")
|
||||||
a_response.add_block (l_tpl_block, "content")
|
a_response.add_block (l_tpl_block, "content")
|
||||||
@@ -1062,7 +1045,7 @@ feature {NONE} -- Block views
|
|||||||
end
|
end
|
||||||
elseif a_response.request.is_post_request_method then
|
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 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_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 ("error_password"), "error_password")
|
||||||
-- l_tpl_block.set_value (a_response.values.item ("token"), "token")
|
-- l_tpl_block.set_value (a_response.values.item ("token"), "token")
|
||||||
@@ -1073,7 +1056,7 @@ feature {NONE} -- Block views
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
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")
|
a_response.add_block (l_tpl_block, "content")
|
||||||
else
|
else
|
||||||
debug ("cms")
|
debug ("cms")
|
||||||
|
|||||||
@@ -118,7 +118,7 @@ feature {NONE} -- Implementation: routes
|
|||||||
r.add_error_message ("You are already signed in!")
|
r.add_error_message ("You are already signed in!")
|
||||||
r.set_main_content (r.link ("Logout", "account/roc-logout", Void))
|
r.set_main_content (r.link ("Logout", "account/roc-logout", Void))
|
||||||
else
|
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))
|
r.add_javascript_url (r.url ("module/" + name + "/files/js/roc_basic_auth.js", Void))
|
||||||
|
|
||||||
create vals.make (1)
|
create vals.make (1)
|
||||||
@@ -170,7 +170,7 @@ feature {NONE} -- Block views
|
|||||||
local
|
local
|
||||||
vals: CMS_VALUE_TABLE
|
vals: CMS_VALUE_TABLE
|
||||||
do
|
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)
|
create vals.make (1)
|
||||||
-- add the variable to the block
|
-- add the variable to the block
|
||||||
a_response.api.hooks.invoke_value_table_alter (vals, a_response)
|
a_response.api.hooks.invoke_value_table_alter (vals, a_response)
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{unless isset="$user"}
|
{unless isset="$user"}
|
||||||
<div class="login-box">
|
<div class="login-box">
|
||||||
<div class="description">The "Basic Auth" relies on the HTTP basic acces authentication.<br/>(see also: <a href="https://en.wikipedia.org/wiki/Basic_access_authentication">https://en.wikipedia.org/wiki/Basic_access_authentication</a> )</div>
|
<div class="description">The "Basic Auth" relies on the HTTP basic access authentication.<br/>(see also: <a href="https://en.wikipedia.org/wiki/Basic_access_authentication">https://en.wikipedia.org/wiki/Basic_access_authentication</a> )</div>
|
||||||
<h3>Login or <a href="{$site_url/}account/roc-register">Register</a></h3>
|
<h3>Login or <a href="{$site_url/}account/roc-register">Register</a></h3>
|
||||||
<div>
|
<div>
|
||||||
<form name="cms_basic_auth" action="{$site_url/}roc-basic-login" method="POST">
|
<form name="cms_basic_auth" action="{$site_url/}roc-basic-login" method="POST">
|
||||||
|
|||||||
@@ -181,7 +181,7 @@ feature -- Hooks
|
|||||||
if a_block_id.is_case_insensitive_equal_general ("contact") then
|
if a_block_id.is_case_insensitive_equal_general ("contact") then
|
||||||
-- "contact", "post_contact"
|
-- "contact", "post_contact"
|
||||||
if a_response.request.is_get_request_method then
|
if a_response.request.is_get_request_method then
|
||||||
if attached template_block (Current, 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
|
||||||
if attached recaptcha_site_key (a_response.api) as l_recaptcha_site_key then
|
if attached recaptcha_site_key (a_response.api) as l_recaptcha_site_key then
|
||||||
l_tpl_block.set_value (l_recaptcha_site_key, "recaptcha_site_key")
|
l_tpl_block.set_value (l_recaptcha_site_key, "recaptcha_site_key")
|
||||||
end
|
end
|
||||||
@@ -201,7 +201,7 @@ feature -- Hooks
|
|||||||
f: CMS_FORM
|
f: CMS_FORM
|
||||||
do
|
do
|
||||||
a_response.add_style (a_response.url ("/module/" + name + "/files/css/contact.css", Void), Void)
|
a_response.add_style (a_response.url ("/module/" + name + "/files/css/contact.css", Void), Void)
|
||||||
if attached template_block (Current, "contact", a_response) as l_tpl_block then
|
if attached template_block (Current, "contact", api) as l_tpl_block then
|
||||||
if attached recaptcha_site_key (api) as l_recaptcha_site_key then
|
if attached recaptcha_site_key (api) as l_recaptcha_site_key then
|
||||||
l_tpl_block.set_value (l_recaptcha_site_key, "recaptcha_site_key")
|
l_tpl_block.set_value (l_recaptcha_site_key, "recaptcha_site_key")
|
||||||
end
|
end
|
||||||
@@ -339,7 +339,7 @@ feature -- Hooks
|
|||||||
r.values.force (True, "has_error")
|
r.values.force (True, "has_error")
|
||||||
vars.put ("True", "has_error")
|
vars.put ("True", "has_error")
|
||||||
end
|
end
|
||||||
if attached template_block_with_values (Current, "post_contact", r, vars) as l_tpl_block then
|
if attached template_block_with_values (Current, "post_contact", api, vars) as l_tpl_block then
|
||||||
across
|
across
|
||||||
r.values as tb
|
r.values as tb
|
||||||
loop
|
loop
|
||||||
@@ -354,7 +354,7 @@ feature -- Hooks
|
|||||||
-- send a bad request status code and redisplay the form with the previous data loaded.
|
-- send a bad request status code and redisplay the form with the previous data loaded.
|
||||||
r.set_value (False, "error")
|
r.set_value (False, "error")
|
||||||
r.set_status_code ({HTTP_STATUS_CODE}.bad_request)
|
r.set_status_code ({HTTP_STATUS_CODE}.bad_request)
|
||||||
if attached template_block_with_values (Current, "contact", r, vars) as l_tpl_block then
|
if attached template_block_with_values (Current, "contact", api, vars) as l_tpl_block then
|
||||||
across
|
across
|
||||||
r.values as tb
|
r.values as tb
|
||||||
loop
|
loop
|
||||||
@@ -377,7 +377,7 @@ feature -- Hooks
|
|||||||
write_error_log (generator + ".handle_post_contact: Internal Server error")
|
write_error_log (generator + ".handle_post_contact: Internal Server error")
|
||||||
r.values.force (True, "has_error")
|
r.values.force (True, "has_error")
|
||||||
r.set_status_code ({HTTP_CONSTANTS}.internal_server_error)
|
r.set_status_code ({HTTP_CONSTANTS}.internal_server_error)
|
||||||
if attached template_block_with_values (Current, "post_contact", r, vars) as l_tpl_block then
|
if attached template_block_with_values (Current, "post_contact", api, vars) as l_tpl_block then
|
||||||
across
|
across
|
||||||
r.values as tb
|
r.values as tb
|
||||||
loop
|
loop
|
||||||
@@ -422,18 +422,6 @@ feature {NONE} -- Helpers
|
|||||||
|
|
||||||
feature {NONE} -- Contact Message
|
feature {NONE} -- Contact Message
|
||||||
|
|
||||||
template_block_with_values (a_module: CMS_MODULE; a_block_id: READABLE_STRING_8; a_response: CMS_RESPONSE; a_values: STRING_TABLE [ANY]): like template_block
|
|
||||||
do
|
|
||||||
Result := template_block (a_module, a_block_id, a_response)
|
|
||||||
if Result /= Void then
|
|
||||||
across
|
|
||||||
a_values as ic
|
|
||||||
loop
|
|
||||||
Result.set_value (ic.item, ic.key)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
email_html_message (a_message_id: READABLE_STRING_8; a_response: CMS_RESPONSE; a_html_encoded_values: STRING_TABLE [READABLE_STRING_8]): STRING
|
email_html_message (a_message_id: READABLE_STRING_8; a_response: CMS_RESPONSE; a_html_encoded_values: STRING_TABLE [READABLE_STRING_8]): STRING
|
||||||
-- html message related to `a_message_id'.
|
-- html message related to `a_message_id'.
|
||||||
local
|
local
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ feature -- Handler
|
|||||||
attached l_search.last_result as l_result and then
|
attached l_search.last_result as l_result and then
|
||||||
l_result.status = 200
|
l_result.status = 200
|
||||||
then
|
then
|
||||||
if attached template_block (Current, "search", r) as l_tpl_block then
|
if attached template_block (Current, "search", api) as l_tpl_block then
|
||||||
l_tpl_block.set_value (l_result, "result")
|
l_tpl_block.set_value (l_result, "result")
|
||||||
r.add_block (l_tpl_block, "content")
|
r.add_block (l_tpl_block, "content")
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -243,7 +243,7 @@ feature -- Hooks
|
|||||||
a_response.location.same_string ("account")
|
a_response.location.same_string ("account")
|
||||||
then
|
then
|
||||||
if
|
if
|
||||||
attached template_block ("account_info", a_response) as l_tpl_block and then
|
attached template_block (Current, "account_info", a_response.api) as l_tpl_block and then
|
||||||
attached a_response.user as l_user
|
attached a_response.user as l_user
|
||||||
then
|
then
|
||||||
associate_account (l_user, a_response.values)
|
associate_account (l_user, a_response.values)
|
||||||
@@ -323,7 +323,7 @@ feature {NONE} -- Block views
|
|||||||
local
|
local
|
||||||
vals: CMS_VALUE_TABLE
|
vals: CMS_VALUE_TABLE
|
||||||
do
|
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)
|
create vals.make (1)
|
||||||
-- add the variable to the block
|
-- add the variable to the block
|
||||||
a_response.api.hooks.invoke_value_table_alter (vals, a_response)
|
a_response.api.hooks.invoke_value_table_alter (vals, a_response)
|
||||||
|
|||||||
@@ -270,7 +270,7 @@ feature {NONE} -- Block views
|
|||||||
local
|
local
|
||||||
vals: CMS_VALUE_TABLE
|
vals: CMS_VALUE_TABLE
|
||||||
do
|
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)
|
create vals.make (1)
|
||||||
-- add the variable to the block
|
-- add the variable to the block
|
||||||
a_response.api.hooks.invoke_value_table_alter (vals, a_response)
|
a_response.api.hooks.invoke_value_table_alter (vals, a_response)
|
||||||
|
|||||||
@@ -141,7 +141,7 @@ feature {NONE} -- Implementation: routes
|
|||||||
if api.user_is_authenticated then
|
if api.user_is_authenticated then
|
||||||
r.add_error_message ("You are already signed in!")
|
r.add_error_message ("You are already signed in!")
|
||||||
else
|
else
|
||||||
if attached template_block ("login", r) as l_tpl_block then
|
if attached template_block (Current, "login", api) as l_tpl_block then
|
||||||
create vals.make (1)
|
create vals.make (1)
|
||||||
-- add the variable to the block
|
-- add the variable to the block
|
||||||
l_tpl_block.set_value (api.user, "user")
|
l_tpl_block.set_value (api.user, "user")
|
||||||
@@ -223,7 +223,7 @@ feature {NONE} -- Implementation: routes
|
|||||||
end
|
end
|
||||||
else
|
else
|
||||||
create {GENERIC_VIEW_CMS_RESPONSE} r.make (req, res, api)
|
create {GENERIC_VIEW_CMS_RESPONSE} r.make (req, res, api)
|
||||||
if attached template_block ("login", r) as l_tpl_block then
|
if attached template_block (Current, "login", api) as l_tpl_block then
|
||||||
l_tpl_block.set_value (l_username.value, "username")
|
l_tpl_block.set_value (l_username.value, "username")
|
||||||
l_tpl_block.set_value ("Wrong: Username or password ", "error")
|
l_tpl_block.set_value ("Wrong: Username or password ", "error")
|
||||||
r.add_block (l_tpl_block, "content")
|
r.add_block (l_tpl_block, "content")
|
||||||
@@ -232,7 +232,7 @@ feature {NONE} -- Implementation: routes
|
|||||||
r.execute
|
r.execute
|
||||||
else
|
else
|
||||||
create {BAD_REQUEST_ERROR_CMS_RESPONSE} r.make (req, res, api)
|
create {BAD_REQUEST_ERROR_CMS_RESPONSE} r.make (req, res, api)
|
||||||
if attached template_block ("login", r) as l_tpl_block then
|
if attached template_block (Current, "login", api) as l_tpl_block then
|
||||||
if attached {WSF_STRING} req.form_parameter ("username") as l_username then
|
if attached {WSF_STRING} req.form_parameter ("username") as l_username then
|
||||||
l_tpl_block.set_value (l_username.value, "username")
|
l_tpl_block.set_value (l_username.value, "username")
|
||||||
end
|
end
|
||||||
@@ -272,7 +272,7 @@ feature {NONE} -- Block views
|
|||||||
local
|
local
|
||||||
vals: CMS_VALUE_TABLE
|
vals: CMS_VALUE_TABLE
|
||||||
do
|
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)
|
create vals.make (1)
|
||||||
-- add the variable to the block
|
-- add the variable to the block
|
||||||
a_response.api.hooks.invoke_value_table_alter (vals, a_response)
|
a_response.api.hooks.invoke_value_table_alter (vals, a_response)
|
||||||
|
|||||||
@@ -26,6 +26,6 @@ feature -- Hook
|
|||||||
end
|
end
|
||||||
|
|
||||||
note
|
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)"
|
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -6,17 +6,17 @@ note
|
|||||||
deferred class
|
deferred class
|
||||||
CMS_HOOK_BLOCK_HELPER
|
CMS_HOOK_BLOCK_HELPER
|
||||||
|
|
||||||
feature -- Factory
|
feature {NONE} -- Factory
|
||||||
|
|
||||||
template_block (a_module: CMS_MODULE; a_block_id: READABLE_STRING_8; a_response: CMS_RESPONSE): detachable CMS_SMARTY_TEMPLATE_BLOCK
|
template_block (a_module: CMS_MODULE; a_block_id: READABLE_STRING_8; a_cms_api: CMS_API): detachable CMS_SMARTY_TEMPLATE_BLOCK
|
||||||
-- Smarty content block for `a_block_id' in the context of `a_module' and `a_response'.
|
-- Smarty content block for `a_block_id' in the context of `a_module' and `a_cms_api'.
|
||||||
local
|
local
|
||||||
res: PATH
|
res: PATH
|
||||||
p: detachable PATH
|
p: detachable PATH
|
||||||
do
|
do
|
||||||
create res.make_from_string ("templates")
|
create res.make_from_string ("templates")
|
||||||
res := res.extended ("block_").appended (a_block_id).appended_with_extension ("tpl")
|
res := res.extended ("block_").appended (a_block_id).appended_with_extension ("tpl")
|
||||||
p := a_response.api.module_theme_resource_location (a_module, res)
|
p := a_cms_api.module_theme_resource_location (a_module, res)
|
||||||
if p /= Void then
|
if p /= Void then
|
||||||
if attached p.entry as e then
|
if attached p.entry as e then
|
||||||
create Result.make (a_block_id, Void, p.parent, e)
|
create Result.make (a_block_id, Void, p.parent, e)
|
||||||
@@ -26,6 +26,20 @@ feature -- Factory
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
template_block_with_values (a_module: CMS_MODULE; a_block_id: READABLE_STRING_8; a_cms_api: CMS_API; a_values: STRING_TABLE [ANY]): like template_block
|
||||||
|
-- Smarty content block for `a_block_id' in the context of `a_module' and `a_cms_api',
|
||||||
|
-- With additional `a_values'.
|
||||||
|
do
|
||||||
|
Result := template_block (a_module, a_block_id, a_cms_api)
|
||||||
|
if Result /= Void then
|
||||||
|
across
|
||||||
|
a_values as ic
|
||||||
|
loop
|
||||||
|
Result.set_value (ic.item, ic.key)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
note
|
note
|
||||||
copyright: "2011-2016, 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)"
|
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||||
|
|||||||
Reference in New Issue
Block a user