Added notion of author (owner) and editor to allow the editing of node by non owner users.
This commit is contained in:
@@ -201,9 +201,9 @@ feature -- Forms ...
|
||||
s := l_summary
|
||||
end
|
||||
|
||||
if attached fd.string_item ("format") as s_format and then attached response.api.format (s_format) as f_format then
|
||||
if attached fd.string_item ("format") as s_format and then attached cms_api.format (s_format) as f_format then
|
||||
f := f_format
|
||||
elseif a_node /= Void and then attached a_node.format as s_format and then attached response.api.format (s_format) as f_format then
|
||||
elseif a_node /= Void and then attached a_node.format as s_format and then attached cms_api.format (s_format) as f_format then
|
||||
f := f_format
|
||||
else
|
||||
f := cms_api.formats.default_format
|
||||
@@ -214,8 +214,13 @@ feature -- Forms ...
|
||||
a_node.set_content (b, s, f.name)
|
||||
end
|
||||
|
||||
-- Update author
|
||||
a_node.set_author (response.user)
|
||||
-- Update editor, author
|
||||
a_node.set_editor (cms_api.user)
|
||||
if a_node.author = Void then
|
||||
a_node.set_author (cms_api.user)
|
||||
else
|
||||
-- Keep existing author as creator!
|
||||
end
|
||||
end
|
||||
|
||||
new_node (response: NODE_RESPONSE; fd: WSF_FORM_DATA; a_node: detachable CMS_NODE): G
|
||||
@@ -253,7 +258,8 @@ feature -- Forms ...
|
||||
l_node := content_type.new_node_with_title ("...", Void)
|
||||
end
|
||||
end
|
||||
l_node.set_author (response.user)
|
||||
l_node.set_author (cms_api.user)
|
||||
l_node.set_editor (cms_api.user)
|
||||
|
||||
--Summary
|
||||
if attached fd.string_item ("summary") as l_summary then
|
||||
|
||||
@@ -471,6 +471,7 @@ feature -- Form
|
||||
Result := a_content_type.new_node (a_node)
|
||||
end
|
||||
Result.set_author (user)
|
||||
Result.set_editor (user)
|
||||
end
|
||||
|
||||
apply_form_data_to_node (a_content_type: CMS_NODE_TYPE [CMS_NODE]; a_form_data: WSF_FORM_DATA; a_node: CMS_NODE)
|
||||
|
||||
@@ -333,11 +333,20 @@ feature {NONE} -- Trash:Restore
|
||||
b.append (" #")
|
||||
b.append (n.revision.out)
|
||||
b.append (" : ")
|
||||
b.append (n.modification_date.out)
|
||||
b.append (api.formatted_date_time_yyyy_mm_dd__hh_min_ss (n.modification_date))
|
||||
b.append ("</a>")
|
||||
if attached n.author as l_author then
|
||||
b.append (" by ")
|
||||
if attached n.editor as l_editor then
|
||||
if n.revision = 1 then
|
||||
b.append (" created by ")
|
||||
else
|
||||
b.append (" edited by ")
|
||||
end
|
||||
b.append (r.link (r.user_profile_name (l_editor), "user/" + l_editor.id.out, Void))
|
||||
end
|
||||
if attached n.author as l_author and then not l_author.same_as (n.editor) then
|
||||
b.append (" (owner: ")
|
||||
b.append (r.link (r.user_profile_name (l_author), "user/" + l_author.id.out, Void))
|
||||
b.append (")")
|
||||
end
|
||||
if node_api.has_permission_for_action_on_node ("edit revisions", l_node, api.user) then
|
||||
b.append (" (<a href=%"")
|
||||
|
||||
Reference in New Issue
Block a user