Added support for path_aliases.
Refactored CMS_MODULE.router (..): WSF_ROUTER design, to create only one router object of type CMS_ROUTER. Added optional CMS_NODE.link: CMS_LOCAL_LINK Reviewed permissions related to node module. Refactor and add CMS_STORAGE_SQL(_BUILDER) abstractions for implementation relying only on SQL statements. Factorized sql builder initialization (to work for sqlite and mysql storage builders). Added CMS_RESPONSE.formatted_string (a_text: READABLE_STRING_GENERAL; args: TUPLE): STRING_32 Added function "translation", but not implemented for now. Updated indexing notes and comments. Code cleaning.
This commit is contained in:
@@ -37,12 +37,11 @@ feature {NONE} -- Initialization
|
||||
|
||||
feature -- Access: router
|
||||
|
||||
router (a_api: CMS_API): WSF_ROUTER
|
||||
-- Node router.
|
||||
setup_router (a_router: WSF_ROUTER; a_api: CMS_API)
|
||||
-- <Precursor>
|
||||
do
|
||||
create Result.make (2)
|
||||
configure_api_login (a_api, Result)
|
||||
configure_api_logoff (a_api, Result)
|
||||
configure_api_login (a_api, a_router)
|
||||
configure_api_logoff (a_api, a_router)
|
||||
end
|
||||
|
||||
feature -- Access: filter
|
||||
|
||||
@@ -176,6 +176,14 @@ feature -- URL
|
||||
end
|
||||
end
|
||||
|
||||
node_link (a_node: CMS_NODE): CMS_LOCAL_LINK
|
||||
-- CMS link for node `a_node'.
|
||||
require
|
||||
a_node.has_id
|
||||
do
|
||||
create Result.make (a_node.title, cms_api.path_alias (node_path (a_node)))
|
||||
end
|
||||
|
||||
node_path (a_node: CMS_NODE): STRING
|
||||
-- URI path for node `a_node'.
|
||||
-- using the /node/{nid} url.
|
||||
@@ -234,6 +242,11 @@ feature -- Access: Node
|
||||
Result := a_node
|
||||
end
|
||||
|
||||
-- Update link with aliasing.
|
||||
if a_node /= Void and then a_node.has_id then
|
||||
a_node.set_link (node_link (a_node))
|
||||
end
|
||||
|
||||
-- Update partial user if needed.
|
||||
if
|
||||
Result /= Void and then
|
||||
@@ -259,16 +272,17 @@ feature -- Access: Node
|
||||
|
||||
feature -- Permission Scope: Node
|
||||
|
||||
permission_scope (u: detachable CMS_USER; a_node: CMS_NODE): STRING
|
||||
-- Result 'own' if the user `u' is the owner of the node `a_node', in other case
|
||||
-- `any'.
|
||||
has_permission_for_action_on_node (a_action: READABLE_STRING_8; a_node: CMS_NODE; a_user: detachable CMS_USER; ): BOOLEAN
|
||||
-- Has permission to execute action `a_action' on node `a_node', by eventual user `a_user'?
|
||||
local
|
||||
l_type_name: READABLE_STRING_8
|
||||
do
|
||||
-- FIXME: check if this is ok, since a role may have "any" permission enabled, and "own" disabled,
|
||||
-- in this case, we should check both permissions
|
||||
-- obviously such case should be rare, and look like bad configured permissions, but this may occurs.
|
||||
Result := "any"
|
||||
if u /= Void and then is_author_of_node (u, a_node) then
|
||||
Result := "own"
|
||||
l_type_name := a_node.content_type
|
||||
Result := cms_api.user_has_permission (a_user, a_action + " any " + l_type_name)
|
||||
if not Result and a_user /= Void then
|
||||
if is_author_of_node (a_user, a_node) then
|
||||
Result := cms_api.user_has_permission (a_user, a_action + " own " + l_type_name)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -54,6 +54,7 @@ feature -- Conversion
|
||||
a_node.format
|
||||
)
|
||||
set_status (a_node.status)
|
||||
set_link (a_node.link)
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
@@ -142,6 +143,11 @@ feature -- status report
|
||||
Result := a_content_type.is_case_insensitive_equal (content_type)
|
||||
end
|
||||
|
||||
feature -- Access: menu
|
||||
|
||||
link: detachable CMS_LOCAL_LINK
|
||||
-- Associated menu link.
|
||||
|
||||
feature -- Element change
|
||||
|
||||
set_content (a_content: like content; a_summary: like summary; a_format: like format)
|
||||
@@ -158,6 +164,9 @@ feature -- Element change
|
||||
-- Assign `title' with `a_title'.
|
||||
do
|
||||
title := a_title
|
||||
if attached link as lnk then
|
||||
lnk.set_title (a_title)
|
||||
end
|
||||
ensure
|
||||
title_assigned: title = a_title
|
||||
end
|
||||
@@ -211,6 +220,14 @@ feature -- Element change
|
||||
auther_set: author = u
|
||||
end
|
||||
|
||||
set_link (a_link: like link)
|
||||
-- Set `link' to `a_link'.
|
||||
do
|
||||
link := a_link
|
||||
end
|
||||
|
||||
feature -- Status change
|
||||
|
||||
mark_not_published
|
||||
-- Set status to not_published.
|
||||
do
|
||||
@@ -235,7 +252,6 @@ feature -- Element change
|
||||
status_trash: status = {CMS_NODE_API}.trashed
|
||||
end
|
||||
|
||||
|
||||
feature {CMS_NODE_STORAGE_I} -- Access: status change.
|
||||
|
||||
set_status (a_status: like status)
|
||||
|
||||
@@ -65,6 +65,26 @@ feature -- Forms ...
|
||||
fset.extend (tselect)
|
||||
|
||||
f.extend (fset)
|
||||
|
||||
-- Path aliase
|
||||
create ti.make ("path_alias")
|
||||
ti.set_label ("Path")
|
||||
ti.set_size (70)
|
||||
if a_node /= Void and then a_node.has_id then
|
||||
if attached a_node.link as lnk then
|
||||
ti.set_text_value (lnk.location)
|
||||
else
|
||||
ti.set_text_value (response.api.path_alias (response.node_api.node_path (a_node)))
|
||||
end
|
||||
end
|
||||
if
|
||||
attached f.fields_by_name ("title") as l_title_fields and then
|
||||
attached l_title_fields.first as l_title_field
|
||||
then
|
||||
f.insert_after (ti, l_title_field)
|
||||
else
|
||||
f.extend (ti)
|
||||
end
|
||||
end
|
||||
|
||||
update_node (response: NODE_RESPONSE; fd: WSF_FORM_DATA; a_node: CMS_NODE)
|
||||
@@ -160,8 +180,9 @@ feature -- Output
|
||||
node_api := a_response.node_api
|
||||
|
||||
a_response.add_variable (a_node, "node")
|
||||
create lnk.make ("View", node_api.node_path (a_node))
|
||||
create lnk.make (a_response.translation ("View", Void), a_response.node_local_link (a_node).location)
|
||||
lnk.set_weight (1)
|
||||
|
||||
a_response.add_to_primary_tabs (lnk)
|
||||
create lnk.make ("Edit", node_api.node_path (a_node) + "/edit")
|
||||
lnk.set_weight (2)
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
note
|
||||
description: "Summary description for {CMS_PAGE_NODE_TYPE_WEBFORM_MANAGER}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ feature -- Execution
|
||||
-- Computed response message.
|
||||
local
|
||||
b: STRING_8
|
||||
f: like edit_form
|
||||
f: like new_edit_form
|
||||
fd: detachable WSF_FORM_DATA
|
||||
nid: INTEGER_64
|
||||
do
|
||||
@@ -48,43 +48,44 @@ feature -- Execution
|
||||
attached node_api.node (nid) as l_node
|
||||
then
|
||||
if attached node_api.node_type_for (l_node) as l_type then
|
||||
if has_permission ("edit " + node_api.permission_scope (current_user (request), l_node) + " " + l_type.name) then
|
||||
f := edit_form (l_node, url (request.path_info, Void), "edit-" + l_type.name, l_type)
|
||||
if node_api.has_permission_for_action_on_node ("edit", l_node, current_user (request)) then
|
||||
f := new_edit_form (l_node, url (request.path_info, Void), "edit-" + l_type.name, l_type)
|
||||
invoke_form_alter (f, fd)
|
||||
if request.is_post_request_method then
|
||||
f.validation_actions.extend (agent edit_form_validate (?, b))
|
||||
f.submit_actions.extend (agent edit_form_submit (?, l_node, l_type, b))
|
||||
f.process (Current)
|
||||
fd := f.last_data
|
||||
end
|
||||
if l_node.has_id then
|
||||
add_to_menu (create {CMS_LOCAL_LINK}.make (translation ("View", Void), node_url (l_node)), primary_tabs)
|
||||
add_to_menu (create {CMS_LOCAL_LINK}.make (translation ("Edit", Void), "/node/" + l_node.id.out + "/edit"), primary_tabs)
|
||||
end
|
||||
|
||||
if attached redirection as l_location then
|
||||
-- FIXME: Hack for now
|
||||
set_title (l_node.title)
|
||||
add_to_menu (create {CMS_LOCAL_LINK}.make ("View", node_url (l_node)), primary_tabs)
|
||||
add_to_menu (create {CMS_LOCAL_LINK}.make ("Edit", "/node/" + l_node.id.out + "/edit"), primary_tabs)
|
||||
|
||||
b.append (html_encoded (l_type.title) + " saved")
|
||||
else
|
||||
set_title ("Edit " + html_encoded (l_type.title) + " #" + l_node.id.out)
|
||||
|
||||
add_to_menu (create {CMS_LOCAL_LINK}.make ("View", node_url (l_node)), primary_tabs)
|
||||
add_to_menu (create {CMS_LOCAL_LINK}.make ("Edit", "/node/" + l_node.id.out + "/edit"), primary_tabs)
|
||||
|
||||
set_title (formatted_string (translation ("Edit $1 #$2", Void), [l_type.title, l_node.id]))
|
||||
f.append_to_html (wsf_theme, b)
|
||||
end
|
||||
else
|
||||
b.append ("<h1>Access denied</h1>")
|
||||
b.append ("<h1>")
|
||||
b.append (translation ("Access denied", Void))
|
||||
b.append ("</h1>")
|
||||
end
|
||||
else
|
||||
set_title ("Unknown node")
|
||||
set_title (translation ("Unknown node", Void))
|
||||
end
|
||||
elseif
|
||||
attached {WSF_STRING} request.path_parameter ("type") as p_type and then
|
||||
attached node_api.node_type (p_type.value) as l_type
|
||||
then
|
||||
if has_permission ("create " + l_type.name) then
|
||||
if has_permissions (<<"create any", "create " + l_type.name>>) then
|
||||
if attached l_type.new_node (Void) as l_node then
|
||||
f := edit_form (l_node, url (request.path_info, Void), "edit-" + l_type.name, l_type)
|
||||
f := new_edit_form (l_node, url (request.path_info, Void), "edit-" + l_type.name, l_type)
|
||||
invoke_form_alter (f, fd)
|
||||
if request.is_post_request_method then
|
||||
f.validation_actions.extend (agent edit_form_validate (?, b))
|
||||
f.submit_actions.extend (agent edit_form_submit (?, l_node, l_type, b))
|
||||
@@ -94,25 +95,31 @@ feature -- Execution
|
||||
|
||||
set_title ("Edit " + html_encoded (l_type.title) + " #" + l_node.id.out)
|
||||
|
||||
add_to_menu (create {CMS_LOCAL_LINK}.make ("View", node_url (l_node)), primary_tabs)
|
||||
add_to_menu (create {CMS_LOCAL_LINK}.make ("Edit", "/node/" + l_node.id.out + "/edit"), primary_tabs)
|
||||
if l_node.has_id then
|
||||
add_to_menu (create {CMS_LOCAL_LINK}.make (translation ("View", Void), node_url (l_node)), primary_tabs)
|
||||
add_to_menu (create {CMS_LOCAL_LINK}.make (translation ("Edit", Void), "/node/" + l_node.id.out + "/edit"), primary_tabs)
|
||||
end
|
||||
|
||||
f.append_to_html (wsf_theme, b)
|
||||
else
|
||||
b.append ("<h1>Server error</h1>")
|
||||
b.append ("<h1>")
|
||||
b.append (translation ("Server error", Void))
|
||||
b.append ("</h1>")
|
||||
end
|
||||
else
|
||||
b.append ("<h1>Access denied</h1>")
|
||||
b.append ("<h1>")
|
||||
b.append (translation ("Access denied", Void))
|
||||
b.append ("</h1>")
|
||||
end
|
||||
else
|
||||
set_title ("Create new content ...")
|
||||
set_title (translation ("Create new content ...", Void))
|
||||
b.append ("<ul id=%"content-types%">")
|
||||
across
|
||||
node_api.node_types as ic
|
||||
loop
|
||||
if
|
||||
attached ic.item as l_node_type and then
|
||||
(has_permission ("create any") or has_permission ("create " + l_node_type.name))
|
||||
has_permissions (<<"create any", "create " + l_node_type.name>>)
|
||||
then
|
||||
b.append ("<li>" + link (l_node_type.name, "/node/add/" + l_node_type.name, Void))
|
||||
if attached l_node_type.description as d then
|
||||
@@ -191,16 +198,25 @@ feature -- Form
|
||||
end
|
||||
node_api.save_node (l_node)
|
||||
if attached current_user (request) as u then
|
||||
api.log ("node", "User %"" + user_link (u) + "%" " + s + " node " + link (a_type.name +" #" + l_node.id.out, "/node/" + l_node.id.out , Void), 0, node_local_link (l_node))
|
||||
api.log ("node", "User %"" + user_html_link (u) + "%" " + s + " node " + link (a_type.name +" #" + l_node.id.out, "/node/" + l_node.id.out , Void), 0, node_local_link (l_node))
|
||||
else
|
||||
api.log ("node", "Anonymous " + s + " node " + a_type.name +" #" + l_node.id.out, 0, node_local_link (l_node))
|
||||
end
|
||||
add_success_message ("Node #" + l_node.id.out + " saved.")
|
||||
|
||||
if attached fd.string_item ("path_alias") as l_path_alias then
|
||||
api.set_path_alias (node_api.node_path (l_node), l_path_alias, False)
|
||||
l_node.set_link (create {CMS_LOCAL_LINK}.make (l_node.title, l_path_alias))
|
||||
else
|
||||
l_node.set_link (node_api.node_link (l_node))
|
||||
end
|
||||
|
||||
set_redirection (node_url (l_node))
|
||||
end
|
||||
end
|
||||
|
||||
edit_form (a_node: detachable CMS_NODE; a_url: READABLE_STRING_8; a_name: STRING; a_type: CMS_NODE_TYPE [CMS_NODE]): CMS_FORM
|
||||
new_edit_form (a_node: detachable CMS_NODE; a_url: READABLE_STRING_8; a_name: STRING; a_node_type: CMS_NODE_TYPE [CMS_NODE]): CMS_FORM
|
||||
-- Create a web form named `a_name' for node `a_node' (if set), using form action url `a_url', and for type of node `a_node_type'.
|
||||
local
|
||||
f: CMS_FORM
|
||||
ts: WSF_FORM_SUBMIT_INPUT
|
||||
@@ -216,8 +232,7 @@ feature -- Form
|
||||
end
|
||||
f.extend (th)
|
||||
|
||||
fill_edit_form (a_type, f, a_node)
|
||||
|
||||
populate_form (a_node_type, f, a_node)
|
||||
f.extend_html_text ("<br/>")
|
||||
|
||||
create ts.make ("op")
|
||||
@@ -228,11 +243,15 @@ feature -- Form
|
||||
ts.set_default_value ("Preview")
|
||||
f.extend (ts)
|
||||
|
||||
if a_node /= Void and then a_node.id > 0 and then has_permission ("delete " + a_name) then
|
||||
if
|
||||
a_node /= Void and then
|
||||
a_node.id > 0 and then
|
||||
has_permission ("delete " + a_name)
|
||||
then
|
||||
create ts.make ("op")
|
||||
ts.set_default_value ("Delete")
|
||||
fixme ("[
|
||||
ts.set_default_value (i18n ("Delete"))i18n or other name such as "translated" or "translation
|
||||
ts.set_default_value (translation ("Delete"))
|
||||
]")
|
||||
f.extend (ts)
|
||||
end
|
||||
@@ -240,8 +259,18 @@ feature -- Form
|
||||
Result := f
|
||||
end
|
||||
|
||||
populate_form (a_content_type: CMS_NODE_TYPE [CMS_NODE]; a_form: WSF_FORM; a_node: detachable CMS_NODE)
|
||||
-- Fill the web form `a_form' with data from `a_node' if set,
|
||||
-- and apply this to content type `a_content_type'.
|
||||
do
|
||||
if attached node_api.node_type_webform_manager (a_content_type) as wf then
|
||||
wf.populate_form (Current, a_form, a_node)
|
||||
end
|
||||
end
|
||||
|
||||
new_node (a_content_type: CMS_NODE_TYPE [CMS_NODE]; a_form_data: WSF_FORM_DATA; a_node: detachable CMS_NODE): CMS_NODE
|
||||
--
|
||||
-- Node creation with form_data `a_form_data' for the given content type `a_content_type'
|
||||
-- using optional `a_node' to get extra node data.
|
||||
do
|
||||
if attached node_api.node_type_webform_manager (a_content_type) as wf then
|
||||
Result := wf.new_node (Current, a_form_data, a_node)
|
||||
@@ -258,11 +287,4 @@ feature -- Form
|
||||
end
|
||||
end
|
||||
|
||||
fill_edit_form (a_content_type: CMS_NODE_TYPE [CMS_NODE]; a_form: WSF_FORM; a_node: detachable CMS_NODE)
|
||||
do
|
||||
if attached node_api.node_type_webform_manager (a_content_type) as wf then
|
||||
wf.populate_form (Current, a_form, a_node)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -150,7 +150,7 @@ feature -- HTTP Methods
|
||||
l_id.is_integer and then
|
||||
attached node_api.node (l_id.integer_value) as l_node
|
||||
then
|
||||
if api.user_has_permission (l_user, "delete " + node_api.permission_scope (l_user, l_node) + " " + l_node.content_type) then
|
||||
if node_api.has_permission_for_action_on_node ("delete", l_node, current_user (req)) then
|
||||
node_api.delete_node (l_node)
|
||||
res.send (create {CMS_REDIRECTION_RESPONSE_MESSAGE}.make (req.absolute_script_url ("")))
|
||||
else
|
||||
|
||||
@@ -51,36 +51,48 @@ feature -- Helpers
|
||||
end
|
||||
end
|
||||
|
||||
feature -- Helpers
|
||||
feature -- Helpers: cms link
|
||||
|
||||
user_local_link (u: CMS_USER): CMS_LINK
|
||||
user_local_link (u: CMS_USER): CMS_LOCAL_LINK
|
||||
do
|
||||
create {CMS_LOCAL_LINK} Result.make (u.name, user_url (u))
|
||||
create Result.make (u.name, user_url (u))
|
||||
end
|
||||
|
||||
node_local_link (n: CMS_NODE): CMS_LINK
|
||||
node_local_link (n: CMS_NODE): CMS_LOCAL_LINK
|
||||
do
|
||||
create {CMS_LOCAL_LINK} Result.make (n.title, node_url (n))
|
||||
if attached n.link as lnk then
|
||||
Result := lnk
|
||||
else
|
||||
Result := node_api.node_link (n)
|
||||
end
|
||||
end
|
||||
|
||||
user_link (u: CMS_USER): like link
|
||||
feature -- Helpers: html link
|
||||
|
||||
user_html_link (u: CMS_USER): like link
|
||||
do
|
||||
Result := link (u.name, "/user/" + u.id.out, Void)
|
||||
end
|
||||
|
||||
node_link (n: CMS_NODE): like link
|
||||
node_html_link (n: CMS_NODE): like link
|
||||
do
|
||||
Result := link (n.title, "/node/" + n.id.out, Void)
|
||||
end
|
||||
|
||||
feature -- Helpers: URL
|
||||
|
||||
user_url (u: CMS_USER): like url
|
||||
require
|
||||
u_with_id: u.has_id
|
||||
do
|
||||
Result := url ("/user/" + u.id.out, Void)
|
||||
end
|
||||
|
||||
node_url (n: CMS_NODE): like url
|
||||
require
|
||||
n_with_id: n.has_id
|
||||
do
|
||||
Result := url ("/node/" + n.id.out, Void)
|
||||
Result := url (node_api.node_link (n).location, Void)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -40,6 +40,7 @@ feature -- HTTP Methods
|
||||
l_page: CMS_RESPONSE
|
||||
s: STRING
|
||||
n: CMS_NODE
|
||||
lnk: CMS_LOCAL_LINK
|
||||
do
|
||||
-- At the moment the template is hardcoded, but we can
|
||||
-- get them from the configuration file and load them into
|
||||
@@ -57,8 +58,10 @@ feature -- HTTP Methods
|
||||
lst as ic
|
||||
loop
|
||||
n := ic.item
|
||||
lnk := node_api.node_link (n)
|
||||
s.append ("<li class=%"cms_type_"+ n.content_type +"%">")
|
||||
s.append (l_page.link (n.title + " (#" + n.id.out + ")", node_api.node_path (n), Void))
|
||||
s.append (l_page.link (lnk.title, lnk.location, Void))
|
||||
-- s.append (l_page.link (n.title + " (#" + n.id.out + ")", node_api.node_path (n), Void))
|
||||
s.append ("</li>%N")
|
||||
end
|
||||
s.append ("</ul>%N")
|
||||
|
||||
@@ -109,8 +109,8 @@ feature {CMS_API} -- Access: API
|
||||
|
||||
feature -- Access: router
|
||||
|
||||
router (a_api: CMS_API): WSF_ROUTER
|
||||
-- Node router.
|
||||
setup_router (a_router: WSF_ROUTER; a_api: CMS_API)
|
||||
-- <Precursor>
|
||||
local
|
||||
l_node_api: like node_api
|
||||
do
|
||||
@@ -119,8 +119,7 @@ feature -- Access: router
|
||||
create l_node_api.make (a_api)
|
||||
node_api := l_node_api
|
||||
end
|
||||
create Result.make (2)
|
||||
configure_web (a_api, l_node_api, Result)
|
||||
configure_web (a_api, l_node_api, a_router)
|
||||
end
|
||||
|
||||
configure_web (a_api: CMS_API; a_node_api: CMS_NODE_API; a_router: WSF_ROUTER)
|
||||
|
||||
@@ -107,6 +107,8 @@ feature -- Change: Node
|
||||
no_id: not a_node.has_id
|
||||
valid_user: attached a_node.author as l_author and then l_author.id > 0
|
||||
deferred
|
||||
ensure
|
||||
has_id: a_node.has_id
|
||||
end
|
||||
|
||||
update_node (a_node: CMS_NODE)
|
||||
|
||||
@@ -157,51 +157,6 @@ feature -- Change: Node
|
||||
sql_change (sql_delete_node, l_parameters)
|
||||
end
|
||||
|
||||
-- update_node_title (a_user_id: like {CMS_USER}.id; a_node_id: like {CMS_NODE}.id; a_title: READABLE_STRING_32)
|
||||
-- -- <Precursor>
|
||||
-- local
|
||||
-- l_parameters: STRING_TABLE [detachable ANY]
|
||||
-- do
|
||||
-- -- FIXME: unused a_user_id !
|
||||
-- error_handler.reset
|
||||
-- write_information_log (generator + ".update_node_title")
|
||||
-- create l_parameters.make (3)
|
||||
-- l_parameters.put (a_title, "title")
|
||||
-- l_parameters.put (create {DATE_TIME}.make_now_utc, "changed")
|
||||
-- l_parameters.put (a_node_id, "nid")
|
||||
-- sql_change (sql_update_node_title, l_parameters)
|
||||
-- end
|
||||
|
||||
-- update_node_summary (a_user_id: Like {CMS_USER}.id; a_node_id: like {CMS_NODE}.id; a_summary: READABLE_STRING_32)
|
||||
-- -- <Precursor>
|
||||
-- local
|
||||
-- l_parameters: STRING_TABLE [detachable ANY]
|
||||
-- do
|
||||
-- -- FIXME: unused a_user_id !
|
||||
-- error_handler.reset
|
||||
-- write_information_log (generator + ".update_node_summary")
|
||||
-- create l_parameters.make (3)
|
||||
-- l_parameters.put (a_summary, "summary")
|
||||
-- l_parameters.put (create {DATE_TIME}.make_now_utc, "changed")
|
||||
-- l_parameters.put (a_node_id, "nid")
|
||||
-- sql_change (sql_update_node_summary, l_parameters)
|
||||
-- end
|
||||
|
||||
-- update_node_content (a_user_id: Like {CMS_USER}.id;a_node_id: like {CMS_NODE}.id; a_content: READABLE_STRING_32)
|
||||
-- -- <Precursor>
|
||||
-- local
|
||||
-- l_parameters: STRING_TABLE [detachable ANY]
|
||||
-- do
|
||||
-- -- FIXME: unused a_user_id !
|
||||
-- error_handler.reset
|
||||
-- write_information_log (generator + ".update_node_content")
|
||||
-- create l_parameters.make (3)
|
||||
-- l_parameters.put (a_content, "content")
|
||||
-- l_parameters.put (create {DATE_TIME}.make_now_utc, "changed")
|
||||
-- l_parameters.put (a_node_id, "nid")
|
||||
-- sql_change (sql_update_node_content, l_parameters)
|
||||
-- end
|
||||
|
||||
feature {NONE} -- Implementation
|
||||
|
||||
store_node (a_node: CMS_NODE)
|
||||
@@ -273,9 +228,9 @@ feature {NONE} -- Queries
|
||||
-- SQL Query to retrieve all nodes.
|
||||
--| note: {CMS_NODE_API}.trashed = -1
|
||||
|
||||
sql_select_node_by_id: STRING = "SELECT nid, revision, type, title, summary, content, format, author, publish, created, changed, status FROM Nodes WHERE nid =:nid ORDER BY revision desc, publish desc LIMIT 1;"
|
||||
sql_select_node_by_id: STRING = "SELECT nid, revision, type, title, summary, content, format, author, publish, created, changed, status FROM Nodes WHERE nid =:nid ORDER BY revision DESC, publish DESC LIMIT 1;"
|
||||
|
||||
sql_select_recent_nodes: STRING = "SELECT nid, revision, type, title, summary, content, format, author, publish, created, changed, status FROM Nodes ORDER BY nid desc, publish desc LIMIT :rows OFFSET :offset ;"
|
||||
sql_select_recent_nodes: STRING = "SELECT nid, revision, type, title, summary, content, format, author, publish, created, changed, status FROM Nodes ORDER BY nid DESC, publish DESC LIMIT :rows OFFSET :offset ;"
|
||||
|
||||
sql_insert_node: STRING = "INSERT INTO nodes (revision, type, title, summary, content, format, publish, created, changed, status, author) VALUES (1, :type, :title, :summary, :content, :format, :publish, :created, :changed, :status, :author);"
|
||||
-- SQL Insert to add a new node.
|
||||
|
||||
Reference in New Issue
Block a user