Updated code based on Jocelyn suggestions.

This commit is contained in:
jvelilla
2015-05-15 09:40:18 -03:00
parent 9fbadac7ac
commit 1c59a65983
5 changed files with 18 additions and 18 deletions

View File

@@ -217,7 +217,7 @@ feature -- Access: Node
-- List of nodes with status in {CMS_NODE_API}.trashed. -- List of nodes with status in {CMS_NODE_API}.trashed.
-- if the current user is admin, it will retrieve all the trashed nodes -- if the current user is admin, it will retrieve all the trashed nodes
do do
Result := node_storage.trash_nodes (a_user.id) Result := node_storage.trashed_nodes (a_user.id)
end end
recent_nodes (a_offset, a_rows: INTEGER): LIST [CMS_NODE] recent_nodes (a_offset, a_rows: INTEGER): LIST [CMS_NODE]
@@ -332,11 +332,11 @@ feature -- Change: Node
end end
revert_node (a_node: CMS_NODE) restore_node (a_node: CMS_NODE)
-- Revert node `a_node'. -- Restore node `a_node'.
-- From {CMS_NODE_API}.trashed to {CMS_NODE_API}.not_published. -- From {CMS_NODE_API}.trashed to {CMS_NODE_API}.not_published.
do do
node_storage.revert_node (a_node) node_storage.restore_node (a_node)
end end

View File

@@ -233,7 +233,7 @@ feature {NONE} -- Trash:Revert
attached node_api.node (l_id.integer_value) as l_node attached node_api.node (l_id.integer_value) as l_node
then then
if node_api.has_permission_for_action_on_node ("trash", l_node, current_user (req)) then if node_api.has_permission_for_action_on_node ("trash", l_node, current_user (req)) then
node_api.revert_node (l_node) node_api.restore_node (l_node)
res.send (create {CMS_REDIRECTION_RESPONSE_MESSAGE}.make (req.absolute_script_url (""))) res.send (create {CMS_REDIRECTION_RESPONSE_MESSAGE}.make (req.absolute_script_url ("")))
else else
send_access_denied (req, res) send_access_denied (req, res)

View File

@@ -70,7 +70,7 @@ feature -- Access
deferred deferred
end end
trash_nodes (a_user_id: INTEGER_64): LIST [CMS_NODE] trashed_nodes (a_user_id: INTEGER_64): LIST [CMS_NODE]
-- List of nodes by user `a_user_id'. -- List of nodes by user `a_user_id'.
deferred deferred
end end
@@ -148,11 +148,11 @@ feature -- Change: Node
end end
end end
revert_node (a_node: CMS_NODE) restore_node (a_node: CMS_NODE)
-- Revert `a_node'. -- Restore `a_node'.
do do
if a_node.has_id then if a_node.has_id then
revert_node_by_id (a_node.id) restore_node_by_id (a_node.id)
end end
end end
@@ -163,8 +163,8 @@ feature -- Change: Node
deferred deferred
end end
revert_node_by_id (a_id: INTEGER_64) restore_node_by_id (a_id: INTEGER_64)
-- Revert node by id `a_id'. -- Restore node by id `a_id'.
require require
valid_node_id: a_id > 0 valid_node_id: a_id > 0
deferred deferred

View File

@@ -41,7 +41,7 @@ feature -- Access: node
create {ARRAYED_LIST [CMS_NODE]} Result.make (0) create {ARRAYED_LIST [CMS_NODE]} Result.make (0)
end end
trash_nodes (a_user_id: INTEGER_64): LIST [CMS_NODE] trashed_nodes (a_user_id: INTEGER_64): LIST [CMS_NODE]
-- List of nodes by user `a_user_id'. -- List of nodes by user `a_user_id'.
do do
create {ARRAYED_LIST [CMS_NODE]} Result.make (0) create {ARRAYED_LIST [CMS_NODE]} Result.make (0)
@@ -91,7 +91,7 @@ feature -- Node
do do
end end
revert_node_by_id (a_id: INTEGER_64) restore_node_by_id (a_id: INTEGER_64)
-- <Precursor> -- <Precursor>
do do
end end

View File

@@ -59,7 +59,7 @@ feature -- Access
-- end -- end
end end
trash_nodes (a_user_id: INTEGER_64): LIST [CMS_NODE] trashed_nodes (a_user_id: INTEGER_64): LIST [CMS_NODE]
-- List of nodes. -- List of nodes.
local local
l_parameters: STRING_TABLE [detachable ANY] l_parameters: STRING_TABLE [detachable ANY]
@@ -203,7 +203,7 @@ feature -- Change: Node
sql_change (sql_trash_node, l_parameters) sql_change (sql_trash_node, l_parameters)
end end
revert_node_by_id (a_id: INTEGER_64) restore_node_by_id (a_id: INTEGER_64)
-- <Precursor> -- <Precursor>
local local
l_parameters: STRING_TABLE [ANY] l_parameters: STRING_TABLE [ANY]
@@ -217,7 +217,7 @@ feature -- Change: Node
l_parameters.put (l_time, "changed") l_parameters.put (l_time, "changed")
l_parameters.put ({CMS_NODE_API}.not_published, "status") l_parameters.put ({CMS_NODE_API}.not_published, "status")
l_parameters.put (a_id, "nid") l_parameters.put (a_id, "nid")
sql_change (sql_revert_node, l_parameters) sql_change (sql_restore_node, l_parameters)
end end
@@ -315,10 +315,10 @@ feature {NONE} -- Queries
sql_delete_node: STRING = "UPDATE nodes SET changed=:changed, status =:status WHERE nid=:nid" sql_delete_node: STRING = "UPDATE nodes SET changed=:changed, status =:status WHERE nid=:nid"
-- Soft deletion with free metadata. -- Soft deletion with free metadata.
sql_trash_node: STRING = "DELETE FROM NODES WHERE nid=:nid" sql_trash_node: STRING = "DELETE FROM nodes WHERE nid=:nid"
-- Physical deletion with free metadata. -- Physical deletion with free metadata.
sql_revert_node: STRING = "UPDATE nodes SET changed=:changed, status =:status WHERE nid=:nid" sql_restore_node: STRING = "UPDATE nodes SET changed=:changed, status =:status WHERE nid=:nid"
-- Revert node to {CMS_NODE_API}.not_publised. -- Revert node to {CMS_NODE_API}.not_publised.
-- sql_update_node_author: STRING = "UPDATE nodes SET author=:author WHERE nid=:nid;" -- sql_update_node_author: STRING = "UPDATE nodes SET author=:author WHERE nid=:nid;"