Updated CMS
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1,2 +1,4 @@
|
|||||||
EIFGENs
|
EIFGENs
|
||||||
*.swp
|
*.swp
|
||||||
|
*.log*
|
||||||
|
*.rc
|
||||||
@@ -70,7 +70,7 @@ feature -- HTTP Methods
|
|||||||
-- Existing node
|
-- Existing node
|
||||||
if attached {WSF_STRING} req.path_parameter ("id") as l_id then
|
if attached {WSF_STRING} req.path_parameter ("id") as l_id then
|
||||||
if l_id.is_integer and then attached {CMS_NODE} api_service.node (l_id.integer_value) as l_node then
|
if l_id.is_integer and then attached {CMS_NODE} api_service.node (l_id.integer_value) as l_node then
|
||||||
create {NODE_VIEW_CMS_RESPONSE} l_page.make (req, res, setup, "modules/node_content")
|
create {GENERIC_VIEW_CMS_RESPONSE} l_page.make (req, res, setup, "modules/node_content")
|
||||||
l_page.add_variable (l_node.content, "content")
|
l_page.add_variable (l_node.content, "content")
|
||||||
l_page.add_variable (l_id.value, "id")
|
l_page.add_variable (l_id.value, "id")
|
||||||
l_page.execute
|
l_page.execute
|
||||||
@@ -78,12 +78,7 @@ feature -- HTTP Methods
|
|||||||
do_error (req, res, l_id)
|
do_error (req, res, l_id)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
-- Todo extract method
|
(create {ERROR_500_CMS_RESPONSE}.make (req, res, setup, "master2/error")).execute
|
||||||
to_implement ("Check how to implemet API error")
|
|
||||||
-- create l_page.make (req, "master2/error.tpl")
|
|
||||||
-- l_page.set_value ("500", "code")
|
|
||||||
-- l_page.set_value (req.absolute_script_url (req.path_info), "request")
|
|
||||||
-- l_page.send_to (res)
|
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
(create {CMS_GENERIC_RESPONSE}).new_response_unauthorized (req, res)
|
(create {CMS_GENERIC_RESPONSE}).new_response_unauthorized (req, res)
|
||||||
@@ -94,7 +89,7 @@ feature -- HTTP Methods
|
|||||||
do_post (req: WSF_REQUEST; res: WSF_RESPONSE)
|
do_post (req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||||
-- <Precursor>
|
-- <Precursor>
|
||||||
local
|
local
|
||||||
u_node: CMS_NODE
|
l_page: CMS_RESPONSE
|
||||||
do
|
do
|
||||||
if attached current_user_name (req) then
|
if attached current_user_name (req) then
|
||||||
if attached {WSF_STRING} req.path_parameter ("id") as l_id then
|
if attached {WSF_STRING} req.path_parameter ("id") as l_id then
|
||||||
@@ -103,22 +98,14 @@ feature -- HTTP Methods
|
|||||||
if l_method.is_case_insensitive_equal ("PUT") then
|
if l_method.is_case_insensitive_equal ("PUT") then
|
||||||
do_put (req, res)
|
do_put (req, res)
|
||||||
else
|
else
|
||||||
to_implement ("Check how to implement API error")
|
(create {ERROR_500_CMS_RESPONSE}.make (req, res, setup, "master2/error")).execute
|
||||||
-- create l_page.make (req, "master2/error.tpl")
|
|
||||||
-- l_page.set_value ("500", "code")
|
|
||||||
-- l_page.set_value (req.absolute_script_url (req.path_info), "request")
|
|
||||||
-- l_page.send_to (res)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
do_error (req, res, l_id)
|
do_error (req, res, l_id)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
to_implement ("Check how to implement API error")
|
(create {ERROR_500_CMS_RESPONSE}.make (req, res, setup, "master2/error")).execute
|
||||||
-- create l_page.make (req, "master2/error.tpl")
|
|
||||||
-- l_page.set_value ("500", "code")
|
|
||||||
-- l_page.set_value (req.absolute_script_url (req.path_info), "request")
|
|
||||||
-- l_page.send_to (res)
|
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
(create {CMS_GENERIC_RESPONSE}).new_response_unauthorized (req, res)
|
(create {CMS_GENERIC_RESPONSE}).new_response_unauthorized (req, res)
|
||||||
@@ -129,7 +116,7 @@ feature -- HTTP Methods
|
|||||||
-- <Precursor>
|
-- <Precursor>
|
||||||
local
|
local
|
||||||
u_node: CMS_NODE
|
u_node: CMS_NODE
|
||||||
-- l_page: ROC_RESPONSE
|
l_page: CMS_RESPONSE
|
||||||
do
|
do
|
||||||
to_implement ("Check if user has permissions")
|
to_implement ("Check if user has permissions")
|
||||||
if attached current_user (req) as l_user then
|
if attached current_user (req) as l_user then
|
||||||
@@ -143,11 +130,7 @@ feature -- HTTP Methods
|
|||||||
do_error (req, res, l_id)
|
do_error (req, res, l_id)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
to_implement ("Check how to implement API error")
|
(create {ERROR_500_CMS_RESPONSE}.make (req, res, setup, "master2/error")).execute
|
||||||
-- create l_page.make (req, "master2/error.tpl")
|
|
||||||
-- l_page.set_value ("500", "code")
|
|
||||||
-- l_page.set_value (req.absolute_script_url (req.path_info), "request")
|
|
||||||
-- l_page.send_to (res)
|
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
(create {CMS_GENERIC_RESPONSE}).new_response_unauthorized (req, res)
|
(create {CMS_GENERIC_RESPONSE}).new_response_unauthorized (req, res)
|
||||||
@@ -158,18 +141,20 @@ feature -- Error
|
|||||||
do_error (req: WSF_REQUEST; res: WSF_RESPONSE; a_id: WSF_STRING)
|
do_error (req: WSF_REQUEST; res: WSF_RESPONSE; a_id: WSF_STRING)
|
||||||
-- Handling error.
|
-- Handling error.
|
||||||
local
|
local
|
||||||
|
l_page: CMS_RESPONSE
|
||||||
do
|
do
|
||||||
to_implement ("Check how to implement API error")
|
create {GENERIC_VIEW_CMS_RESPONSE} l_page.make (req, res, setup, "master2/error")
|
||||||
-- create l_page.make (req, "master2/error.tpl")
|
l_page.add_variable (req.absolute_script_url (req.path_info), "request")
|
||||||
-- if a_id.is_integer then
|
if a_id.is_integer then
|
||||||
-- -- resource not found
|
-- resource not found
|
||||||
-- l_page.set_value ("404", "code")
|
l_page.add_variable ("404", "code")
|
||||||
-- else
|
l_page.set_status_code (404)
|
||||||
-- -- bad request
|
else
|
||||||
-- l_page.set_value ("400", "code")
|
-- bad request
|
||||||
-- end
|
l_page.add_variable ("400", "code")
|
||||||
-- l_page.set_value (req.absolute_script_url (req.path_info), "request")
|
l_page.set_status_code (400)
|
||||||
-- l_page.send_to(res)
|
end
|
||||||
|
l_page.execute
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ feature -- HTTP Methods
|
|||||||
-- Existing node
|
-- Existing node
|
||||||
if attached {WSF_STRING} req.path_parameter ("id") as l_id then
|
if attached {WSF_STRING} req.path_parameter ("id") as l_id then
|
||||||
if l_id.is_integer and then attached {CMS_NODE} api_service.node (l_id.integer_value) as l_node then
|
if l_id.is_integer and then attached {CMS_NODE} api_service.node (l_id.integer_value) as l_node then
|
||||||
create {NODE_VIEW_CMS_RESPONSE} l_page.make (req, res, setup,"modules/node")
|
create {GENERIC_VIEW_CMS_RESPONSE} l_page.make (req, res, setup,"modules/node")
|
||||||
l_page.add_variable (l_node, "node")
|
l_page.add_variable (l_node, "node")
|
||||||
l_page.execute
|
l_page.execute
|
||||||
else
|
else
|
||||||
@@ -97,11 +97,7 @@ feature -- HTTP Methods
|
|||||||
elseif l_method.is_case_insensitive_equal ("PUT") then
|
elseif l_method.is_case_insensitive_equal ("PUT") then
|
||||||
do_put (req, res)
|
do_put (req, res)
|
||||||
else
|
else
|
||||||
to_implement ("Implement specific responses for 500 pages")
|
(create {ERROR_500_CMS_RESPONSE}.make (req, res, setup, "master2/error")).execute
|
||||||
create {NODE_VIEW_CMS_RESPONSE} l_page.make (req, res, setup, "master2/error")
|
|
||||||
l_page.add_variable ("500", "code")
|
|
||||||
l_page.add_variable (req.absolute_script_url (req.path_info), "request")
|
|
||||||
l_page.execute
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
@@ -136,7 +132,7 @@ feature -- HTTP Methods
|
|||||||
do_error (req, res, l_id)
|
do_error (req, res, l_id)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
-- Internal server error
|
(create {ERROR_500_CMS_RESPONSE}.make (req, res, setup, "master2/error")).execute
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
(create {CMS_GENERIC_RESPONSE}).new_response_unauthorized (req, res)
|
(create {CMS_GENERIC_RESPONSE}).new_response_unauthorized (req, res)
|
||||||
@@ -156,7 +152,7 @@ feature -- HTTP Methods
|
|||||||
do_error (req, res, l_id)
|
do_error (req, res, l_id)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
-- Internal server error
|
(create {ERROR_500_CMS_RESPONSE}.make (req, res, setup, "master2/error")).execute
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
(create {CMS_GENERIC_RESPONSE}).new_response_unauthorized (req, res)
|
(create {CMS_GENERIC_RESPONSE}).new_response_unauthorized (req, res)
|
||||||
@@ -170,17 +166,18 @@ feature -- Error
|
|||||||
local
|
local
|
||||||
l_page: CMS_RESPONSE
|
l_page: CMS_RESPONSE
|
||||||
do
|
do
|
||||||
to_implement ("Not implemented")
|
create {GENERIC_VIEW_CMS_RESPONSE} l_page.make (req, res, setup, "master2/error")
|
||||||
-- create l_page.make (req, "master2/error.tpl")
|
l_page.add_variable (req.absolute_script_url (req.path_info), "request")
|
||||||
-- if a_id.is_integer then
|
if a_id.is_integer then
|
||||||
-- -- resource not found
|
-- resource not found
|
||||||
-- l_page.set_value ("404", "code")
|
l_page.add_variable ("404", "code")
|
||||||
-- else
|
l_page.set_status_code (404)
|
||||||
-- -- bad request
|
else
|
||||||
-- l_page.set_value ("400", "code")
|
-- bad request
|
||||||
-- end
|
l_page.add_variable ("400", "code")
|
||||||
-- l_page.set_value (req.absolute_script_url (req.path_info), "request")
|
l_page.set_status_code (400)
|
||||||
-- l_page.send_to (res)
|
end
|
||||||
|
l_page.execute
|
||||||
end
|
end
|
||||||
|
|
||||||
feature {NONE} -- Node
|
feature {NONE} -- Node
|
||||||
@@ -190,7 +187,7 @@ feature {NONE} -- Node
|
|||||||
l_page: CMS_RESPONSE
|
l_page: CMS_RESPONSE
|
||||||
do
|
do
|
||||||
if attached current_user_name (req) then
|
if attached current_user_name (req) then
|
||||||
create {NODE_VIEW_CMS_RESPONSE} l_page.make (req, res, setup, "modules/node")
|
create {GENERIC_VIEW_CMS_RESPONSE} l_page.make (req, res, setup, "modules/node")
|
||||||
l_page.add_variable (setup.is_html, "html")
|
l_page.add_variable (setup.is_html, "html")
|
||||||
l_page.add_variable (setup.is_web, "web")
|
l_page.add_variable (setup.is_web, "web")
|
||||||
l_page.execute
|
l_page.execute
|
||||||
|
|||||||
@@ -69,9 +69,7 @@ feature -- HTTP Methods
|
|||||||
-- Existing node
|
-- Existing node
|
||||||
if attached {WSF_STRING} req.path_parameter ("id") as l_id then
|
if attached {WSF_STRING} req.path_parameter ("id") as l_id then
|
||||||
if l_id.is_integer and then attached {CMS_NODE} api_service.node (l_id.integer_value) as l_node then
|
if l_id.is_integer and then attached {CMS_NODE} api_service.node (l_id.integer_value) as l_node then
|
||||||
create {NODE_VIEW_CMS_RESPONSE} l_page.make (req, res, setup, "modules/node_summary")
|
create {GENERIC_VIEW_CMS_RESPONSE} l_page.make (req, res, setup, "modules/node_summary")
|
||||||
l_page.add_variable (setup.is_html, "html")
|
|
||||||
l_page.add_variable (setup.is_web, "web")
|
|
||||||
l_page.add_variable (l_node.summary, "summary")
|
l_page.add_variable (l_node.summary, "summary")
|
||||||
l_page.add_variable (l_id.value, "id")
|
l_page.add_variable (l_id.value, "id")
|
||||||
l_page.execute
|
l_page.execute
|
||||||
@@ -79,11 +77,7 @@ feature -- HTTP Methods
|
|||||||
do_error (req, res, l_id)
|
do_error (req, res, l_id)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
to_implement ("Check how to implement API error")
|
(create {ERROR_500_CMS_RESPONSE}.make (req, res, setup, "master2/error")).execute
|
||||||
-- create l_page.make (req, "master2/error.tpl")
|
|
||||||
-- l_page.set_value ("500", "code")
|
|
||||||
-- l_page.set_value (req.absolute_script_url (req.path_info), "request")
|
|
||||||
-- l_page.send_to (res)
|
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
(create {CMS_GENERIC_RESPONSE}).new_response_unauthorized (req, res)
|
(create {CMS_GENERIC_RESPONSE}).new_response_unauthorized (req, res)
|
||||||
@@ -103,22 +97,14 @@ feature -- HTTP Methods
|
|||||||
if l_method.is_case_insensitive_equal ("PUT") then
|
if l_method.is_case_insensitive_equal ("PUT") then
|
||||||
do_put (req, res)
|
do_put (req, res)
|
||||||
else
|
else
|
||||||
to_implement ("Check how to implement API error")
|
(create {ERROR_500_CMS_RESPONSE}.make (req, res, setup, "master2/error")).execute
|
||||||
-- create l_page.make (req, "master2/error.tpl")
|
|
||||||
-- l_page.set_value ("500", "code")
|
|
||||||
-- l_page.set_value (req.absolute_script_url (req.path_info), "request")
|
|
||||||
-- l_page.send_to (res)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
do_error (req, res, l_id)
|
do_error (req, res, l_id)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
to_implement ("Check how to implement API error")
|
(create {ERROR_500_CMS_RESPONSE}.make (req, res, setup, "master2/error")).execute
|
||||||
-- create l_page.make (req, "master2/error.tpl")
|
|
||||||
-- l_page.set_value ("500", "code")
|
|
||||||
-- l_page.set_value (req.absolute_script_url (req.path_info), "request")
|
|
||||||
-- l_page.send_to (res)
|
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
(create {CMS_GENERIC_RESPONSE}).new_response_unauthorized (req, res)
|
(create {CMS_GENERIC_RESPONSE}).new_response_unauthorized (req, res)
|
||||||
@@ -130,7 +116,6 @@ feature -- HTTP Methods
|
|||||||
local
|
local
|
||||||
u_node: CMS_NODE
|
u_node: CMS_NODE
|
||||||
do
|
do
|
||||||
to_implement ("Check if user has permissions!!!")
|
|
||||||
if attached current_user (req) as l_user then
|
if attached current_user (req) as l_user then
|
||||||
if attached {WSF_STRING} req.path_parameter ("id") as l_id then
|
if attached {WSF_STRING} req.path_parameter ("id") as l_id then
|
||||||
if l_id.is_integer and then attached {CMS_NODE} api_service.node (l_id.integer_value) as l_node then
|
if l_id.is_integer and then attached {CMS_NODE} api_service.node (l_id.integer_value) as l_node then
|
||||||
@@ -142,11 +127,7 @@ feature -- HTTP Methods
|
|||||||
do_error (req, res, l_id)
|
do_error (req, res, l_id)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
to_implement ("Check how to implement API error")
|
(create {ERROR_500_CMS_RESPONSE}.make (req, res, setup, "master2/error")).execute
|
||||||
-- create l_page.make (req, "master2/error.tpl")
|
|
||||||
-- l_page.set_value ("500", "code")
|
|
||||||
-- l_page.set_value (req.absolute_script_url (req.path_info), "request")
|
|
||||||
-- l_page.send_to (res)
|
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
(create {CMS_GENERIC_RESPONSE}).new_response_unauthorized (req, res)
|
(create {CMS_GENERIC_RESPONSE}).new_response_unauthorized (req, res)
|
||||||
@@ -155,21 +136,24 @@ feature -- HTTP Methods
|
|||||||
|
|
||||||
feature -- Error
|
feature -- Error
|
||||||
|
|
||||||
|
|
||||||
do_error (req: WSF_REQUEST; res: WSF_RESPONSE; a_id: WSF_STRING)
|
do_error (req: WSF_REQUEST; res: WSF_RESPONSE; a_id: WSF_STRING)
|
||||||
-- Handling error.
|
-- Handling error.
|
||||||
local
|
local
|
||||||
-- l_page: ROC_RESPONSE
|
l_page: CMS_RESPONSE
|
||||||
do
|
do
|
||||||
-- create l_page.make (req, "master2/error.tpl")
|
create {GENERIC_VIEW_CMS_RESPONSE} l_page.make (req, res, setup, "master2/error")
|
||||||
-- if a_id.is_integer then
|
l_page.add_variable (req.absolute_script_url (req.path_info), "request")
|
||||||
-- -- resource not found
|
if a_id.is_integer then
|
||||||
-- l_page.set_value ("404", "code")
|
-- resource not found
|
||||||
-- else
|
l_page.add_variable ("404", "code")
|
||||||
-- -- bad request
|
l_page.set_status_code (404)
|
||||||
-- l_page.set_value ("400", "code")
|
else
|
||||||
-- end
|
-- bad request
|
||||||
-- l_page.set_value (req.absolute_script_url (req.path_info), "request")
|
l_page.add_variable ("400", "code")
|
||||||
-- l_page.send_to(res)
|
l_page.set_status_code (400)
|
||||||
|
end
|
||||||
|
l_page.execute
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ feature -- HTTP Methods
|
|||||||
-- Existing node
|
-- Existing node
|
||||||
if attached {WSF_STRING} req.path_parameter ("id") as l_id then
|
if attached {WSF_STRING} req.path_parameter ("id") as l_id then
|
||||||
if l_id.is_integer and then attached {CMS_NODE} api_service.node (l_id.integer_value) as l_node then
|
if l_id.is_integer and then attached {CMS_NODE} api_service.node (l_id.integer_value) as l_node then
|
||||||
create {NODE_VIEW_CMS_RESPONSE} l_page.make (req, res, setup, "modules/node_title")
|
create {GENERIC_VIEW_CMS_RESPONSE} l_page.make (req, res, setup, "modules/node_title")
|
||||||
l_page.add_variable (setup.is_html, "html")
|
l_page.add_variable (setup.is_html, "html")
|
||||||
l_page.add_variable (setup.is_web, "web")
|
l_page.add_variable (setup.is_web, "web")
|
||||||
l_page.add_variable (l_node.title, "title")
|
l_page.add_variable (l_node.title, "title")
|
||||||
@@ -80,7 +80,7 @@ feature -- HTTP Methods
|
|||||||
end
|
end
|
||||||
else
|
else
|
||||||
to_implement ("Check how to implement API error")
|
to_implement ("Check how to implement API error")
|
||||||
-- create l_page.make (req, "master2/error.tpl")
|
-- create l_page.make (req, "master2/error")
|
||||||
-- l_page.set_value ("500", "code")
|
-- l_page.set_value ("500", "code")
|
||||||
-- l_page.set_value (req.absolute_script_url (req.path_info), "request")
|
-- l_page.set_value (req.absolute_script_url (req.path_info), "request")
|
||||||
-- l_page.send_to (res)
|
-- l_page.send_to (res)
|
||||||
@@ -102,22 +102,14 @@ feature -- HTTP Methods
|
|||||||
if l_method.is_case_insensitive_equal ("PUT") then
|
if l_method.is_case_insensitive_equal ("PUT") then
|
||||||
do_put (req, res)
|
do_put (req, res)
|
||||||
else
|
else
|
||||||
to_implement ("Check how to implement API error")
|
(create {ERROR_500_CMS_RESPONSE}.make (req, res, setup, "master2/error")).execute
|
||||||
-- create l_page.make (req, "master2/error.tpl")
|
|
||||||
-- l_page.set_value ("500", "code")
|
|
||||||
-- l_page.set_value (req.absolute_script_url (req.path_info), "request")
|
|
||||||
-- l_page.send_to (res)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
do_error (req, res, l_id)
|
do_error (req, res, l_id)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
to_implement ("Check how to implement API error")
|
(create {ERROR_500_CMS_RESPONSE}.make (req, res, setup, "master2/error")).execute
|
||||||
-- create l_page.make (req, "master2/error.tpl")
|
|
||||||
-- l_page.set_value ("500", "code")
|
|
||||||
-- l_page.set_value (req.absolute_script_url (req.path_info), "request")
|
|
||||||
-- l_page.send_to (res)
|
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
(create {CMS_GENERIC_RESPONSE}).new_response_unauthorized (req, res)
|
(create {CMS_GENERIC_RESPONSE}).new_response_unauthorized (req, res)
|
||||||
@@ -141,11 +133,7 @@ feature -- HTTP Methods
|
|||||||
do_error (req, res, l_id)
|
do_error (req, res, l_id)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
to_implement ("check how to implement API error")
|
(create {ERROR_500_CMS_RESPONSE}.make (req, res, setup, "master2/error")).execute
|
||||||
-- create l_page.make (req, "master2/error.tpl")
|
|
||||||
-- l_page.set_value ("500", "code")
|
|
||||||
-- l_page.set_value (req.absolute_script_url (req.path_info), "request")
|
|
||||||
-- l_page.send_to (res)
|
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
(create {CMS_GENERIC_RESPONSE}).new_response_unauthorized (req, res)
|
(create {CMS_GENERIC_RESPONSE}).new_response_unauthorized (req, res)
|
||||||
@@ -157,18 +145,20 @@ feature -- Error
|
|||||||
do_error (req: WSF_REQUEST; res: WSF_RESPONSE; a_id: WSF_STRING)
|
do_error (req: WSF_REQUEST; res: WSF_RESPONSE; a_id: WSF_STRING)
|
||||||
-- Handling error.
|
-- Handling error.
|
||||||
local
|
local
|
||||||
|
l_page: CMS_RESPONSE
|
||||||
do
|
do
|
||||||
to_implement ("Check how to add API error")
|
create {GENERIC_VIEW_CMS_RESPONSE} l_page.make (req, res, setup, "master2/error")
|
||||||
-- create l_page.make (req, "master2/error.tpl")
|
l_page.add_variable (req.absolute_script_url (req.path_info), "request")
|
||||||
-- if a_id.is_integer then
|
if a_id.is_integer then
|
||||||
-- -- resource not found
|
-- resource not found
|
||||||
-- l_page.set_value ("404", "code")
|
l_page.add_variable ("404", "code")
|
||||||
-- else
|
l_page.set_status_code (404)
|
||||||
-- -- bad request
|
else
|
||||||
-- l_page.set_value ("400", "code")
|
-- bad request
|
||||||
-- end
|
l_page.add_variable ("400", "code")
|
||||||
-- l_page.set_value (req.absolute_script_url (req.path_info), "request")
|
l_page.set_status_code (400)
|
||||||
-- l_page.send_to (res)
|
end
|
||||||
|
l_page.execute
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -46,7 +46,14 @@ feature -- HTTP Methods
|
|||||||
|
|
||||||
do_get (req: WSF_REQUEST; res: WSF_RESPONSE)
|
do_get (req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||||
-- <Precursor>
|
-- <Precursor>
|
||||||
|
local
|
||||||
|
l_page: CMS_RESPONSE
|
||||||
do
|
do
|
||||||
(create {NODES_VIEW_CMS_RESPONSE}.make (req, res, setup,"modules/nodes")).execute
|
-- At the moment the template is hardcoded, but we can
|
||||||
|
-- get them from the configuration file and load them into
|
||||||
|
-- the setup class.
|
||||||
|
create {GENERIC_VIEW_CMS_RESPONSE} l_page.make (req, res, setup, "modules/nodes")
|
||||||
|
l_page.add_variable (api_service.nodes, "nodes")
|
||||||
|
l_page.execute
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -38,8 +38,6 @@ feature -- Implementation
|
|||||||
|
|
||||||
setup_router
|
setup_router
|
||||||
-- Setup `router'.
|
-- Setup `router'.
|
||||||
local
|
|
||||||
fhdl: WSF_FILE_SYSTEM_HANDLER
|
|
||||||
do
|
do
|
||||||
create router.make (5)
|
create router.make (5)
|
||||||
configure_api_node
|
configure_api_node
|
||||||
|
|||||||
@@ -21,8 +21,8 @@ feature -- User
|
|||||||
if attached {CMS_USER} current_user (req) as l_user then
|
if attached {CMS_USER} current_user (req) as l_user then
|
||||||
Result := l_user.name
|
Result := l_user.name
|
||||||
end
|
end
|
||||||
fixme ("Workaround to add nodes!!!")
|
|
||||||
Result := "admin" -- Workaround
|
|
||||||
end
|
end
|
||||||
|
|
||||||
current_user (req: WSF_REQUEST): detachable CMS_USER
|
current_user (req: WSF_REQUEST): detachable CMS_USER
|
||||||
|
|||||||
@@ -17,6 +17,13 @@ inherit
|
|||||||
execute_default
|
execute_default
|
||||||
end
|
end
|
||||||
|
|
||||||
|
WSF_FILTERED_SERVICE
|
||||||
|
|
||||||
|
WSF_FILTER
|
||||||
|
rename
|
||||||
|
execute as execute_filter
|
||||||
|
end
|
||||||
|
|
||||||
WSF_NO_PROXY_POLICY
|
WSF_NO_PROXY_POLICY
|
||||||
|
|
||||||
WSF_URI_HELPER_FOR_ROUTED_SERVICE
|
WSF_URI_HELPER_FOR_ROUTED_SERVICE
|
||||||
@@ -37,6 +44,7 @@ feature {NONE} -- Initialization
|
|||||||
setup := a_setup
|
setup := a_setup
|
||||||
configuration := a_setup.configuration
|
configuration := a_setup.configuration
|
||||||
modules := a_setup.modules
|
modules := a_setup.modules
|
||||||
|
initialize_users
|
||||||
initialize_auth_engine
|
initialize_auth_engine
|
||||||
initialize_mailer
|
initialize_mailer
|
||||||
initialize_router
|
initialize_router
|
||||||
@@ -47,7 +55,6 @@ feature {NONE} -- Initialization
|
|||||||
|
|
||||||
initialize_users
|
initialize_users
|
||||||
do
|
do
|
||||||
to_implement ("To Implement initialize users")
|
|
||||||
end
|
end
|
||||||
|
|
||||||
initialize_mailer
|
initialize_mailer
|
||||||
|
|||||||
@@ -92,6 +92,19 @@ feature -- Theme
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
feature -- Element Change
|
||||||
|
|
||||||
|
set_status_code (a_status: INTEGER)
|
||||||
|
-- Set `status_code' with `a_status'.
|
||||||
|
note
|
||||||
|
EIS: "src=eiffel:?class=HTTP_STATUS_CODE"
|
||||||
|
do
|
||||||
|
to_implement ("Feature to test if a_status is a valid status code!!!.")
|
||||||
|
status_code := a_status
|
||||||
|
ensure
|
||||||
|
status_code_set: status_code = a_status
|
||||||
|
end
|
||||||
|
|
||||||
feature -- Generation
|
feature -- Generation
|
||||||
|
|
||||||
prepare (page: CMS_HTML_PAGE)
|
prepare (page: CMS_HTML_PAGE)
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
note
|
note
|
||||||
description: "Summary description for {NODE_VIEW_CMS_RESPONSE}."
|
description: "Summary description for {ERROR_500_CMS_RESPONSE}."
|
||||||
date: "$Date$"
|
date: "$Date$"
|
||||||
revision: "$Revision$"
|
revision: "$Revision$"
|
||||||
|
|
||||||
class
|
class
|
||||||
NODES_VIEW_CMS_RESPONSE
|
ERROR_500_CMS_RESPONSE
|
||||||
|
|
||||||
inherit
|
inherit
|
||||||
|
|
||||||
@@ -20,7 +20,9 @@ feature -- Generation
|
|||||||
|
|
||||||
custom_prepare (page: CMS_HTML_PAGE)
|
custom_prepare (page: CMS_HTML_PAGE)
|
||||||
do
|
do
|
||||||
page.register_variable (setup.api_service.nodes, "nodes")
|
page.register_variable (request.absolute_script_url (request.path_info), "request")
|
||||||
|
page.register_variable ("500", "code")
|
||||||
|
page.set_status_code (500)
|
||||||
end
|
end
|
||||||
|
|
||||||
feature -- Execution
|
feature -- Execution
|
||||||
@@ -28,7 +30,7 @@ feature -- Execution
|
|||||||
process
|
process
|
||||||
-- Computed response message.
|
-- Computed response message.
|
||||||
do
|
do
|
||||||
set_title ("List of Nodes")
|
set_title ("Internal Server Error")
|
||||||
set_page_title (Void)
|
set_page_title (Void)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -4,7 +4,7 @@ note
|
|||||||
revision: "$Revision$"
|
revision: "$Revision$"
|
||||||
|
|
||||||
class
|
class
|
||||||
NODE_VIEW_CMS_RESPONSE
|
GENERIC_VIEW_CMS_RESPONSE
|
||||||
|
|
||||||
inherit
|
inherit
|
||||||
|
|
||||||
@@ -30,7 +30,7 @@ feature -- Execution
|
|||||||
process
|
process
|
||||||
-- Computed response message.
|
-- Computed response message.
|
||||||
do
|
do
|
||||||
set_title ("List of Nodes")
|
set_title ("CMS")
|
||||||
set_page_title (Void)
|
set_page_title (Void)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -17,7 +17,7 @@
|
|||||||
<library name="wsf_extension" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\wsf_extension-safe.ecf" readonly="false"/>
|
<library name="wsf_extension" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\wsf_extension-safe.ecf" readonly="false"/>
|
||||||
|
|
||||||
|
|
||||||
<library name="cms" location="..\..\cms\cms.ecf"/>
|
<library name="cms" location="..\..\cms\cms.ecf" readonly="false"/>
|
||||||
</target>
|
</target>
|
||||||
<target name="roc_api_any" extends="common">
|
<target name="roc_api_any" extends="common">
|
||||||
<root class="EWF_ROC_SERVER" feature="make_and_launch"/>
|
<root class="EWF_ROC_SERVER" feature="make_and_launch"/>
|
||||||
|
|||||||
@@ -15,7 +15,6 @@
|
|||||||
<library name="layout" location="..\..\..\layout\layout.ecf"/>
|
<library name="layout" location="..\..\..\layout\layout.ecf"/>
|
||||||
<library name="logging" location="$ISE_LIBRARY\library\runtime\logging\logging-safe.ecf"/>
|
<library name="logging" location="$ISE_LIBRARY\library\runtime\logging\logging-safe.ecf"/>
|
||||||
<library name="mysql" location="$ISE_LIBRARY\library\store\dbms\rdbms\mysql\mysql-safe.ecf"/>
|
<library name="mysql" location="$ISE_LIBRARY\library\store\dbms\rdbms\mysql\mysql-safe.ecf"/>
|
||||||
<library name="odbc" location="$ISE_LIBRARY\library\store\dbms\rdbms\odbc\odbc-safe.ecf"/>
|
|
||||||
<library name="store" location="$ISE_LIBRARY\library\store\store-safe.ecf" readonly="false"/>
|
<library name="store" location="$ISE_LIBRARY\library\store\store-safe.ecf" readonly="false"/>
|
||||||
<library name="thread" location="$ISE_LIBRARY\library\thread\thread-safe.ecf"/>
|
<library name="thread" location="$ISE_LIBRARY\library\thread\thread-safe.ecf"/>
|
||||||
<library name="time" location="$ISE_LIBRARY\library\time\time-safe.ecf"/>
|
<library name="time" location="$ISE_LIBRARY\library\time\time-safe.ecf"/>
|
||||||
@@ -27,6 +26,11 @@
|
|||||||
</file_rule>
|
</file_rule>
|
||||||
</cluster>
|
</cluster>
|
||||||
<cluster name="interface" location="..\..\interface\" recursive="true"/>
|
<cluster name="interface" location="..\..\interface\" recursive="true"/>
|
||||||
<cluster name="common" location="..\common\" recursive="true"/>
|
<cluster name="common" location="..\common\" recursive="true">
|
||||||
|
<file_rule>
|
||||||
|
<exclude>/database/database_connection_odbc.e</exclude>
|
||||||
|
</file_rule>
|
||||||
|
</cluster>
|
||||||
|
|
||||||
</target>
|
</target>
|
||||||
</system>
|
</system>
|
||||||
|
|||||||
Reference in New Issue
Block a user