Extracted page support from cms_node_module, and add a proper CMS_PAGE_MODULE.
- now, the CMS_PAGE_MODULE has to be declared in the related CMS_SETUP via CMS_EXECUTION. (See demo for example) Improved the export facilities. Implemented blog and page export. Added import facilities. Implemented blog and page import. Improved node revision web interface (allow to edit a past revision, in order to restore it as latest revisionm i.e current). Removed specific tag from blog module, and reuse the taxonomy module for that purpose. Added WIKITEXT module that provide a WIKITEXT_FILTER, so now we can have wikitext content. - for now, no support for wiki links such as [[Foobar]].
This commit is contained in:
@@ -8,6 +8,8 @@ class
|
||||
|
||||
inherit
|
||||
CMS_NODE_TYPE_WEBFORM_MANAGER [CMS_PAGE]
|
||||
rename
|
||||
make as make_for_node
|
||||
redefine
|
||||
content_type,
|
||||
append_content_as_html_to,
|
||||
@@ -19,11 +21,22 @@ inherit
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make (a_type: like content_type; a_page_api: CMS_PAGE_API)
|
||||
do
|
||||
page_api := a_page_api
|
||||
make_for_node (a_type, a_page_api.node_api)
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
content_type: CMS_PAGE_NODE_TYPE
|
||||
-- Associated content type.
|
||||
|
||||
page_api: CMS_PAGE_API
|
||||
-- Associated page API.
|
||||
|
||||
feature -- Forms ...
|
||||
|
||||
populate_form (response: NODE_RESPONSE; f: CMS_FORM; a_node: detachable CMS_NODE)
|
||||
@@ -122,7 +135,7 @@ feature -- Forms ...
|
||||
if
|
||||
nid > 0 and then
|
||||
attached l_node_api.node (nid) as l_node and then
|
||||
l_node_api.is_node_a_parent_of (l_node, l_parent_node)
|
||||
page_api.is_node_a_parent_of (l_node, l_parent_node)
|
||||
then
|
||||
fd.report_invalid_field ("select_parent_node", "Invalid parent due to cycle (node #" + nid.out + " is already a parent of node #" + l_parent_id.out)
|
||||
end
|
||||
@@ -144,7 +157,7 @@ feature -- Output
|
||||
lnk: CMS_LOCAL_LINK
|
||||
do
|
||||
Precursor (a_node, is_teaser, a_output, a_response)
|
||||
|
||||
|
||||
if not is_teaser then
|
||||
l_node_api := node_api
|
||||
if
|
||||
@@ -170,7 +183,7 @@ feature -- Output
|
||||
a_output.append (a_response.link (l_parent_node.title, l_node_api.node_path (l_parent_node), Void))
|
||||
a_output.append ("</li>")
|
||||
end
|
||||
if attached l_node_api.children (a_node) as l_children then
|
||||
if attached page_api.children (a_node) as l_children then
|
||||
across
|
||||
l_children as ic
|
||||
loop
|
||||
|
||||
@@ -30,7 +30,15 @@ feature -- Execution
|
||||
location.ends_with_general ("/edit") and then
|
||||
node_api.has_permission_for_action_on_node ("edit", l_node, user)
|
||||
then
|
||||
edit_node (l_node, l_type, b)
|
||||
if
|
||||
attached {WSF_STRING} request.query_parameter ("revision") as p_rev and then
|
||||
p_rev.value.is_integer_64 and then
|
||||
attached node_api.revision_node (l_node.id, p_rev.value.to_integer_64) as l_rev_node
|
||||
then
|
||||
edit_node (l_rev_node, l_type, l_rev_node.revision < l_node.revision, b)
|
||||
else
|
||||
edit_node (l_node, l_type, False, b)
|
||||
end
|
||||
elseif
|
||||
location.ends_with_general ("/delete") and then
|
||||
node_api.has_permission_for_action_on_node ("delete", l_node, user)
|
||||
@@ -118,12 +126,15 @@ feature {NONE} -- Create a new node
|
||||
end
|
||||
|
||||
|
||||
edit_node (a_node: CMS_NODE; a_type: CMS_NODE_TYPE [CMS_NODE]; b: STRING_8)
|
||||
edit_node (a_node: CMS_NODE; a_type: CMS_NODE_TYPE [CMS_NODE]; is_old_revision: BOOLEAN; b: STRING_8)
|
||||
local
|
||||
f: like new_edit_form
|
||||
fd: detachable WSF_FORM_DATA
|
||||
do
|
||||
f := new_edit_form (A_node, url (location, Void), "edit-" + a_type.name, a_type)
|
||||
if is_old_revision then
|
||||
add_warning_message ("You are editing old revision #" + a_node.revision.out + " !")
|
||||
end
|
||||
api.hooks.invoke_form_alter (f, fd, Current)
|
||||
if request.is_post_request_method then
|
||||
f.validation_actions.extend (agent edit_form_validate (?, b))
|
||||
@@ -135,6 +146,7 @@ feature {NONE} -- Create a new node
|
||||
add_to_menu (node_local_link (a_node, translation ("View", Void)), primary_tabs)
|
||||
add_to_menu (create {CMS_LOCAL_LINK}.make (translation ("Edit", Void), node_api.node_path (a_node) + "/edit"), primary_tabs)
|
||||
add_to_menu (create {CMS_LOCAL_LINK}.make ("Delete", node_api.node_path (a_node) + "/delete"), primary_tabs)
|
||||
add_to_menu (create {CMS_LOCAL_LINK}.make ("Revisions", node_api.node_path (a_node) + "/revision"), primary_tabs)
|
||||
end
|
||||
|
||||
if attached redirection as l_location then
|
||||
|
||||
@@ -122,6 +122,7 @@ feature -- HTTP Methods
|
||||
if
|
||||
l_node /= Void and then
|
||||
l_rev > 0 and then
|
||||
l_rev < l_node.revision and then
|
||||
node_api.has_permission_for_action_on_node ("view revisions", l_node, api.user)
|
||||
then
|
||||
l_node := node_api.revision_node (l_nid, l_rev)
|
||||
@@ -322,7 +323,12 @@ feature {NONE} -- Trash:Restore
|
||||
b.append ("<a href=%"")
|
||||
b.append (r.url (node_api.node_path (n) + "?revision=" + n.revision.out, Void))
|
||||
b.append ("%">")
|
||||
|
||||
if n.revision = l_node.revision then
|
||||
b.append ("Current ")
|
||||
else
|
||||
b.append ("Revision")
|
||||
end
|
||||
b.append (" #")
|
||||
b.append (n.revision.out)
|
||||
b.append (" : ")
|
||||
b.append (n.modification_date.out)
|
||||
@@ -331,6 +337,11 @@ feature {NONE} -- Trash:Restore
|
||||
b.append (" by ")
|
||||
b.append (r.link (l_author.name, "user/" + l_author.id.out, Void))
|
||||
end
|
||||
if node_api.has_permission_for_action_on_node ("edit revisions", l_node, api.user) then
|
||||
b.append (" (<a href=%"")
|
||||
b.append (r.url (node_api.node_path (n) + "/edit?revision=" + n.revision.out, Void))
|
||||
b.append ("%">edit</a>)")
|
||||
end
|
||||
b.append ("</li>")
|
||||
end
|
||||
b.append ("</ul>")
|
||||
|
||||
@@ -38,6 +38,7 @@ feature -- Execution
|
||||
local
|
||||
nid: INTEGER_64
|
||||
l_node: like node
|
||||
l_title: STRING_32
|
||||
do
|
||||
l_node := node
|
||||
if l_node = Void then
|
||||
@@ -62,8 +63,11 @@ feature -- Execution
|
||||
if revision > 0 then
|
||||
add_warning_message ("The revisions let you track differences between multiple versions of a post.")
|
||||
end
|
||||
if l_node /= Void and revision > 0 then
|
||||
set_title ("Revision #" + revision.out + " of " + html_encoded (l_node.title))
|
||||
if l_node /= Void and then revision > 0 and then revision < l_node.revision then
|
||||
create l_title.make_from_string_general ("Revision #" + revision.out + " of %"")
|
||||
l_title.append (l_node.title)
|
||||
l_title.append_character ('"')
|
||||
set_title (l_title)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user