Added integration configuration file all-safe.ecf
Fixed various compilation error
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||||
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-13-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-13-0 http://www.eiffel.com/developers/xml/configuration-1-13-0.xsd" name="config_tests" uuid="AD1DE0F7-BC8A-4A17-9A44-56C917BD5604">
|
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-13-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-13-0 http://www.eiffel.com/developers/xml/configuration-1-13-0.xsd" name="config_tests" library_target="config_tests" uuid="AD1DE0F7-BC8A-4A17-9A44-56C917BD5604">
|
||||||
<target name="config_tests">
|
<target name="config_tests">
|
||||||
<root class="TEST_CONFIG_READER_SET" feature="default_create"/>
|
<root class="TEST_CONFIG_READER_SET" feature="default_create"/>
|
||||||
<file_rule>
|
<file_rule>
|
||||||
|
|||||||
@@ -11,7 +11,6 @@
|
|||||||
</option>
|
</option>
|
||||||
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
|
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
|
||||||
<library name="cms_app_env" location="..\app_env\app_env-safe.ecf"/>
|
<library name="cms_app_env" location="..\app_env\app_env-safe.ecf"/>
|
||||||
<library name="net" location="$ISE_LIBRARY\library\net\net-safe.ecf"/>
|
|
||||||
<library name="notification_mailer" location="$ISE_LIBRARY\contrib\library\runtime\process\notification_email\notification_email-safe.ecf"/>
|
<library name="notification_mailer" location="$ISE_LIBRARY\contrib\library\runtime\process\notification_email\notification_email-safe.ecf"/>
|
||||||
<cluster name="src" location=".\" recursive="true"/>
|
<cluster name="src" location=".\" recursive="true"/>
|
||||||
</target>
|
</target>
|
||||||
|
|||||||
@@ -26,8 +26,6 @@ feature {NONE} -- Initialization
|
|||||||
|
|
||||||
initialize
|
initialize
|
||||||
-- Initialize service.
|
-- Initialize service.
|
||||||
local
|
|
||||||
l_address_factory: INET_ADDRESS_FACTORY
|
|
||||||
do
|
do
|
||||||
admin_email := parameters.admin_email
|
admin_email := parameters.admin_email
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||||
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-13-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-13-0 http://www.eiffel.com/developers/xml/configuration-1-13-0.xsd" name="tests" uuid="FE27C81D-3F7D-4E46-992B-55F4BBDA4F8B">
|
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-13-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-13-0 http://www.eiffel.com/developers/xml/configuration-1-13-0.xsd" name="tests_store_odbc" library_target="tests_store_odbc" uuid="FE27C81D-3F7D-4E46-992B-55F4BBDA4F8B">
|
||||||
<target name="tests">
|
<target name="tests_store_odbc">
|
||||||
<root class="APPLICATION" feature="make"/>
|
<root class="APPLICATION" feature="make"/>
|
||||||
<option warning="true" void_safety="conformance">
|
<option warning="true" void_safety="conformance">
|
||||||
<assertions precondition="true" postcondition="true" check="true" invariant="true" loop="true" supplier_precondition="true"/>
|
<assertions precondition="true" postcondition="true" check="true" invariant="true" loop="true" supplier_precondition="true"/>
|
||||||
|
|||||||
@@ -1,167 +0,0 @@
|
|||||||
note
|
|
||||||
description: "Summary description for {NEW_CONTENT_HANDLER}."
|
|
||||||
date: "$Date: 2015-02-13 13:08:13 +0100 (ven., 13 févr. 2015) $"
|
|
||||||
revision: "$Revision: 96616 $"
|
|
||||||
|
|
||||||
class
|
|
||||||
NODE_CONTENT_HANDLER
|
|
||||||
|
|
||||||
inherit
|
|
||||||
CMS_NODE_HANDLER
|
|
||||||
|
|
||||||
WSF_URI_HANDLER
|
|
||||||
rename
|
|
||||||
execute as uri_execute,
|
|
||||||
new_mapping as new_uri_mapping
|
|
||||||
end
|
|
||||||
|
|
||||||
WSF_URI_TEMPLATE_HANDLER
|
|
||||||
rename
|
|
||||||
execute as uri_template_execute,
|
|
||||||
new_mapping as new_uri_template_mapping
|
|
||||||
select
|
|
||||||
new_uri_template_mapping
|
|
||||||
end
|
|
||||||
|
|
||||||
WSF_RESOURCE_HANDLER_HELPER
|
|
||||||
redefine
|
|
||||||
do_get,
|
|
||||||
do_post,
|
|
||||||
do_put
|
|
||||||
end
|
|
||||||
|
|
||||||
REFACTORING_HELPER
|
|
||||||
|
|
||||||
create
|
|
||||||
make
|
|
||||||
|
|
||||||
feature -- execute
|
|
||||||
|
|
||||||
execute (req: WSF_REQUEST; res: WSF_RESPONSE)
|
|
||||||
-- Execute request handler
|
|
||||||
do
|
|
||||||
execute_methods (req, res)
|
|
||||||
end
|
|
||||||
|
|
||||||
uri_execute (req: WSF_REQUEST; res: WSF_RESPONSE)
|
|
||||||
-- Execute request handler
|
|
||||||
do
|
|
||||||
execute (req, res)
|
|
||||||
end
|
|
||||||
|
|
||||||
uri_template_execute (req: WSF_REQUEST; res: WSF_RESPONSE)
|
|
||||||
-- Execute request handler
|
|
||||||
do
|
|
||||||
execute (req, res)
|
|
||||||
end
|
|
||||||
|
|
||||||
feature -- HTTP Methods
|
|
||||||
|
|
||||||
do_get (req: WSF_REQUEST; res: WSF_RESPONSE)
|
|
||||||
-- <Precursor>
|
|
||||||
local
|
|
||||||
l_page: CMS_RESPONSE
|
|
||||||
do
|
|
||||||
if attached current_user_name (req) then
|
|
||||||
-- Existing node
|
|
||||||
if attached {WSF_STRING} req.path_parameter ("id") as l_id then
|
|
||||||
if l_id.is_integer and then attached node_api.node (l_id.integer_value) as l_node then
|
|
||||||
create {GENERIC_VIEW_CMS_RESPONSE} l_page.make (req, res, api)
|
|
||||||
l_page.add_variable (l_node.content, "node_content")
|
|
||||||
l_page.add_variable (l_id.value, "id")
|
|
||||||
l_page.execute
|
|
||||||
else
|
|
||||||
do_error (req, res, l_id)
|
|
||||||
end
|
|
||||||
else
|
|
||||||
(create {INTERNAL_SERVER_ERROR_CMS_RESPONSE}.make (req, res, api)).execute
|
|
||||||
end
|
|
||||||
else
|
|
||||||
send_access_denied (res)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
do_post (req: WSF_REQUEST; res: WSF_RESPONSE)
|
|
||||||
-- <Precursor>
|
|
||||||
do
|
|
||||||
if attached current_user_name (req) then
|
|
||||||
if attached {WSF_STRING} req.path_parameter ("id") as l_id then
|
|
||||||
if l_id.is_integer and then attached node_api.node (l_id.integer_value) as l_node then
|
|
||||||
if attached {WSF_STRING} req.form_parameter ("method") as l_method then
|
|
||||||
if l_method.is_case_insensitive_equal ("PUT") then
|
|
||||||
do_put (req, res)
|
|
||||||
else
|
|
||||||
(create {INTERNAL_SERVER_ERROR_CMS_RESPONSE}.make (req, res, api)).execute
|
|
||||||
end
|
|
||||||
end
|
|
||||||
else
|
|
||||||
do_error (req, res, l_id)
|
|
||||||
end
|
|
||||||
else
|
|
||||||
(create {INTERNAL_SERVER_ERROR_CMS_RESPONSE}.make (req, res, api)).execute
|
|
||||||
end
|
|
||||||
else
|
|
||||||
send_access_denied (res)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
do_put (req: WSF_REQUEST; res: WSF_RESPONSE)
|
|
||||||
-- <Precursor>
|
|
||||||
local
|
|
||||||
u_node: CMS_NODE
|
|
||||||
do
|
|
||||||
to_implement ("Check if user has permissions")
|
|
||||||
if attached current_user (req) as l_user then
|
|
||||||
if attached {WSF_STRING} req.path_parameter ("id") as l_id then
|
|
||||||
if l_id.is_integer and then attached node_api.node (l_id.integer_value) as l_node then
|
|
||||||
u_node := extract_data_form (req)
|
|
||||||
u_node.set_id (l_id.value.to_integer_64)
|
|
||||||
node_api.update_node_content (l_user.id, u_node.id, u_node.content)
|
|
||||||
redirect_to (req.absolute_script_url (""), res)
|
|
||||||
else
|
|
||||||
do_error (req, res, l_id)
|
|
||||||
end
|
|
||||||
else
|
|
||||||
(create {INTERNAL_SERVER_ERROR_CMS_RESPONSE}.make (req, res, api)).execute
|
|
||||||
end
|
|
||||||
else
|
|
||||||
send_access_denied (res)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
feature -- Error
|
|
||||||
|
|
||||||
do_error (req: WSF_REQUEST; res: WSF_RESPONSE; a_id: WSF_STRING)
|
|
||||||
-- Handling error.
|
|
||||||
local
|
|
||||||
l_page: CMS_RESPONSE
|
|
||||||
do
|
|
||||||
create {GENERIC_VIEW_CMS_RESPONSE} l_page.make (req, res, api)
|
|
||||||
l_page.add_variable (req.absolute_script_url (req.path_info), "request")
|
|
||||||
if a_id.is_integer then
|
|
||||||
-- resource not found
|
|
||||||
l_page.add_variable ("404", "code")
|
|
||||||
l_page.set_status_code (404)
|
|
||||||
else
|
|
||||||
-- bad request
|
|
||||||
l_page.add_variable ("400", "code")
|
|
||||||
l_page.set_status_code (400)
|
|
||||||
end
|
|
||||||
l_page.execute
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
feature -- {NONE} Form data
|
|
||||||
|
|
||||||
|
|
||||||
extract_data_form (req: WSF_REQUEST): CMS_NODE
|
|
||||||
-- Extract request form data and build a object
|
|
||||||
-- Node
|
|
||||||
do
|
|
||||||
create Result.make ("", "", "")
|
|
||||||
if attached {WSF_STRING}req.form_parameter ("content") as l_content then
|
|
||||||
Result.set_content (l_content.value)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
||||||
@@ -1,240 +0,0 @@
|
|||||||
note
|
|
||||||
description: "Node handler for the API."
|
|
||||||
date: "$Date: 2015-02-13 13:08:13 +0100 (ven., 13 févr. 2015) $"
|
|
||||||
revision: "$Revision: 96616 $"
|
|
||||||
|
|
||||||
class
|
|
||||||
NODE_RESOURCE_HANDLER
|
|
||||||
|
|
||||||
inherit
|
|
||||||
CMS_NODE_HANDLER
|
|
||||||
|
|
||||||
WSF_URI_HANDLER
|
|
||||||
rename
|
|
||||||
execute as uri_execute,
|
|
||||||
new_mapping as new_uri_mapping
|
|
||||||
end
|
|
||||||
|
|
||||||
WSF_URI_TEMPLATE_HANDLER
|
|
||||||
rename
|
|
||||||
execute as uri_template_execute,
|
|
||||||
new_mapping as new_uri_template_mapping
|
|
||||||
select
|
|
||||||
new_uri_template_mapping
|
|
||||||
end
|
|
||||||
|
|
||||||
WSF_RESOURCE_HANDLER_HELPER
|
|
||||||
redefine
|
|
||||||
do_get,
|
|
||||||
do_post,
|
|
||||||
do_put,
|
|
||||||
do_delete
|
|
||||||
end
|
|
||||||
|
|
||||||
REFACTORING_HELPER
|
|
||||||
|
|
||||||
create
|
|
||||||
make
|
|
||||||
|
|
||||||
feature -- execute
|
|
||||||
|
|
||||||
execute (req: WSF_REQUEST; res: WSF_RESPONSE)
|
|
||||||
-- Execute request handler
|
|
||||||
do
|
|
||||||
execute_methods (req, res)
|
|
||||||
end
|
|
||||||
|
|
||||||
uri_execute (req: WSF_REQUEST; res: WSF_RESPONSE)
|
|
||||||
-- Execute request handler
|
|
||||||
do
|
|
||||||
execute (req, res)
|
|
||||||
end
|
|
||||||
|
|
||||||
uri_template_execute (req: WSF_REQUEST; res: WSF_RESPONSE)
|
|
||||||
-- Execute request handler
|
|
||||||
do
|
|
||||||
execute (req, res)
|
|
||||||
end
|
|
||||||
|
|
||||||
feature -- HTTP Methods
|
|
||||||
|
|
||||||
do_get (req: WSF_REQUEST; res: WSF_RESPONSE)
|
|
||||||
-- <Precursor>
|
|
||||||
local
|
|
||||||
l_page: CMS_RESPONSE
|
|
||||||
do
|
|
||||||
-- Existing node
|
|
||||||
if attached {WSF_STRING} req.path_parameter ("id") as l_id then
|
|
||||||
if
|
|
||||||
l_id.is_integer and then
|
|
||||||
attached node_api.node (l_id.value.to_integer_64) as l_node
|
|
||||||
then
|
|
||||||
-- FIXME: there is a mix between CMS interface and API interface here.
|
|
||||||
create {GENERIC_VIEW_CMS_RESPONSE} l_page.make (req, res, api)
|
|
||||||
l_page.add_variable (l_node, "node")
|
|
||||||
l_page.execute
|
|
||||||
else
|
|
||||||
do_error (req, res, l_id)
|
|
||||||
end
|
|
||||||
else
|
|
||||||
-- Factory
|
|
||||||
new_node (req, res)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
do_post (req: WSF_REQUEST; res: WSF_RESPONSE)
|
|
||||||
-- <Precursor>
|
|
||||||
local
|
|
||||||
u_node: CMS_NODE
|
|
||||||
do
|
|
||||||
to_implement ("Check user permissions!!!")
|
|
||||||
if attached current_user (req) as l_user then
|
|
||||||
if attached {WSF_STRING} req.path_parameter ("id") as l_id then
|
|
||||||
if
|
|
||||||
l_id.is_integer and then
|
|
||||||
attached node_api.node (l_id.value.to_integer_64) as l_node
|
|
||||||
then
|
|
||||||
if attached {WSF_STRING} req.form_parameter ("method") as l_method then
|
|
||||||
if l_method.is_case_insensitive_equal ("DELETE") then
|
|
||||||
do_delete (req, res)
|
|
||||||
elseif l_method.is_case_insensitive_equal ("PUT") then
|
|
||||||
do_put (req, res)
|
|
||||||
else
|
|
||||||
(create {INTERNAL_SERVER_ERROR_CMS_RESPONSE}.make (req, res, api)).execute
|
|
||||||
end
|
|
||||||
end
|
|
||||||
else
|
|
||||||
do_error (req, res, l_id)
|
|
||||||
end
|
|
||||||
else
|
|
||||||
-- New node
|
|
||||||
-- FIXME !!!
|
|
||||||
if attached {WSF_STRING} req.form_parameter ("type") as p_type then
|
|
||||||
if attached node_api.content_type (p_type.value) as ct then
|
|
||||||
end
|
|
||||||
create {CMS_PARTIAL_NODE} u_node.make_empty (p_type.url_encoded_value)
|
|
||||||
else
|
|
||||||
create {CMS_PARTIAL_NODE} u_node.make_empty ("")
|
|
||||||
end
|
|
||||||
|
|
||||||
update_node_from_data_form (req, u_node)
|
|
||||||
u_node.set_author (l_user)
|
|
||||||
node_api.new_node (u_node)
|
|
||||||
redirect_to (req.absolute_script_url (""), res)
|
|
||||||
end
|
|
||||||
else
|
|
||||||
send_access_denied (res)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
do_put (req: WSF_REQUEST; res: WSF_RESPONSE)
|
|
||||||
-- <Precursor>
|
|
||||||
do
|
|
||||||
|
|
||||||
if attached current_user (req) as l_user then
|
|
||||||
if attached {WSF_STRING} req.path_parameter ("id") as l_id then
|
|
||||||
if
|
|
||||||
l_id.is_integer and then
|
|
||||||
attached node_api.node (l_id.value.to_integer_64) as l_node
|
|
||||||
then
|
|
||||||
update_node_from_data_form (req, l_node)
|
|
||||||
l_node.set_author (l_user)
|
|
||||||
node_api.update_node (l_node)
|
|
||||||
redirect_to (req.absolute_script_url (""), res)
|
|
||||||
else
|
|
||||||
do_error (req, res, l_id)
|
|
||||||
end
|
|
||||||
else
|
|
||||||
(create {INTERNAL_SERVER_ERROR_CMS_RESPONSE}.make (req, res, api)).execute
|
|
||||||
end
|
|
||||||
else
|
|
||||||
send_access_denied (res)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
do_delete (req: WSF_REQUEST; res: WSF_RESPONSE)
|
|
||||||
-- <Precursor>
|
|
||||||
do
|
|
||||||
if attached current_user_name (req) then
|
|
||||||
if attached {WSF_STRING} req.path_parameter ("id") as l_id then
|
|
||||||
if
|
|
||||||
l_id.is_integer and then
|
|
||||||
attached node_api.node (l_id.integer_value) as l_node
|
|
||||||
then
|
|
||||||
node_api.delete_node (l_node)
|
|
||||||
res.send (create {CMS_REDIRECTION_RESPONSE_MESSAGE}.make (req.absolute_script_url ("")))
|
|
||||||
else
|
|
||||||
do_error (req, res, l_id)
|
|
||||||
end
|
|
||||||
else
|
|
||||||
(create {INTERNAL_SERVER_ERROR_CMS_RESPONSE}.make (req, res, api)).execute
|
|
||||||
end
|
|
||||||
else
|
|
||||||
send_access_denied (res)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
feature -- Error
|
|
||||||
|
|
||||||
do_error (req: WSF_REQUEST; res: WSF_RESPONSE; a_id: WSF_STRING)
|
|
||||||
-- Handling error.
|
|
||||||
local
|
|
||||||
l_page: CMS_RESPONSE
|
|
||||||
do
|
|
||||||
create {GENERIC_VIEW_CMS_RESPONSE} l_page.make (req, res, api)
|
|
||||||
l_page.add_variable (req.absolute_script_url (req.path_info), "request")
|
|
||||||
if a_id.is_integer then
|
|
||||||
-- resource not found
|
|
||||||
l_page.add_variable ("404", "code")
|
|
||||||
l_page.set_status_code (404)
|
|
||||||
else
|
|
||||||
-- bad request
|
|
||||||
l_page.add_variable ("400", "code")
|
|
||||||
l_page.set_status_code (400)
|
|
||||||
end
|
|
||||||
l_page.execute
|
|
||||||
end
|
|
||||||
|
|
||||||
feature {NONE} -- Node
|
|
||||||
|
|
||||||
new_node (req: WSF_REQUEST; res: WSF_RESPONSE)
|
|
||||||
local
|
|
||||||
l_page: CMS_RESPONSE
|
|
||||||
do
|
|
||||||
if api.user_has_permission (current_user (req), "create node") then
|
|
||||||
create {GENERIC_VIEW_CMS_RESPONSE} l_page.make (req, res, api)
|
|
||||||
l_page.execute
|
|
||||||
else
|
|
||||||
send_access_denied (res)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
feature -- {NONE} Form data
|
|
||||||
|
|
||||||
update_node_from_data_form (req: WSF_REQUEST; a_node: CMS_NODE)
|
|
||||||
-- Extract request form data and build a object
|
|
||||||
-- Node
|
|
||||||
local
|
|
||||||
l_title: detachable READABLE_STRING_32
|
|
||||||
l_summary, l_content, l_format: detachable READABLE_STRING_8
|
|
||||||
do
|
|
||||||
if attached {WSF_STRING} req.form_parameter ("title") as p_title then
|
|
||||||
l_title := p_title.value
|
|
||||||
a_node.set_title (l_title)
|
|
||||||
end
|
|
||||||
if attached {WSF_STRING} req.form_parameter ("summary") as p_summary then
|
|
||||||
l_summary := html_encoded (p_summary.value)
|
|
||||||
end
|
|
||||||
if attached {WSF_STRING} req.form_parameter ("content") as p_content then
|
|
||||||
l_content := html_encoded (p_content.value)
|
|
||||||
end
|
|
||||||
if attached {WSF_STRING} req.form_parameter ("format") as p_format then
|
|
||||||
l_format := p_format.url_encoded_value
|
|
||||||
end
|
|
||||||
if l_format = Void then
|
|
||||||
l_format := a_node.format
|
|
||||||
end
|
|
||||||
a_node.set_content (l_content, l_summary, l_format)
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
||||||
@@ -1,75 +0,0 @@
|
|||||||
note
|
|
||||||
description: "Request handler related to /nodes."
|
|
||||||
date: "$Date: 2015-02-13 13:08:13 +0100 (ven., 13 févr. 2015) $"
|
|
||||||
revision: "$Revision: 96616 $"
|
|
||||||
|
|
||||||
class
|
|
||||||
NODE_RESOURCES_HANDLER
|
|
||||||
|
|
||||||
inherit
|
|
||||||
CMS_NODE_HANDLER
|
|
||||||
|
|
||||||
WSF_URI_HANDLER
|
|
||||||
rename
|
|
||||||
new_mapping as new_uri_mapping
|
|
||||||
end
|
|
||||||
|
|
||||||
WSF_RESOURCE_HANDLER_HELPER
|
|
||||||
redefine
|
|
||||||
do_get
|
|
||||||
end
|
|
||||||
|
|
||||||
REFACTORING_HELPER
|
|
||||||
|
|
||||||
create
|
|
||||||
make
|
|
||||||
|
|
||||||
feature -- execute
|
|
||||||
|
|
||||||
execute (req: WSF_REQUEST; res: WSF_RESPONSE)
|
|
||||||
-- Execute request handler
|
|
||||||
do
|
|
||||||
execute_methods (req, res)
|
|
||||||
end
|
|
||||||
|
|
||||||
feature -- HTTP Methods
|
|
||||||
|
|
||||||
do_get (req: WSF_REQUEST; res: WSF_RESPONSE)
|
|
||||||
-- <Precursor>
|
|
||||||
local
|
|
||||||
l_page: CMS_RESPONSE
|
|
||||||
s: STRING
|
|
||||||
do
|
|
||||||
-- 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, api)
|
|
||||||
l_page.add_variable (node_api.nodes, "nodes")
|
|
||||||
|
|
||||||
|
|
||||||
-- NOTE: for development purposes we have the following hardcode output.
|
|
||||||
create s.make_from_string ("<p>Nodes:</p>")
|
|
||||||
if attached node_api.nodes as lst then
|
|
||||||
across
|
|
||||||
lst as ic
|
|
||||||
loop
|
|
||||||
s.append ("<li>")
|
|
||||||
s.append ("<a href=%"")
|
|
||||||
s.append (req.script_url ("/node/" + ic.item.id.out))
|
|
||||||
s.append ("%">")
|
|
||||||
s.append (api.html_encoded (ic.item.title))
|
|
||||||
s.append (" (")
|
|
||||||
s.append (ic.item.id.out)
|
|
||||||
s.append (")")
|
|
||||||
s.append ("</a>")
|
|
||||||
s.append ("</li>%N")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
l_page.set_main_content (s)
|
|
||||||
l_page.add_block (create {CMS_CONTENT_BLOCK}.make ("nodes_warning", Void, "/nodes/ is not yet fully implemented<br/>", Void), "highlighted")
|
|
||||||
l_page.execute
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
||||||
@@ -1,168 +0,0 @@
|
|||||||
note
|
|
||||||
description: "Summary description for {NODE_SUMMARY_HANDLER}."
|
|
||||||
date: "$Date: 2015-02-13 13:08:13 +0100 (ven., 13 févr. 2015) $"
|
|
||||||
revision: "$Revision: 96616 $"
|
|
||||||
|
|
||||||
class
|
|
||||||
NODE_SUMMARY_HANDLER
|
|
||||||
|
|
||||||
inherit
|
|
||||||
CMS_NODE_HANDLER
|
|
||||||
|
|
||||||
WSF_URI_HANDLER
|
|
||||||
rename
|
|
||||||
execute as uri_execute,
|
|
||||||
new_mapping as new_uri_mapping
|
|
||||||
end
|
|
||||||
|
|
||||||
WSF_URI_TEMPLATE_HANDLER
|
|
||||||
rename
|
|
||||||
execute as uri_template_execute,
|
|
||||||
new_mapping as new_uri_template_mapping
|
|
||||||
select
|
|
||||||
new_uri_template_mapping
|
|
||||||
end
|
|
||||||
|
|
||||||
WSF_RESOURCE_HANDLER_HELPER
|
|
||||||
redefine
|
|
||||||
do_get,
|
|
||||||
do_post,
|
|
||||||
do_put
|
|
||||||
end
|
|
||||||
|
|
||||||
REFACTORING_HELPER
|
|
||||||
|
|
||||||
create
|
|
||||||
make
|
|
||||||
|
|
||||||
feature -- execute
|
|
||||||
|
|
||||||
execute (req: WSF_REQUEST; res: WSF_RESPONSE)
|
|
||||||
-- Execute request handler
|
|
||||||
do
|
|
||||||
execute_methods (req, res)
|
|
||||||
end
|
|
||||||
|
|
||||||
uri_execute (req: WSF_REQUEST; res: WSF_RESPONSE)
|
|
||||||
-- Execute request handler
|
|
||||||
do
|
|
||||||
execute (req, res)
|
|
||||||
end
|
|
||||||
|
|
||||||
uri_template_execute (req: WSF_REQUEST; res: WSF_RESPONSE)
|
|
||||||
-- Execute request handler
|
|
||||||
do
|
|
||||||
execute (req, res)
|
|
||||||
end
|
|
||||||
|
|
||||||
feature -- HTTP Methods
|
|
||||||
|
|
||||||
do_get (req: WSF_REQUEST; res: WSF_RESPONSE)
|
|
||||||
-- <Precursor>
|
|
||||||
local
|
|
||||||
l_page: CMS_RESPONSE
|
|
||||||
do
|
|
||||||
if attached current_user_name (req) then
|
|
||||||
-- Existing node
|
|
||||||
if attached {WSF_STRING} req.path_parameter ("id") as l_id then
|
|
||||||
if l_id.is_integer and then attached node_api.node (l_id.integer_value) as l_node then
|
|
||||||
create {GENERIC_VIEW_CMS_RESPONSE} l_page.make (req, res, api)
|
|
||||||
l_page.add_variable (l_id.value, "id")
|
|
||||||
l_page.add_variable (l_node.summary, "node_summary")
|
|
||||||
l_page.execute
|
|
||||||
else
|
|
||||||
do_error (req, res, l_id)
|
|
||||||
end
|
|
||||||
else
|
|
||||||
(create {INTERNAL_SERVER_ERROR_CMS_RESPONSE}.make (req, res, api)).execute
|
|
||||||
end
|
|
||||||
else
|
|
||||||
send_access_denied (res)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
do_post (req: WSF_REQUEST; res: WSF_RESPONSE)
|
|
||||||
-- <Precursor>
|
|
||||||
do
|
|
||||||
if attached current_user_name (req) then
|
|
||||||
if attached {WSF_STRING} req.path_parameter ("id") as l_id then
|
|
||||||
if l_id.is_integer and then attached node_api.node (l_id.integer_value) as l_node then
|
|
||||||
if attached {WSF_STRING} req.form_parameter ("method") as l_method then
|
|
||||||
if l_method.is_case_insensitive_equal ("PUT") then
|
|
||||||
do_put (req, res)
|
|
||||||
else
|
|
||||||
(create {INTERNAL_SERVER_ERROR_CMS_RESPONSE}.make (req, res, api)).execute
|
|
||||||
end
|
|
||||||
end
|
|
||||||
else
|
|
||||||
do_error (req, res, l_id)
|
|
||||||
end
|
|
||||||
else
|
|
||||||
(create {INTERNAL_SERVER_ERROR_CMS_RESPONSE}.make (req, res, api)).execute
|
|
||||||
end
|
|
||||||
else
|
|
||||||
send_access_denied (res)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
do_put (req: WSF_REQUEST; res: WSF_RESPONSE)
|
|
||||||
-- <Precursor>
|
|
||||||
local
|
|
||||||
u_node: CMS_NODE
|
|
||||||
do
|
|
||||||
if attached current_user (req) as l_user then
|
|
||||||
if attached {WSF_STRING} req.path_parameter ("id") as l_id then
|
|
||||||
if l_id.is_integer and then attached node_api.node (l_id.integer_value) as l_node then
|
|
||||||
u_node := extract_data_form (req)
|
|
||||||
u_node.set_id (l_id.value.to_integer_64)
|
|
||||||
node_api.update_node_summary (l_user.id,u_node.id, u_node.summary)
|
|
||||||
redirect_to (req.absolute_script_url (""), res)
|
|
||||||
else
|
|
||||||
do_error (req, res, l_id)
|
|
||||||
end
|
|
||||||
else
|
|
||||||
(create {INTERNAL_SERVER_ERROR_CMS_RESPONSE}.make (req, res, api)).execute
|
|
||||||
end
|
|
||||||
else
|
|
||||||
send_access_denied (res)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
feature -- Error
|
|
||||||
|
|
||||||
|
|
||||||
do_error (req: WSF_REQUEST; res: WSF_RESPONSE; a_id: WSF_STRING)
|
|
||||||
-- Handling error.
|
|
||||||
local
|
|
||||||
l_page: CMS_RESPONSE
|
|
||||||
do
|
|
||||||
create {GENERIC_VIEW_CMS_RESPONSE} l_page.make (req, res, api)
|
|
||||||
l_page.add_variable (req.absolute_script_url (req.path_info), "request")
|
|
||||||
if a_id.is_integer then
|
|
||||||
-- resource not found
|
|
||||||
l_page.add_variable ("404", "code")
|
|
||||||
l_page.set_status_code (404)
|
|
||||||
else
|
|
||||||
-- bad request
|
|
||||||
l_page.add_variable ("400", "code")
|
|
||||||
l_page.set_status_code (400)
|
|
||||||
end
|
|
||||||
l_page.execute
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
feature -- {NONE} Form data
|
|
||||||
|
|
||||||
|
|
||||||
extract_data_form (req: WSF_REQUEST): CMS_NODE
|
|
||||||
-- Extract request form data and build a object
|
|
||||||
-- Node
|
|
||||||
do
|
|
||||||
create Result.make ("", "", "")
|
|
||||||
if attached {WSF_STRING}req.form_parameter ("summary") as l_summary then
|
|
||||||
Result.set_summary (l_summary.value)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
||||||
@@ -1,166 +0,0 @@
|
|||||||
note
|
|
||||||
description: "Summary description for {NODE_TITLE_HANDLER}."
|
|
||||||
date: "$Date: 2015-02-13 13:08:13 +0100 (ven., 13 févr. 2015) $"
|
|
||||||
revision: "$Revision: 96616 $"
|
|
||||||
|
|
||||||
class
|
|
||||||
NODE_TITLE_HANDLER
|
|
||||||
|
|
||||||
inherit
|
|
||||||
CMS_NODE_HANDLER
|
|
||||||
|
|
||||||
WSF_URI_HANDLER
|
|
||||||
rename
|
|
||||||
execute as uri_execute,
|
|
||||||
new_mapping as new_uri_mapping
|
|
||||||
end
|
|
||||||
|
|
||||||
WSF_URI_TEMPLATE_HANDLER
|
|
||||||
rename
|
|
||||||
execute as uri_template_execute,
|
|
||||||
new_mapping as new_uri_template_mapping
|
|
||||||
select
|
|
||||||
new_uri_template_mapping
|
|
||||||
end
|
|
||||||
|
|
||||||
WSF_RESOURCE_HANDLER_HELPER
|
|
||||||
redefine
|
|
||||||
do_get,
|
|
||||||
do_post,
|
|
||||||
do_put
|
|
||||||
end
|
|
||||||
|
|
||||||
REFACTORING_HELPER
|
|
||||||
|
|
||||||
create
|
|
||||||
make
|
|
||||||
|
|
||||||
feature -- execute
|
|
||||||
|
|
||||||
execute (req: WSF_REQUEST; res: WSF_RESPONSE)
|
|
||||||
-- Execute request handler
|
|
||||||
do
|
|
||||||
execute_methods (req, res)
|
|
||||||
end
|
|
||||||
|
|
||||||
uri_execute (req: WSF_REQUEST; res: WSF_RESPONSE)
|
|
||||||
-- Execute request handler
|
|
||||||
do
|
|
||||||
execute (req, res)
|
|
||||||
end
|
|
||||||
|
|
||||||
uri_template_execute (req: WSF_REQUEST; res: WSF_RESPONSE)
|
|
||||||
-- Execute request handler
|
|
||||||
do
|
|
||||||
execute (req, res)
|
|
||||||
end
|
|
||||||
|
|
||||||
feature -- HTTP Methods
|
|
||||||
|
|
||||||
do_get (req: WSF_REQUEST; res: WSF_RESPONSE)
|
|
||||||
-- <Precursor>
|
|
||||||
local
|
|
||||||
l_page: CMS_RESPONSE
|
|
||||||
do
|
|
||||||
if attached current_user_name (req) as l_user then
|
|
||||||
-- Existing node
|
|
||||||
if attached {WSF_STRING} req.path_parameter ("id") as l_id then
|
|
||||||
if l_id.is_integer and then attached node_api.node (l_id.integer_value) as l_node then
|
|
||||||
create {GENERIC_VIEW_CMS_RESPONSE} l_page.make (req, res, api)
|
|
||||||
l_page.add_variable (l_node.title, "node_title")
|
|
||||||
l_page.add_variable (l_id.value, "id")
|
|
||||||
l_page.execute
|
|
||||||
else
|
|
||||||
do_error (req, res, l_id)
|
|
||||||
end
|
|
||||||
else
|
|
||||||
(create {INTERNAL_SERVER_ERROR_CMS_RESPONSE}.make (req, res, api)).execute
|
|
||||||
end
|
|
||||||
else
|
|
||||||
send_access_denied (res)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
do_post (req: WSF_REQUEST; res: WSF_RESPONSE)
|
|
||||||
-- <Precursor>
|
|
||||||
do
|
|
||||||
if attached current_user_name (req) as l_user then
|
|
||||||
if attached {WSF_STRING} req.path_parameter ("id") as l_id then
|
|
||||||
if l_id.is_integer and then attached node_api.node (l_id.integer_value) as l_node then
|
|
||||||
if attached {WSF_STRING} req.form_parameter ("method") as l_method then
|
|
||||||
if l_method.is_case_insensitive_equal ("PUT") then
|
|
||||||
do_put (req, res)
|
|
||||||
else
|
|
||||||
(create {INTERNAL_SERVER_ERROR_CMS_RESPONSE}.make (req, res, api)).execute
|
|
||||||
end
|
|
||||||
end
|
|
||||||
else
|
|
||||||
do_error (req, res, l_id)
|
|
||||||
end
|
|
||||||
else
|
|
||||||
(create {INTERNAL_SERVER_ERROR_CMS_RESPONSE}.make (req, res, api)).execute
|
|
||||||
end
|
|
||||||
else
|
|
||||||
send_access_denied (res)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
do_put (req: WSF_REQUEST; res: WSF_RESPONSE)
|
|
||||||
-- <Precursor>
|
|
||||||
local
|
|
||||||
u_node: CMS_NODE
|
|
||||||
do
|
|
||||||
to_implement ("Check if user has permissions")
|
|
||||||
if attached current_user (req) as l_user then
|
|
||||||
if attached {WSF_STRING} req.path_parameter ("id") as l_id then
|
|
||||||
if l_id.is_integer and then attached node_api.node (l_id.integer_value) as l_node then
|
|
||||||
u_node := extract_data_form (req)
|
|
||||||
u_node.set_id (l_id.value.to_integer_64)
|
|
||||||
node_api.update_node_title (l_user.id, u_node.id, u_node.title)
|
|
||||||
redirect_to (req.absolute_script_url (""), res)
|
|
||||||
else
|
|
||||||
do_error (req, res, l_id)
|
|
||||||
end
|
|
||||||
else
|
|
||||||
(create {INTERNAL_SERVER_ERROR_CMS_RESPONSE}.make (req, res, api)).execute
|
|
||||||
end
|
|
||||||
else
|
|
||||||
send_access_denied (res)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
feature -- Error
|
|
||||||
|
|
||||||
do_error (req: WSF_REQUEST; res: WSF_RESPONSE; a_id: WSF_STRING)
|
|
||||||
-- Handling error.
|
|
||||||
local
|
|
||||||
l_page: CMS_RESPONSE
|
|
||||||
do
|
|
||||||
create {GENERIC_VIEW_CMS_RESPONSE} l_page.make (req, res, api)
|
|
||||||
l_page.add_variable (req.absolute_script_url (req.path_info), "request")
|
|
||||||
if a_id.is_integer then
|
|
||||||
-- resource not found
|
|
||||||
l_page.add_variable ("404", "code")
|
|
||||||
l_page.set_status_code (404)
|
|
||||||
else
|
|
||||||
-- bad request
|
|
||||||
l_page.add_variable ("400", "code")
|
|
||||||
l_page.set_status_code (400)
|
|
||||||
end
|
|
||||||
l_page.execute
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
feature -- {NONE} Form data
|
|
||||||
|
|
||||||
extract_data_form (req: WSF_REQUEST): CMS_NODE
|
|
||||||
-- Extract request form data and build a object
|
|
||||||
-- Node
|
|
||||||
do
|
|
||||||
create Result.make ("", "", "")
|
|
||||||
if attached {WSF_STRING} req.form_parameter ("title") as l_title then
|
|
||||||
Result.set_title (l_title.value)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
note
|
note
|
||||||
description: "Summary description for {CMS_HOOK_BLOCK_HELPER}."
|
description: "Summary description for {CMS_HOOK_BLOCK_HELPER}."
|
||||||
author: ""
|
|
||||||
date: "$Date: 2015-01-14 16:13:47 +0100 (mer., 14 janv. 2015) $"
|
date: "$Date: 2015-01-14 16:13:47 +0100 (mer., 14 janv. 2015) $"
|
||||||
revision: "$Revision: 96454 $"
|
revision: "$Revision: 96454 $"
|
||||||
|
|
||||||
@@ -17,7 +16,7 @@ feature -- Factory
|
|||||||
do
|
do
|
||||||
create res.make_from_string ("templates")
|
create res.make_from_string ("templates")
|
||||||
res := res.extended ("block_").appended (a_block_id).appended_with_extension ("tpl")
|
res := res.extended ("block_").appended (a_block_id).appended_with_extension ("tpl")
|
||||||
p := a_response.module_resource_path (a_module, res)
|
p := a_response.api.module_theme_resource_location (a_module, res)
|
||||||
if p /= Void then
|
if p /= Void then
|
||||||
if attached p.entry as e then
|
if attached p.entry as e then
|
||||||
create Result.make (a_block_id, Void, p.parent, e)
|
create Result.make (a_block_id, Void, p.parent, e)
|
||||||
@@ -27,4 +26,7 @@ feature -- Factory
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
note
|
||||||
|
copyright: "2011-2015, Jocelyn Fiat, Javier Velilla, Eiffel Software and others"
|
||||||
|
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||||
end
|
end
|
||||||
|
|||||||
41
tests/all-safe.ecf
Normal file
41
tests/all-safe.ecf
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||||
|
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-10-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-10-0 http://www.eiffel.com/developers/xml/configuration-1-10-0.xsd" name="all" uuid="1172C52C-6979-4293-8F01-80FADA5A2B69">
|
||||||
|
<description>Integration project including many lib</description>
|
||||||
|
<target name="all">
|
||||||
|
<root all_classes="true"/>
|
||||||
|
<file_rule>
|
||||||
|
<exclude>/.git$</exclude>
|
||||||
|
<exclude>/EIFGENs$</exclude>
|
||||||
|
<exclude>/.svn$</exclude>
|
||||||
|
</file_rule>
|
||||||
|
<option warning="true" full_class_checking="true" is_attached_by_default="true" void_safety="all" syntax="standard">
|
||||||
|
</option>
|
||||||
|
|
||||||
|
<library name="cms" location="..\cms-safe.ecf" readonly="false"/>
|
||||||
|
<library name="demo" location="..\examples\demo\demo-safe.ecf" readonly="false"/>
|
||||||
|
<library name="cms_blog_module" location="..\examples\demo\modules\blog\cms_blog_module-safe.ecf" readonly="false"/>
|
||||||
|
<library name="cms_demo_module" location="..\examples\demo\modules\demo\cms_demo_module-safe.ecf" readonly="false"/>
|
||||||
|
<library name="app_env" location="..\library\app_env\app_env-safe.ecf" readonly="false"/>
|
||||||
|
<library name="config" location="..\library\configuration\config-safe.ecf" readonly="false"/>
|
||||||
|
<library name="config_tests" location="..\library\configuration\tests\config_tests-safe.ecf" readonly="false"/>
|
||||||
|
<library name="email_service" location="..\library\email\email-safe.ecf" readonly="false"/>
|
||||||
|
<library name="cms_model" location="..\library\model\cms_model-safe.ecf" readonly="false"/>
|
||||||
|
<library name="store_mysql" location="..\library\persistence\store_mysql\store_mysql-safe.ecf" readonly="false"/>
|
||||||
|
<library name="persistence_store_odbc" location="..\library\persistence\store_odbc\store_odbc-safe.ecf" readonly="false"/>
|
||||||
|
<library name="tests_store_odbc" location="..\library\persistence\store_odbc\tests\tests-safe.ecf" readonly="false"/>
|
||||||
|
<library name="auth_module" location="..\modules\auth\auth-safe.ecf" readonly="false"/>
|
||||||
|
<library name="basic_auth" location="..\modules\basic_auth\basic_auth-safe.ecf" readonly="false"/>
|
||||||
|
<library name="node" location="..\modules\node\node-safe.ecf" readonly="false"/>
|
||||||
|
<library name="oauth_module" location="..\modules\oauth20\oauth20-safe.ecf" readonly="false"/>
|
||||||
|
</target>
|
||||||
|
<target name="all_windows" extends="all">
|
||||||
|
<description>Compiling as Windows , on other platforms than Windows</description>
|
||||||
|
<root all_classes="true"/>
|
||||||
|
<setting name="platform" value="windows"/>
|
||||||
|
</target>
|
||||||
|
<target name="all_unix" extends="all">
|
||||||
|
<description>Compiling as UNIX , on other platforms than Unix</description>
|
||||||
|
<root all_classes="true"/>
|
||||||
|
<setting name="platform" value="unix"/>
|
||||||
|
</target>
|
||||||
|
</system>
|
||||||
Reference in New Issue
Block a user