Splitted administration and normal web site interfaces.
This optimises a bit the routing map, and make cleaner separation. Make the base url for admin pages customizable via `administration.base_path` variable in cms.ini note: could be /admin, /roc-admin, or .. It is possible to have a specific theme for administration via the variable "administration.admin"
This commit is contained in:
@@ -9,13 +9,10 @@ class
|
||||
inherit
|
||||
CMS_MODULE
|
||||
redefine
|
||||
setup_hooks,
|
||||
permissions
|
||||
end
|
||||
|
||||
CMS_HOOK_MENU_SYSTEM_ALTER
|
||||
|
||||
CMS_HOOK_RESPONSE_ALTER
|
||||
CMS_ADMINISTRABLE
|
||||
|
||||
create
|
||||
make
|
||||
@@ -35,83 +32,18 @@ feature -- Access
|
||||
|
||||
name: STRING = "admin"
|
||||
|
||||
feature {CMS_API} -- Module Initialization
|
||||
feature {CMS_EXECUTION} -- Administration
|
||||
|
||||
administration: CMS_ADMIN_MODULE_ADMINISTRATION
|
||||
do
|
||||
create Result.make (Current)
|
||||
end
|
||||
|
||||
feature -- Access: router
|
||||
|
||||
setup_router (a_router: WSF_ROUTER; a_api: CMS_API)
|
||||
-- <Precursor>
|
||||
do
|
||||
configure_web (a_api, a_router)
|
||||
end
|
||||
|
||||
configure_web (a_api: CMS_API; a_router: WSF_ROUTER)
|
||||
local
|
||||
l_admin_handler: CMS_ADMIN_HANDLER
|
||||
|
||||
l_modules_handler: CMS_ADMIN_MODULES_HANDLER
|
||||
l_users_handler: CMS_ADMIN_USERS_HANDLER
|
||||
l_roles_handler: CMS_ADMIN_ROLES_HANDLER
|
||||
|
||||
l_user_handler: CMS_USER_HANDLER
|
||||
l_role_handler: CMS_ROLE_HANDLER
|
||||
l_admin_logs_handler: CMS_LOGS_HANDLER
|
||||
|
||||
l_admin_cache_handler: CMS_ADMIN_CACHE_HANDLER
|
||||
l_admin_export_handler: CMS_ADMIN_EXPORT_HANDLER
|
||||
l_admin_import_handler: CMS_ADMIN_IMPORT_HANDLER
|
||||
l_admin_path_alias_handler: CMS_ADMIN_PATH_ALIAS_HANDLER
|
||||
|
||||
l_uri_mapping: WSF_URI_MAPPING
|
||||
do
|
||||
create l_admin_handler.make (a_api)
|
||||
create l_uri_mapping.make_trailing_slash_ignored ("/admin", l_admin_handler)
|
||||
a_router.map (l_uri_mapping, a_router.methods_get_post)
|
||||
|
||||
create l_modules_handler.make (a_api)
|
||||
create l_uri_mapping.make_trailing_slash_ignored ("/admin/modules", l_modules_handler)
|
||||
a_router.map (l_uri_mapping, a_router.methods_get_post)
|
||||
|
||||
create l_users_handler.make (a_api)
|
||||
create l_uri_mapping.make_trailing_slash_ignored ("/admin/users", l_users_handler)
|
||||
a_router.map (l_uri_mapping, a_router.methods_get_post)
|
||||
|
||||
create l_roles_handler.make (a_api)
|
||||
create l_uri_mapping.make_trailing_slash_ignored ("/admin/roles", l_roles_handler)
|
||||
a_router.map (l_uri_mapping, a_router.methods_get_post)
|
||||
|
||||
create l_admin_logs_handler.make (a_api)
|
||||
create l_uri_mapping.make_trailing_slash_ignored ("/admin/logs", l_admin_logs_handler)
|
||||
a_router.map (l_uri_mapping, a_router.methods_get)
|
||||
|
||||
create l_admin_path_alias_handler.make (a_api)
|
||||
create l_uri_mapping.make_trailing_slash_ignored ("/admin/path_alias", l_admin_path_alias_handler)
|
||||
a_router.map (l_uri_mapping, a_router.methods_get_post)
|
||||
|
||||
|
||||
create l_admin_cache_handler.make (a_api)
|
||||
create l_uri_mapping.make_trailing_slash_ignored ("/admin/cache", l_admin_cache_handler)
|
||||
a_router.map (l_uri_mapping, a_router.methods_get_post)
|
||||
|
||||
create l_admin_export_handler.make (a_api)
|
||||
create l_uri_mapping.make_trailing_slash_ignored ("/admin/export", l_admin_export_handler)
|
||||
a_router.map (l_uri_mapping, a_router.methods_get_post)
|
||||
|
||||
create l_admin_import_handler.make (a_api)
|
||||
create l_uri_mapping.make_trailing_slash_ignored ("/admin/import", l_admin_import_handler)
|
||||
a_router.map (l_uri_mapping, a_router.methods_get_post)
|
||||
|
||||
create l_user_handler.make (a_api)
|
||||
a_router.handle ("/admin/add/user", l_user_handler, a_router.methods_get_post)
|
||||
a_router.handle ("/admin/user/{id}", l_user_handler, a_router.methods_get)
|
||||
a_router.handle ("/admin/user/{id}/edit", l_user_handler, a_router.methods_get_post)
|
||||
a_router.handle ("/admin/user/{id}/delete", l_user_handler, a_router.methods_get_post)
|
||||
|
||||
create l_role_handler.make (a_api)
|
||||
a_router.handle ("/admin/add/role", l_role_handler, a_router.methods_get_post)
|
||||
a_router.handle ("/admin/role/{id}", l_role_handler, a_router.methods_get)
|
||||
a_router.handle ("/admin/role/{id}/edit", l_role_handler, a_router.methods_get_post)
|
||||
a_router.handle ("/admin/role/{id}/delete", l_role_handler, a_router.methods_get_post)
|
||||
end
|
||||
|
||||
feature -- Security
|
||||
@@ -121,57 +53,7 @@ feature -- Security
|
||||
do
|
||||
Result := Precursor
|
||||
Result.force ("access admin")
|
||||
Result.force ("admin users")
|
||||
Result.force ("admin roles")
|
||||
Result.force ("admin modules")
|
||||
Result.force ("admin cache")
|
||||
Result.force ("admin core caches")
|
||||
Result.force ("clear blocks cache")
|
||||
Result.force ("admin export")
|
||||
Result.force ("admin import")
|
||||
end
|
||||
|
||||
feature -- Hooks
|
||||
|
||||
setup_hooks (a_hooks: CMS_HOOK_CORE_MANAGER)
|
||||
-- <Precursor>
|
||||
do
|
||||
a_hooks.subscribe_to_menu_system_alter_hook (Current)
|
||||
a_hooks.subscribe_to_response_alter_hook (Current)
|
||||
end
|
||||
|
||||
response_alter (a_response: CMS_RESPONSE)
|
||||
-- <Precursor>
|
||||
do
|
||||
a_response.add_style (a_response.url ("/module/" + name + "/files/css/admin.css", Void), Void)
|
||||
end
|
||||
|
||||
menu_system_alter (a_menu_system: CMS_MENU_SYSTEM; a_response: CMS_RESPONSE)
|
||||
local
|
||||
lnk: CMS_LOCAL_LINK
|
||||
admin_lnk: CMS_LINK_COMPOSITE
|
||||
do
|
||||
if a_response.api.user_is_authenticated then
|
||||
admin_lnk := a_menu_system.management_menu.new_composite_item ("Admin", "admin")
|
||||
|
||||
create lnk.make ("Module", "admin/modules")
|
||||
lnk.set_permission_arguments (<<"manage module">>)
|
||||
admin_lnk.extend (lnk)
|
||||
|
||||
-- Per module cache permission!
|
||||
create lnk.make ("Cache", "admin/cache")
|
||||
lnk.set_permission_arguments (<<"admin cache">>)
|
||||
admin_lnk.extend (lnk)
|
||||
|
||||
-- Per module export permission!
|
||||
create lnk.make ("Export", "admin/export")
|
||||
lnk.set_permission_arguments (<<"admin export">>)
|
||||
admin_lnk.extend (lnk)
|
||||
-- Per module import permission!
|
||||
create lnk.make ("Import", "admin/import")
|
||||
lnk.set_permission_arguments (<<"admin import">>)
|
||||
admin_lnk.extend (lnk)
|
||||
end
|
||||
end
|
||||
|
||||
note
|
||||
|
||||
159
modules/admin/cms_admin_module_administration.e
Normal file
159
modules/admin/cms_admin_module_administration.e
Normal file
@@ -0,0 +1,159 @@
|
||||
note
|
||||
description: "Summary description for {CMS_ADMIN_MODULE_ADMINISTRATION}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
CMS_ADMIN_MODULE_ADMINISTRATION
|
||||
|
||||
inherit
|
||||
CMS_MODULE_ADMINISTRATION [CMS_ADMIN_MODULE]
|
||||
redefine
|
||||
setup_hooks,
|
||||
permissions
|
||||
end
|
||||
|
||||
CMS_HOOK_MENU_SYSTEM_ALTER
|
||||
|
||||
CMS_HOOK_RESPONSE_ALTER
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature -- Security
|
||||
|
||||
permissions: LIST [READABLE_STRING_8]
|
||||
-- List of permission ids, used by this module, and declared.
|
||||
do
|
||||
Result := Precursor
|
||||
Result.force ("access admin")
|
||||
Result.force ("admin users")
|
||||
Result.force ("admin roles")
|
||||
Result.force ("admin modules")
|
||||
Result.force ("admin cache")
|
||||
Result.force ("admin core caches")
|
||||
Result.force ("clear blocks cache")
|
||||
Result.force ("admin export")
|
||||
Result.force ("admin import")
|
||||
end
|
||||
|
||||
feature {NONE} -- Router/administration
|
||||
|
||||
setup_administration_router (a_router: WSF_ROUTER; a_api: CMS_API)
|
||||
-- <Precursor>
|
||||
local
|
||||
l_admin_handler: CMS_ADMIN_HANDLER
|
||||
|
||||
l_modules_handler: CMS_ADMIN_MODULES_HANDLER
|
||||
l_users_handler: CMS_ADMIN_USERS_HANDLER
|
||||
l_roles_handler: CMS_ADMIN_ROLES_HANDLER
|
||||
|
||||
l_user_handler: CMS_USER_HANDLER
|
||||
l_role_handler: CMS_ROLE_HANDLER
|
||||
l_admin_logs_handler: CMS_LOGS_HANDLER
|
||||
|
||||
l_admin_cache_handler: CMS_ADMIN_CACHE_HANDLER
|
||||
l_admin_export_handler: CMS_ADMIN_EXPORT_HANDLER
|
||||
l_admin_import_handler: CMS_ADMIN_IMPORT_HANDLER
|
||||
l_admin_path_alias_handler: CMS_ADMIN_PATH_ALIAS_HANDLER
|
||||
|
||||
l_uri_mapping: WSF_URI_MAPPING
|
||||
do
|
||||
create l_admin_handler.make (a_api)
|
||||
create l_uri_mapping.make_trailing_slash_ignored ("", l_admin_handler)
|
||||
a_router.map (l_uri_mapping, a_router.methods_get_post)
|
||||
|
||||
create l_modules_handler.make (a_api)
|
||||
create l_uri_mapping.make_trailing_slash_ignored ("/modules", l_modules_handler)
|
||||
a_router.map (l_uri_mapping, a_router.methods_get_post)
|
||||
|
||||
create l_users_handler.make (a_api)
|
||||
create l_uri_mapping.make_trailing_slash_ignored ("/users", l_users_handler)
|
||||
a_router.map (l_uri_mapping, a_router.methods_get_post)
|
||||
|
||||
create l_roles_handler.make (a_api)
|
||||
create l_uri_mapping.make_trailing_slash_ignored ("/roles", l_roles_handler)
|
||||
a_router.map (l_uri_mapping, a_router.methods_get_post)
|
||||
|
||||
create l_admin_logs_handler.make (a_api)
|
||||
create l_uri_mapping.make_trailing_slash_ignored ("/logs", l_admin_logs_handler)
|
||||
a_router.map (l_uri_mapping, a_router.methods_get)
|
||||
|
||||
create l_admin_path_alias_handler.make (a_api)
|
||||
create l_uri_mapping.make_trailing_slash_ignored ("/path_alias", l_admin_path_alias_handler)
|
||||
a_router.map (l_uri_mapping, a_router.methods_get_post)
|
||||
|
||||
|
||||
create l_admin_cache_handler.make (a_api)
|
||||
create l_uri_mapping.make_trailing_slash_ignored ("/cache", l_admin_cache_handler)
|
||||
a_router.map (l_uri_mapping, a_router.methods_get_post)
|
||||
|
||||
create l_admin_export_handler.make (a_api)
|
||||
create l_uri_mapping.make_trailing_slash_ignored ("/export", l_admin_export_handler)
|
||||
a_router.map (l_uri_mapping, a_router.methods_get_post)
|
||||
|
||||
create l_admin_import_handler.make (a_api)
|
||||
create l_uri_mapping.make_trailing_slash_ignored ("/import", l_admin_import_handler)
|
||||
a_router.map (l_uri_mapping, a_router.methods_get_post)
|
||||
|
||||
create l_user_handler.make (a_api)
|
||||
a_router.handle ("/add/user", l_user_handler, a_router.methods_get_post)
|
||||
a_router.handle ("/user/{id}", l_user_handler, a_router.methods_get)
|
||||
a_router.handle ("/user/{id}/edit", l_user_handler, a_router.methods_get_post)
|
||||
a_router.handle ("/user/{id}/delete", l_user_handler, a_router.methods_get_post)
|
||||
|
||||
create l_role_handler.make (a_api)
|
||||
a_router.handle ("/add/role", l_role_handler, a_router.methods_get_post)
|
||||
a_router.handle ("/role/{id}", l_role_handler, a_router.methods_get)
|
||||
a_router.handle ("/role/{id}/edit", l_role_handler, a_router.methods_get_post)
|
||||
a_router.handle ("/role/{id}/delete", l_role_handler, a_router.methods_get_post)
|
||||
end
|
||||
|
||||
feature -- Hooks
|
||||
|
||||
setup_hooks (a_hooks: CMS_HOOK_CORE_MANAGER)
|
||||
-- <Precursor>
|
||||
do
|
||||
a_hooks.subscribe_to_menu_system_alter_hook (Current)
|
||||
a_hooks.subscribe_to_response_alter_hook (Current)
|
||||
end
|
||||
|
||||
response_alter (a_response: CMS_RESPONSE)
|
||||
-- <Precursor>
|
||||
do
|
||||
a_response.add_style (a_response.url ("/module/" + name + "/files/css/admin.css", Void), Void)
|
||||
end
|
||||
|
||||
menu_system_alter (a_menu_system: CMS_MENU_SYSTEM; a_response: CMS_RESPONSE)
|
||||
local
|
||||
lnk: CMS_LOCAL_LINK
|
||||
admin_lnk: CMS_LINK_COMPOSITE
|
||||
l_api: CMS_API
|
||||
do
|
||||
l_api := a_response.api
|
||||
if l_api.user_is_authenticated then
|
||||
admin_lnk := a_menu_system.management_menu.new_composite_item ("Admin", l_api.administration_path_location (""))
|
||||
|
||||
create lnk.make ("Module", l_api.administration_path_location ("modules"))
|
||||
lnk.set_permission_arguments (<<"manage module">>)
|
||||
admin_lnk.extend (lnk)
|
||||
|
||||
-- Per module cache permission!
|
||||
create lnk.make ("Cache", l_api.administration_path_location ("cache"))
|
||||
lnk.set_permission_arguments (<<"admin cache">>)
|
||||
admin_lnk.extend (lnk)
|
||||
|
||||
-- Per module export permission!
|
||||
create lnk.make ("Export", l_api.administration_path_location ("export"))
|
||||
lnk.set_permission_arguments (<<"admin export">>)
|
||||
admin_lnk.extend (lnk)
|
||||
-- Per module import permission!
|
||||
create lnk.make ("Import", l_api.administration_path_location ("import"))
|
||||
lnk.set_permission_arguments (<<"admin import">>)
|
||||
admin_lnk.extend (lnk)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
@@ -204,10 +204,10 @@ feature -- Execution
|
||||
|
||||
create l_mods_to_install.make (0)
|
||||
across
|
||||
a_response.api.setup.modules as ic
|
||||
api.setup.modules as ic
|
||||
loop
|
||||
mod := ic.item
|
||||
if not a_response.api.is_module_installed (mod) then
|
||||
if not api.is_module_installed (mod) then
|
||||
l_mods_to_install.extend (mod)
|
||||
else
|
||||
create l_extra.make_empty
|
||||
@@ -286,10 +286,10 @@ feature -- Execution
|
||||
create Result.make (a_response.url (a_response.location, Void), "modules_collection")
|
||||
create l_mods_to_install.make (0)
|
||||
across
|
||||
a_response.api.setup.modules as ic
|
||||
api.setup.modules as ic
|
||||
loop
|
||||
mod := ic.item
|
||||
if not a_response.api.is_module_installed (mod) then
|
||||
if not api.is_module_installed (mod) then
|
||||
l_mods_to_install.extend (mod)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -23,14 +23,14 @@ feature -- Process
|
||||
l_package: READABLE_STRING_8
|
||||
do
|
||||
create l_admin_links.make (5)
|
||||
l_admin_links.force (["core", <<"admin users">>, local_link ("Users", "admin/users"), "View/Edit/Add Users"])
|
||||
l_admin_links.force (["core", <<"admin roles">>, local_link ("Roles", "admin/roles"), "View/Edit/Add Roles"])
|
||||
l_admin_links.force (["core", <<"admin modules">>, local_link ("Modules", "admin/modules"), "(un)Install modules"])
|
||||
l_admin_links.force (["core", <<"view logs">>, local_link ("Logs", "admin/logs"), "View logs"])
|
||||
l_admin_links.force (["core", <<"admin path_alias">>, local_link ("Path Alias", "admin/path_alias"), "Manage path aliases"])
|
||||
l_admin_links.force (["support", <<"admin cache">>, local_link ("Cache", "admin/cache"), "Clear caches"])
|
||||
l_admin_links.force (["support", <<"admin export">>, local_link ("Export", "admin/export"), "Export CMS contents, and modules contents."])
|
||||
l_admin_links.force (["support", <<"admin import">>, local_link ("Import", "admin/import"), "Import CMS contents, and modules contents."])
|
||||
l_admin_links.force (["core", <<"admin users">>, administration_link ("Users", "users"), "View/Edit/Add Users"])
|
||||
l_admin_links.force (["core", <<"admin roles">>, administration_link ("Roles", "roles"), "View/Edit/Add Roles"])
|
||||
l_admin_links.force (["core", <<"admin modules">>, administration_link ("Modules", "modules"), "(un)Install modules"])
|
||||
l_admin_links.force (["core", <<"view logs">>, administration_link ("Logs", "logs"), "View logs"])
|
||||
l_admin_links.force (["core", <<"admin path_alias">>, administration_link ("Path Alias", "path_alias"), "Manage path aliases"])
|
||||
l_admin_links.force (["support", <<"admin cache">>, administration_link ("Cache", "cache"), "Clear caches"])
|
||||
l_admin_links.force (["support", <<"admin export">>, administration_link ("Export", "export"), "Export CMS contents, and modules contents."])
|
||||
l_admin_links.force (["support", <<"admin import">>, administration_link ("Import", "import"), "Import CMS contents, and modules contents."])
|
||||
create categories.make_caseless (3)
|
||||
across
|
||||
l_admin_links as ic
|
||||
|
||||
@@ -91,7 +91,7 @@ feature -- HTTP Methods
|
||||
u := ic.item
|
||||
s.append ("<li class=%"cms_role%">")
|
||||
s.append ("<a href=%"")
|
||||
s.append (req.absolute_script_url ("/admin/role/" + u.id.out))
|
||||
s.append (req.absolute_script_url (api.administration_path ("/role/") + u.id.out))
|
||||
s.append ("%">")
|
||||
s.append (html_encoded (u.name))
|
||||
s.append ("</a>")
|
||||
@@ -101,7 +101,7 @@ feature -- HTTP Methods
|
||||
end
|
||||
|
||||
if l_response.has_permission ("admin roles") then
|
||||
s.append (l_response.link ("Add Role", "admin/add/role", Void))
|
||||
s.append (l_response.link ("Add Role", api.administration_path_location ("add/role"), Void))
|
||||
end
|
||||
|
||||
|
||||
|
||||
@@ -72,9 +72,9 @@ feature -- Process Edit
|
||||
fd := f.last_data
|
||||
end
|
||||
if a_role.has_id then
|
||||
add_to_menu (create {CMS_LOCAL_LINK}.make (translation ("View", Void), "admin/role/" + a_role.id.out), primary_tabs)
|
||||
add_to_menu (create {CMS_LOCAL_LINK}.make (translation ("Edit", Void), "admin/role/" + a_role.id.out + "/edit"), primary_tabs)
|
||||
add_to_menu (create {CMS_LOCAL_LINK}.make (translation ("Delete", Void), "admin/role/" + a_role.id.out + "/delete"), primary_tabs)
|
||||
add_to_menu (api.administration_link (translation ("View", Void), "role/" + a_role.id.out), primary_tabs)
|
||||
add_to_menu (api.administration_link (translation ("Edit", Void), "role/" + a_role.id.out + "/edit"), primary_tabs)
|
||||
add_to_menu (api.administration_link (translation ("Delete", Void), "role/" + a_role.id.out + "/delete"), primary_tabs)
|
||||
end
|
||||
if attached redirection as l_location then
|
||||
-- FIXME: Hack for now
|
||||
@@ -103,9 +103,9 @@ feature -- Process Delete
|
||||
fd := f.last_data
|
||||
end
|
||||
if a_role.has_id then
|
||||
add_to_menu (create {CMS_LOCAL_LINK}.make (translation ("View", Void), "admin/role/" + a_role.id.out), primary_tabs)
|
||||
add_to_menu (create {CMS_LOCAL_LINK}.make (translation ("Edit", Void), "admin/role/" + a_role.id.out + "/edit"), primary_tabs)
|
||||
add_to_menu (create {CMS_LOCAL_LINK}.make (translation ("Delete", Void), "admin/role/" + a_role.id.out + "/delete"), primary_tabs)
|
||||
add_to_menu (api.administration_link (translation ("View", Void), "role/" + a_role.id.out), primary_tabs)
|
||||
add_to_menu (api.administration_link (translation ("Edit", Void), "role/" + a_role.id.out + "/edit"), primary_tabs)
|
||||
add_to_menu (api.administration_link (translation ("Delete", Void), "role/" + a_role.id.out + "/delete"), primary_tabs)
|
||||
end
|
||||
if attached redirection as l_location then
|
||||
-- FIXME: Hack for now
|
||||
@@ -283,7 +283,7 @@ feature -- Form
|
||||
create ts.make ("op")
|
||||
ts.set_default_value ("Cancel")
|
||||
ts.set_formmethod ("GET")
|
||||
ts.set_formaction ("/admin/role/" + a_role.id.out)
|
||||
ts.set_formaction (api.administration_path ("/role/" + a_role.id.out))
|
||||
f.extend (ts)
|
||||
end
|
||||
Result := f
|
||||
@@ -434,7 +434,7 @@ feature -- Form
|
||||
api.user_api.save_user_role (a_role)
|
||||
if not api.user_api.has_error then
|
||||
add_success_message ("Permissions updated")
|
||||
set_redirection (absolute_url ("admin/role/" + a_role.id.out, Void))
|
||||
set_redirection (absolute_url (api.administration_path_location ("role/" + a_role.id.out), Void))
|
||||
else
|
||||
add_error_message ("Error during permissions update operation.")
|
||||
end
|
||||
@@ -458,8 +458,8 @@ feature -- Form
|
||||
if api.user_api.has_error then
|
||||
-- handle error
|
||||
else
|
||||
add_success_message ("Created Role " + link (l_role, "admin/role/" + u.id.out, Void))
|
||||
set_redirection (absolute_url ("admin/role/" + u.id.out, Void))
|
||||
add_success_message ("Created Role " + link (l_role, api.administration_path_location ("role/" + u.id.out), Void))
|
||||
set_redirection (absolute_url (api.administration_path_location ("role/" + u.id.out), Void))
|
||||
end
|
||||
else
|
||||
a_form_data.report_invalid_field ("username", "Missing role!")
|
||||
|
||||
@@ -86,11 +86,11 @@ feature -- HTTP Methods
|
||||
create {FORBIDDEN_ERROR_CMS_RESPONSE} r.make (req, res, api)
|
||||
if r.has_permission ("admin roles") then
|
||||
if req.percent_encoded_path_info.ends_with_general ("/edit") then
|
||||
check valid_url: req.percent_encoded_path_info.starts_with_general ("/admin/role/") end
|
||||
check valid_url: req.percent_encoded_path_info.starts_with_general (api.administration_path ("/role/")) end
|
||||
create edit_response.make (req, res, api)
|
||||
edit_response.execute
|
||||
elseif req.percent_encoded_path_info.ends_with_general ("/delete") then
|
||||
check valid_url: req.percent_encoded_path_info.starts_with_general ("/admin/role/") end
|
||||
check valid_url: req.percent_encoded_path_info.starts_with_general (api.administration_path ("/role/")) end
|
||||
create edit_response.make (req, res, api)
|
||||
edit_response.execute
|
||||
else
|
||||
@@ -192,7 +192,7 @@ feature {NONE} -- New role
|
||||
local
|
||||
edit_response: CMS_ROLE_FORM_RESPONSE
|
||||
do
|
||||
if req.percent_encoded_path_info.starts_with_general ("/admin/add/role") then
|
||||
if req.percent_encoded_path_info.starts_with_general (api.administration_path ("/add/role")) then
|
||||
create edit_response.make (req, res, api)
|
||||
edit_response.execute
|
||||
else
|
||||
|
||||
@@ -52,16 +52,17 @@ feature -- Execution
|
||||
s: STRING
|
||||
do
|
||||
a_response.set_value (a_role, "role")
|
||||
create lnk.make (a_response.translation ("View", Void), "admin/role/" + a_role.id.out)
|
||||
lnk := api.administration_link (a_response.translation ("View", Void), "role/" + a_role.id.out)
|
||||
lnk.set_is_active (True)
|
||||
lnk.set_weight (1)
|
||||
a_response.add_to_primary_tabs (lnk)
|
||||
create lnk.make (a_response.translation ("Edit", Void), "admin/role/" + a_role.id.out + "/edit")
|
||||
|
||||
lnk := api.administration_link (a_response.translation ("Edit", Void), "role/" + a_role.id.out + "/edit")
|
||||
lnk.set_weight (2)
|
||||
a_response.add_to_primary_tabs (lnk)
|
||||
|
||||
if a_role /= Void and then a_role.id > 0 then
|
||||
create lnk.make (a_response.translation ("Delete", Void), "admin/role/" + a_role.id.out + "/delete")
|
||||
lnk := api.administration_link (a_response.translation ("Delete", Void), "role/" + a_role.id.out + "/delete")
|
||||
lnk.set_weight (3)
|
||||
a_response.add_to_primary_tabs (lnk)
|
||||
end
|
||||
|
||||
@@ -89,7 +89,7 @@ feature -- HTTP Methods
|
||||
end
|
||||
|
||||
create s_pager.make_empty
|
||||
create l_page_helper.make ("admin/users/?page={page}&size={size}", user_api.users_count.as_natural_64, 25) -- FIXME: Make this default page size a global CMS settings
|
||||
create l_page_helper.make (api.administration_path_location ("users/?page={page}&size={size}"), user_api.users_count.as_natural_64, 25) -- FIXME: Make this default page size a global CMS settings
|
||||
l_page_helper.get_setting_from_request (req)
|
||||
if l_page_helper.has_upper_limit and then l_page_helper.pages_count > 1 then
|
||||
l_page_helper.append_to_html (l_response, s_pager)
|
||||
@@ -107,7 +107,7 @@ feature -- HTTP Methods
|
||||
u := ic.item
|
||||
s.append ("<li class=%"user%">")
|
||||
s.append ("<span class=%"identifier%"><a href=%"")
|
||||
s.append (req.absolute_script_url ("/admin/user/"+u.id.out))
|
||||
s.append (req.absolute_script_url (api.administration_path ("/user/" + u.id.out)))
|
||||
s.append ("%">")
|
||||
l_display_name := user_api.user_display_name (u)
|
||||
s.append (html_encoded (l_display_name))
|
||||
@@ -151,7 +151,7 @@ feature -- HTTP Methods
|
||||
s.append (s_pager)
|
||||
|
||||
if l_response.has_permission ("manage " + {CMS_ADMIN_MODULE}.name) then
|
||||
s.append (l_response.link ("Add User", "admin/add/user", Void))
|
||||
s.append (api.link ("Add User", api.administration_path_location ("add/user"), Void))
|
||||
end
|
||||
|
||||
l_response.set_main_content (s)
|
||||
|
||||
@@ -72,9 +72,9 @@ feature -- Process Edit
|
||||
fd := f.last_data
|
||||
end
|
||||
if a_user.has_id then
|
||||
add_to_menu (create {CMS_LOCAL_LINK}.make (translation ("View", Void),"admin/user/" + a_user.id.out), primary_tabs)
|
||||
add_to_menu (create {CMS_LOCAL_LINK}.make (translation ("Edit", Void),"admin/user/" + a_user.id.out + "/edit"), primary_tabs)
|
||||
add_to_menu (create {CMS_LOCAL_LINK}.make (translation ("Delete", Void),"admin/user/" + a_user.id.out + "/delete"), primary_tabs)
|
||||
add_to_menu (api.administration_link (translation ("View", Void), "user/" + a_user.id.out), primary_tabs)
|
||||
add_to_menu (api.administration_link (translation ("Edit", Void), "user/" + a_user.id.out + "/edit"), primary_tabs)
|
||||
add_to_menu (api.administration_link (translation ("Delete", Void), "user/" + a_user.id.out + "/delete"), primary_tabs)
|
||||
end
|
||||
if attached redirection as l_location then
|
||||
-- FIXME: Hack for now
|
||||
@@ -103,9 +103,9 @@ feature -- Process Delete
|
||||
fd := f.last_data
|
||||
end
|
||||
if a_user.has_id then
|
||||
add_to_menu (create {CMS_LOCAL_LINK}.make (translation ("View", Void),"admin/user/" + a_user.id.out ), primary_tabs)
|
||||
add_to_menu (create {CMS_LOCAL_LINK}.make (translation ("Edit", Void),"admin/user/" + a_user.id.out + "/edit"), primary_tabs)
|
||||
add_to_menu (create {CMS_LOCAL_LINK}.make (translation ("Delete", Void),"admin/user/" + a_user.id.out + "/delete"), primary_tabs)
|
||||
add_to_menu (api.administration_link (translation ("View", Void),"user/" + a_user.id.out ), primary_tabs)
|
||||
add_to_menu (api.administration_link (translation ("Edit", Void),"user/" + a_user.id.out + "/edit"), primary_tabs)
|
||||
add_to_menu (api.administration_link (translation ("Delete", Void),"user/" + a_user.id.out + "/delete"), primary_tabs)
|
||||
end
|
||||
if attached redirection as l_location then
|
||||
-- FIXME: Hack for now
|
||||
@@ -180,7 +180,7 @@ feature -- Form
|
||||
if a_user /= Void then
|
||||
l_user := a_user
|
||||
if l_user.has_id then
|
||||
create {CMS_LOCAL_LINK} lnk.make (translation ("View", Void),"admin/user/" + l_user.id.out )
|
||||
lnk := api.administration_link (translation ("View", Void),"user/" + l_user.id.out)
|
||||
change_user (fd, a_user)
|
||||
s := "modified"
|
||||
set_redirection (lnk.location)
|
||||
@@ -302,7 +302,7 @@ feature -- Form
|
||||
create ts.make ("op")
|
||||
ts.set_default_value ("Cancel")
|
||||
ts.set_formmethod ("GET")
|
||||
ts.set_formaction ("/admin/user/" + a_user.id.out)
|
||||
ts.set_formaction (api.administration_path ("/user/" + a_user.id.out))
|
||||
f.extend (ts)
|
||||
end
|
||||
|
||||
|
||||
@@ -86,11 +86,11 @@ feature -- HTTP Methods
|
||||
create {FORBIDDEN_ERROR_CMS_RESPONSE} r.make (req, res, api)
|
||||
if r.has_permission ("admin users") then
|
||||
if req.percent_encoded_path_info.ends_with_general ("/edit") then
|
||||
check valid_url: req.percent_encoded_path_info.starts_with_general ("/admin/user/") end
|
||||
check valid_url: req.percent_encoded_path_info.starts_with_general (api.administration_path ("/user/")) end
|
||||
create edit_response.make (req, res, api)
|
||||
edit_response.execute
|
||||
elseif req.percent_encoded_path_info.ends_with_general ("/delete") then
|
||||
check valid_url: req.percent_encoded_path_info.starts_with_general ("/admin/user/") end
|
||||
check valid_url: req.percent_encoded_path_info.starts_with_general (api.administration_path ("/user/")) end
|
||||
create edit_response.make (req, res, api)
|
||||
edit_response.execute
|
||||
else
|
||||
@@ -192,7 +192,7 @@ feature {NONE} -- New User
|
||||
local
|
||||
edit_response: CMS_USER_FORM_RESPONSE
|
||||
do
|
||||
if req.percent_encoded_path_info.starts_with ("/admin/add/user") then
|
||||
if req.percent_encoded_path_info.starts_with (api.administration_path ("/add/user")) then
|
||||
create edit_response.make (req, res, api)
|
||||
edit_response.execute
|
||||
else
|
||||
|
||||
@@ -53,17 +53,17 @@ feature -- Execution
|
||||
ago: DATE_TIME_AGO_CONVERTER
|
||||
do
|
||||
a_response.set_value (a_user, "user")
|
||||
create lnk.make (a_response.translation ("View", Void), "admin/user/" + a_user.id.out)
|
||||
lnk := api.administration_link (a_response.translation ("View", Void), "user/" + a_user.id.out)
|
||||
lnk.set_is_active (True)
|
||||
lnk.set_weight (1)
|
||||
a_response.add_to_primary_tabs (lnk)
|
||||
create lnk.make (a_response.translation ("Edit", Void), "admin/user/" + a_user.id.out + "/edit")
|
||||
lnk := api.administration_link (a_response.translation ("Edit", Void), "user/" + a_user.id.out + "/edit")
|
||||
lnk.set_permission_arguments (<<"manage admin", "manage users", "manage own user">>)
|
||||
lnk.set_weight (2)
|
||||
a_response.add_to_primary_tabs (lnk)
|
||||
|
||||
if a_user /= Void and then a_user.id > 0 then
|
||||
create lnk.make (a_response.translation ("Delete", Void), "admin/user/" + a_user.id.out + "/delete")
|
||||
lnk := api.administration_link (a_response.translation ("Delete", Void), "user/" + a_user.id.out + "/delete")
|
||||
lnk.set_weight (3)
|
||||
a_response.add_to_primary_tabs (lnk)
|
||||
end
|
||||
@@ -102,7 +102,7 @@ feature -- Execution
|
||||
across l_roles as ic loop
|
||||
l_role := ic.item
|
||||
s.append ("<li>")
|
||||
s.append (link (l_role.name, "admin/role/" + l_role.id.out, Void))
|
||||
s.append (link (l_role.name, api.administration_path_location ("role/" + l_role.id.out), Void))
|
||||
s.append ("</li>")
|
||||
if request.query_parameter ("debug") /= Void then
|
||||
s.append ("<h5>Permissions:</h5>")
|
||||
|
||||
@@ -13,6 +13,8 @@ inherit
|
||||
permissions
|
||||
end
|
||||
|
||||
CMS_ADMINISTRABLE
|
||||
|
||||
CMS_HOOK_AUTO_REGISTER
|
||||
|
||||
CMS_HOOK_RESPONSE_ALTER
|
||||
@@ -62,10 +64,16 @@ feature -- Access
|
||||
Result.force ("account activate")
|
||||
Result.force ("account reject")
|
||||
Result.force ("account reactivate")
|
||||
Result.force ("admin registration")
|
||||
Result.force ("change own username")
|
||||
end
|
||||
|
||||
feature {CMS_EXECUTION} -- Administration
|
||||
|
||||
administration: CMS_AUTHENTICATION_MODULE_ADMINISTRATION
|
||||
do
|
||||
create Result.make (Current)
|
||||
end
|
||||
|
||||
feature -- Access: docs
|
||||
|
||||
root_dir: PATH
|
||||
@@ -91,7 +99,6 @@ feature -- Router
|
||||
-- <Precursor>
|
||||
do
|
||||
configure_web (a_api, a_router)
|
||||
configure_web_admin (a_api, a_router)
|
||||
end
|
||||
|
||||
configure_web (a_api: CMS_API; a_router: WSF_ROUTER)
|
||||
@@ -116,13 +123,6 @@ feature -- Router
|
||||
a_router.handle ("/account/change/{field}", create {WSF_URI_TEMPLATE_AGENT_HANDLER}.make (agent handle_change_field (a_api, ?, ?)), a_router.methods_get_post)
|
||||
end
|
||||
|
||||
|
||||
configure_web_admin (a_api: CMS_API; a_router: WSF_ROUTER)
|
||||
-- Configure router mapping for admin web interface.
|
||||
do
|
||||
a_router.handle ("/admin/pending-registrations/", create {WSF_URI_AGENT_HANDLER}.make (agent handle_admin_pending_registrations (?, ?, a_api)), a_router.methods_get)
|
||||
end
|
||||
|
||||
feature -- Hooks configuration
|
||||
|
||||
setup_hooks (a_hooks: CMS_HOOK_CORE_MANAGER)
|
||||
@@ -194,9 +194,10 @@ feature -- Hooks configuration
|
||||
a_menu_system.primary_menu.extend (lnk)
|
||||
|
||||
-- Add the link to the taxonomy to the main menu
|
||||
if a_response.has_permission ("admin registration") then
|
||||
create lnk.make ("Registration", "admin/pending-registrations/")
|
||||
a_menu_system.management_menu.extend_into (lnk, "Admin", "admin")
|
||||
if a_response.has_permission ("access admin") then
|
||||
create lnk.make ("Administration", a_response.api.administration_path_location (Void))
|
||||
lnk.set_weight (999)
|
||||
a_menu_system.navigation_menu.extend (lnk)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -797,97 +798,6 @@ feature -- Handler
|
||||
r.execute
|
||||
end
|
||||
|
||||
handle_admin_pending_registrations (req: WSF_REQUEST; res: WSF_RESPONSE; api: CMS_API)
|
||||
local
|
||||
l_response: CMS_RESPONSE
|
||||
s: STRING
|
||||
u: CMS_TEMP_USER
|
||||
l_page_helper: CMS_PAGINATION_GENERATOR
|
||||
s_pager: STRING
|
||||
l_count: INTEGER
|
||||
l_user_api: CMS_USER_API
|
||||
do
|
||||
-- At the moment the template are hardcoded, but we can
|
||||
-- get them from the configuration file and load them into
|
||||
-- the setup class.
|
||||
|
||||
create {FORBIDDEN_ERROR_CMS_RESPONSE} l_response.make (req, res, api)
|
||||
if
|
||||
l_response.has_permission ("admin registration")
|
||||
then
|
||||
l_user_api := api.user_api
|
||||
|
||||
l_count := l_user_api.temp_users_count
|
||||
|
||||
create {GENERIC_VIEW_CMS_RESPONSE} l_response.make (req, res, api)
|
||||
|
||||
create s.make_empty
|
||||
if l_count > 1 then
|
||||
l_response.set_title ("Listing " + l_count.out + " Pending Registrations")
|
||||
else
|
||||
l_response.set_title ("Listing " + l_count.out + " Pending Registration")
|
||||
end
|
||||
|
||||
create s_pager.make_empty
|
||||
create l_page_helper.make ("admin/pending-registrations/?page={page}&size={size}", l_user_api.temp_users_count.as_natural_64, 25) -- FIXME: Make this default page size a global CMS settings
|
||||
l_page_helper.get_setting_from_request (req)
|
||||
if l_page_helper.has_upper_limit and then l_page_helper.pages_count > 1 then
|
||||
l_page_helper.append_to_html (l_response, s_pager)
|
||||
if l_page_helper.page_size > 25 then
|
||||
s.append (s_pager)
|
||||
end
|
||||
end
|
||||
|
||||
if attached l_user_api.temp_recent_users (create {CMS_DATA_QUERY_PARAMETERS}.make (l_page_helper.current_page_offset, l_page_helper.page_size)) as lst then
|
||||
s.append ("<ul class=%"cms-temp-users%">%N")
|
||||
across
|
||||
lst as ic
|
||||
loop
|
||||
u := ic.item
|
||||
s.append ("<li class=%"cms_temp_user%">")
|
||||
s.append ("User:" + html_encoded (u.name))
|
||||
s.append ("<ul class=%"cms_temp_user_details%">")
|
||||
if attached u.personal_information as l_information then
|
||||
s.append ("<li class=%"cms_temp_user_detail_information%">")
|
||||
s.append (html_encoded (l_information))
|
||||
s.append ("</li>%N")
|
||||
end
|
||||
if attached u.email as l_email then
|
||||
s.append ("<li class=%"cms_temp_user_detail_email%">")
|
||||
s.append (l_email)
|
||||
s.append ("</li>%N")
|
||||
end
|
||||
if attached l_user_api.token_by_temp_user_id (u.id) as l_token then
|
||||
s.append ("<li>")
|
||||
s.append ("<a href=%"")
|
||||
s.append (req.absolute_script_url ("/account/activate/" + l_token))
|
||||
s.append ("%">")
|
||||
s.append (html_encoded ("Activate"))
|
||||
s.append ("</a>")
|
||||
s.append ("</li>%N")
|
||||
s.append ("<li>")
|
||||
s.append ("<a href=%"")
|
||||
s.append (req.absolute_script_url ("/account/reject/" + l_token))
|
||||
s.append ("%">")
|
||||
s.append (html_encoded ("Reject"))
|
||||
s.append ("</a>")
|
||||
s.append ("</li>%N")
|
||||
end
|
||||
s.append ("</ul>%N")
|
||||
s.append ("</li>%N")
|
||||
end
|
||||
s.append ("</ul>%N")
|
||||
end
|
||||
-- Again the pager at the bottom, if needed
|
||||
s.append (s_pager)
|
||||
|
||||
l_response.set_main_content (s)
|
||||
l_response.execute
|
||||
else
|
||||
l_response.execute
|
||||
end
|
||||
end
|
||||
|
||||
block_list: ITERABLE [like {CMS_BLOCK}.name]
|
||||
do
|
||||
Result := <<"register", "reactivate", "new_password", "reset_password">>
|
||||
|
||||
157
modules/auth/cms_authentication_module_administration.e
Normal file
157
modules/auth/cms_authentication_module_administration.e
Normal file
@@ -0,0 +1,157 @@
|
||||
note
|
||||
description: "Summary description for {CMS_AUTHENTICATION_MODULE_ADMINISTRATION}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
CMS_AUTHENTICATION_MODULE_ADMINISTRATION
|
||||
|
||||
inherit
|
||||
CMS_MODULE_ADMINISTRATION [CMS_AUTHENTICATION_MODULE]
|
||||
redefine
|
||||
setup_hooks,
|
||||
permissions
|
||||
end
|
||||
|
||||
CMS_HOOK_AUTO_REGISTER
|
||||
|
||||
CMS_HOOK_MENU_SYSTEM_ALTER
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature -- Security
|
||||
|
||||
permissions: LIST [READABLE_STRING_8]
|
||||
-- List of permission ids, used by this module, and declared.
|
||||
do
|
||||
Result := Precursor
|
||||
Result.force ("admin registration")
|
||||
end
|
||||
|
||||
feature {NONE} -- Router/administration
|
||||
|
||||
setup_administration_router (a_router: WSF_ROUTER; a_api: CMS_API)
|
||||
-- <Precursor>
|
||||
do
|
||||
a_router.handle ("/pending-registrations/", create {WSF_URI_AGENT_HANDLER}.make (agent handle_admin_pending_registrations (?, ?, a_api)), a_router.methods_get)
|
||||
end
|
||||
|
||||
feature -- Request handling
|
||||
|
||||
handle_admin_pending_registrations (req: WSF_REQUEST; res: WSF_RESPONSE; api: CMS_API)
|
||||
local
|
||||
l_response: CMS_RESPONSE
|
||||
s: STRING
|
||||
u: CMS_TEMP_USER
|
||||
l_page_helper: CMS_PAGINATION_GENERATOR
|
||||
s_pager: STRING
|
||||
l_count: INTEGER
|
||||
l_user_api: CMS_USER_API
|
||||
do
|
||||
-- At the moment the template are hardcoded, but we can
|
||||
-- get them from the configuration file and load them into
|
||||
-- the setup class.
|
||||
|
||||
create {FORBIDDEN_ERROR_CMS_RESPONSE} l_response.make (req, res, api)
|
||||
if
|
||||
l_response.has_permission ("admin registration")
|
||||
then
|
||||
l_user_api := api.user_api
|
||||
|
||||
l_count := l_user_api.temp_users_count
|
||||
|
||||
create {GENERIC_VIEW_CMS_RESPONSE} l_response.make (req, res, api)
|
||||
|
||||
create s.make_empty
|
||||
if l_count > 1 then
|
||||
l_response.set_title ("Listing " + l_count.out + " Pending Registrations")
|
||||
else
|
||||
l_response.set_title ("Listing " + l_count.out + " Pending Registration")
|
||||
end
|
||||
|
||||
create s_pager.make_empty
|
||||
create l_page_helper.make (api.administration_path_location ("pending-registrations/?page={page}&size={size}"), l_user_api.temp_users_count.as_natural_64, 25) -- FIXME: Make this default page size a global CMS settings
|
||||
l_page_helper.get_setting_from_request (req)
|
||||
if l_page_helper.has_upper_limit and then l_page_helper.pages_count > 1 then
|
||||
l_page_helper.append_to_html (l_response, s_pager)
|
||||
if l_page_helper.page_size > 25 then
|
||||
s.append (s_pager)
|
||||
end
|
||||
end
|
||||
|
||||
if attached l_user_api.temp_recent_users (create {CMS_DATA_QUERY_PARAMETERS}.make (l_page_helper.current_page_offset, l_page_helper.page_size)) as lst then
|
||||
s.append ("<ul class=%"cms-temp-users%">%N")
|
||||
across
|
||||
lst as ic
|
||||
loop
|
||||
u := ic.item
|
||||
s.append ("<li class=%"cms_temp_user%">")
|
||||
s.append ("User:" + html_encoded (u.name))
|
||||
s.append ("<ul class=%"cms_temp_user_details%">")
|
||||
if attached u.personal_information as l_information then
|
||||
s.append ("<li class=%"cms_temp_user_detail_information%">")
|
||||
s.append (html_encoded (l_information))
|
||||
s.append ("</li>%N")
|
||||
end
|
||||
if attached u.email as l_email then
|
||||
s.append ("<li class=%"cms_temp_user_detail_email%">")
|
||||
s.append (l_email)
|
||||
s.append ("</li>%N")
|
||||
end
|
||||
if attached l_user_api.token_by_temp_user_id (u.id) as l_token then
|
||||
s.append ("<li>")
|
||||
s.append ("<a href=%"")
|
||||
s.append (req.absolute_script_url ("/account/activate/" + l_token))
|
||||
s.append ("%">")
|
||||
s.append (html_encoded ("Activate"))
|
||||
s.append ("</a>")
|
||||
s.append ("</li>%N")
|
||||
s.append ("<li>")
|
||||
s.append ("<a href=%"")
|
||||
s.append (req.absolute_script_url ("/account/reject/" + l_token))
|
||||
s.append ("%">")
|
||||
s.append (html_encoded ("Reject"))
|
||||
s.append ("</a>")
|
||||
s.append ("</li>%N")
|
||||
end
|
||||
s.append ("</ul>%N")
|
||||
s.append ("</li>%N")
|
||||
end
|
||||
s.append ("</ul>%N")
|
||||
end
|
||||
-- Again the pager at the bottom, if needed
|
||||
s.append (s_pager)
|
||||
|
||||
l_response.set_main_content (s)
|
||||
l_response.execute
|
||||
else
|
||||
l_response.execute
|
||||
end
|
||||
end
|
||||
|
||||
feature -- Hooks configuration
|
||||
|
||||
setup_hooks (a_hooks: CMS_HOOK_CORE_MANAGER)
|
||||
-- Module hooks configuration.
|
||||
do
|
||||
a_hooks.subscribe_to_menu_system_alter_hook (Current)
|
||||
a_hooks.subscribe_to_menu_system_alter_hook (module)
|
||||
a_hooks.subscribe_to_value_table_alter_hook (module)
|
||||
end
|
||||
|
||||
menu_system_alter (a_menu_system: CMS_MENU_SYSTEM; a_response: CMS_RESPONSE)
|
||||
-- Hook execution on collection of menu contained by `a_menu_system'
|
||||
-- for related response `a_response'.
|
||||
local
|
||||
lnk: CMS_LOCAL_LINK
|
||||
do
|
||||
-- Add the link to the taxonomy to the main menu
|
||||
if a_response.has_permission ("admin registration") then
|
||||
create lnk.make ("Registration", a_response.api.administration_path_location ("pending-registrations/"))
|
||||
a_menu_system.management_menu.extend_into (lnk, "Admin", a_response.api.administration_path_location (""))
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
@@ -13,18 +13,17 @@ inherit
|
||||
redefine
|
||||
initialize,
|
||||
setup_hooks,
|
||||
permissions,
|
||||
feed_aggregator_api
|
||||
end
|
||||
|
||||
CMS_ADMINISTRABLE
|
||||
|
||||
CMS_HOOK_BLOCK
|
||||
|
||||
CMS_HOOK_RESPONSE_ALTER
|
||||
|
||||
CMS_HOOK_MENU_SYSTEM_ALTER
|
||||
|
||||
CMS_HOOK_CACHE
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
@@ -42,16 +41,12 @@ feature -- Access
|
||||
|
||||
name: STRING = "feed_aggregator"
|
||||
|
||||
permissions: LIST [READABLE_STRING_8]
|
||||
-- List of permission ids, used by this module, and declared.
|
||||
do
|
||||
Result := Precursor
|
||||
Result.force (permission__manage_feed_aggregator)
|
||||
Result.force (permission__clear_feed_cache)
|
||||
end
|
||||
feature {CMS_EXECUTION} -- Administration
|
||||
|
||||
permission__manage_feed_aggregator: STRING = "manage feed aggregator"
|
||||
permission__clear_feed_cache: STRING = "clear feed cache"
|
||||
administration: FEED_AGGREGATOR_MODULE_ADMINISTRATION
|
||||
do
|
||||
create Result.make (Current)
|
||||
end
|
||||
|
||||
feature {CMS_API} -- Module Initialization
|
||||
|
||||
@@ -74,7 +69,6 @@ feature -- Access: router
|
||||
local
|
||||
h: WSF_URI_TEMPLATE_HANDLER
|
||||
do
|
||||
a_router.handle ("/admin/feed_aggregator/", create {WSF_URI_AGENT_HANDLER}.make (agent handle_feed_aggregator_admin (a_api, ?, ?)), a_router.methods_head_get_post)
|
||||
create {WSF_URI_TEMPLATE_AGENT_HANDLER} h.make (agent handle_feed_aggregation (a_api, ?, ?))
|
||||
a_router.handle ("/feed_aggregation/", h, a_router.methods_head_get)
|
||||
a_router.handle ("/feed_aggregation/{feed_id}", h, a_router.methods_head_get)
|
||||
@@ -82,14 +76,6 @@ feature -- Access: router
|
||||
|
||||
feature -- Handle
|
||||
|
||||
handle_feed_aggregator_admin (a_api: CMS_API; req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
local
|
||||
nyi: NOT_IMPLEMENTED_ERROR_CMS_RESPONSE
|
||||
do
|
||||
create nyi.make (req, res, a_api)
|
||||
nyi.execute
|
||||
end
|
||||
|
||||
handle_feed_aggregation (a_api: CMS_API; req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
local
|
||||
m: WSF_PAGE_RESPONSE
|
||||
@@ -205,29 +191,10 @@ feature -- Hooks configuration
|
||||
a_hooks.subscribe_to_block_hook (Current)
|
||||
a_hooks.subscribe_to_response_alter_hook (Current)
|
||||
a_hooks.subscribe_to_menu_system_alter_hook (Current)
|
||||
a_hooks.subscribe_to_cache_hook (Current)
|
||||
end
|
||||
|
||||
feature -- Hook
|
||||
|
||||
clear_cache (a_cache_id_list: detachable ITERABLE [READABLE_STRING_GENERAL]; a_response: CMS_RESPONSE)
|
||||
-- <Precursor>.
|
||||
local
|
||||
p: PATH
|
||||
dir: DIRECTORY
|
||||
do
|
||||
if a_response.has_permissions (<<permission__clear_feed_cache, permission__manage_feed_aggregator>>) then
|
||||
if a_cache_id_list = Void then
|
||||
-- Clear all cache.
|
||||
p := a_response.api.files_location.extended (".cache").extended (name)
|
||||
create dir.make_with_path (p)
|
||||
if dir.exists then
|
||||
dir.recursive_delete
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
block_list: ITERABLE [like {CMS_BLOCK}.name]
|
||||
-- List of block names, managed by current object.
|
||||
local
|
||||
@@ -300,7 +267,7 @@ feature -- Hook
|
||||
do
|
||||
if attached feed_aggregator_api as l_feed_api then
|
||||
if attached l_feed_api.aggregation (a_feed_id) as l_agg then
|
||||
create l_cache.make (a_response.api.files_location.extended (".cache").extended (name).extended ("feed__" + a_feed_id + "__" + a_count.out + "_" + with_feed_info.out))
|
||||
create l_cache.make (l_feed_api.cms_api.cache_location.extended (name).extended ("feed__" + a_feed_id + "__" + a_count.out + "_" + with_feed_info.out))
|
||||
Result := l_cache.item
|
||||
if Result = Void or l_cache.expired (Void, l_agg.expiration) then
|
||||
|
||||
@@ -368,9 +335,6 @@ feature -- Hook
|
||||
do
|
||||
if a_response.is_authenticated then
|
||||
a_menu_system.navigation_menu.extend (create {CMS_LOCAL_LINK}.make ("Feeds", "feed_aggregation/"))
|
||||
if a_response.has_permission (permission__manage_feed_aggregator) then
|
||||
a_menu_system.management_menu.extend_into (create {CMS_LOCAL_LINK}.make ("Feeds (admin)", "admin/feed_aggregator/"), "Admin", "admin")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
103
modules/feed_aggregator/feed_aggregator_module_administration.e
Normal file
103
modules/feed_aggregator/feed_aggregator_module_administration.e
Normal file
@@ -0,0 +1,103 @@
|
||||
note
|
||||
description: "Summary description for {FEED_AGGREGATOR_MODULE_ADMINISTRATION}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
FEED_AGGREGATOR_MODULE_ADMINISTRATION
|
||||
|
||||
inherit
|
||||
CMS_MODULE_ADMINISTRATION [FEED_AGGREGATOR_MODULE]
|
||||
redefine
|
||||
setup_hooks,
|
||||
permissions
|
||||
end
|
||||
|
||||
CMS_HOOK_RESPONSE_ALTER
|
||||
|
||||
CMS_HOOK_MENU_SYSTEM_ALTER
|
||||
|
||||
CMS_HOOK_CACHE
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature -- Access
|
||||
|
||||
permissions: LIST [READABLE_STRING_8]
|
||||
-- List of permission ids, used by this module, and declared.
|
||||
do
|
||||
Result := Precursor
|
||||
Result.force (permission__clear_feed_cache)
|
||||
Result.force (permission__manage_feed_aggregator)
|
||||
end
|
||||
|
||||
permission__clear_feed_cache: STRING = "clear feed cache"
|
||||
|
||||
permission__manage_feed_aggregator: STRING = "manage feed aggregator"
|
||||
|
||||
feature {NONE} -- Router/administration
|
||||
|
||||
setup_administration_router (a_router: WSF_ROUTER; a_api: CMS_API)
|
||||
do
|
||||
a_router.handle ("/feed_aggregator/", create {WSF_URI_AGENT_HANDLER}.make (agent handle_feed_aggregator_admin (a_api, ?, ?)), a_router.methods_head_get_post)
|
||||
end
|
||||
|
||||
feature -- Handle
|
||||
|
||||
handle_feed_aggregator_admin (a_api: CMS_API; req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
local
|
||||
nyi: NOT_IMPLEMENTED_ERROR_CMS_RESPONSE
|
||||
do
|
||||
create nyi.make (req, res, a_api)
|
||||
nyi.execute
|
||||
end
|
||||
|
||||
feature -- Hook
|
||||
|
||||
setup_hooks (a_hooks: CMS_HOOK_CORE_MANAGER)
|
||||
-- Module hooks configuration.
|
||||
do
|
||||
a_hooks.subscribe_to_response_alter_hook (Current)
|
||||
a_hooks.subscribe_to_menu_system_alter_hook (Current)
|
||||
a_hooks.subscribe_to_cache_hook (Current)
|
||||
end
|
||||
|
||||
clear_cache (a_cache_id_list: detachable ITERABLE [READABLE_STRING_GENERAL]; a_response: CMS_RESPONSE)
|
||||
-- <Precursor>.
|
||||
local
|
||||
p: PATH
|
||||
dir: DIRECTORY
|
||||
do
|
||||
if a_response.has_permissions (<<permission__clear_feed_cache, permission__manage_feed_aggregator>>) then
|
||||
if a_cache_id_list = Void then
|
||||
-- Clear all cache.
|
||||
p := a_response.api.cache_location.extended (name)
|
||||
create dir.make_with_path (p)
|
||||
if dir.exists then
|
||||
dir.recursive_delete
|
||||
end
|
||||
a_response.add_notice_message ("Cache cleared from " + name)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
response_alter (a_response: CMS_RESPONSE)
|
||||
do
|
||||
module.response_alter (a_response)
|
||||
end
|
||||
|
||||
menu_system_alter (a_menu_system: CMS_MENU_SYSTEM; a_response: CMS_RESPONSE)
|
||||
-- Hook execution on collection of menu contained by `a_menu_system'
|
||||
-- for related response `a_response'.
|
||||
do
|
||||
if a_response.is_authenticated then
|
||||
a_menu_system.navigation_menu.extend (create {CMS_LOCAL_LINK}.make ("Feeds", "feed_aggregation/"))
|
||||
if a_response.has_permission (permission__manage_feed_aggregator) then
|
||||
a_menu_system.management_menu.extend_into (a_response.api.administration_link ("Feeds (admin)", "feed_aggregator/"), "Admin", "admin")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
@@ -250,7 +250,7 @@ feature -- Access: Node
|
||||
|
||||
-- Update partial user if needed.
|
||||
if Result /= Void then
|
||||
if attached {CMS_PARTIAL_USER} Result.author as l_partial_author then
|
||||
if attached {CMS_PARTIAL_USER} Result.author as l_partial_author and then l_partial_author.has_id then
|
||||
if attached cms_api.user_api.user_by_id (l_partial_author.id) as l_author then
|
||||
Result.set_author (l_author)
|
||||
else
|
||||
@@ -259,7 +259,7 @@ feature -- Access: Node
|
||||
end
|
||||
end
|
||||
end
|
||||
if attached {CMS_PARTIAL_USER} Result.editor as l_partial_editor then
|
||||
if attached {CMS_PARTIAL_USER} Result.editor as l_partial_editor and then l_partial_editor.has_id then
|
||||
if attached cms_api.user_api.user_by_id (l_partial_editor.id) as l_editor then
|
||||
Result.set_editor (l_editor)
|
||||
else
|
||||
|
||||
@@ -679,10 +679,10 @@ feature {NONE} -- Implementation
|
||||
if attached sql_read_string (7) as l_format then
|
||||
Result.set_format (l_format)
|
||||
end
|
||||
if attached sql_read_integer_64 (8) as l_author_id then
|
||||
if attached sql_read_integer_64 (8) as l_author_id and then l_author_id > 0 then
|
||||
Result.set_author (create {CMS_PARTIAL_USER}.make_with_id (l_author_id))
|
||||
end
|
||||
if attached sql_read_integer_64 (9) as l_editor_id then
|
||||
if attached sql_read_integer_64 (9) as l_editor_id and then l_editor_id > 0 then
|
||||
Result.set_editor (create {CMS_PARTIAL_USER}.make_with_id (l_editor_id))
|
||||
end
|
||||
if attached sql_read_date_time (10) as l_publication_date then
|
||||
|
||||
@@ -69,12 +69,14 @@ feature {CMS_API} -- Module Initialization
|
||||
p1.set_title ("Welcome")
|
||||
p1.set_content ("Welcome, you are using the ROC Eiffel CMS", Void, Void) -- Use default format
|
||||
p1.set_author (u)
|
||||
p1.set_editor (u)
|
||||
l_sql_node_storage.save_node (p1)
|
||||
|
||||
p2 := ct.new_node (Void)
|
||||
p2.set_title ("A new page example")
|
||||
p2.set_content ("This is the content of a page", Void, Void) -- Use default format
|
||||
p2.set_author (u)
|
||||
p2.set_editor (u)
|
||||
p2.set_parent (p1)
|
||||
l_sql_node_storage.save_node (p2)
|
||||
end
|
||||
|
||||
@@ -75,7 +75,7 @@ feature -- Handler
|
||||
d: HTTP_DATE
|
||||
do
|
||||
create {GENERIC_VIEW_CMS_RESPONSE} r.make (req, res, api)
|
||||
create l_cache.make (api.files_location.extended ("modules").extended ("sitemap").extended ("sitemap.xml"))
|
||||
create l_cache.make (api.cache_location.extended (name).extended ("sitemap.xml"))
|
||||
if
|
||||
l_cache.exists and then
|
||||
not l_cache.expired (Void, 24*60*60) -- 1 day
|
||||
|
||||
@@ -21,7 +21,7 @@ inherit
|
||||
permissions
|
||||
end
|
||||
|
||||
CMS_HOOK_MENU_SYSTEM_ALTER
|
||||
CMS_ADMINISTRABLE
|
||||
|
||||
CMS_HOOK_RESPONSE_ALTER
|
||||
|
||||
@@ -46,12 +46,18 @@ feature -- Access
|
||||
-- List of permission ids, used by this module, and declared.
|
||||
do
|
||||
Result := Precursor
|
||||
Result.force ("admin taxonomy")
|
||||
Result.force ("update any taxonomy")
|
||||
Result.force ("update page taxonomy") -- related to node module
|
||||
Result.force ("update blog taxonomy") -- related to blog module
|
||||
end
|
||||
|
||||
feature {CMS_EXECUTION} -- Administration
|
||||
|
||||
administration: CMS_TAXONOMY_MODULE_ADMINISTRATION
|
||||
do
|
||||
create Result.make (Current)
|
||||
end
|
||||
|
||||
feature {CMS_API} -- Module Initialization
|
||||
|
||||
initialize (api: CMS_API)
|
||||
@@ -99,7 +105,7 @@ feature {CMS_API} -- Module management
|
||||
Precursor (api)
|
||||
end
|
||||
|
||||
feature {CMS_API} -- Access: API
|
||||
feature {CMS_API, CMS_MODULE_ADMINISTRATION} -- Access: API
|
||||
|
||||
taxonomy_api: detachable CMS_TAXONOMY_API
|
||||
-- <Precursor>
|
||||
@@ -111,7 +117,6 @@ feature -- Access: router
|
||||
do
|
||||
if attached taxonomy_api as l_taxonomy_api then
|
||||
configure_web (a_api, l_taxonomy_api, a_router)
|
||||
configure_web_amin (a_api, l_taxonomy_api, a_router)
|
||||
else
|
||||
-- Issue with api/dependencies,
|
||||
-- thus Current module should not be used!
|
||||
@@ -133,45 +138,10 @@ feature -- Access: router
|
||||
a_router.handle ("/taxonomy/vocabulary/{vocid}", l_voc_handler, a_router.methods_get)
|
||||
end
|
||||
|
||||
configure_web_amin (a_api: CMS_API; a_taxonomy_api: CMS_TAXONOMY_API; a_router: WSF_ROUTER)
|
||||
-- Configure router mapping for web interface.
|
||||
local
|
||||
l_taxonomy_handler: TAXONOMY_TERM_ADMIN_HANDLER
|
||||
l_voc_handler: TAXONOMY_VOCABULARY_ADMIN_HANDLER
|
||||
do
|
||||
a_router.handle ("/admin/taxonomy/", create {WSF_URI_AGENT_HANDLER}.make (agent handle_admin_taxonomy (?, ?, a_api)), a_router.methods_get)
|
||||
|
||||
create l_taxonomy_handler.make (a_api, a_taxonomy_api)
|
||||
a_router.handle ("/admin/taxonomy/term/", l_taxonomy_handler, a_router.methods_get_post)
|
||||
a_router.handle ("/admin/taxonomy/term/{termid}", l_taxonomy_handler, a_router.methods_get_post)
|
||||
|
||||
create l_voc_handler.make (a_api, a_taxonomy_api)
|
||||
a_router.handle ("/admin/taxonomy/vocabulary/", l_voc_handler, a_router.methods_get_post)
|
||||
a_router.handle ("/admin/taxonomy/vocabulary/{vocid}", l_voc_handler, a_router.methods_get_post)
|
||||
end
|
||||
|
||||
feature -- Handler
|
||||
|
||||
handle_admin_taxonomy (req: WSF_REQUEST; res: WSF_RESPONSE; api: CMS_API)
|
||||
local
|
||||
l_page: CMS_RESPONSE
|
||||
lnk: CMS_LOCAL_LINK
|
||||
do
|
||||
create {GENERIC_VIEW_CMS_RESPONSE} l_page.make (req, res, api)
|
||||
create lnk.make ("Admin Vocabularies", "admin/taxonomy/vocabulary/")
|
||||
l_page.add_to_primary_tabs (lnk)
|
||||
|
||||
create lnk.make ("Create terms", "admin/taxonomy/term/")
|
||||
l_page.add_to_primary_tabs (lnk)
|
||||
|
||||
l_page.execute
|
||||
end
|
||||
|
||||
feature -- Hooks
|
||||
|
||||
setup_hooks (a_hooks: CMS_HOOK_CORE_MANAGER)
|
||||
do
|
||||
a_hooks.subscribe_to_menu_system_alter_hook (Current)
|
||||
a_hooks.subscribe_to_response_alter_hook (Current)
|
||||
end
|
||||
|
||||
@@ -180,15 +150,4 @@ feature -- Hooks
|
||||
a_response.add_style (a_response.url ("/module/" + name + "/files/css/taxonomy.css", Void), Void)
|
||||
end
|
||||
|
||||
menu_system_alter (a_menu_system: CMS_MENU_SYSTEM; a_response: CMS_RESPONSE)
|
||||
local
|
||||
lnk: CMS_LOCAL_LINK
|
||||
do
|
||||
-- Add the link to the taxonomy to the main menu
|
||||
if a_response.has_permission ("admin taxonomy") then
|
||||
create lnk.make ("Taxonomy", "admin/taxonomy/")
|
||||
a_menu_system.management_menu.extend_into (lnk, "Admin", "admin")
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
100
modules/taxonomy/cms_taxonomy_module_administration.e
Normal file
100
modules/taxonomy/cms_taxonomy_module_administration.e
Normal file
@@ -0,0 +1,100 @@
|
||||
note
|
||||
description: "Summary description for {CMS_TAXONOMY_MODULE_ADMINISTRATION}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
CMS_TAXONOMY_MODULE_ADMINISTRATION
|
||||
|
||||
inherit
|
||||
CMS_MODULE_ADMINISTRATION [CMS_TAXONOMY_MODULE]
|
||||
redefine
|
||||
setup_hooks,
|
||||
permissions
|
||||
end
|
||||
|
||||
CMS_HOOK_MENU_SYSTEM_ALTER
|
||||
|
||||
CMS_HOOK_RESPONSE_ALTER
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature -- Security
|
||||
|
||||
permissions: LIST [READABLE_STRING_8]
|
||||
-- List of permission ids, used by this module, and declared.
|
||||
do
|
||||
Result := Precursor
|
||||
Result.force ("admin taxonomy")
|
||||
end
|
||||
|
||||
feature {NONE} -- Router/administration
|
||||
|
||||
setup_administration_router (a_router: WSF_ROUTER; a_api: CMS_API)
|
||||
do
|
||||
if attached module.taxonomy_api as l_taxonomy_api then
|
||||
configure_web_admin (a_api, l_taxonomy_api, a_router)
|
||||
end
|
||||
end
|
||||
|
||||
configure_web_admin (a_api: CMS_API; a_taxonomy_api: CMS_TAXONOMY_API; a_router: WSF_ROUTER)
|
||||
-- Configure router mapping for web interface.
|
||||
local
|
||||
l_taxonomy_handler: TAXONOMY_TERM_ADMIN_HANDLER
|
||||
l_voc_handler: TAXONOMY_VOCABULARY_ADMIN_HANDLER
|
||||
do
|
||||
a_router.handle ("/taxonomy/", create {WSF_URI_AGENT_HANDLER}.make (agent handle_admin_taxonomy (?, ?, a_api)), a_router.methods_get)
|
||||
|
||||
create l_taxonomy_handler.make (a_api, a_taxonomy_api)
|
||||
a_router.handle ("/taxonomy/term/", l_taxonomy_handler, a_router.methods_get_post)
|
||||
a_router.handle ("/taxonomy/term/{termid}", l_taxonomy_handler, a_router.methods_get_post)
|
||||
|
||||
create l_voc_handler.make (a_api, a_taxonomy_api)
|
||||
a_router.handle ("/taxonomy/vocabulary/", l_voc_handler, a_router.methods_get_post)
|
||||
a_router.handle ("/taxonomy/vocabulary/{vocid}", l_voc_handler, a_router.methods_get_post)
|
||||
end
|
||||
|
||||
feature -- Handler
|
||||
|
||||
handle_admin_taxonomy (req: WSF_REQUEST; res: WSF_RESPONSE; api: CMS_API)
|
||||
local
|
||||
l_page: CMS_RESPONSE
|
||||
lnk: CMS_LOCAL_LINK
|
||||
do
|
||||
create {GENERIC_VIEW_CMS_RESPONSE} l_page.make (req, res, api)
|
||||
create lnk.make ("Admin Vocabularies", api.administration_path_location ("taxonomy/vocabulary/"))
|
||||
l_page.add_to_primary_tabs (lnk)
|
||||
|
||||
create lnk.make ("Create terms", api.administration_path_location ("taxonomy/term/"))
|
||||
l_page.add_to_primary_tabs (lnk)
|
||||
|
||||
l_page.execute
|
||||
end
|
||||
|
||||
feature -- Hooks
|
||||
|
||||
setup_hooks (a_hooks: CMS_HOOK_CORE_MANAGER)
|
||||
do
|
||||
a_hooks.subscribe_to_menu_system_alter_hook (Current)
|
||||
a_hooks.subscribe_to_response_alter_hook (Current)
|
||||
end
|
||||
|
||||
response_alter (a_response: CMS_RESPONSE)
|
||||
do
|
||||
module.response_alter (a_response)
|
||||
end
|
||||
|
||||
menu_system_alter (a_menu_system: CMS_MENU_SYSTEM; a_response: CMS_RESPONSE)
|
||||
local
|
||||
lnk: CMS_LOCAL_LINK
|
||||
do
|
||||
-- Add the link to the taxonomy to the main menu
|
||||
if a_response.has_permission ("admin taxonomy") then
|
||||
create lnk.make ("Taxonomy", a_response.api.administration_path_location ("taxonomy/"))
|
||||
a_menu_system.management_menu.extend_into (lnk, "Admin", "admin")
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
@@ -118,7 +118,7 @@ feature -- HTTP Methods
|
||||
else
|
||||
l_page.add_success_message ("Term creation succeed.")
|
||||
s.append ("<div>View term: ")
|
||||
s.append (l_page.link (t.text, "admin/taxonomy/term/" + t.id.out, Void))
|
||||
s.append (l_page.link (t.text, api.administration_path_location ("taxonomy/term/" + t.id.out), Void))
|
||||
s.append ("</div>")
|
||||
|
||||
if
|
||||
|
||||
@@ -88,7 +88,7 @@ feature -- HTTP Methods
|
||||
l_page.add_error_message ("Vocabulary creation failed!")
|
||||
else
|
||||
l_page.add_success_message ("Vocabulary creation succeed!")
|
||||
l_page.set_redirection ("admin/taxonomy/vocabulary/" + voc.id.out)
|
||||
l_page.set_redirection (api.administration_path_location ("taxonomy/vocabulary/" + voc.id.out))
|
||||
end
|
||||
else
|
||||
create {BAD_REQUEST_ERROR_CMS_RESPONSE} l_page.make (req, res, api)
|
||||
@@ -143,7 +143,7 @@ feature -- HTTP Methods
|
||||
end
|
||||
end
|
||||
if not taxonomy_api.has_error then
|
||||
l_page.add_notice_message (l_page.link ({STRING_32} "Back to vocabulary %"" + l_vocabulary.name + "%"", "admin/taxonomy/vocabulary/" + l_vocabulary.id.out, Void))
|
||||
l_page.add_notice_message (l_page.link ({STRING_32} "Back to vocabulary %"" + l_vocabulary.name + "%"", api.administration_path_location ("taxonomy/vocabulary/" + l_vocabulary.id.out), Void))
|
||||
end
|
||||
l_page.set_main_content (s)
|
||||
else
|
||||
@@ -239,7 +239,7 @@ feature -- HTTP Methods
|
||||
create wtb_row.make (3)
|
||||
wtb.add_row (wtb_row)
|
||||
|
||||
create wtb_item.make_with_text (l_page.link (ic.item.text, "admin/taxonomy/term/" + l_term.id.out, Void))
|
||||
create wtb_item.make_with_text (l_page.link (ic.item.text, api.administration_path_location ("taxonomy/term/" + l_term.id.out), Void))
|
||||
wtb_row.set_item (wtb_item, 1)
|
||||
if attached ic.item.description as l_desc then
|
||||
create wtb_item.make_with_text (api.html_encoded (l_desc))
|
||||
@@ -362,7 +362,7 @@ feature -- HTTP Methods
|
||||
create wtb_row.make (3)
|
||||
wtb.add_row (wtb_row)
|
||||
|
||||
create wtb_item.make_with_text (l_page.link (ic.item.name, "admin/taxonomy/vocabulary/" + ic.item.id.out, Void))
|
||||
create wtb_item.make_with_text (l_page.link (ic.item.name, api.administration_path_location ("taxonomy/vocabulary/" + ic.item.id.out), Void))
|
||||
-- if attached ic.item.description as l_desc then
|
||||
-- s.append (" : <em>")
|
||||
-- s.append (api.html_encoded (l_desc))
|
||||
@@ -385,7 +385,7 @@ feature -- HTTP Methods
|
||||
wtb_row.set_item (wtb_item, 2)
|
||||
end
|
||||
|
||||
s := l_page.link ("edit", "admin/taxonomy/vocabulary/" + voc.id.out, Void)
|
||||
s := l_page.link ("edit", api.administration_path_location ("taxonomy/vocabulary/" + voc.id.out), Void)
|
||||
create wtb_item.make_with_text (s)
|
||||
wtb_row.set_item (wtb_item, 3)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user