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:
2015-04-15 16:39:03 +02:00
parent 2b25c23977
commit f2bb061488
59 changed files with 1693 additions and 414 deletions

View File

@@ -10,7 +10,7 @@ deferred class
inherit
CMS_STORAGE
CMS_STORAGE_SQL
CMS_STORAGE_SQL_I
feature {NONE} -- Initialization

View File

@@ -1,79 +0,0 @@
note
description: "Summary description for {CMS_NODE_STORAGE_MYSQL}."
author: ""
date: "$Date: 2015-01-27 19:15:02 +0100 (mar., 27 janv. 2015) $"
revision: "$Revision: 96542 $"
deferred class
CMS_NODE_STORAGE_MYSQL
inherit
CMS_NODE_STORAGE_SQL
redefine
nodes, recent_nodes
end
feature {NONE} -- Implementation
db_handler: DATABASE_HANDLER
deferred
end
feature -- Access
nodes: LIST [CMS_NODE]
-- List of nodes.
do
create {ARRAYED_LIST [CMS_NODE]} Result.make (0)
across nodes_iterator as ic loop
if attached ic.item as l_node then
Result.force (l_node)
end
end
end
recent_nodes (a_lower: INTEGER; a_count: INTEGER): LIST [CMS_NODE]
-- List of recent `a_count' nodes with an offset of `lower'.
do
create {ARRAYED_LIST [CMS_NODE]} Result.make (a_count)
across recent_nodes_iterator (a_lower, a_count) as ic loop
if attached ic.item as l_node then
Result.force (l_node)
end
end
end
feature -- Access: iterator
nodes_iterator: DATABASE_ITERATION_CURSOR [detachable CMS_NODE]
-- List of nodes.
local
l_parameters: STRING_TABLE [ANY]
do
error_handler.reset
write_information_log (generator + ".nodes_iterator")
create l_parameters.make (0)
sql_query (sql_select_nodes, l_parameters)
create Result.make (db_handler, agent fetch_node)
sql_post_execution
end
recent_nodes_iterator (a_lower, a_rows: INTEGER): DATABASE_ITERATION_CURSOR [detachable CMS_NODE]
-- The most recent `a_rows'.
local
l_parameters: STRING_TABLE [ANY]
l_query: STRING
do
-- FIXME: check implementation...
error_handler.reset
write_information_log (generator + ".recent_nodes_iterator")
create l_parameters.make (2)
l_parameters.put (a_rows, "rows")
l_parameters.put (a_lower, "offset")
create l_query.make_from_string (sql_select_recent_nodes)
sql_query (l_query, l_parameters)
create Result.make (db_handler, agent fetch_node)
sql_post_execution
end
end

View File

@@ -7,13 +7,11 @@ class
CMS_STORAGE_MYSQL
inherit
CMS_STORAGE
CMS_STORAGE_STORE_SQL
CMS_USER_STORAGE_MYSQL
CMS_CORE_STORAGE_SQL_I
CMS_NODE_STORAGE_MYSQL
CMS_USER_STORAGE_SQL_I
REFACTORING_HELPER

View File

@@ -10,7 +10,7 @@ class
CMS_STORAGE_MYSQL_BUILDER
inherit
CMS_STORAGE_BUILDER
CMS_STORAGE_SQL_BUILDER
create
make

View File

@@ -1,14 +0,0 @@
note
description: "Summary description for {CMS_USER_STORAGE_MYSQL}."
author: ""
date: "$Date: 2015-01-27 19:15:02 +0100 (mar., 27 janv. 2015) $"
revision: "$Revision: 96542 $"
deferred class
CMS_USER_STORAGE_MYSQL
inherit
CMS_USER_STORAGE_SQL
end

View File

@@ -1,77 +0,0 @@
note
description: "Summary description for {CMS_NODE_STORAGE_SQLITE}."
author: ""
date: "$Date: 2015-02-13 13:08:13 +0100 (ven., 13 févr. 2015) $"
revision: "$Revision: 96616 $"
deferred class
CMS_NODE_STORAGE_SQLITE
inherit
CMS_NODE_STORAGE_SQL
redefine
nodes, recent_nodes
end
feature {NONE} -- Implementation
db_handler: DATABASE_HANDLER
deferred
end
feature -- Access
nodes: LIST [CMS_NODE]
-- List of nodes.
do
create {ARRAYED_LIST [CMS_NODE]} Result.make (0)
across nodes_iterator as ic loop
if attached ic.item as l_node then
Result.force (l_node)
end
end
end
recent_nodes (a_lower: INTEGER; a_count: INTEGER): LIST [CMS_NODE]
-- List of recent `a_count' nodes with an offset of `lower'.
do
create {ARRAYED_LIST [CMS_NODE]} Result.make (a_count)
across recent_nodes_iterator (a_lower, a_count) as ic loop
if attached ic.item as l_node then
Result.force (l_node)
end
end
end
feature -- Access: iterator
nodes_iterator: DATABASE_ITERATION_CURSOR [detachable CMS_NODE]
-- List of nodes.
local
l_parameters: STRING_TABLE [ANY]
do
error_handler.reset
write_information_log (generator + ".nodes_iterator")
create l_parameters.make (0)
sql_query (sql_select_nodes, l_parameters)
create Result.make (db_handler, agent fetch_node)
end
recent_nodes_iterator (a_lower, a_rows: INTEGER): DATABASE_ITERATION_CURSOR [detachable CMS_NODE]
-- The most recent `a_rows'.
local
l_parameters: STRING_TABLE [ANY]
l_query: STRING
do
-- FIXME: check implementation...
error_handler.reset
write_information_log (generator + ".recent_nodes_iterator")
create l_parameters.make (2)
l_parameters.put (a_rows, "rows")
l_parameters.put (a_lower, "offset")
create l_query.make_from_string (sql_select_recent_nodes)
sql_query (l_query, l_parameters)
create Result.make (db_handler, agent fetch_node)
end
end

View File

@@ -7,13 +7,11 @@ class
CMS_STORAGE_SQLITE
inherit
CMS_STORAGE
CMS_STORAGE_STORE_SQL
CMS_USER_STORAGE_SQLITE
CMS_CORE_STORAGE_SQL_I
CMS_NODE_STORAGE_SQLITE
CMS_USER_STORAGE_SQL_I
REFACTORING_HELPER
@@ -27,5 +25,5 @@ feature -- Status report
do
Result := has_user
end
end

View File

@@ -10,7 +10,7 @@ class
CMS_STORAGE_SQLITE_BUILDER
inherit
CMS_STORAGE_BUILDER
CMS_STORAGE_SQL_BUILDER
create
make
@@ -66,6 +66,11 @@ feature -- Factory
r.add_permission ("create page")
r.add_permission ("edit page")
a_storage.save_user_role (r)
-- Test custom value
a_storage.set_custom_value ("abc", "123", "test")
a_storage.set_custom_value ("abc", "OK", "test")
end
end

View File

@@ -1,14 +0,0 @@
note
description: "Summary description for {CMS_USER_STORAGE_SQLITE}."
author: ""
date: "$Date: 2015-01-27 19:15:02 +0100 (mar., 27 janv. 2015) $"
revision: "$Revision: 96542 $"
deferred class
CMS_USER_STORAGE_SQLITE
inherit
CMS_USER_STORAGE_SQL
end