Implemented CMS storage for user and nodes.

Implemented role and permission storage.
Introduced the CMS_PARTIAL_NODE and CMS_PARTIAL_USER.
Added support for node storage extension
  - storage of data specific to each node content type,
  - in addition to the core CMS_NODE)
  - For now, only implemented for SQL storage.
Note: in current version, CMS_PAGE support is hard coded in the core,
    (as opposed to be only supported by the node module.)
Commented/removed for now, the Web API code to update node summary, title, via REST request.
This commit is contained in:
2015-04-14 11:25:02 +02:00
parent 734f661add
commit 133c243126
46 changed files with 2262 additions and 468 deletions

View File

@@ -1,6 +1,7 @@
note
description: "Summary description for {CMS_NODE_API}."
author: ""
description: "[
API to manage CMS Nodes
]"
date: "$Date: 2015-02-13 13:08:13 +0100 (ven., 13 févr. 2015) $"
revision: "$Revision: 96616 $"
@@ -9,12 +10,55 @@ class
inherit
CMS_MODULE_API
redefine
initialize
end
REFACTORING_HELPER
create
make
feature {NONE} -- Implementation
initialize
-- <Precursor>
do
Precursor
initialize_content_types
end
initialize_content_types
-- Initialize content type system.
do
create content_types.make (1)
add_content_type (create {CMS_PAGE_CONTENT_TYPE})
end
feature -- Content type
content_types: ARRAYED_LIST [CMS_CONTENT_TYPE]
-- Available content types
add_content_type (a_type: CMS_CONTENT_TYPE)
do
content_types.force (a_type)
end
content_type (a_name: READABLE_STRING_GENERAL): detachable CMS_CONTENT_TYPE
do
across
content_types as ic
until
Result /= Void
loop
Result := ic.item
if not a_name.is_case_insensitive_equal (Result.name) then
Result := Void
end
end
end
feature -- Access: Node
nodes_count: INTEGER_64
@@ -40,7 +84,37 @@ feature -- Access: Node
debug ("refactor_fixme")
fixme ("Check preconditions")
end
Result := storage.node_by_id (a_id)
Result := full_node (storage.node_by_id (a_id))
end
full_node (a_node: detachable CMS_NODE): detachable CMS_NODE
-- If `a_node' is partial, return the full node from `a_node',
-- otherwise return directly `a_node'.
do
if attached {CMS_PARTIAL_NODE} a_node as l_partial_node then
if attached content_type (l_partial_node.content_type) as ct then
Result := ct.new_node (l_partial_node)
storage.fill_node (Result)
else
Result := l_partial_node
end
else
Result := a_node
end
-- Update partial user if needed.
if
Result /= Void and then
attached {CMS_PARTIAL_USER} Result.author as l_partial_author
then
if attached cms_api.user_api.user_by_id (l_partial_author.id) as l_author then
Result.set_author (l_author)
else
check
valid_author_id: False
end
end
end
end
feature -- Change: Node
@@ -67,32 +141,32 @@ feature -- Change: Node
storage.update_node (a_node)
end
update_node_title (a_user_id: like {CMS_USER}.id; a_node_id: like {CMS_NODE}.id; a_title: READABLE_STRING_32)
-- Update node title, with user identified by `a_id', with node id `a_node_id' and a new title `a_title'.
do
debug ("refactor_fixme")
fixme ("Check preconditions")
end
storage.update_node_title (a_user_id, a_node_id, a_title)
end
-- update_node_title (a_user_id: like {CMS_USER}.id; a_node_id: like {CMS_NODE}.id; a_title: READABLE_STRING_32)
-- -- Update node title, with user identified by `a_id', with node id `a_node_id' and a new title `a_title'.
-- do
-- debug ("refactor_fixme")
-- fixme ("Check preconditions")
-- end
-- storage.update_node_title (a_user_id, a_node_id, a_title)
-- end
update_node_summary (a_user_id: like {CMS_USER}.id; a_node_id: like {CMS_NODE}.id; a_summary: READABLE_STRING_32)
-- Update node summary, with user identified by `a_user_id', with node id `a_node_id' and a new summary `a_summary'.
do
debug ("refactor_fixme")
fixme ("Check preconditions")
end
storage.update_node_summary (a_user_id, a_node_id, a_summary)
end
-- update_node_summary (a_user_id: like {CMS_USER}.id; a_node_id: like {CMS_NODE}.id; a_summary: READABLE_STRING_32)
-- -- Update node summary, with user identified by `a_user_id', with node id `a_node_id' and a new summary `a_summary'.
-- do
-- debug ("refactor_fixme")
-- fixme ("Check preconditions")
-- end
-- storage.update_node_summary (a_user_id, a_node_id, a_summary)
-- end
update_node_content (a_user_id: like {CMS_USER}.id; a_node_id: like {CMS_NODE}.id; a_content: READABLE_STRING_32)
-- Update node content, with user identified by `a_user_id', with node id `a_node_id' and a new content `a_content'.
do
debug ("refactor_fixme")
fixme ("Check preconditions")
end
storage.update_node_content (a_user_id, a_node_id, a_content)
end
-- update_node_content (a_user_id: like {CMS_USER}.id; a_node_id: like {CMS_NODE}.id; a_content: READABLE_STRING_32)
-- -- Update node content, with user identified by `a_user_id', with node id `a_node_id' and a new content `a_content'.
-- do
-- debug ("refactor_fixme")
-- fixme ("Check preconditions")
-- end
-- storage.update_node_content (a_user_id, a_node_id, a_content)
-- end
end