Added support for log stored in CMS_STORAGE.
Added support for custom value stored in CMS_STORAGE. Added optional css classes addition to CMS_BLOCK output. Refactored storage, to manage node from node module code only (or mostly). TODO: improved view for a cms node, for now hardcoded.
This commit is contained in:
@@ -25,16 +25,30 @@ feature {NONE} -- Implementation
|
||||
-- <Precursor>
|
||||
do
|
||||
Precursor
|
||||
if attached {CMS_STORAGE_SQL_I} storage as l_storage_sql then
|
||||
create {CMS_NODE_STORAGE_SQL} node_storage.make (l_storage_sql)
|
||||
else
|
||||
create {CMS_NODE_STORAGE_NULL} node_storage.make
|
||||
end
|
||||
initialize_content_types
|
||||
end
|
||||
|
||||
initialize_content_types
|
||||
-- Initialize content type system.
|
||||
local
|
||||
ct: CMS_PAGE_CONTENT_TYPE
|
||||
do
|
||||
create content_types.make (1)
|
||||
add_content_type (create {CMS_PAGE_CONTENT_TYPE})
|
||||
create content_type_webform_managers.make (1)
|
||||
create ct
|
||||
add_content_type (ct)
|
||||
add_content_type_webform_manager (create {CMS_PAGE_CONTENT_TYPE_WEBFORM_MANAGER}.make (ct))
|
||||
end
|
||||
|
||||
feature {NODE_MODULE} -- Access nodes storage.
|
||||
|
||||
node_storage: CMS_NODE_STORAGE_I
|
||||
|
||||
feature -- Content type
|
||||
|
||||
content_types: ARRAYED_LIST [CMS_CONTENT_TYPE]
|
||||
@@ -59,6 +73,30 @@ feature -- Content type
|
||||
end
|
||||
end
|
||||
|
||||
feature -- Content type webform
|
||||
|
||||
content_type_webform_managers: ARRAYED_LIST [CMS_CONTENT_TYPE_WEBFORM_MANAGER]
|
||||
-- Available content types
|
||||
|
||||
add_content_type_webform_manager (a_type: CMS_CONTENT_TYPE_WEBFORM_MANAGER)
|
||||
do
|
||||
content_type_webform_managers.force (a_type)
|
||||
end
|
||||
|
||||
content_type_webform_manager (a_name: READABLE_STRING_GENERAL): detachable CMS_CONTENT_TYPE_WEBFORM_MANAGER
|
||||
do
|
||||
across
|
||||
content_type_webform_managers 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 -- URL
|
||||
|
||||
new_content_path (ct: detachable CMS_CONTENT_TYPE): STRING
|
||||
@@ -91,19 +129,19 @@ feature -- Access: Node
|
||||
|
||||
nodes_count: INTEGER_64
|
||||
do
|
||||
Result := storage.nodes_count
|
||||
Result := node_storage.nodes_count
|
||||
end
|
||||
|
||||
nodes: LIST [CMS_NODE]
|
||||
-- List of nodes.
|
||||
do
|
||||
Result := storage.nodes
|
||||
Result := node_storage.nodes
|
||||
end
|
||||
|
||||
recent_nodes (a_offset, a_rows: INTEGER): LIST [CMS_NODE]
|
||||
-- List of the `a_rows' most recent nodes starting from `a_offset'.
|
||||
do
|
||||
Result := storage.recent_nodes (a_offset, a_rows)
|
||||
Result := node_storage.recent_nodes (a_offset, a_rows)
|
||||
end
|
||||
|
||||
node (a_id: INTEGER_64): detachable CMS_NODE
|
||||
@@ -112,7 +150,7 @@ feature -- Access: Node
|
||||
debug ("refactor_fixme")
|
||||
fixme ("Check preconditions")
|
||||
end
|
||||
Result := full_node (storage.node_by_id (a_id))
|
||||
Result := full_node (node_storage.node_by_id (a_id))
|
||||
end
|
||||
|
||||
full_node (a_node: detachable CMS_NODE): detachable CMS_NODE
|
||||
@@ -122,7 +160,7 @@ feature -- Access: Node
|
||||
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)
|
||||
node_storage.fill_node (Result)
|
||||
else
|
||||
Result := l_partial_node
|
||||
end
|
||||
@@ -147,26 +185,32 @@ feature -- Access: Node
|
||||
|
||||
feature -- Change: Node
|
||||
|
||||
save_node (a_node: CMS_NODE)
|
||||
-- Save `a_node'.
|
||||
do
|
||||
node_storage.save_node (a_node)
|
||||
end
|
||||
|
||||
new_node (a_node: CMS_NODE)
|
||||
-- Add a new node `a_node'
|
||||
require
|
||||
no_id: not a_node.has_id
|
||||
do
|
||||
storage.new_node (a_node)
|
||||
node_storage.new_node (a_node)
|
||||
end
|
||||
|
||||
delete_node (a_node: CMS_NODE)
|
||||
-- Delete `a_node'.
|
||||
do
|
||||
if a_node.has_id then
|
||||
storage.delete_node (a_node)
|
||||
node_storage.delete_node (a_node)
|
||||
end
|
||||
end
|
||||
|
||||
update_node (a_node: CMS_NODE)
|
||||
-- Update node `a_node' data.
|
||||
do
|
||||
storage.update_node (a_node)
|
||||
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)
|
||||
@@ -175,7 +219,7 @@ feature -- Change: Node
|
||||
-- debug ("refactor_fixme")
|
||||
-- fixme ("Check preconditions")
|
||||
-- end
|
||||
-- storage.update_node_title (a_user_id, a_node_id, a_title)
|
||||
-- node_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)
|
||||
@@ -184,7 +228,7 @@ feature -- Change: Node
|
||||
-- debug ("refactor_fixme")
|
||||
-- fixme ("Check preconditions")
|
||||
-- end
|
||||
-- storage.update_node_summary (a_user_id, a_node_id, a_summary)
|
||||
-- node_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)
|
||||
@@ -193,7 +237,7 @@ feature -- Change: Node
|
||||
-- debug ("refactor_fixme")
|
||||
-- fixme ("Check preconditions")
|
||||
-- end
|
||||
-- storage.update_node_content (a_user_id, a_node_id, a_content)
|
||||
-- node_storage.update_node_content (a_user_id, a_node_id, a_content)
|
||||
-- end
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user