Renamed node_api and node_storage by blog_api and blog_storage in related CMS_BLOG_* classes. Mainly to avoid confusion with NODE_ classes.

Merged CMS_BLOG_CONFIG with CMS_BLOG_API.
In CMS_BLOG_API, prefer argument of type CMS_USER, rather than using directly user id.
Added a CMS_EDITOR_CONTENT_FORMAT for now, to be the format editable by the WYSIWYG editor.
Added CMS_MODULE.is_initialized: BOOLEAN to equip router, and module_api with expected preconditions.

Fixed typo, especially in log output.
Corrected a few routine names such as add_authors that should not be a function according to its name.
Converted various function returning html content, to procedure appending html content to an output string to minimize temporary string object creation.
Cosmetic: added spaces to make code easier to read, and indentation.
This commit is contained in:
2015-05-27 19:00:32 +02:00
parent e35893fdb9
commit c871eae10e
20 changed files with 376 additions and 303 deletions

View File

@@ -16,8 +16,10 @@ feature -- Access
deferred
end
blogs_count_from_user (user_id: INTEGER_64) : INTEGER_64
-- Number of nodes of type blog from user with user_id
blogs_count_from_user (a_user: CMS_USER) : INTEGER_64
-- Number of nodes of type blog from `a_user'.
require
has_id: a_user.has_id
deferred
end
@@ -26,13 +28,15 @@ feature -- Access
deferred
end
blogs_limited (limit:NATURAL_32; offset:NATURAL_32) : LIST[CMS_NODE]
-- List of posts ordered by creation date from offset to offset + limit
blogs_limited (limit: NATURAL_32; offset: NATURAL_32): LIST [CMS_NODE]
-- List of posts ordered by creation date from offset to offset + limit.
deferred
end
blogs_from_user_limited (user_id: INTEGER_32; limit:NATURAL_32; offset:NATURAL_32) : LIST[CMS_NODE]
-- List of posts from user_id ordered by creation date from offset to offset + limit
blogs_from_user_limited (a_user: CMS_USER; limit: NATURAL_32; offset: NATURAL_32): LIST [CMS_NODE]
-- List of posts from `a_user' ordered by creation date from offset to offset + limit.
require
has_id: a_user.has_id
deferred
end

View File

@@ -22,25 +22,25 @@ feature -- Access
do
end
blogs_count_from_user (user_id: INTEGER_64) : INTEGER_64
-- Number of nodes of type blog from user with user_id
blogs_count_from_user (a_user: CMS_USER) : INTEGER_64
-- <Precursor>
do
end
blogs: LIST[CMS_NODE]
-- List of nodes.
blogs: LIST [CMS_NODE]
-- <Precursor>
do
create {ARRAYED_LIST [CMS_NODE]} Result.make (0)
end
blogs_limited (limit:NATURAL_32; offset:NATURAL_32) : LIST[CMS_NODE]
-- List of posts ordered by creation date from offset to offset + limit
blogs_limited (limit: NATURAL_32; offset: NATURAL_32) : LIST [CMS_NODE]
-- <Precursor>
do
create {ARRAYED_LIST [CMS_NODE]} Result.make (0)
end
blogs_from_user_limited (user_id: INTEGER_32; limit:NATURAL_32; offset:NATURAL_32) : LIST[CMS_NODE]
-- List of posts from user_id ordered by creation date from offset to offset + limit
blogs_from_user_limited (a_user: CMS_USER; limit: NATURAL_32; offset: NATURAL_32): LIST [CMS_NODE]
-- <Precursor>
do
create {ARRAYED_LIST [CMS_NODE]} Result.make (0)
end

View File

@@ -18,25 +18,25 @@ create
feature -- Access
blogs_count: INTEGER_64
-- Count of blog nodes
-- <Precursor>
do
error_handler.reset
write_information_log (generator + ".nodes_count")
write_information_log (generator + ".blogs_count")
sql_query (sql_select_blog_count, Void)
if sql_rows_count = 1 then
Result := sql_read_integer_64 (1)
end
end
blogs_count_from_user (user_id: INTEGER_64) : INTEGER_64
-- Number of nodes of type blog from user with user_id
blogs_count_from_user (a_user: CMS_USER) : INTEGER_64
-- <Precursor>
local
l_parameters: STRING_TABLE [detachable ANY]
do
error_handler.reset
write_information_log (generator + ".nodes_count")
write_information_log (generator + ".blogs_count_from_user")
create l_parameters.make (2)
l_parameters.put (user_id, "user")
l_parameters.put (a_user.id, "user")
sql_query (sql_select_blog_count_from_user, l_parameters)
if sql_rows_count = 1 then
Result := sql_read_integer_64 (1)
@@ -44,12 +44,12 @@ feature -- Access
end
blogs: LIST [CMS_NODE]
-- List of nodes ordered by creation date (descending).
-- <Precursor>
do
create {ARRAYED_LIST [CMS_NODE]} Result.make (0)
error_handler.reset
write_information_log (generator + ".nodes")
write_information_log (generator + ".blogs")
from
sql_query (sql_select_blogs_order_created_desc, Void)
@@ -64,15 +64,15 @@ feature -- Access
end
end
blogs_limited (a_limit:NATURAL_32; a_offset:NATURAL_32) : LIST[CMS_NODE]
-- List of nodes ordered by creation date from limit to limit + offset
blogs_limited (a_limit: NATURAL_32; a_offset: NATURAL_32): LIST [CMS_NODE]
-- <Precursor>
local
l_parameters: STRING_TABLE [detachable ANY]
do
create {ARRAYED_LIST [CMS_NODE]} Result.make (0)
error_handler.reset
write_information_log (generator + ".nodes")
write_information_log (generator + ".blogs_limited")
from
create l_parameters.make (2)
@@ -90,21 +90,21 @@ feature -- Access
end
end
blogs_from_user_limited (a_user_id:INTEGER_32; a_limit:NATURAL_32; a_offset:NATURAL_32) : LIST[CMS_NODE]
-- List of posts of the author with a_user_id ordered by creation date starting at offset and limited by limit
blogs_from_user_limited (a_user: CMS_USER; a_limit: NATURAL_32; a_offset: NATURAL_32): LIST [CMS_NODE]
-- <Precursor>
local
l_parameters: STRING_TABLE [detachable ANY]
do
create {ARRAYED_LIST [CMS_NODE]} Result.make (0)
error_handler.reset
write_information_log (generator + ".nodes")
write_information_log (generator + ".blogs_from_user_limited")
from
create l_parameters.make (2)
l_parameters.put (a_limit, "limit")
l_parameters.put (a_offset, "offset")
l_parameters.put (a_user_id, "user")
l_parameters.put (a_user.id, "user")
sql_query (sql_blogs_from_user_limited, l_parameters)
sql_start
until