Refactorying the CMS component, to have an effective CMS_SERVICE, and setup as CMS_SETUP.
This way the application is much simpler, no need to implement deferred feature of CMS_SERVICE.
This commit is contained in:
@@ -17,9 +17,8 @@ create
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make (a_service: like service)
|
||||
make
|
||||
do
|
||||
service := a_service
|
||||
name := "admin"
|
||||
version := "1.0"
|
||||
description := "Set of service to administrate the site"
|
||||
@@ -30,16 +29,17 @@ feature {NONE} -- Initialization
|
||||
|
||||
feature {CMS_SERVICE} -- Registration
|
||||
|
||||
service: CMS_SERVICE
|
||||
service: detachable CMS_SERVICE
|
||||
|
||||
register (a_service: CMS_SERVICE)
|
||||
do
|
||||
a_service.map_uri ("/admin/", agent handle_admin)
|
||||
a_service.map_uri ("/admin/users/", agent handle_admin_users)
|
||||
a_service.map_uri ("/admin/blocks/", agent handle_admin_blocks)
|
||||
a_service.map_uri ("/admin/modules/", agent handle_admin_modules)
|
||||
a_service.map_uri ("/admin/logs/", agent handle_admin_logs)
|
||||
a_service.map_uri_template ("/admin/log/{log-id}", agent handle_admin_log_view)
|
||||
service := a_service
|
||||
a_service.map_uri ("/admin/", agent handle_admin (a_service, ?, ?))
|
||||
a_service.map_uri ("/admin/users/", agent handle_admin_users (a_service, ?, ?))
|
||||
a_service.map_uri ("/admin/blocks/", agent handle_admin_blocks (a_service, ?, ?))
|
||||
a_service.map_uri ("/admin/modules/", agent handle_admin_modules (a_service, ?, ?))
|
||||
a_service.map_uri ("/admin/logs/", agent handle_admin_logs (a_service, ?, ?))
|
||||
a_service.map_uri_template ("/admin/log/{log-id}", agent handle_admin_log_view (a_service, ?, ?))
|
||||
|
||||
a_service.add_menu_alter_hook (Current)
|
||||
end
|
||||
@@ -57,43 +57,40 @@ feature -- Hooks
|
||||
|
||||
links: HASH_TABLE [CMS_MODULE_LINK, STRING]
|
||||
-- Link indexed by path
|
||||
local
|
||||
-- lnk: CMS_MODULE_LINK
|
||||
do
|
||||
create Result.make (3)
|
||||
-- create lnk.make ("Date/time demo")
|
||||
-- lnk.set_callback (agent process_date_time_demo, <<"arg">>)
|
||||
-- Result["/demo/date/{arg}"] := lnk
|
||||
create Result.make (0)
|
||||
end
|
||||
|
||||
handle_admin (req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
feature -- Handler
|
||||
|
||||
handle_admin (cms: CMS_SERVICE; req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
do
|
||||
(create {ADMIN_CMS_EXECUTION}.make (req, res, service)).execute
|
||||
(create {ADMIN_CMS_EXECUTION}.make (req, res, cms)).execute
|
||||
end
|
||||
|
||||
handle_admin_users (req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
handle_admin_users (cms: CMS_SERVICE; req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
do
|
||||
(create {ADMIN_USERS_CMS_EXECUTION}.make (req, res, service)).execute
|
||||
(create {ADMIN_USERS_CMS_EXECUTION}.make (req, res, cms)).execute
|
||||
end
|
||||
|
||||
handle_admin_blocks (req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
handle_admin_blocks (cms: CMS_SERVICE; req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
do
|
||||
(create {ADMIN_BLOCKS_CMS_EXECUTION}.make (req, res, service)).execute
|
||||
(create {ADMIN_BLOCKS_CMS_EXECUTION}.make (req, res, cms)).execute
|
||||
end
|
||||
|
||||
handle_admin_modules (req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
handle_admin_modules (cms: CMS_SERVICE; req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
do
|
||||
(create {ADMIN_MODULES_CMS_EXECUTION}.make (req, res, service)).execute
|
||||
(create {ADMIN_MODULES_CMS_EXECUTION}.make (req, res, cms)).execute
|
||||
end
|
||||
|
||||
handle_admin_logs (req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
handle_admin_logs (cms: CMS_SERVICE; req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
do
|
||||
(create {ADMIN_LOGS_CMS_EXECUTION}.make (req, res, service)).execute
|
||||
(create {ADMIN_LOGS_CMS_EXECUTION}.make (req, res, cms)).execute
|
||||
end
|
||||
|
||||
handle_admin_log_view (req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
handle_admin_log_view (cms: CMS_SERVICE; req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
do
|
||||
(create {LOG_VIEW_CMS_EXECUTION}.make (req, res, service)).execute
|
||||
(create {LOG_VIEW_CMS_EXECUTION}.make (req, res, cms)).execute
|
||||
end
|
||||
|
||||
|
||||
|
||||
136
draft/application/cms/src/modules/debug/debug_module.e
Normal file
136
draft/application/cms/src/modules/debug/debug_module.e
Normal file
@@ -0,0 +1,136 @@
|
||||
note
|
||||
description: "Summary description for {DEBUG_MODULE}."
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
DEBUG_MODULE
|
||||
|
||||
inherit
|
||||
CMS_MODULE
|
||||
|
||||
-- CMS_HOOK_BLOCK
|
||||
|
||||
CMS_HOOK_AUTO_REGISTER
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make
|
||||
do
|
||||
name := "debug"
|
||||
version := "1.0"
|
||||
description := "Debug"
|
||||
package := "cms"
|
||||
end
|
||||
|
||||
feature {CMS_SERVICE} -- Registration
|
||||
|
||||
service: detachable CMS_SERVICE
|
||||
|
||||
register (a_service: CMS_SERVICE)
|
||||
do
|
||||
service := a_service
|
||||
a_service.map_uri_template ("/debug/", agent handle_debug (a_service, ?, ?))
|
||||
end
|
||||
|
||||
feature -- Hooks
|
||||
|
||||
links: HASH_TABLE [CMS_MODULE_LINK, STRING]
|
||||
-- Link indexed by path
|
||||
local
|
||||
-- lnk: CMS_MODULE_LINK
|
||||
do
|
||||
create Result.make (0)
|
||||
-- create lnk.make ("Date/time demo")
|
||||
-- lnk.set_callback (agent process_date_time_demo, <<"arg">>)
|
||||
-- Result["/demo/date/{arg}"] := lnk
|
||||
end
|
||||
|
||||
feature -- Hooks
|
||||
|
||||
-- block_list: ITERABLE [like {CMS_BLOCK}.name]
|
||||
-- do
|
||||
-- Result := <<"debug-info">>
|
||||
-- end
|
||||
|
||||
-- get_block_view (a_block_id: detachable READABLE_STRING_8; a_execution: CMS_EXECUTION)
|
||||
-- local
|
||||
-- b: CMS_CONTENT_BLOCK
|
||||
-- do
|
||||
-- create b.make ("debug-info", "Debug", "... ", a_execution.formats.plain_text)
|
||||
-- a_execution.add_block (b, Void)
|
||||
-- end
|
||||
|
||||
feature -- Handler
|
||||
|
||||
handle_debug (cms: CMS_SERVICE; req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
local
|
||||
e: CMS_EXECUTION
|
||||
s: STRING
|
||||
do
|
||||
if req.is_get_request_method then
|
||||
create {ANY_CMS_EXECUTION} e.make (req, res, cms)
|
||||
e.set_title ("DEBUG")
|
||||
|
||||
create s.make_empty
|
||||
append_info_to ("Name", cms.site_name, e, s)
|
||||
append_info_to ("Url", cms.site_url, e, s)
|
||||
|
||||
if attached cms.configuration as cfg and then attached cfg.configuration_location as l_loc then
|
||||
s.append ("<hr/>")
|
||||
append_info_to ("Configuration file", l_loc, e, s)
|
||||
end
|
||||
|
||||
s.append ("<hr/>")
|
||||
|
||||
append_info_to ("Current dir", (create {EXECUTION_ENVIRONMENT}).current_working_path.name, e, s)
|
||||
append_info_to ("Base url", cms.base_url, e, s)
|
||||
append_info_to ("Script url", cms.script_url, e, s)
|
||||
s.append ("<hr/>")
|
||||
append_info_to ("Dir", cms.site_dir, e, s)
|
||||
append_info_to ("Var dir", cms.site_var_dir, e, s)
|
||||
s.append ("<hr/>")
|
||||
append_info_to ("Theme", cms.theme_name, e, s)
|
||||
append_info_to ("Theme location", cms.theme_resource_location, e, s)
|
||||
s.append ("<hr/>")
|
||||
append_info_to ("Files location", cms.files_location, e, s)
|
||||
s.append ("<hr/>")
|
||||
|
||||
append_info_to ("Url", e.url ("/", Void), e, s)
|
||||
if attached e.user as u then
|
||||
append_info_to ("User", u.name, e, s)
|
||||
append_info_to ("User url", e.user_url (u), e, s)
|
||||
|
||||
end
|
||||
|
||||
e.set_main_content (s)
|
||||
else
|
||||
create {NOT_FOUND_CMS_EXECUTION} e.make (req, res, cms)
|
||||
end
|
||||
e.execute
|
||||
end
|
||||
|
||||
append_info_to (n: READABLE_STRING_8; v: detachable READABLE_STRING_GENERAL; e: CMS_EXECUTION; t: STRING)
|
||||
do
|
||||
t.append ("<li>")
|
||||
t.append ("<strong>" + n + "</strong>: ")
|
||||
if v /= Void then
|
||||
t.append (e.html_encoded (v))
|
||||
end
|
||||
t.append ("</li>")
|
||||
end
|
||||
|
||||
note
|
||||
copyright: "Copyright (c) 1984-2013, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
source: "[
|
||||
Eiffel Software
|
||||
5949 Hollister Ave., Goleta, CA 93117 USA
|
||||
Telephone 805-685-1006, Fax 805-685-6869
|
||||
Website http://www.eiffel.com
|
||||
Customer support http://support.eiffel.com
|
||||
]"
|
||||
end
|
||||
@@ -19,9 +19,8 @@ create
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make (a_service: like service)
|
||||
make
|
||||
do
|
||||
service := a_service
|
||||
name := "node"
|
||||
version := "1.0"
|
||||
description := "Service to manage content based on 'node'"
|
||||
@@ -32,20 +31,21 @@ feature {NONE} -- Initialization
|
||||
|
||||
feature {CMS_SERVICE} -- Registration
|
||||
|
||||
service: CMS_SERVICE
|
||||
service: detachable CMS_SERVICE
|
||||
|
||||
register (a_service: CMS_SERVICE)
|
||||
local
|
||||
h: CMS_HANDLER
|
||||
do
|
||||
a_service.map_uri ("/node/add", agent handle_node_add)
|
||||
a_service.map_uri_template ("/node/add/{type}", agent handle_node_add)
|
||||
service := a_service
|
||||
a_service.map_uri ("/node/add", agent handle_node_add (a_service, ?, ?))
|
||||
a_service.map_uri_template ("/node/add/{type}", agent handle_node_add (a_service, ?, ?))
|
||||
|
||||
create {CMS_HANDLER} h.make (agent handle_node_view)
|
||||
create {CMS_HANDLER} h.make (agent handle_node_view (a_service, ?, ?))
|
||||
a_service.router.map (create {WSF_URI_TEMPLATE_MAPPING}.make ("/node/{nid}", h))
|
||||
a_service.router.map (create {WSF_URI_TEMPLATE_MAPPING}.make ("/node/{nid}/view", h))
|
||||
|
||||
a_service.map_uri_template ("/node/{nid}/edit", agent handle_node_edit)
|
||||
a_service.map_uri_template ("/node/{nid}/edit", agent handle_node_edit (a_service, ?, ?))
|
||||
|
||||
a_service.add_content_type (create {CMS_PAGE_CONTENT_TYPE}.make)
|
||||
|
||||
@@ -86,28 +86,23 @@ feature -- Hooks
|
||||
|
||||
links: HASH_TABLE [CMS_MODULE_LINK, STRING]
|
||||
-- Link indexed by path
|
||||
local
|
||||
-- lnk: CMS_MODULE_LINK
|
||||
do
|
||||
create Result.make (3)
|
||||
-- create lnk.make ("Date/time demo")
|
||||
-- lnk.set_callback (agent process_date_time_demo, <<"arg">>)
|
||||
-- Result["/demo/date/{arg}"] := lnk
|
||||
create Result.make (0)
|
||||
end
|
||||
|
||||
handle_node_view (req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
handle_node_view (cms: CMS_SERVICE; req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
do
|
||||
(create {NODE_VIEW_CMS_EXECUTION}.make (req, res, service)).execute
|
||||
(create {NODE_VIEW_CMS_EXECUTION}.make (req, res, cms)).execute
|
||||
end
|
||||
|
||||
handle_node_edit (req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
handle_node_edit (cms: CMS_SERVICE; req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
do
|
||||
(create {NODE_EDIT_CMS_EXECUTION}.make (req, res, service)).execute
|
||||
(create {NODE_EDIT_CMS_EXECUTION}.make (req, res, cms)).execute
|
||||
end
|
||||
|
||||
handle_node_add (req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
handle_node_add (cms: CMS_SERVICE; req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
do
|
||||
(create {NODE_ADD_CMS_EXECUTION}.make (req, res, service)).execute
|
||||
(create {NODE_ADD_CMS_EXECUTION}.make (req, res, cms)).execute
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -1,112 +0,0 @@
|
||||
note
|
||||
description: "[
|
||||
]"
|
||||
|
||||
class
|
||||
USER_LOGIN_CMS_EXECUTION
|
||||
|
||||
inherit
|
||||
CMS_EXECUTION
|
||||
|
||||
CMS_AUTH_ENGINE
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature -- Status
|
||||
|
||||
valid_credential (u,p: READABLE_STRING_32): BOOLEAN
|
||||
do
|
||||
Result := service.storage.is_valid_credential (u, p)
|
||||
end
|
||||
|
||||
feature -- Execution
|
||||
|
||||
process
|
||||
-- Computed response message.
|
||||
local
|
||||
auth_engine: CMS_AUTH_ENGINE
|
||||
l_url: detachable READABLE_STRING_8
|
||||
err: detachable STRING_8
|
||||
b: STRING_8
|
||||
u: detachable STRING_32
|
||||
do
|
||||
if request.is_request_method ("post") then
|
||||
if
|
||||
attached {WSF_STRING} request.form_parameter (form_login_name) as s_login and then not s_login.is_empty and
|
||||
attached {WSF_STRING} request.form_parameter (form_password_name) as s_passwd and then not s_passwd.is_empty
|
||||
then
|
||||
auth_engine := Current
|
||||
u := s_login.value
|
||||
if attached service.storage.user_by_name (u) as l_user and auth_engine.valid_credential (u, s_passwd.value) then
|
||||
login (l_user, request)
|
||||
else
|
||||
err := "Authentication failed for [" + html_encoded (u) + "]"
|
||||
end
|
||||
if attached {WSF_STRING} request.form_parameter ("form-destination") as s_dest then
|
||||
l_url := request.script_url (s_dest.value)
|
||||
end
|
||||
end
|
||||
else
|
||||
if
|
||||
attached {WSF_STRING} request.item ("destination") as s_dest
|
||||
then
|
||||
l_url := request.script_url (s_dest.value)
|
||||
end
|
||||
end
|
||||
|
||||
if l_url = Void then
|
||||
l_url := request.script_url ("/user")
|
||||
end
|
||||
|
||||
if authenticated then
|
||||
set_redirection (l_url)
|
||||
set_title ("Login")
|
||||
create b.make_empty
|
||||
b.append ("<h1>Login</h1>%N")
|
||||
set_main_content (b)
|
||||
else
|
||||
set_title ("Login")
|
||||
create b.make_empty
|
||||
b.append ("<h1>Login</h1>%N")
|
||||
|
||||
if err /= Void then
|
||||
b.append ("<div id=%"error-box%" style=%"background-color: #fcc; color:#f00;%">" + err + "</div>")
|
||||
end
|
||||
|
||||
b.append ("<form action=%"" + request.path_info + "%" method=%"POST%" id=%"form-login%" style=%"border: dotted 1px #099; display: inline-block; padding: 10px; margin: 10px;%">%N")
|
||||
-- b.append ("<div style=%"display:none%"><input type=%"hidden%" name=%"form-login-token%" value=%""+ cms.session.uuid +"%"></div>")
|
||||
b.append ("<div style=%"display:none%"><input type=%"hidden%" name=%"form-destination%" value=%""+ l_url +"%"></div>")
|
||||
b.append ("<div class=%"required username%">")
|
||||
b.append ("<strong><label for=%"id_username%">Username or email</label></strong> <em>(required)</em><br/>")
|
||||
b.append ("<input type=%"text%" id=%"id_username%" autofocus=%"autofocus%" name=%"" + form_login_name + "%" ")
|
||||
if u /= Void then
|
||||
b.append (" value=%""+ html_encoded (u) +"%" ")
|
||||
end
|
||||
b.append ("/>")
|
||||
b.append ("</div>")
|
||||
b.append ("<div class=%"required password%">")
|
||||
b.append ("<strong><label for=%"id_password%">Password</label></strong> <em>(required)</em><br/>")
|
||||
b.append ("<input type=%"password%" id=%"id_password%" name=%"" + form_password_name + "%" />")
|
||||
b.append ("</div>")
|
||||
|
||||
b.append ("<p class=%"description%"><a href=%"" + url ("/user/password", Void) + "%" tabindex=%"-1%">Reset password</a></p>%N")
|
||||
|
||||
b.append ("<div class=%"submit%">")
|
||||
b.append ("<input type=%"submit%" value=%"Log in%" name=%"submit%" >%N")
|
||||
b.append ("[
|
||||
<img alt="login" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAHiQAAB4kB+XNYvQAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAASmSURBVGiB1ZpbaBxVGMd/Mzu5bSRJY6LubmKJl4J9qShdwdpGGxGlharJSwpVVFrUUF+iT1VEUYRgaEGqsa2FGtu8xNtDsBQi5EFBS8UnsYWUtpsmaqppIdkkm+4eH77ZzWazl7lllv7gPOycmXP+/9kzM+d839GUUnjEOqAL2A7cCdSYJWjWx4F5s/wN/AgMAzNedK65NHI38CKwAwiZpcLitUvAlFlGgBPAFadCnBppAQ4DDwNhQHMqwEQBk8A5oAeYsNuAXSP1QD/wFNBqtzOLxIAzQC9ww/JVSimrZbdSalwplVJrT8rsa7dVfVZNHFRKTftgIJdps++SGksNrSDwLbAFqHUxXNwwB/wEPIe8+fJSzEi12cCDgO61OpukgN+RG7qQ74RiRkaApylg4sj4YZLqpgcalwloBvvu7SlUnQJOI6/6VRQy8jHwKkWG04aRMIlUwp7SElTqlVzYMVnslDlgAHgztyLf3e5GPnLleiaKUYto686tyDXSCHwANPkgyilNiMbG7INGzkn9QJvdltdVNnJg43uOVH34x7vMJP6ze1kbovWl9IFsI+uBJ3Ew3QgGaulqXfVvW+Lg+T5msG1EQ7SuBy7DyqH1GTKHulVoQTQDy0YiwKayyHHHJkR7xsgLyBTcFYupRbdN2CWEaM8Y2Yn7qTjHLw4w9s+o22bsoCHa0YEGZE3hmsXkInvP7vHbTBhoMJDlacTu1fs39JJMJQGoq6jLHE+kEuw9u4ejmwdpv6PDI61FiQBdBtCB9eVphv339xas89lMBdCh48FDno+0GZ+GWchAIh0F+f7q15y6fMJSaxPx2IrfPv4zNQbL4Zq8TM5P8Mu/PzvuwSczQZ0SRrzAh2EW9G3lp6Ghaa4/VQXRKbIO9ooqvYqj0UG2NW9fqy7iBiWMhGtaeOT2Ry21NhGPcXV+5QNfpVdxLPoVW5ufcKzSAnEDicUWZFekk12RTkutHTrfx6ELfZnfYuIkW5sfdyPSCvMGEnv1nOpANcc2n+Sx5va1aD6XKQMYBTqx+XXv//MjbqolAOoqGnjtvjcydT6bWAJGDSS0/w4SWbfM5+OfZKIokZrWjJHqQDVfRE+xpWmbt3ILMwUM68B1PBpeNUaQ49EhP02AaL+eXrN/A0RxuSZ5uW0fFXqlW2F2UIj2zMJqEMlPuMJnEyCaB2HZyBSSZLnVOIf5WGRPUXpwkfoqA1cQzcDKuNYEkil6BZvPSjw5x3BsyJGaeHLOyWUK0ZpJ0eUGseuB34B7SrVUpiB2movAQ2Sl5nJnvzeAt4Fpz9R5zzSicUV+Md80fghJFc/6IMous4i2VeM4N4id5i3gASTRE8h3woGN769JoqcISWDM1LaKUqm3MSSXnteMjySRV207BVJvxVaIC+aFpynvMJs1NRQ0AaWTnAtISHIAuOaZNOtcM/veSRETgK0NA91KqUvKvw0Dl8w+Pd0wkC71SqkjSqnYGpqImX3U29HmdFNNCPgUmTGH8GZTzRTwK/A6DpYVbrc53YXkJ55FouJh7G1zmjTLd8CXwF9Ohbg1ks1twPPAM8i/FCT/xrM4csd/QNYSnrwR/wfI5AekDWyX2QAAAABJRU5ErkJggg=="
|
||||
style="float:right; margin: 5px;"/>
|
||||
]")
|
||||
b.append ("</div>")
|
||||
b.append ("<p>Need an account? <a href=%"" + url ("/user/register", Void) + "%">Sign up now!</a></p>%N")
|
||||
b.append ("</form>%N")
|
||||
|
||||
set_main_content (b)
|
||||
end
|
||||
end
|
||||
|
||||
form_login_name: STRING = "login"
|
||||
form_password_name: STRING = "password"
|
||||
|
||||
end
|
||||
@@ -19,9 +19,8 @@ create
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make (a_service: like service)
|
||||
make
|
||||
do
|
||||
service := a_service
|
||||
name := "user"
|
||||
version := "1.0"
|
||||
description := "Users management"
|
||||
@@ -32,22 +31,23 @@ feature {NONE} -- Initialization
|
||||
|
||||
feature {CMS_SERVICE} -- Registration
|
||||
|
||||
service: CMS_SERVICE
|
||||
service: detachable CMS_SERVICE
|
||||
|
||||
register (a_service: CMS_SERVICE)
|
||||
local
|
||||
h: CMS_HANDLER
|
||||
do
|
||||
-- a_service.map_uri ("/user", agent handle_login)
|
||||
a_service.map_uri ("/user/logout", agent handle_logout)
|
||||
a_service.map_uri ("/user/register", agent handle_register)
|
||||
a_service.map_uri ("/user/password", agent handle_request_new_password)
|
||||
service := a_service
|
||||
|
||||
create {CMS_HANDLER} h.make (agent handle_user)
|
||||
a_service.map_uri ("/user/logout", agent handle_logout (a_service, ?, ?))
|
||||
a_service.map_uri ("/user/register", agent handle_register (a_service, ?, ?))
|
||||
a_service.map_uri ("/user/password", agent handle_request_new_password (a_service, ?, ?))
|
||||
|
||||
create {CMS_HANDLER} h.make (agent handle_user (a_service, ?, ?))
|
||||
a_service.router.map (create {WSF_URI_TEMPLATE_MAPPING}.make ("/user/{uid}", h))
|
||||
a_service.router.map (create {WSF_URI_MAPPING}.make_trailing_slash_ignored ("/user", h))
|
||||
a_service.map_uri_template ("/user/{uid}/edit", agent handle_edit)
|
||||
a_service.map_uri_template ("/user/reset/{uid}/{last-signed}/{extra}", agent handle_reset_password)
|
||||
a_service.map_uri_template ("/user/{uid}/edit", agent handle_edit (a_service, ?, ?))
|
||||
a_service.map_uri_template ("/user/reset/{uid}/{last-signed}/{extra}", agent handle_reset_password (a_service, ?, ?))
|
||||
|
||||
a_service.add_menu_alter_hook (Current)
|
||||
a_service.add_block_hook (Current)
|
||||
@@ -104,53 +104,40 @@ feature -- Hooks
|
||||
|
||||
links: HASH_TABLE [CMS_MODULE_LINK, STRING]
|
||||
-- Link indexed by path
|
||||
local
|
||||
-- lnk: CMS_MODULE_LINK
|
||||
do
|
||||
create Result.make (3)
|
||||
-- create lnk.make ("Date/time demo")
|
||||
-- lnk.set_callback (agent process_date_time_demo, <<"arg">>)
|
||||
-- Result["/demo/date/{arg}"] := lnk
|
||||
create Result.make (0)
|
||||
end
|
||||
|
||||
-- handle_login (req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
-- do
|
||||
-- (create {USER_LOGIN_CMS_EXECUTION}.make (req, res, service)).execute
|
||||
-- end
|
||||
feature -- Handlers
|
||||
|
||||
handle_logout (req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
handle_logout (cms: CMS_SERVICE; req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
do
|
||||
(create {USER_LOGOUT_CMS_EXECUTION}.make (req, res, service)).execute
|
||||
(create {USER_LOGOUT_CMS_EXECUTION}.make (req, res, cms)).execute
|
||||
end
|
||||
|
||||
handle_user (req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
handle_user (cms: CMS_SERVICE; req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
do
|
||||
(create {USER_CMS_EXECUTION}.make (req, res, service)).execute
|
||||
(create {USER_CMS_EXECUTION}.make (req, res, cms)).execute
|
||||
end
|
||||
|
||||
handle_edit (req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
handle_edit (cms: CMS_SERVICE; req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
do
|
||||
(create {USER_EDIT_CMS_EXECUTION}.make (req, res, service)).execute
|
||||
(create {USER_EDIT_CMS_EXECUTION}.make (req, res, cms)).execute
|
||||
end
|
||||
|
||||
-- handle_account (req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
-- do
|
||||
-- (create {USER_ACCOUNT_CMS_EXECUTION}.make (req, res, service)).execute
|
||||
-- end
|
||||
|
||||
handle_register (req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
handle_register (cms: CMS_SERVICE; req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
do
|
||||
(create {USER_REGISTER_CMS_EXECUTION}.make (req, res, service)).execute
|
||||
(create {USER_REGISTER_CMS_EXECUTION}.make (req, res, cms)).execute
|
||||
end
|
||||
|
||||
handle_request_new_password (req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
handle_request_new_password (cms: CMS_SERVICE; req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
do
|
||||
(create {USER_NEW_PASSWORD_CMS_EXECUTION}.make (req, res, service)).execute
|
||||
(create {USER_NEW_PASSWORD_CMS_EXECUTION}.make (req, res, cms)).execute
|
||||
end
|
||||
|
||||
handle_reset_password (req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
handle_reset_password (cms: CMS_SERVICE; req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
do
|
||||
(create {USER_RESET_PASSWORD_CMS_EXECUTION}.make (req, res, service)).execute
|
||||
(create {USER_RESET_PASSWORD_CMS_EXECUTION}.make (req, res, cms)).execute
|
||||
end
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user