Merge branch 'master' of https://github.com/EiffelWebFramework/ROC into roc_gcse
Conflicts: examples/demo/demo-safe.ecf
This commit is contained in:
@@ -93,7 +93,7 @@ feature -- HTTP Methods
|
||||
s.append ("<a href=%"")
|
||||
s.append (req.absolute_script_url ("/admin/role/" + u.id.out))
|
||||
s.append ("%">")
|
||||
s.append (u.name)
|
||||
s.append (html_encoded (u.name))
|
||||
s.append ("</a>")
|
||||
s.append ("</li>%N")
|
||||
end
|
||||
|
||||
@@ -106,7 +106,7 @@ feature -- HTTP Methods
|
||||
s.append ("<a href=%"")
|
||||
s.append (req.absolute_script_url ("/admin/user/"+u.id.out))
|
||||
s.append ("%">")
|
||||
s.append (u.name)
|
||||
s.append (html_encoded (u.name))
|
||||
s.append ("</a>")
|
||||
s.append ("</li>%N")
|
||||
end
|
||||
|
||||
@@ -50,10 +50,10 @@ feature -- Access
|
||||
|
||||
feature -- Access: node
|
||||
|
||||
summary: detachable READABLE_STRING_8
|
||||
summary: detachable READABLE_STRING_32
|
||||
-- A short summary of the node.
|
||||
|
||||
content: detachable READABLE_STRING_8
|
||||
content: detachable READABLE_STRING_32
|
||||
-- Content of the node.
|
||||
|
||||
format: detachable READABLE_STRING_8
|
||||
|
||||
@@ -83,17 +83,18 @@ feature -- Persistence
|
||||
|
||||
if l_update then
|
||||
if l_has_modif then
|
||||
sql_change (sql_update_node_data, l_parameters)
|
||||
sql_modify (sql_update_node_data, l_parameters)
|
||||
end
|
||||
else
|
||||
if l_has_modif then
|
||||
sql_change (sql_insert_node_data, l_parameters)
|
||||
sql_insert (sql_insert_node_data, l_parameters)
|
||||
else
|
||||
-- no page data, means everything is empty.
|
||||
-- FOR NOW: always record row
|
||||
-- sql_change (sql_insert_node_data, l_parameters)
|
||||
end
|
||||
end
|
||||
sql_finalize
|
||||
end
|
||||
end
|
||||
|
||||
@@ -116,7 +117,8 @@ feature -- Persistence
|
||||
if a_node.has_id then
|
||||
create l_parameters.make (1)
|
||||
l_parameters.put (a_node.id, "nid")
|
||||
sql_change (sql_delete_node_data, l_parameters)
|
||||
sql_modify (sql_delete_node_data, l_parameters)
|
||||
sql_finalize
|
||||
end
|
||||
end
|
||||
|
||||
@@ -136,18 +138,21 @@ feature {NONE} -- Implementation
|
||||
l_parameters.put (a_node.revision, "revision")
|
||||
sql_query (sql_select_node_data, l_parameters)
|
||||
if not has_error then
|
||||
n := sql_rows_count
|
||||
if n = 1 then
|
||||
if not sql_after then
|
||||
-- nid, revision, tags
|
||||
l_rev := sql_read_integer_64 (2)
|
||||
l_tags := sql_read_string_32 (3)
|
||||
if l_tags /= Void then
|
||||
Result := [l_rev, l_tags]
|
||||
end
|
||||
else
|
||||
check unique_data: n = 0 end
|
||||
sql_forth
|
||||
if not sql_after then
|
||||
check unique_data: n = 0 end
|
||||
Result := Void
|
||||
end
|
||||
end
|
||||
end
|
||||
sql_finalize
|
||||
ensure
|
||||
accepted_revision: Result /= Void implies Result.revision <= a_node.revision
|
||||
end
|
||||
|
||||
@@ -230,9 +230,9 @@ feature -- HTML Output
|
||||
lnk := blog_api.node_api.node_link (n)
|
||||
a_output.append ("<p class=%"blog_list_summary%">")
|
||||
if attached api.format (n.format) as f then
|
||||
a_output.append (f.formatted_output (l_summary))
|
||||
f.append_formatted_to (l_summary, a_output)
|
||||
else
|
||||
a_output.append (page.formats.default_format.formatted_output (l_summary))
|
||||
page.formats.default_format.append_formatted_to (l_summary, a_output)
|
||||
end
|
||||
a_output.append ("<br />")
|
||||
a_output.append (page.link ("See more...", lnk.location, Void))
|
||||
|
||||
@@ -123,7 +123,7 @@ feature -- HTML Output
|
||||
do
|
||||
a_output.append ("<h2>Posts from ")
|
||||
if attached user as l_user then
|
||||
a_output.append (l_user.name)
|
||||
a_output.append (html_encoded (l_user.name))
|
||||
else
|
||||
a_output.append ("unknown user")
|
||||
end
|
||||
|
||||
@@ -23,9 +23,10 @@ feature -- Access
|
||||
error_handler.reset
|
||||
write_information_log (generator + ".blogs_count")
|
||||
sql_query (sql_select_blog_count, Void)
|
||||
if sql_rows_count = 1 then
|
||||
if not has_error and not sql_after then
|
||||
Result := sql_read_integer_64 (1)
|
||||
end
|
||||
sql_finalize
|
||||
end
|
||||
|
||||
blogs_count_from_user (a_user: CMS_USER) : INTEGER_64
|
||||
@@ -38,9 +39,10 @@ feature -- Access
|
||||
create l_parameters.make (2)
|
||||
l_parameters.put (a_user.id, "user")
|
||||
sql_query (sql_select_blog_count_from_user, l_parameters)
|
||||
if sql_rows_count = 1 then
|
||||
if not has_error and not sql_after then
|
||||
Result := sql_read_integer_64 (1)
|
||||
end
|
||||
sql_finalize
|
||||
end
|
||||
|
||||
blogs: LIST [CMS_NODE]
|
||||
@@ -62,6 +64,7 @@ feature -- Access
|
||||
end
|
||||
sql_forth
|
||||
end
|
||||
sql_finalize
|
||||
end
|
||||
|
||||
blogs_limited (a_limit: NATURAL_32; a_offset: NATURAL_32): LIST [CMS_NODE]
|
||||
@@ -88,6 +91,7 @@ feature -- Access
|
||||
end
|
||||
sql_forth
|
||||
end
|
||||
sql_finalize
|
||||
end
|
||||
|
||||
blogs_from_user_limited (a_user: CMS_USER; a_limit: NATURAL_32; a_offset: NATURAL_32): LIST [CMS_NODE]
|
||||
@@ -115,6 +119,7 @@ feature -- Access
|
||||
end
|
||||
sql_forth
|
||||
end
|
||||
sql_finalize
|
||||
end
|
||||
|
||||
feature {NONE} -- Queries
|
||||
|
||||
@@ -230,6 +230,7 @@ feature -- Hook
|
||||
s: READABLE_STRING_8
|
||||
b: CMS_CONTENT_BLOCK
|
||||
pref: STRING
|
||||
nb: INTEGER
|
||||
do
|
||||
if attached feed_aggregator_api as l_feed_api then
|
||||
pref := "feed."
|
||||
@@ -238,7 +239,15 @@ feature -- Hook
|
||||
else
|
||||
s := a_block_id
|
||||
end
|
||||
if attached feed_to_html (s, 0, True, a_response) as l_content then
|
||||
nb := 0
|
||||
if
|
||||
attached a_response.block_options (a_block_id) as l_options and then
|
||||
attached {READABLE_STRING_GENERAL} l_options.item ("size") as l_size and then
|
||||
l_size.is_integer
|
||||
then
|
||||
nb := l_size.to_integer
|
||||
end
|
||||
if attached feed_to_html (s, nb, True, a_response) as l_content then
|
||||
create b.make (a_block_id, Void, l_content, Void)
|
||||
b.set_is_raw (True)
|
||||
a_response.add_block (b, "feed_" + s)
|
||||
|
||||
@@ -103,12 +103,12 @@ feature -- Access
|
||||
-- Full title of the node.
|
||||
-- Required!
|
||||
|
||||
summary: detachable READABLE_STRING_8
|
||||
summary: detachable READABLE_STRING_32
|
||||
-- A short summary of the node.
|
||||
deferred
|
||||
end
|
||||
|
||||
content: detachable READABLE_STRING_8
|
||||
content: detachable READABLE_STRING_32
|
||||
-- Content of the node.
|
||||
deferred
|
||||
end
|
||||
|
||||
@@ -33,10 +33,10 @@ feature -- Access: code
|
||||
|
||||
feature -- Access: content
|
||||
|
||||
summary: detachable READABLE_STRING_8
|
||||
summary: detachable READABLE_STRING_32
|
||||
-- A short summary of the node.
|
||||
|
||||
content: detachable READABLE_STRING_8
|
||||
content: detachable READABLE_STRING_32
|
||||
-- Content of the node.
|
||||
|
||||
format: detachable READABLE_STRING_8
|
||||
|
||||
@@ -44,10 +44,10 @@ feature -- Access
|
||||
|
||||
feature -- Access: content
|
||||
|
||||
summary: detachable READABLE_STRING_8
|
||||
summary: detachable READABLE_STRING_32
|
||||
-- A short summary of the node.
|
||||
|
||||
content: detachable READABLE_STRING_8
|
||||
content: detachable READABLE_STRING_32
|
||||
-- Content of the node.
|
||||
|
||||
format: detachable READABLE_STRING_8
|
||||
|
||||
@@ -100,6 +100,7 @@ feature -- Forms ...
|
||||
local
|
||||
ti: WSF_FORM_TEXT_INPUT
|
||||
l_uri: detachable READABLE_STRING_8
|
||||
l_iri: detachable READABLE_STRING_32
|
||||
do
|
||||
-- Path alias
|
||||
create ti.make ("path_alias")
|
||||
@@ -111,7 +112,8 @@ feature -- Forms ...
|
||||
if attached a_node.link as lnk then
|
||||
l_uri := lnk.location
|
||||
else
|
||||
l_uri := percent_encoder.percent_decoded_string (response.api.location_alias (response.node_api.node_path (a_node)))
|
||||
l_iri := percent_encoder.percent_decoded_string (response.api.location_alias (response.node_api.node_path (a_node)))
|
||||
l_uri := l_iri.to_string_8
|
||||
end
|
||||
ti.set_text_value (l_uri)
|
||||
ti.set_description ("Optionally specify an alternative URL path by which this content can be accessed. For example, type 'about' when writing an about page. Use a relative path or the URL alias won't work.")
|
||||
@@ -151,10 +153,9 @@ feature -- Forms ...
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
update_node (response: NODE_RESPONSE; fd: WSF_FORM_DATA; a_node: CMS_NODE)
|
||||
local
|
||||
b,s: detachable READABLE_STRING_8
|
||||
b,s: detachable READABLE_STRING_32
|
||||
f: detachable CONTENT_FORMAT
|
||||
do
|
||||
if attached fd.integer_item ("id") as l_id and then l_id > 0 then
|
||||
@@ -193,7 +194,7 @@ feature -- Forms ...
|
||||
new_node (response: NODE_RESPONSE; fd: WSF_FORM_DATA; a_node: detachable CMS_NODE): G
|
||||
-- <Precursor>
|
||||
local
|
||||
b,s: detachable READABLE_STRING_8
|
||||
b,s: detachable READABLE_STRING_32
|
||||
f: detachable CONTENT_FORMAT
|
||||
l_node: detachable like new_node
|
||||
do
|
||||
@@ -304,7 +305,7 @@ feature -- Output
|
||||
s.append ("<div class=%"info%"> ")
|
||||
if attached a_node.author as l_author then
|
||||
s.append (" by ")
|
||||
s.append (l_author.name)
|
||||
s.append (a_response.html_encoded (l_author.name))
|
||||
end
|
||||
if attached a_node.modification_date as l_modified then
|
||||
s.append (" (modified: ")
|
||||
@@ -321,9 +322,9 @@ feature -- Output
|
||||
-- if attached a_node.summary as l_summary then
|
||||
-- s.append ("<p class=%"summary%">")
|
||||
-- if attached node_api.cms_api.format (a_node.format) as f then
|
||||
-- s.append (f.formatted_output (l_summary))
|
||||
-- append_formatted_output (l_content, f, s)
|
||||
-- else
|
||||
-- s.append (a_response.formats.default_format.formatted_output (l_summary))
|
||||
-- append_formatted_output (l_content, a_response.formats.default_format, s)
|
||||
-- end
|
||||
|
||||
-- s.append ("</p>")
|
||||
@@ -333,9 +334,9 @@ feature -- Output
|
||||
if attached a_node.content as l_content then
|
||||
s.append ("<p class=%"content%">")
|
||||
if attached node_api.cms_api.format (a_node.format) as f then
|
||||
s.append (f.formatted_output (l_content))
|
||||
append_formatted_output (l_content, f, s)
|
||||
else
|
||||
s.append (a_response.formats.default_format.formatted_output (l_content))
|
||||
append_formatted_output (l_content, a_response.formats.default_format, s)
|
||||
end
|
||||
|
||||
s.append ("</p>")
|
||||
@@ -346,5 +347,15 @@ feature -- Output
|
||||
a_response.set_main_content (s)
|
||||
end
|
||||
|
||||
append_formatted_output (a_content: READABLE_STRING_GENERAL; a_format: CONTENT_FORMAT; a_output: STRING_8)
|
||||
-- Format `a_content' with format `a_format'.
|
||||
do
|
||||
if a_content.is_valid_as_string_8 then
|
||||
a_output.append (a_format.formatted_output (a_content.to_string_8))
|
||||
else
|
||||
a_format.append_formatted_to (a_content, a_output)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
@@ -28,12 +28,12 @@ feature -- Access
|
||||
error_handler.reset
|
||||
write_information_log (generator + ".nodes_count")
|
||||
sql_query (sql_select_nodes_count, Void)
|
||||
if sql_rows_count = 1 then
|
||||
if not has_error and not sql_after then
|
||||
Result := sql_read_natural_64 (1)
|
||||
end
|
||||
sql_finalize
|
||||
end
|
||||
|
||||
|
||||
nodes: LIST [CMS_NODE]
|
||||
-- List of nodes.
|
||||
do
|
||||
@@ -53,6 +53,7 @@ feature -- Access
|
||||
end
|
||||
sql_forth
|
||||
end
|
||||
sql_finalize
|
||||
end
|
||||
|
||||
node_revisions (a_node: CMS_NODE): LIST [CMS_NODE]
|
||||
@@ -80,6 +81,7 @@ feature -- Access
|
||||
end
|
||||
sql_forth
|
||||
end
|
||||
sql_finalize
|
||||
end
|
||||
|
||||
trashed_nodes (a_user: detachable CMS_USER): LIST [CMS_NODE]
|
||||
@@ -109,6 +111,7 @@ feature -- Access
|
||||
end
|
||||
sql_forth
|
||||
end
|
||||
sql_finalize
|
||||
end
|
||||
|
||||
recent_nodes (a_lower: INTEGER; a_count: INTEGER): LIST [CMS_NODE]
|
||||
@@ -135,6 +138,7 @@ feature -- Access
|
||||
end
|
||||
sql_forth
|
||||
end
|
||||
sql_finalize
|
||||
end
|
||||
|
||||
recent_node_changes_before (a_lower: INTEGER; a_count: INTEGER; a_date: DATE_TIME): LIST [CMS_NODE]
|
||||
@@ -163,6 +167,7 @@ feature -- Access
|
||||
end
|
||||
sql_forth
|
||||
end
|
||||
sql_finalize
|
||||
end
|
||||
|
||||
node_by_id (a_id: INTEGER_64): detachable CMS_NODE
|
||||
@@ -175,9 +180,10 @@ feature -- Access
|
||||
create l_parameters.make (1)
|
||||
l_parameters.put (a_id, "nid")
|
||||
sql_query (sql_select_node_by_id, l_parameters)
|
||||
if sql_rows_count = 1 then
|
||||
if not has_error and not sql_after then
|
||||
Result := fetch_node
|
||||
end
|
||||
sql_finalize
|
||||
end
|
||||
|
||||
node_by_id_and_revision (a_node_id, a_revision: INTEGER_64): detachable CMS_NODE
|
||||
@@ -191,9 +197,10 @@ feature -- Access
|
||||
l_parameters.put (a_node_id, "nid")
|
||||
l_parameters.put (a_revision, "revision")
|
||||
sql_query (sql_select_node_by_id_and_revision, l_parameters)
|
||||
if sql_rows_count = 1 then
|
||||
if not has_error and not sql_after then
|
||||
Result := fetch_node
|
||||
end
|
||||
sql_finalize
|
||||
end
|
||||
|
||||
node_author (a_node: CMS_NODE): detachable CMS_USER
|
||||
@@ -207,9 +214,10 @@ feature -- Access
|
||||
l_parameters.put (a_node.id, "nid")
|
||||
l_parameters.put (a_node.revision, "revision")
|
||||
sql_query (Select_user_author, l_parameters)
|
||||
if sql_rows_count >= 1 then
|
||||
if not has_error and not sql_after then
|
||||
Result := fetch_author
|
||||
end
|
||||
sql_finalize
|
||||
end
|
||||
|
||||
last_inserted_node_id: INTEGER_64
|
||||
@@ -218,9 +226,10 @@ feature -- Access
|
||||
error_handler.reset
|
||||
write_information_log (generator + ".last_inserted_node_id")
|
||||
sql_query (Sql_last_insert_node_id, Void)
|
||||
if sql_rows_count = 1 then
|
||||
if not has_error and not sql_after then
|
||||
Result := sql_read_integer_64 (1)
|
||||
end
|
||||
sql_finalize
|
||||
end
|
||||
|
||||
last_inserted_node_revision (a_node: detachable CMS_NODE): INTEGER_64
|
||||
@@ -234,15 +243,20 @@ feature -- Access
|
||||
create l_parameters.make (1)
|
||||
l_parameters.force (a_node.id, "nid")
|
||||
sql_query (Sql_last_insert_node_revision_for_nid, l_parameters)
|
||||
if sql_rows_count = 1 then
|
||||
if not has_error and not sql_after then
|
||||
if sql_item (1) /= Void then
|
||||
Result := sql_read_integer_64 (1)
|
||||
end
|
||||
sql_forth
|
||||
if not sql_after then
|
||||
check no_more_than_one: False end
|
||||
end
|
||||
end
|
||||
sql_finalize
|
||||
end
|
||||
-- if Result = 0 and not has_error then --| include the case a_node = Void
|
||||
-- sql_query (Sql_last_insert_node_revision, Void)
|
||||
-- if sql_rows_count = 1 then
|
||||
-- if not has_error and not sql_after then
|
||||
-- if sql_item (1) /= Void then
|
||||
-- Result := sql_read_integer_64 (1)
|
||||
-- end
|
||||
@@ -275,6 +289,7 @@ feature -- Access: outline
|
||||
end
|
||||
sql_forth
|
||||
end
|
||||
sql_finalize
|
||||
end
|
||||
|
||||
available_parents_for_node (a_node: CMS_NODE): LIST [CMS_NODE]
|
||||
@@ -300,6 +315,7 @@ feature -- Access: outline
|
||||
end
|
||||
sql_forth
|
||||
end
|
||||
sql_finalize
|
||||
end
|
||||
|
||||
feature -- Change: Node
|
||||
@@ -328,7 +344,8 @@ feature -- Change: Node
|
||||
l_parameters.put (create {DATE_TIME}.make_now_utc, "changed")
|
||||
l_parameters.put ({CMS_NODE_API}.trashed, "status")
|
||||
l_parameters.put (a_id, "nid")
|
||||
sql_change (sql_trash_node, l_parameters)
|
||||
sql_modify (sql_trash_node, l_parameters)
|
||||
sql_finalize
|
||||
end
|
||||
|
||||
delete_node_base (a_node: CMS_NODE)
|
||||
@@ -343,11 +360,13 @@ feature -- Change: Node
|
||||
error_handler.reset
|
||||
create l_parameters.make (1)
|
||||
l_parameters.put (a_node.id, "nid")
|
||||
sql_change (sql_delete_node, l_parameters)
|
||||
sql_modify (sql_delete_node, l_parameters)
|
||||
sql_finalize
|
||||
|
||||
-- we remove node_revisions and pages.
|
||||
-- Check: maybe we need a transaction.
|
||||
sql_change (sql_delete_node_revisions, l_parameters)
|
||||
sql_modify (sql_delete_node_revisions, l_parameters)
|
||||
sql_finalize
|
||||
|
||||
if not error_handler.has_error then
|
||||
extended_delete (a_node)
|
||||
@@ -368,7 +387,8 @@ feature -- Change: Node
|
||||
l_parameters.put (l_time, "changed")
|
||||
l_parameters.put ({CMS_NODE_API}.not_published, "status")
|
||||
l_parameters.put (a_id, "nid")
|
||||
sql_change (sql_restore_node, l_parameters)
|
||||
sql_modify (sql_restore_node, l_parameters)
|
||||
sql_finalize
|
||||
end
|
||||
|
||||
|
||||
@@ -412,7 +432,9 @@ feature {NONE} -- Implementation
|
||||
create l_copy_parameters.make (2)
|
||||
l_copy_parameters.force (a_node.id, "nid")
|
||||
-- l_copy_parameters.force (l_rev - 1, "revision")
|
||||
sql_change (sql_copy_node_to_revision, l_copy_parameters)
|
||||
sql_insert (sql_copy_node_to_revision, l_copy_parameters)
|
||||
sql_finalize
|
||||
|
||||
|
||||
if not has_error then
|
||||
a_node.set_revision (l_rev)
|
||||
@@ -420,7 +442,8 @@ feature {NONE} -- Implementation
|
||||
-- Update
|
||||
l_parameters.put (a_node.id, "nid")
|
||||
l_parameters.put (a_node.revision, "revision")
|
||||
sql_change (sql_update_node, l_parameters)
|
||||
sql_modify (sql_update_node, l_parameters)
|
||||
sql_finalize
|
||||
|
||||
if not error_handler.has_error then
|
||||
a_node.set_modification_date (now)
|
||||
@@ -431,7 +454,9 @@ feature {NONE} -- Implementation
|
||||
l_parameters.put (a_node.creation_date, "created")
|
||||
l_parameters.put (l_rev, "revision")
|
||||
|
||||
sql_change (sql_insert_node, l_parameters)
|
||||
sql_insert (sql_insert_node, l_parameters)
|
||||
sql_finalize
|
||||
|
||||
if not error_handler.has_error then
|
||||
a_node.set_modification_date (now)
|
||||
a_node.set_id (last_inserted_node_id)
|
||||
@@ -550,7 +575,7 @@ feature {NONE} -- Implementation
|
||||
if attached sql_read_string_32 (5) as l_summary then
|
||||
Result.set_summary (l_summary)
|
||||
end
|
||||
if attached sql_read_string (6) as l_content then
|
||||
if attached sql_read_string_32 (6) as l_content then
|
||||
Result.set_content (l_content)
|
||||
end
|
||||
if attached sql_read_string (7) as l_format then
|
||||
|
||||
@@ -73,17 +73,18 @@ feature -- Persistence
|
||||
|
||||
if l_update then
|
||||
if l_has_modif then
|
||||
sql_change (sql_update_node_data, l_parameters)
|
||||
sql_modify (sql_update_node_data, l_parameters)
|
||||
end
|
||||
else
|
||||
if l_has_modif then
|
||||
sql_change (sql_insert_node_data, l_parameters)
|
||||
sql_insert (sql_insert_node_data, l_parameters)
|
||||
else
|
||||
-- no page data, means everything is empty.
|
||||
-- FOR NOW: always record row
|
||||
sql_change (sql_insert_node_data, l_parameters)
|
||||
sql_insert (sql_insert_node_data, l_parameters)
|
||||
end
|
||||
end
|
||||
sql_finalize
|
||||
end
|
||||
end
|
||||
|
||||
@@ -121,7 +122,8 @@ feature -- Persistence
|
||||
if a_node.has_id then
|
||||
create l_parameters.make (1)
|
||||
l_parameters.put (a_node.id, "nid")
|
||||
sql_change (sql_delete_node_data, l_parameters)
|
||||
sql_modify (sql_delete_node_data, l_parameters)
|
||||
sql_finalize
|
||||
end
|
||||
end
|
||||
|
||||
@@ -139,14 +141,19 @@ feature {NONE} -- Implementation
|
||||
l_parameters.put (a_node.revision, "revision")
|
||||
sql_query (sql_select_node_data, l_parameters)
|
||||
if not has_error then
|
||||
n := sql_rows_count
|
||||
if n = 1 then
|
||||
if not sql_after then
|
||||
-- nid, revision, parent
|
||||
Result := [sql_read_integer_64 (2), sql_read_integer_64 (3)]
|
||||
sql_forth
|
||||
if not sql_after then
|
||||
check unique_data: n = 0 end
|
||||
Result := Void
|
||||
end
|
||||
else
|
||||
check unique_data: n = 0 end
|
||||
end
|
||||
end
|
||||
sql_finalize
|
||||
ensure
|
||||
accepted_revision: Result /= Void implies Result.revision <= a_node.revision
|
||||
end
|
||||
|
||||
@@ -121,6 +121,7 @@ feature {CMS_API} -- Module management
|
||||
end
|
||||
l_sql_storage.sql_forth
|
||||
end
|
||||
l_sql_storage.sql_finalize
|
||||
across l_consumers as ic loop
|
||||
if not l_sql_storage.sql_table_exists (ic.item) then
|
||||
if attached l_sql_storage.sql_script_content (api.module_resource_location (Current, (create {PATH}.make_from_string ("scripts")).extended ("oauth2_table.sql.tpl"))) as sql then
|
||||
@@ -131,6 +132,7 @@ feature {CMS_API} -- Module management
|
||||
end
|
||||
end
|
||||
end
|
||||
l_sql_storage.sql_finalize
|
||||
Precursor {CMS_MODULE}(api)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -53,11 +53,15 @@ feature -- Access User Outh
|
||||
create l_string.make_from_string (select_user_oauth2_template_by_id)
|
||||
l_string.replace_substring_all ("$table_name", oauth2_sql_table_name (a_consumer))
|
||||
sql_query (l_string, l_parameters)
|
||||
if sql_rows_count = 1 then
|
||||
if not has_error and not sql_after then
|
||||
Result := fetch_user
|
||||
else
|
||||
check no_more_than_one: sql_rows_count = 0 end
|
||||
sql_forth
|
||||
if not sql_after then
|
||||
check no_more_than_one: False end
|
||||
Result := Void
|
||||
end
|
||||
end
|
||||
sql_finalize
|
||||
end
|
||||
|
||||
user_oauth2_by_email (a_email: like {CMS_USER}.email; a_consumer: READABLE_STRING_GENERAL): detachable CMS_USER
|
||||
@@ -73,11 +77,15 @@ feature -- Access User Outh
|
||||
create l_string.make_from_string (select_user_oauth2_template_by_email)
|
||||
l_string.replace_substring_all ("$table_name", oauth2_sql_table_name (a_consumer))
|
||||
sql_query (l_string, l_parameters)
|
||||
if sql_rows_count = 1 then
|
||||
if not has_error and not sql_after then
|
||||
Result := fetch_user
|
||||
else
|
||||
check no_more_than_one: sql_rows_count = 0 end
|
||||
sql_forth
|
||||
if not sql_after then
|
||||
check no_more_than_one: False end
|
||||
Result := Void
|
||||
end
|
||||
end
|
||||
sql_finalize
|
||||
end
|
||||
|
||||
user_oauth2_by_token (a_token: READABLE_STRING_GENERAL; a_consumer: READABLE_STRING_GENERAL): detachable CMS_USER
|
||||
@@ -93,11 +101,15 @@ feature -- Access User Outh
|
||||
create l_string.make_from_string (select_user_by_oauth2_template_token)
|
||||
l_string.replace_substring_all ("$table_name", oauth2_sql_table_name (a_consumer))
|
||||
sql_query (l_string, l_parameters)
|
||||
if sql_rows_count = 1 then
|
||||
if not has_error and not sql_after then
|
||||
Result := fetch_user
|
||||
else
|
||||
check no_more_than_one: sql_rows_count = 0 end
|
||||
sql_forth
|
||||
if not sql_after then
|
||||
check no_more_than_one: False end
|
||||
Result := Void
|
||||
end
|
||||
end
|
||||
sql_finalize
|
||||
end
|
||||
|
||||
|
||||
@@ -122,6 +134,7 @@ feature --Access: Consumers
|
||||
sql_forth
|
||||
end
|
||||
end
|
||||
sql_finalize
|
||||
end
|
||||
|
||||
oauth_consumer_by_name (a_name: READABLE_STRING_8): detachable CMS_OAUTH_20_CONSUMER
|
||||
@@ -134,11 +147,15 @@ feature --Access: Consumers
|
||||
create l_parameters.make (1)
|
||||
l_parameters.put (a_name, "name")
|
||||
sql_query (sql_oauth_consumer_name, l_parameters)
|
||||
if sql_rows_count = 1 then
|
||||
if not has_error and not sql_after then
|
||||
Result := fetch_consumer
|
||||
else
|
||||
check no_more_than_one: sql_rows_count = 0 end
|
||||
sql_forth
|
||||
if not sql_after then
|
||||
check no_more_than_one: False end
|
||||
Result := Void
|
||||
end
|
||||
end
|
||||
sql_finalize
|
||||
end
|
||||
|
||||
oauth_consumer_by_callback (a_callback: READABLE_STRING_8): detachable CMS_OAUTH_20_CONSUMER
|
||||
@@ -151,11 +168,15 @@ feature --Access: Consumers
|
||||
create l_parameters.make (1)
|
||||
l_parameters.put (a_callback, "name")
|
||||
sql_query (sql_oauth_consumer_callback, l_parameters)
|
||||
if sql_rows_count = 1 then
|
||||
if not has_error and not sql_after then
|
||||
Result := fetch_consumer
|
||||
else
|
||||
check no_more_than_one: sql_rows_count = 0 end
|
||||
sql_forth
|
||||
if not sql_after then
|
||||
check no_more_than_one: False end
|
||||
Result := Void
|
||||
end
|
||||
end
|
||||
sql_finalize
|
||||
end
|
||||
|
||||
feature -- Change: User OAuth
|
||||
@@ -181,8 +202,9 @@ feature -- Change: User OAuth
|
||||
|
||||
create l_string.make_from_string (sql_insert_oauth2_template)
|
||||
l_string.replace_substring_all ("$table_name", oauth2_sql_table_name (a_consumer))
|
||||
sql_change (l_string, l_parameters)
|
||||
sql_insert (l_string, l_parameters)
|
||||
sql_commit_transaction
|
||||
sql_finalize
|
||||
end
|
||||
|
||||
update_user_oauth2 (a_token: READABLE_STRING_GENERAL; a_user_profile: READABLE_STRING_32; a_user: CMS_USER; a_consumer: READABLE_STRING_GENERAL )
|
||||
@@ -202,8 +224,9 @@ feature -- Change: User OAuth
|
||||
|
||||
create l_string.make_from_string (sql_update_oauth2_template)
|
||||
l_string.replace_substring_all ("$table_name", oauth2_sql_table_name (a_consumer))
|
||||
sql_change (l_string, l_parameters)
|
||||
sql_modify (l_string, l_parameters)
|
||||
sql_commit_transaction
|
||||
sql_finalize
|
||||
end
|
||||
|
||||
remove_user_oauth2 (a_user: CMS_USER; a_consumer: READABLE_STRING_GENERAL)
|
||||
@@ -221,8 +244,9 @@ feature -- Change: User OAuth
|
||||
|
||||
create l_string.make_from_string (sql_remove_oauth2_template)
|
||||
l_string.replace_substring_all ("$table_name", oauth2_sql_table_name (a_consumer))
|
||||
sql_change (l_string, l_parameters)
|
||||
sql_modify (l_string, l_parameters)
|
||||
sql_commit_transaction
|
||||
sql_finalize
|
||||
end
|
||||
|
||||
feature {NONE} -- Implementation OAuth Consumer
|
||||
@@ -342,7 +366,7 @@ feature {NONE} -- User OAuth2
|
||||
|
||||
Sql_remove_oauth2_template: STRING = "DELETE FROM $table_name WHERE uid =:uid;"
|
||||
|
||||
Sql_oauth_consumers: STRING = "SELECT name FROM oauth2_consumers";
|
||||
Sql_oauth_consumers: STRING = "SELECT name FROM oauth2_consumers;"
|
||||
|
||||
Sql_oauth2_table_prefix: STRING = "oauth2_"
|
||||
|
||||
|
||||
@@ -33,11 +33,15 @@ feature -- Access User Outh
|
||||
l_parameters.put (a_uid, "uid")
|
||||
l_parameters.put (a_identity, "identity")
|
||||
sql_query (Select_user_openid_by_id, l_parameters)
|
||||
if sql_rows_count = 1 then
|
||||
if not has_error and not sql_after then
|
||||
Result := fetch_user
|
||||
else
|
||||
check no_more_than_one: sql_rows_count = 0 end
|
||||
sql_forth
|
||||
if not sql_after then
|
||||
check no_more_than_one: False end
|
||||
Result := Void
|
||||
end
|
||||
end
|
||||
sql_finalize
|
||||
end
|
||||
|
||||
user_openid_by_identity (a_identity: READABLE_STRING_GENERAL): detachable CMS_USER
|
||||
@@ -50,14 +54,19 @@ feature -- Access User Outh
|
||||
create l_parameters.make (1)
|
||||
l_parameters.put (a_identity, "identity")
|
||||
sql_query (Select_user_by_openid_identity, l_parameters)
|
||||
if sql_rows_count = 1 then
|
||||
if not has_error and not sql_after then
|
||||
Result := fetch_user
|
||||
sql_forth
|
||||
if not sql_after then
|
||||
check no_more_than_one: False end
|
||||
Result := Void
|
||||
end
|
||||
else
|
||||
check no_more_than_one: sql_rows_count = 0 end
|
||||
check no_more_than_one: False end
|
||||
end
|
||||
sql_finalize
|
||||
end
|
||||
|
||||
|
||||
feature --Access: Consumers
|
||||
|
||||
openid_consumers: LIST [STRING]
|
||||
@@ -79,6 +88,7 @@ feature --Access: Consumers
|
||||
sql_forth
|
||||
end
|
||||
end
|
||||
sql_finalize
|
||||
end
|
||||
|
||||
openid_consumer_by_name (a_name: READABLE_STRING_8): detachable CMS_OPENID_CONSUMER
|
||||
@@ -91,11 +101,14 @@ feature --Access: Consumers
|
||||
create l_parameters.make (1)
|
||||
l_parameters.put (a_name, "name")
|
||||
sql_query (sql_openid_consumer_name, l_parameters)
|
||||
if sql_rows_count = 1 then
|
||||
if not has_error and not sql_after then
|
||||
Result := fetch_consumer
|
||||
else
|
||||
check no_more_than_one: sql_rows_count = 0 end
|
||||
sql_forth
|
||||
if not sql_after then
|
||||
check no_more_than_one: False end
|
||||
end
|
||||
end
|
||||
sql_finalize
|
||||
end
|
||||
|
||||
feature -- Change: User OAuth
|
||||
@@ -114,8 +127,9 @@ feature -- Change: User OAuth
|
||||
l_parameters.put (a_user.id, "uid")
|
||||
l_parameters.put (a_identity, "identity")
|
||||
l_parameters.put (create {DATE_TIME}.make_now_utc, "utc_date")
|
||||
sql_change (Sql_insert_openid, l_parameters)
|
||||
sql_insert (Sql_insert_openid, l_parameters)
|
||||
sql_commit_transaction
|
||||
sql_finalize
|
||||
end
|
||||
|
||||
feature {NONE} -- Implementation OAuth Consumer
|
||||
|
||||
@@ -70,6 +70,7 @@ feature -- Hook
|
||||
b: CMS_CONTENT_BLOCK
|
||||
s, l_content: STRING
|
||||
gen: FEED_TO_XHTML_VISITOR
|
||||
nb: NATURAL_32
|
||||
do
|
||||
if a_block_id.same_string_general ("recent_changes") then
|
||||
create l_content.make (1024)
|
||||
@@ -81,7 +82,16 @@ feature -- Hook
|
||||
s.append_string ("</li>")
|
||||
gen.set_footer (s)
|
||||
|
||||
recent_changes_feed (a_response, 10, Void).accept (gen)
|
||||
nb := 10
|
||||
if
|
||||
attached a_response.block_options (a_block_id) as l_options and then
|
||||
attached {READABLE_STRING_GENERAL} l_options.item ("size") as l_size and then
|
||||
l_size.is_integer
|
||||
then
|
||||
nb := l_size.to_natural_32
|
||||
end
|
||||
|
||||
recent_changes_feed (a_response, nb, Void).accept (gen)
|
||||
|
||||
create b.make (a_block_id, Void, l_content, Void)
|
||||
a_response.put_block (b, Void, False)
|
||||
|
||||
26
modules/recent_changes/recent_changes.ecf
Normal file
26
modules/recent_changes/recent_changes.ecf
Normal file
@@ -0,0 +1,26 @@
|
||||
<?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="recent_changes" uuid="1C3893A3-46FC-4E60-86AE-37CB7939BC7F" library_target="recent_changes">
|
||||
<target name="recent_changes">
|
||||
<root all_classes="true"/>
|
||||
<file_rule>
|
||||
<exclude>/EIFGENs$</exclude>
|
||||
<exclude>/CVS$</exclude>
|
||||
<exclude>/.svn$</exclude>
|
||||
</file_rule>
|
||||
<option warning="true" void_safety="none" syntax="transitional">
|
||||
<assertions precondition="true" postcondition="true" check="true" invariant="true" loop="true" supplier_precondition="true"/>
|
||||
</option>
|
||||
<library name="base" location="$ISE_LIBRARY\library\base\base.ecf"/>
|
||||
<library name="base_extension" location="$ISE_LIBRARY\library\base_extension\base_extension.ecf"/>
|
||||
<library name="time" location="$ISE_LIBRARY\library\time\time.ecf"/>
|
||||
<library name="cms" location="..\..\cms.ecf"/>
|
||||
<library name="cms_model" location="..\..\library\model\cms_model.ecf" readonly="false"/>
|
||||
<library name="error" location="$ISE_LIBRARY\contrib\library\utility\general\error\error.ecf"/>
|
||||
<library name="feed" location="$ISE_LIBRARY\contrib\library\text\parser\feed\feed.ecf"/>
|
||||
<library name="http" location="$ISE_LIBRARY\contrib\library\network\protocol\http\http.ecf"/>
|
||||
<library name="wsf" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\wsf.ecf"/>
|
||||
<library name="wsf_extension" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\wsf_extension.ecf" readonly="false"/>
|
||||
<library name="wsf_html" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf_html\wsf_html.ecf" readonly="false"/>
|
||||
<cluster name="src" location=".\" recursive="true"/>
|
||||
</target>
|
||||
</system>
|
||||
Reference in New Issue
Block a user