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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user