Compare commits

...

24 Commits

Author SHA1 Message Date
ec53a2682b Updated notification mailer, to always store output messages.
Fixed CMS_RESPONSE, and specific error response, to return expected status code.
2015-09-28 10:47:57 +02:00
jvelilla
7b2e6ab7b4 Merge branch 'jvelilla-roc_jv_issues' 2015-09-15 14:35:35 -03:00
jvelilla
87f4de1264 Merge branch 'roc_jv_issues' of https://github.com/jvelilla/ROC into roc_jv_issues 2015-09-15 14:30:02 -03:00
jvelilla
ed614a662c Updated CMS node and blog to remove extension data.
Comments: minor update.

Updated CMS_NODE_STORAGE_I API.
Delete a node using a node as formal parameter instead of node id.
Clean code and update log information.

Added precondition to delete node to accept nodes with a valid a id.

Added missing assertions tag names.
2015-09-15 14:28:33 -03:00
jvelilla
d54ad59e5f Added missing assertions tag names. 2015-09-15 14:10:51 -03:00
jvelilla
9173ef2ded Added precondition to delete node to accept nodes with a valid a id. 2015-09-15 11:40:13 -03:00
jvelilla
ad9e908dc2 Updated CMS_NODE_STORAGE_I API.
Delete a node using a node as formal parameter instead of node id.
Clean code and update log information.
2015-09-15 10:42:30 -03:00
jvelilla
4584917877 Comments: minor update. 2015-09-15 09:02:38 -03:00
jvelilla
f7d68d09e4 Updated CMS node and blog to remove extension data. 2015-09-15 08:54:43 -03:00
f9ecd4956f Keep the until date in the form data, so that new filter will remember the until date. 2015-09-09 23:12:52 +02:00
18e159ad3c Simplified the add child mechanism, by using a query parameter ?parent=nid
(instead of specific node/{nid}/add_child/page url)
Fixed implementation of `CMS_NODE_API.is_node_a_parent_of (..)',
  and improved parent validity checking against cycle.
2015-09-09 23:04:08 +02:00
438259033a Renamed link "Trash" to "Move to trash". 2015-09-09 22:10:13 +02:00
62e74ea6cd Refactor notion of trash and delete.
- Trash a node now does a soft delete (move to trash container).
 - Delete a node now remove it from the storage (no undo).

Signed-off-by: jvelilla <javier.hector@gmail.com>
2015-09-09 22:05:23 +02:00
32a409b7e9 Refactored add child feature, to have all the page specific code in CMS_PAGE_NODE_TYPE_WEBFORM_MANAGER (and not in the general node code).
Note that ideally PAGE could be a separated page node module (as it is for blog).
Added listing of children for each "page".
2015-09-09 21:58:16 +02:00
jvelilla
eb70af6f19 CMS_NODE_API.available_parents_for_node
- Fixed comment.
     - added check to know if there are potencial cycles
     - added postcondition to ensure the list of potencial parent will not produce a cycle.

CMS_PAGE_NODE_TYPE_WEBFORM_MANAGER.update_node
     - Updated code to handle unassing parent from a node when the user
     - submit a -1 value.

NODE_FORM_RESPONSE.edit_form_validation
      - Added validation for node_parent, check if the input is valid and then
      - if exist a valid node in the list of available parents for the current node.

Signed-off-by: jvelilla <javier.hector@gmail.com>
2015-09-09 16:53:37 +02:00
5f4eb2cf10 Correct implementation of node extension save operation. 2015-09-08 20:44:00 +02:00
88bc52fffb Updated roc script, install module for the examples, and updated demo site folder. 2015-09-08 16:03:36 +02:00
jvelilla
544e6540ed Add child page support.
- Add support to create a new node as a child of an existing node.
   - Update or add a parent for a given node.
Fix delete and trash behavior: when a node is not published only the
   - author or admin see it.

Fix Node and Page node Revisions.
2015-09-08 15:57:17 +02:00
2431d7af6c Improved the recent changes modules:
- extracted from populate_recent_changes, the recent_changes_sources that enables to filter early.
Added author_name to the CMS_RECENT_CHANGE_ITEM to support author which is not related to any CMS_USER.
Implemented the simple filtering on source and add parameters size and date.
2015-09-03 14:47:17 +02:00
jvelilla
0d55bd67a2 Updated Basic Auth Module: remove the escaping from the logout message 2015-09-01 12:56:26 -03:00
jvelilla
e1727cc445 Merge branch 'jvelilla-roc_logout' 2015-09-01 11:50:37 -03:00
jvelilla
634a078282 Updated Loging form:
Display invalid credentials message inside the primary-tabs div.
Added support to submit the form using <Enter>.
2015-09-01 11:41:50 -03:00
jvelilla
2f65a084ac Updated logout message. Change message and added a div to make it easier style the site 2015-09-01 11:15:25 -03:00
jvelilla
13df6fd593 Added Logout message 2015-09-01 10:55:28 -03:00
38 changed files with 828 additions and 380 deletions

View File

@@ -1,9 +1,12 @@
setlocal
set ROC_CMD=%~dp0..\..\tools\roc.exe
set ROC_CMD=call %~dp0..\..\tools\roc.bat
set ROC_CMS_DIR=%~dp0
%ROC_CMD% install --module ..\..\modules\admin --dir %ROC_CMS_DIR%
%ROC_CMD% install --module ..\..\modules\auth --dir %ROC_CMS_DIR%
%ROC_CMD% install --module ..\..\modules\basic_auth --dir %ROC_CMS_DIR%
%ROC_CMD% install --module ..\..\modules\node --dir %ROC_CMS_DIR%
%ROC_CMD% install --module ..\..\modules\blog --dir %ROC_CMS_DIR%
%ROC_CMD% install --module ..\..\modules\node --dir %ROC_CMS_DIR%
%ROC_CMD% install --module ..\..\modules\oauth20 --dir %ROC_CMS_DIR%
%ROC_CMD% install --module ..\..\modules\openid --dir %ROC_CMS_DIR%
%ROC_CMD% install --module ..\..\modules\recent_changes --dir %ROC_CMS_DIR%

View File

@@ -8,10 +8,10 @@
</head>
<body>
<p>You have required a new password at <a href="...">ROC CMS</a></p>
<p>You have required a new password at <a href="$host">ROC CMS</a></p>
<p>To complete your request, please click on this link to genereate a new password:<p>
<p><a href="$link">$link</a></p>
</body>
</html>
</html>

View File

@@ -8,11 +8,11 @@
</head>
<body>
<p>You have request a new activation token at<a href="...">ROC CMS</a></p>
<p>You have request a new activation token at <a href="$host">ROC CMS</a></p>
<p>To complete your registration, please click on this link to activate your account:<p>
<p><a href="$link">$link</a></p>
<p>Thank you for joining us.</p>
</body>
</html>
</html>

View File

@@ -7,7 +7,7 @@
<meta name="author" content="ROC CMS">
</head>
<body>
<p>Welcome to<a href="...">ROC CMS</a></p>
<p>Welcome to<a href="$host">ROC CMS</a></p>
<p>Thank you for joining us.</p>
</body>
</html>
</html>

View File

@@ -25,5 +25,5 @@
</p>
</div>
</div>
{/unless}
</div>
{/unless}
</div>

View File

@@ -25,7 +25,7 @@ ROC_AUTH.login = function() {
var newdiv = document.createElement('div');
newdiv.innerHTML = "<br>Invalid Credentials</br>";
newdiv.id = 'myModalFormId';
$("body").append(newdiv);
$(".primary-tabs").append(newdiv);
}
}else{
@@ -49,7 +49,7 @@ ROC_AUTH.login = function() {
var newdiv = document.createElement('div');
newdiv.innerHTML = "<br>Invalid Credentials</br>";
newdiv.id = 'myModalFormId';
$("body").append(newdiv);
$(".primary-tabs").append(newdiv);
}
}
@@ -93,7 +93,7 @@ ROC_AUTH.login_with_redirect = function() {
var newdiv = document.createElement('div');
newdiv.innerHTML = "<br>Invalid Credentials</br>";
newdiv.id = 'myModalFormId';
$("body").append(newdiv);
$(".primary-tabs").append(newdiv);
$("#imgProgressRedirect").hide();
}
}else{
@@ -122,8 +122,8 @@ ROC_AUTH.login_with_redirect = function() {
var newdiv = document.createElement('div');
newdiv.innerHTML = "<br>Invalid Credentials</br>";
newdiv.id = 'myModalFormId';
$("body").append(newdiv);
$("#imgProgressRedirect").hide();
$(".primary-tabs").append(newdiv);
$("#imgProgressRedirect").hide();
}
}

View File

@@ -5,12 +5,12 @@
<div>
<form name="cms_basic_auth" action method="POST">
<div>
<input type="text" name="username" required>
<input type="text" name="username" id="username" required>
<label>Username</label>
</div>
<div>
<input type="password" name="password" required>
<input type="password" name="password" id="password" required>
<label>Password</label>
</div>
@@ -25,10 +25,5 @@
</p>
</div>
</div>
<div>
{foreach item="item" from="$oauth_consumers"}
<a href="{$site_url/}account/login-with-oauth/{$item/}">Login with {$item/}</a><br>
{/foreach}
</div>
{/unless}
</div>

View File

@@ -28,7 +28,6 @@ feature {NONE} -- Initialization
-- Initialize service.
do
admin_email := parameters.admin_email
create {NOTIFICATION_SMTP_MAILER} mailer.make (parameters.smtp_server)
set_successful
end

View File

@@ -47,6 +47,7 @@ feature -- HTTP Methods
l_page: CMS_RESPONSE
l_url: STRING
i: INTEGER
l_message: STRING
do
api.logger.put_information (generator + ".do_get Processing basic auth logoff", Void)
if attached req.query_parameter ("prompt") as l_prompt then
@@ -72,6 +73,10 @@ feature -- HTTP Methods
l_page.set_status_code ({HTTP_STATUS_CODE}.found)
l_page.set_redirection (l_url)
end
create l_message.make_from_string (logout_message)
l_message.replace_substring_all ("$site_login", req.absolute_script_url ("/account/roc-login"))
l_message.replace_substring_all ("$site_home", req.absolute_script_url (""))
l_page.set_main_content (l_message)
l_page.execute
end
end
@@ -113,4 +118,15 @@ feature -- HTTP Methods
end
end
feature {NONE}-- Lougout Message
logout_message: STRING = "[
<div class="cms-logout-message">
<h2>You are now signed out</h2>
<p>You can <a href="$site_login">log</a> in again, or go to the <a href="$site_home">front page</a>.</p>
</div>
]"
end

View File

@@ -25,7 +25,7 @@ ROC_AUTH.login = function() {
var newdiv = document.createElement('div');
newdiv.innerHTML = "<br>Invalid Credentials</br>";
newdiv.id = 'myModalFormId';
$("body").append(newdiv);
$(".primary-tabs").append(newdiv);
}
}else{
@@ -49,7 +49,7 @@ ROC_AUTH.login = function() {
var newdiv = document.createElement('div');
newdiv.innerHTML = "<br>Invalid Credentials</br>";
newdiv.id = 'myModalFormId';
$("body").append(newdiv);
$(".primary-tabs").append(newdiv);
}
}
@@ -93,7 +93,7 @@ ROC_AUTH.login_with_redirect = function() {
var newdiv = document.createElement('div');
newdiv.innerHTML = "<br>Invalid Credentials</br>";
newdiv.id = 'myModalFormId';
$("body").append(newdiv);
$(".primary-tabs").append(newdiv);
$("#imgProgressRedirect").hide();
}
}else{
@@ -122,8 +122,8 @@ ROC_AUTH.login_with_redirect = function() {
var newdiv = document.createElement('div');
newdiv.innerHTML = "<br>Invalid Credentials</br>";
newdiv.id = 'myModalFormId';
$("body").append(newdiv);
$("#imgProgressRedirect").hide();
$(".primary-tabs").append(newdiv);
$("#imgProgressRedirect").hide();
}
}

View File

@@ -5,12 +5,12 @@
<div>
<form name="cms_basic_auth" action method="POST">
<div>
<input type="text" name="username" required>
<input type="text" name="username" id="username" required>
<label>Username</label>
</div>
<div>
<input type="password" name="password" required>
<input type="password" name="password" id="password" required>
<label>Password</label>
</div>

View File

@@ -108,6 +108,18 @@ feature -- Persistence
end
end
delete_node (a_node: CMS_BLOG)
-- <Precursor>
local
l_parameters: STRING_TABLE [ANY]
do
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)
end
end
feature {NONE} -- Implementation
node_data (a_node: CMS_NODE): detachable TUPLE [revision: INTEGER_64; tags: READABLE_STRING_32]
@@ -136,12 +148,15 @@ feature {NONE} -- Implementation
check unique_data: n = 0 end
end
end
ensure
accepted_revision: Result /= Void implies Result.revision <= a_node.revision
end
feature -- SQL
sql_select_node_data: STRING = "SELECT nid, revision, tags FROM blog_post_nodes WHERE nid =:nid AND revision<=:revision ORDER BY revision DESC LIMIT 1;"
sql_select_node_data: STRING = "SELECT nid, revision, tags FROM blog_post_nodes WHERE nid=:nid AND revision<=:revision ORDER BY revision DESC LIMIT 1;"
sql_insert_node_data: STRING = "INSERT INTO blog_post_nodes (nid, revision, tags) VALUES (:nid, :revision, :tags);"
sql_update_node_data: STRING = "UPDATE blog_post_nodes SET nid=:nid, revision=:revision, tags=:tags WHERE nid=:nid AND revision=:revision;"
sql_delete_node_data: STRING = "DELETE FROM blog_post_nodes WHERE nid=:nid;"
end

View File

@@ -281,14 +281,17 @@ feature -- Access: Node
else
Result := l_partial_node
end
-- Update link with aliasing.
if Result /= Void and then Result.has_id then
Result.set_link (node_link (Result))
end
else
Result := a_node
if Result.has_id and Result.link = Void then
Result.set_link (node_link (Result))
end
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
check has_link: Result.has_id implies attached Result.link as lnk and then lnk.location.same_string (node_link (Result).location) end
-- Update partial user if needed.
if
@@ -327,6 +330,47 @@ feature -- Access: Node
end
end
feature -- Access: page/book outline
children (a_node: CMS_NODE): detachable LIST [CMS_NODE]
-- Children of node `a_node'.
-- note: this is the partial version of the nodes.
do
Result := node_storage.children (a_node)
end
available_parents_for_node (a_node: CMS_NODE): LIST [CMS_NODE]
-- Potential parent nodes for node `a_node'.
-- Ensure no cycle exists.
do
create {ARRAYED_LIST [CMS_NODE]} Result.make (0)
across node_storage.available_parents_for_node (a_node) as ic loop
check distinct: not a_node.same_node (ic.item) end
if not is_node_a_parent_of (a_node, ic.item) then
Result.force (ic.item)
end
end
ensure
no_cycle: across Result as c all not is_node_a_parent_of (a_node, c.item) end
end
is_node_a_parent_of (a_node: CMS_NODE; a_child: CMS_NODE): BOOLEAN
-- Is `a_node' a direct or indirect parent of node `a_child'?
require
distinct_nodes: not a_node.same_node (a_child)
do
if
attached {CMS_PAGE} full_node (a_child) as l_child_page and then
attached l_child_page.parent as l_parent
then
if l_parent.same_node (a_node) then
Result := True
else
Result := is_node_a_parent_of (a_node, l_parent)
end
end
end
feature -- Permission Scope: Node
has_permission_for_action_on_node (a_action: READABLE_STRING_8; a_node: CMS_NODE; a_user: detachable CMS_USER; ): BOOLEAN
@@ -365,6 +409,7 @@ feature -- Change: Node
delete_node (a_node: CMS_NODE)
-- Delete `a_node'.
--! remove the node from the storage.
do
reset_error
if a_node.has_id then
@@ -383,7 +428,7 @@ feature -- Change: Node
trash_node (a_node: CMS_NODE)
-- Trash node `a_node'.
--! remove the node from the storage.
-- Soft delete
do
reset_error
node_storage.trash_node (a_node)

View File

@@ -170,6 +170,8 @@ feature -- Access
Result.force ("trash own " + l_type_name)
Result.force ("restore own " + l_type_name)
Result.force ("view unpublished " + l_type_name)
Result.force ("view revisions own " + l_type_name)
end
end
@@ -280,7 +282,27 @@ feature -- Hooks
end
end
populate_recent_changes (a_changes: CMS_RECENT_CHANGE_CONTAINER; a_sources: LIST [READABLE_STRING_8])
recent_changes_sources: detachable LIST [READABLE_STRING_8]
-- <Precursor>
local
lst: ARRAYED_LIST [READABLE_STRING_8]
do
if
attached node_api as l_node_api and then
attached l_node_api.content_types as l_types and then
not l_types.is_empty
then
create lst.make (l_types.count)
across
l_types as ic
loop
lst.force (ic.item.name)
end
Result := lst
end
end
populate_recent_changes (a_changes: CMS_RECENT_CHANGE_CONTAINER; a_current_user: detachable CMS_USER)
local
params: CMS_DATA_QUERY_PARAMETERS
ch: CMS_RECENT_CHANGE_ITEM
@@ -288,43 +310,44 @@ feature -- Hooks
l_info: STRING_8
l_src: detachable READABLE_STRING_8
l_nodes: ITERABLE [CMS_NODE]
l_date: detachable DATE_TIME
do
create params.make (0, a_changes.limit)
if attached node_api as l_node_api then
across
l_node_api.content_types as ic
loop
a_sources.force (ic.item.name)
end
l_src := a_changes.source
if attached a_changes.date as l_date then
l_nodes := l_node_api.recent_node_changes_before (params, l_date)
else
l_nodes := l_node_api.recent_node_changes_before (params, create {DATE_TIME}.make_now_utc)
l_date := a_changes.date
if l_date = Void then
create l_date.make_now_utc
end
l_nodes := l_node_api.recent_node_changes_before (params, l_date)
across l_nodes as ic loop
n := ic.item
if l_src = Void or else l_src.is_case_insensitive_equal_general (n.content_type) then
n := l_node_api.full_node (n)
create ch.make (n.content_type, create {CMS_LOCAL_LINK}.make (n.title, "node/" + n.id.out), n.modification_date)
if n.creation_date ~ n.modification_date then
l_info := "new"
if not n.is_published then
l_info.append (" (unpublished)")
end
else
if n.is_trashed then
l_info := "deleted"
else
l_info := "updated"
if l_node_api.has_permission_for_action_on_node ("view", n, a_current_user) then
n := l_node_api.full_node (n)
create ch.make (n.content_type, create {CMS_LOCAL_LINK}.make (n.title, "node/" + n.id.out), n.modification_date)
if n.creation_date ~ n.modification_date then
l_info := "new"
if not n.is_published then
l_info.append (" (unpublished)")
end
else
if n.is_trashed then
l_info := "deleted"
else
l_info := "updated"
if not n.is_published then
l_info.append (" (unpublished)")
end
end
end
ch.set_information (l_info)
ch.set_author (n.author)
a_changes.force (ch)
else
-- Forbidden
-- FIXME: provide a visual indication!
end
ch.set_information (l_info)
ch.set_author (n.author)
a_changes.force (ch)
end
end
end

View File

@@ -10,7 +10,7 @@ deferred class
CMS_NODE
inherit
DEBUG_OUTPUT
REFACTORING_HELPER
feature{NONE} -- Initialization
@@ -166,6 +166,23 @@ feature -- Access: menu
link: detachable CMS_LOCAL_LINK
-- Associated menu link.
feature -- Status report
debug_output: STRING_32
-- <Precursor>
do
create Result.make_from_string_general ("#")
Result.append_integer_64 (id)
Result.append_character (' ')
Result.append_character ('<')
Result.append_string_general (content_type)
Result.append_character ('>')
Result.append_character (' ')
Result.append_character ('%"')
Result.append (title)
Result.append_character ('%"')
end
feature -- Element change
set_content (a_content: like content; a_summary: like summary; a_format: like format)

View File

@@ -274,10 +274,10 @@ feature -- Output
if a_node.status = {CMS_NODE_API}.trashed then
create lnk.make ("Trash", node_api.node_path (a_node) + "/trash")
create lnk.make ("Delete", node_api.node_path (a_node) + "/delete")
lnk.set_weight (2)
a_response.add_to_primary_tabs (lnk)
elseif a_node /= Void and then a_node.has_id then
elseif a_node.has_id then
-- Node in {{CMS_NODE_API}.published} or {CMS_NODE_API}.not_published} status.
create lnk.make ("Edit", node_api.node_path (a_node) + "/edit")
lnk.set_weight (2)
@@ -291,9 +291,9 @@ feature -- Output
end
if
node_api.has_permission_for_action_on_node ("delete", a_node, l_user)
node_api.has_permission_for_action_on_node ("trash", a_node, l_user)
then
create lnk.make ("Delete", node_api.node_path (a_node) + "/delete")
create lnk.make ("Move to trash", node_api.node_path (a_node) + "/trash")
lnk.set_weight (3)
a_response.add_to_primary_tabs (lnk)
end

View File

@@ -10,7 +10,10 @@ inherit
CMS_NODE_TYPE_WEBFORM_MANAGER [CMS_PAGE]
redefine
content_type,
append_html_output_to
append_html_output_to,
populate_form,
new_node,
update_node
end
create
@@ -21,140 +24,116 @@ feature -- Access
content_type: CMS_PAGE_NODE_TYPE
-- Associated content type.
feature -- Forms ...
feature -- Forms ...
-- fill_edit_form (response: NODE_RESPONSE; f: CMS_FORM; a_node: detachable CMS_NODE)
-- local
-- ti: WSF_FORM_TEXT_INPUT
-- fset: WSF_FORM_FIELD_SET
-- ta: WSF_FORM_TEXTAREA
-- tselect: WSF_FORM_SELECT
-- opt: WSF_FORM_SELECT_OPTION
-- do
-- create ti.make ("title")
-- ti.set_label ("Title")
-- ti.set_size (70)
-- if a_node /= Void then
-- ti.set_text_value (a_node.title)
-- end
-- ti.set_is_required (True)
-- f.extend (ti)
populate_form (response: NODE_RESPONSE; f: CMS_FORM; a_node: detachable CMS_NODE)
local
ti: WSF_FORM_NUMBER_INPUT
fs: WSF_FORM_FIELD_SET
l_parent_id: INTEGER_64
do
Precursor (response, f, a_node)
-- f.extend_html_text ("<br/>")
if attached {CMS_PAGE} a_node as l_page then
create fs.make
fs.set_legend ("Pages structure")
fs.set_collapsible (True)
f.extend (fs)
create ti.make ("select_parent_node")
ti.set_label ("Parent page")
ti.set_description ("The parent page is the book structure.")
if attached l_page.parent as l_parent_node then
l_parent_id := l_parent_node.id
fs.extend_html_text ("<div><strong>Currently, the parent page is </strong> ")
fs.extend_html_text (response.node_html_link (l_parent_node, l_parent_node.title))
fs.extend_html_text ("</div>")
end
ti.set_validation_action (agent parent_validation (response, ?))
fs.extend (ti)
-- create ta.make ("body")
-- ta.set_rows (10)
-- ta.set_cols (70)
-- if a_node /= Void then
-- ta.set_text_value (a_node.content)
-- end
---- ta.set_label ("Body")
-- ta.set_description ("This is the main content")
-- ta.set_is_required (False)
-- FIXME: add notion of "weight"
-- create fset.make
-- fset.set_legend ("Body")
-- fset.extend (ta)
if
attached {WSF_STRING} response.request.query_parameter ("parent") as p_parent and then
p_parent.is_integer
then
l_parent_id := p_parent.integer_value.to_integer_64
end
if l_parent_id > 0 then
ti.set_default_value (l_parent_id.out)
end
end
end
-- fset.extend_html_text ("<br/>")
update_node (a_response: NODE_RESPONSE; fd: WSF_FORM_DATA; a_node: CMS_NODE)
-- <Precursor>
local
l_parent_id: INTEGER_64
do
Precursor (a_response, fd, a_node)
if attached {CMS_PAGE} a_node as l_page then
if attached fd.integer_item ("select_parent_node") as i_parent_node then
l_parent_id := i_parent_node.to_integer_64
end
if
l_parent_id > 0 and then
attached {CMS_PAGE} a_response.node_api.node (l_parent_id) as l_parent_page
then
l_page.set_parent (l_parent_page)
elseif l_parent_id = -1 then
-- Set parent to Void
l_page.set_parent (Void)
end
end
end
-- create tselect.make ("format")
-- tselect.set_label ("Body's format")
-- tselect.set_is_required (True)
-- across
-- content_type.available_formats as c
-- loop
-- create opt.make (c.item.name, c.item.title)
-- if attached c.item.html_help as f_help then
-- opt.set_description ("<ul>" + f_help + "</ul>")
-- end
-- tselect.add_option (opt)
-- end
-- if a_node /= Void and then attached a_node.format as l_format then
-- tselect.set_text_by_value (l_format)
-- end
new_node (response: NODE_RESPONSE; fd: WSF_FORM_DATA; a_node: detachable like new_node): like content_type.new_node
-- <Precursor>
do
Result := Precursor (response, fd, a_node)
if attached fd.integer_item ("select_parent_node") as l_parent_id then
if l_parent_id = -1 then
Result.set_parent (Void)
elseif attached {CMS_PAGE} response.node_api.node (l_parent_id) as l_parent then
Result.set_parent (l_parent)
end
end
end
-- fset.extend (tselect)
-- f.extend (fset)
-- end
-- change_node (response: NODE_RESPONSE; fd: WSF_FORM_DATA; a_node: like new_node)
-- local
-- b: detachable READABLE_STRING_8
-- f: detachable CONTENT_FORMAT
-- do
-- if attached fd.integer_item ("id") as l_id and then l_id > 0 then
-- check a_node.id = l_id end
-- end
-- if attached fd.string_item ("title") as l_title then
-- a_node.set_title (l_title)
-- end
-- if attached fd.string_item ("body") as l_body then
-- b := l_body
-- end
-- if attached fd.string_item ("format") as s_format and then attached response.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
-- f := f_format
-- else
-- f := response.api.formats.default_format
-- end
-- if b /= Void then
-- a_node.set_content (b, Void, f.name) -- FIXME: summary
-- end
-- end
-- new_node (response: NODE_RESPONSE; fd: WSF_FORM_DATA; a_node: detachable like new_node): CMS_PAGE
-- -- <Precursor>
-- local
-- b: detachable READABLE_STRING_8
-- f: detachable CONTENT_FORMAT
-- l_node: detachable like new_node
-- do
-- l_node := a_node
-- if attached fd.integer_item ("id") as l_id and then l_id > 0 then
-- if l_node /= Void then
-- check l_node.id = l_id end
-- else
-- if attached {like new_node} response.node_api.node (l_id) as n then
-- l_node := n
-- else
-- -- FIXME: Error
-- end
-- end
-- end
-- if attached fd.string_item ("title") as l_title then
-- if l_node = Void then
-- l_node := content_type.new_node (Void)
-- l_node.set_title (l_title)
-- else
-- l_node.set_title (l_title)
-- end
-- else
-- if l_node = Void then
-- l_node := content_type.new_node_with_title ("...", Void)
-- end
-- end
-- l_node.set_author (response.user)
-- if attached fd.string_item ("body") as l_body then
-- b := l_body
-- end
-- if attached fd.string_item ("format") as s_format and then attached response.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
-- f := f_format
-- else
-- f := response.api.formats.default_format
-- end
-- if b /= Void then
-- l_node.set_content (b, Void, f.name)
-- end
-- Result := l_node
-- end
parent_validation (a_response: NODE_RESPONSE; fd: WSF_FORM_DATA)
local
node_api: CMS_NODE_API
l_parent_id: INTEGER_64
nid: INTEGER_64
l_parent_node: detachable CMS_NODE
do
node_api := a_response.node_api
if attached fd.integer_item ("select_parent_node") as s_parent_node then
l_parent_id := s_parent_node.to_integer_64
else
l_parent_id := 0
end
if l_parent_id > 0 then
l_parent_node := node_api.node (l_parent_id)
if l_parent_node = Void then
fd.report_invalid_field ("select_parent_node", "Invalid parent, not found id #" + l_parent_id.out)
else
nid := a_response.node_id_path_parameter
if
nid > 0 and then
attached node_api.node (nid) as l_node and then
node_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
end
elseif l_parent_id = -1 or else l_parent_id = 0 then
-- -1 is Used to unassign a parent node
-- 0 is not taken into account, any other input value is considered invalid.
else
fd.report_invalid_field ("select_parent_node", "Invalid node id")
end
end
feature -- Output
@@ -162,8 +141,20 @@ feature -- Output
-- <Precursor>
local
s: STRING
node_api: CMS_NODE_API
lnk: CMS_LOCAL_LINK
do
node_api := a_response.node_api
Precursor (a_node, a_response)
if a_node.has_id and then not a_node.is_trashed then
if node_api.has_permission_for_action_on_node ("create", a_node, a_response.user) then
create lnk.make ("Add Child", "node/add/page?parent=" + a_node.id.out)
lnk.set_weight (3)
a_response.add_to_primary_tabs (lnk)
end
end
if attached a_response.main_content as l_main_content then
s := l_main_content
else
@@ -171,11 +162,22 @@ feature -- Output
end
if attached {CMS_PAGE} a_node as l_node_page then
s.append ("<ul class=%"page-navigation%">")
if attached l_node_page.parent as l_parent_node then
s.append ("<div>Parent page is ")
s.append (a_response.link (l_parent_node.title + " (#" + l_parent_node.id.out + ")", a_response.node_api.node_path (l_parent_node), Void))
s.append ("</div>")
s.append ("<li class=%"page-parent%">Go to parent page ")
s.append (a_response.link (l_parent_node.title, a_response.node_api.node_path (l_parent_node), Void))
s.append ("</li>")
end
if attached node_api.children (a_node) as l_children then
across
l_children as ic
loop
s.append ("<li>")
s.append (a_response.link (ic.item.title, a_response.node_api.node_path (ic.item), Void))
s.append ("</li>")
end
end
s.append ("</ul>")
end
a_response.set_main_content (s)

View File

@@ -37,91 +37,30 @@ feature -- Execution
-- Computed response message.
local
b: STRING_8
f: like new_edit_form
fd: detachable WSF_FORM_DATA
nid: INTEGER_64
do
create b.make_empty
nid := node_id_path_parameter (request)
nid := node_id_path_parameter
if
nid > 0 and then
attached node_api.node (nid) as l_node
then
if attached node_api.node_type_for (l_node) as l_type then
fixme ("refactor: process_edit, process_create process edit")
if
location.ends_with_general ("/edit") and then
node_api.has_permission_for_action_on_node ("edit", l_node, user)
then
f := new_edit_form (l_node, url (location, Void), "edit-" + l_type.name, l_type)
hooks.invoke_form_alter (f, fd, Current)
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 (node_local_link (l_node, translation ("View", Void)), primary_tabs)
add_to_menu (create {CMS_LOCAL_LINK}.make (translation ("Edit", Void), node_api.node_path (l_node) + "/edit"), primary_tabs)
add_to_menu (create {CMS_LOCAL_LINK}.make ("Delete", node_api.node_path (l_node) + "/delete"), primary_tabs)
end
if attached redirection as l_location then
-- FIXME: Hack for now
set_title (l_node.title)
b.append (html_encoded (l_type.title) + " saved")
else
set_title (formatted_string (translation ("Edit $1 #$2", Void), [l_type.title, l_node.id]))
f.append_to_html (wsf_theme, b)
end
edit_node (l_node, l_type, b)
elseif
location.ends_with_general ("/delete") and then
node_api.has_permission_for_action_on_node ("delete", l_node, user)
then
f := new_delete_form (l_node, url (location, Void), "delete-" + l_type.name, l_type)
hooks.invoke_form_alter (f, fd, Current)
if request.is_post_request_method then
f.process (Current)
fd := f.last_data
end
if l_node.has_id then
add_to_menu (node_local_link (l_node, translation ("View", Void)), primary_tabs)
add_to_menu (create {CMS_LOCAL_LINK}.make (translation ("Edit", Void), node_api.node_path (l_node) + "/edit"), primary_tabs)
add_to_menu (create {CMS_LOCAL_LINK}.make ("Delete", node_api.node_path (l_node) + "/delete"), primary_tabs)
end
if attached redirection as l_location then
-- FIXME: Hack for now
set_title (l_node.title)
b.append (html_encoded (l_type.title) + " deleted")
else
set_title (formatted_string (translation ("Delete $1 #$2", Void), [l_type.title, l_node.id]))
f.append_to_html (wsf_theme, b)
end
delete_node (l_node, l_type, b)
elseif
location.ends_with_general ("/trash") and then
node_api.has_permission_for_action_on_node ("trash", l_node, user)
then
f := new_trash_form (l_node, url (location, Void), "trash-" + l_type.name, l_type)
hooks.invoke_form_alter (f, fd, Current)
if request.is_post_request_method then
f.process (Current)
fd := f.last_data
end
if l_node.has_id then
add_to_menu (node_local_link (l_node, translation ("View", Void)), primary_tabs)
add_to_menu (create {CMS_LOCAL_LINK}.make ("Trash", node_api.node_path (l_node) + "/Trash"), primary_tabs)
end
if attached redirection as l_location then
-- FIXME: Hack for now
set_title (l_node.title)
b.append (html_encoded (l_type.title) + " trashed")
else
set_title (formatted_string (translation ("Trash $1 #$2", Void), [l_type.title, l_node.id]))
f.append_to_html (wsf_theme, b)
end
trash_node (l_node, l_type, b)
else
b.append ("<h1>")
b.append (translation ("Access denied", Void))
@@ -135,29 +74,8 @@ feature -- Execution
attached node_api.node_type (p_type.value) as l_type
then
if has_permissions (<<"create any", "create " + l_type.name>>) then
if attached l_type.new_node (Void) as l_node then
f := new_edit_form (l_node, url (location, Void), "edit-" + l_type.name, l_type)
hooks.invoke_form_alter (f, fd, Current)
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
set_title ("Edit " + html_encoded (l_type.title) + " #" + l_node.id.out)
if l_node.has_id then
add_to_menu (node_local_link (l_node, translation ("View", Void)), primary_tabs)
add_to_menu (create {CMS_LOCAL_LINK}.make (translation ("Edit", Void), node_api.node_path (l_node) + "/edit"), primary_tabs)
end
f.append_to_html (wsf_theme, b)
else
b.append ("<h1>")
b.append (translation ("Server error", Void))
b.append ("</h1>")
end
-- create new node
create_new_node (l_type, b)
else
b.append ("<h1>")
b.append (translation ("Access denied", Void))
@@ -185,6 +103,126 @@ feature -- Execution
set_main_content (b)
end
feature {NONE} -- Create a new node
create_new_node (a_type: CMS_NODE_TYPE [CMS_NODE]; b: STRING_8)
local
f: like new_edit_form
fd: detachable WSF_FORM_DATA
do
if attached a_type.new_node (Void) as l_node then
-- create new node
f := new_edit_form (l_node, url (location, Void), "edit-" + a_type.name, a_type)
hooks.invoke_form_alter (f, fd, Current)
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, a_type, b))
f.process (Current)
fd := f.last_data
end
if l_node.has_id then
set_title ("Edit " + html_encoded (a_type.title) + " #" + l_node.id.out)
add_to_menu (node_local_link (l_node, translation ("View", Void)), primary_tabs)
add_to_menu (create {CMS_LOCAL_LINK}.make (translation ("Edit", Void), node_api.node_path (l_node) + "/edit"), primary_tabs)
else
set_title ("New " + html_encoded (a_type.title))
end
f.append_to_html (wsf_theme, b)
else
b.append ("<h1>")
b.append (translation ("Server error", Void))
b.append ("</h1>")
end
end
edit_node (a_node: CMS_NODE; a_type: CMS_NODE_TYPE [CMS_NODE]; 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)
hooks.invoke_form_alter (f, fd, Current)
if request.is_post_request_method then
f.validation_actions.extend (agent edit_form_validate (?, b))
f.submit_actions.extend (agent edit_form_submit (?, a_node, a_type, b))
f.process (Current)
fd := f.last_data
end
if a_node.has_id then
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)
end
if attached redirection as l_location then
-- FIXME: Hack for now
set_title (a_node.title)
b.append (html_encoded (a_type.title) + " saved")
else
set_title (formatted_string (translation ("Edit $1 #$2", Void), [a_type.title, a_node.id]))
f.append_to_html (wsf_theme, b)
end
end
delete_node (a_node: CMS_NODE; a_type: CMS_NODE_TYPE [CMS_NODE]; b: STRING_8)
local
f: like new_edit_form
fd: detachable WSF_FORM_DATA
do
f := new_delete_form (a_node, url (location, Void), "delete-" + a_type.name, a_type)
hooks.invoke_form_alter (f, fd, Current)
if request.is_post_request_method then
f.process (Current)
fd := f.last_data
end
if a_node.has_id then
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)
end
if attached redirection as l_location then
-- FIXME: Hack for now
set_title (a_node.title)
b.append (html_encoded (a_type.title) + " deleted")
else
set_title (formatted_string (translation ("Delete $1 #$2", Void), [a_type.title, a_node.id]))
f.append_to_html (wsf_theme, b)
end
end
trash_node (a_node: CMS_NODE; a_type: CMS_NODE_TYPE [CMS_NODE]; b: STRING_8)
local
f: like new_edit_form
fd: detachable WSF_FORM_DATA
do
f := new_trash_form (a_node, url (location, Void), "trash-" + a_type.name, a_type)
hooks.invoke_form_alter (f, fd, Current)
if request.is_post_request_method then
f.process (Current)
fd := f.last_data
end
if a_node.has_id then
add_to_menu (node_local_link (a_node, translation ("View", Void)), primary_tabs)
add_to_menu (create {CMS_LOCAL_LINK}.make ("Trash", node_api.node_path (a_node) + "/Trash"), primary_tabs)
end
if attached redirection as l_location then
-- FIXME: Hack for now
set_title (a_node.title)
b.append (html_encoded (a_type.title) + " trashed")
else
set_title (formatted_string (translation ("Trash $1 #$2", Void), [a_type.title, a_node.id]))
f.append_to_html (wsf_theme, b)
end
end
feature -- Form
edit_form_validate (fd: WSF_FORM_DATA; b: STRING)
@@ -221,6 +259,7 @@ feature -- Form
s: STRING
l_path_alias: detachable READABLE_STRING_8
do
fixme ("Refactor code per operacion: Preview, Save")
l_preview := attached {WSF_STRING} fd.item ("op") as l_op and then l_op.same_string ("Preview")
if not l_preview then
debug ("cms")
@@ -250,6 +289,7 @@ feature -- Form
fixme ("for now, publishing is not implemented, so let's assume any node saved is published.") -- FIXME
l_node.mark_published
node_api.save_node (l_node)
if attached user as u then
api.log ("node",
@@ -290,7 +330,6 @@ feature -- Form
th: WSF_FORM_HIDDEN_INPUT
do
create f.make (a_url, a_name)
create th.make ("node-id")
if a_node /= Void then
th.set_text_value (a_node.id.out)
@@ -300,8 +339,8 @@ feature -- Form
f.extend (th)
populate_form (a_node_type, f, a_node)
f.extend_html_text ("<br/>")
f.extend_html_text ("<br/>")
create ts.make ("op")
ts.set_default_value ("Save")
f.extend (ts)
@@ -336,7 +375,7 @@ feature -- Form
ts.set_default_value (translation ("Delete"))
]")
f.extend (ts)
fixme ("wsf_html: add support for HTML5 input attributes!!! ")
to_implement ("Refactor code to use the new wsf_html HTML5 support")
f.extend_html_text("<input type='submit' value='Cancel' formmethod='GET', formaction='/node/"+a_node.id.out+"'>" )
end

View File

@@ -99,6 +99,15 @@ feature -- HTTP Methods
edit_response.execute
elseif req.percent_encoded_path_info.ends_with ("/revision") then
do_revisions (req, res)
-- elseif req.percent_encoded_path_info.ends_with ("/add_child/page") then
-- -- Add child node
-- l_nid := node_id_path_parameter (req)
-- if l_nid > 0 then
-- -- create a new child node with node id `l_id' as parent.
-- create_new_node (req, res)
-- else
-- send_not_found (req, res)
-- end
else
-- Display existing node
l_nid := node_id_path_parameter (req)
@@ -117,15 +126,29 @@ feature -- HTTP Methods
then
l_node := node_api.revision_node (l_nid, l_rev)
end
if
l_node /= Void and then (l_rev > 0 or else l_node.is_published)
then
create view_response.make (req, res, api, node_api)
view_response.set_node (l_node)
view_response.set_revision (l_rev)
view_response.execute
else
if l_node = Void then
send_not_found (req, res)
else
if
l_rev > 0 or else l_node.is_published
then
create view_response.make (req, res, api, node_api)
view_response.set_node (l_node)
view_response.set_revision (l_rev)
view_response.execute
elseif
attached current_user (req) as l_user and then
( node_api.is_author_of_node (l_user, l_node)
or else api.user_api.user_has_permission (l_user, "view unpublished " + l_node.content_type)
)
then
create view_response.make (req, res, api, node_api)
view_response.set_node (l_node)
view_response.set_revision (l_rev)
view_response.execute
else
send_access_denied (req, res)
end
end
else
-- redirect_to (req.absolute_script_url ("/node/"), res) -- New node.
@@ -166,6 +189,9 @@ feature -- HTTP Methods
elseif req.percent_encoded_path_info.starts_with ("/node/add/") then
create edit_response.make (req, res, api, node_api)
edit_response.execute
elseif req.percent_encoded_path_info.ends_with ("/add_child/page") then
create edit_response.make (req, res, api, node_api)
edit_response.execute
else
to_implement ("REST API")
send_not_implemented ("REST API not yet implemented", req, res)
@@ -179,8 +205,8 @@ feature -- HTTP Methods
send_not_implemented ("REST API not yet implemented", req, res)
end
do_delete (req: WSF_REQUEST; res: WSF_RESPONSE)
-- <Precursor>
do_trash (req: WSF_REQUEST; res: WSF_RESPONSE)
-- Trash a node, soft delete.
do
if attached current_user (req) as l_user then
if attached {WSF_STRING} req.path_parameter ("id") as l_id then
@@ -188,8 +214,8 @@ feature -- HTTP Methods
l_id.is_integer and then
attached node_api.node (l_id.integer_value) as l_node
then
if node_api.has_permission_for_action_on_node ("delete", l_node, current_user (req)) then
node_api.delete_node (l_node)
if node_api.has_permission_for_action_on_node ("trash", l_node, current_user (req)) then
node_api.trash_node (l_node)
res.send (create {CMS_REDIRECTION_RESPONSE_MESSAGE}.make (req.absolute_script_url ("")))
else
send_access_denied (req, res)
@@ -214,8 +240,8 @@ feature -- HTTP Methods
feature {NONE} -- Trash:Restore
do_trash (req: WSF_REQUEST; res: WSF_RESPONSE)
-- Trash a node from the database.
do_delete (req: WSF_REQUEST; res: WSF_RESPONSE)
-- Delete a node from the database.
do
if attached current_user (req) as l_user then
if attached {WSF_STRING} req.path_parameter ("id") as l_id then
@@ -223,8 +249,8 @@ feature {NONE} -- Trash:Restore
l_id.is_integer and then
attached node_api.node (l_id.integer_value) as l_node
then
if node_api.has_permission_for_action_on_node ("trash", l_node, current_user (req)) then
node_api.trash_node (l_node)
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
send_access_denied (req, res)
@@ -355,5 +381,4 @@ feature {NONE} -- Node
send_bad_request (req, res)
end
end
end

View File

@@ -27,12 +27,12 @@ feature -- Access
feature -- Helpers
node_id_path_parameter (req: WSF_REQUEST): INTEGER_64
-- Node id passed as path parameter for request `req'.
node_id_path_parameter: INTEGER_64
-- Node id passed as path parameter for request `request'.
local
s: STRING
do
if attached {WSF_STRING} req.path_parameter ("id") as p_nid then
if attached {WSF_STRING} request.path_parameter ("id") as p_nid then
s := p_nid.value
if s.is_integer_64 then
Result := s.to_integer_64

View File

@@ -61,7 +61,7 @@ feature -- Execution
do
l_node := node
if l_node = Void then
nid := node_id_path_parameter (request)
nid := node_id_path_parameter
if nid > 0 then
l_node := node_api.node (nid)
end
@@ -84,6 +84,8 @@ feature -- Execution
if l_node /= Void and revision > 0 then
set_title ("Revision #" + revision.out + " of " + html_encoded (l_node.title))
end
end
end

View File

@@ -13,6 +13,7 @@
<library name="base" location="$ISE_LIBRARY\library\base\base.ecf"/>
<library name="cms" location="..\..\cms.ecf"/>
<library name="cms_model" location="..\..\library\model\cms_model.ecf" readonly="false"/>
<library name="cms_recent_changes_module" location="..\..\modules\recent_changes\recent_changes.ecf" readonly="false"/>
<library name="error" location="$ISE_LIBRARY\contrib\library\utility\general\error\error.ecf"/>
<library name="http" location="$ISE_LIBRARY\contrib\library\network\protocol\http\http.ecf"/>
<library name="http_authorization" location="$ISE_LIBRARY\contrib\library\network\authentication\http_authorization\http_authorization.ecf" readonly="false"/>

View File

@@ -49,6 +49,13 @@ feature -- Persistence
end
end
delete_node (a_node: CMS_NODE)
-- remove node extensions.
require
a_node_accepted: is_accepted (a_node)
deferred
end
feature {NONE} -- Persistence implementation
store (a_node: G)

View File

@@ -44,7 +44,7 @@ feature {NONE} -- Implementation
extended_store (a_node: CMS_NODE)
-- Store extended data from `a_node'.
require
not error_handler.has_error
not_has_error: not error_handler.has_error
do
if attached node_storage_extension (a_node) as ext then
ext.store_node (a_node)
@@ -54,13 +54,23 @@ feature {NONE} -- Implementation
extended_load (a_node: CMS_NODE)
-- Load extended data into `a_node'.
require
not error_handler.has_error
not_has_error: not error_handler.has_error
do
if attached node_storage_extension (a_node) as ext then
ext.load_node (a_node)
end
end
extended_delete (a_node: CMS_NODE)
-- Delete extended data related to node `a_node'.
require
not_has_error: not error_handler.has_error
do
if attached node_storage_extension (a_node) as ext then
ext.delete_node (a_node)
end
end
feature -- Access
nodes_count: NATURAL_64
@@ -117,6 +127,21 @@ feature -- Access
deferred
end
feature -- Access: outline
children (a_node: CMS_NODE): detachable LIST [CMS_NODE]
-- Children of node `a_node'.
-- note: this is the partial version of the nodes.
deferred
end
available_parents_for_node (a_node: CMS_NODE): LIST [CMS_NODE]
-- Given the node `a_node', return the list of possible parent nodes id
deferred
ensure
a_node_excluded: across Result as ic all not a_node.same_node (ic.item) end
end
feature -- Change: Node
save_node (a_node: CMS_NODE)
@@ -150,16 +175,19 @@ feature -- Change: Node
delete_node (a_node: CMS_NODE)
-- Delete `a_node'.
require
valid_node_id: a_node.has_id
do
if a_node.has_id then
delete_node_by_id (a_node.id)
end
-- TODO
-- Check if we need to use a transaction
-- we delete a node
-- node_revisions
-- and extensions (PAGE, BLOG, etc).
delete_node_base (a_node)
end
delete_node_by_id (a_id: INTEGER_64)
-- Remove node by id `a_id'.
require
valid_node_id: a_id > 0
delete_node_base (a_node: CMS_NODE)
-- Remove node `a_node'.
deferred
end

View File

@@ -86,6 +86,19 @@ feature -- Access: node
create {ARRAYED_LIST [CMS_USER]} Result.make (0)
end
feature -- Access: outline
children (a_node: CMS_NODE): detachable LIST [CMS_NODE]
-- <Precursor>
do
end
available_parents_for_node (a_node: CMS_NODE): LIST [CMS_NODE]
-- <Precursor>
do
create {ARRAYED_LIST [CMS_NODE]} Result.make (0)
end
feature -- Node
new_node (a_node: CMS_NODE)
@@ -93,7 +106,7 @@ feature -- Node
do
end
delete_node_by_id (a_id: INTEGER_64)
delete_node_base (a_node: CMS_NODE)
-- <Precursor>
do
end

View File

@@ -53,11 +53,6 @@ feature -- Access
end
sql_forth
end
-- across
-- Result as ic
-- loop
-- fill_node (ic.item)
-- end
end
node_revisions (a_node: CMS_NODE): LIST [CMS_NODE]
@@ -95,7 +90,7 @@ feature -- Access
create {ARRAYED_LIST [CMS_NODE]} Result.make (0)
error_handler.reset
write_information_log (generator + ".trash_nodes")
write_information_log (generator + ".trashed_nodes")
from
create l_parameters.make (1)
@@ -124,7 +119,7 @@ feature -- Access
create {ARRAYED_LIST [CMS_NODE]} Result.make (0)
error_handler.reset
write_information_log (generator + ".nodes")
write_information_log (generator + ".recent_nodes")
from
create l_parameters.make (2)
@@ -150,7 +145,7 @@ feature -- Access
create {ARRAYED_LIST [CMS_NODE]} Result.make (0)
error_handler.reset
write_information_log (generator + ".nodes")
write_information_log (generator + ".recent_node_changes_before")
from
create l_parameters.make (3)
@@ -176,7 +171,7 @@ feature -- Access
l_parameters: STRING_TABLE [ANY]
do
error_handler.reset
write_information_log (generator + ".node")
write_information_log (generator + ".node_by_id")
create l_parameters.make (1)
l_parameters.put (a_id, "nid")
sql_query (sql_select_node_by_id, l_parameters)
@@ -191,7 +186,7 @@ feature -- Access
l_parameters: STRING_TABLE [ANY]
do
error_handler.reset
write_information_log (generator + ".node")
write_information_log (generator + ".node_by_id_and_revision")
create l_parameters.make (1)
l_parameters.put (a_node_id, "nid")
l_parameters.put (a_revision, "revision")
@@ -255,6 +250,58 @@ feature -- Access
-- end
end
feature -- Access: outline
children (a_node: CMS_NODE): detachable LIST [CMS_NODE]
-- <Precursor>
local
l_parameters: STRING_TABLE [detachable ANY]
do
create {ARRAYED_LIST [CMS_NODE]} Result.make (0)
error_handler.reset
write_information_log (generator + ".children")
from
create l_parameters.make (1)
l_parameters.put (a_node.id, "nid")
sql_query (sql_select_children_of_node, l_parameters)
sql_start
until
sql_after
loop
if attached fetch_node as l_node then
Result.force (l_node)
end
sql_forth
end
end
available_parents_for_node (a_node: CMS_NODE): LIST [CMS_NODE]
-- <Precursor>
local
l_parameters: STRING_TABLE [detachable ANY]
do
create {ARRAYED_LIST [CMS_NODE]} Result.make (0)
error_handler.reset
write_information_log (generator + ".available_parents_for_node")
from
create l_parameters.make (1)
l_parameters.put (a_node.id, "nid")
sql_query (sql_select_available_parents_for_node, l_parameters)
sql_start
until
sql_after
loop
if attached fetch_node as l_node then
Result.force (l_node)
end
sql_forth
end
end
feature -- Change: Node
new_node (a_node: CMS_NODE)
@@ -269,34 +316,42 @@ feature -- Change: Node
store_node (a_node)
end
delete_node_by_id (a_id: INTEGER_64)
trash_node_by_id (a_id: INTEGER_64)
-- Remove node by id `a_id'.
local
l_parameters: STRING_TABLE [ANY]
do
write_information_log (generator + ".delete_node {" + a_id.out + "}")
write_information_log (generator + ".trash_node_by_id {" + a_id.out + "}")
error_handler.reset
create l_parameters.make (3)
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_delete_node, l_parameters)
sql_change (sql_trash_node, l_parameters)
end
trash_node_by_id (a_id: INTEGER_64)
delete_node_base (a_node: CMS_NODE)
-- <Precursor>
local
l_parameters: STRING_TABLE [ANY]
l_time: DATE_TIME
do
create l_time.make_now_utc
write_information_log (generator + ".trash_node {" + a_id.out + "}")
write_information_log (generator + ".delete_node_base {" + a_node.id.out + "}")
error_handler.reset
create l_parameters.make (1)
l_parameters.put (a_id, "nid")
sql_change (sql_trash_node, l_parameters)
l_parameters.put (a_node.id, "nid")
sql_change (sql_delete_node, l_parameters)
-- we remove node_revisions and pages.
-- Check: maybe we need a transaction.
sql_change (sql_delete_node_revisions, l_parameters)
if not error_handler.has_error then
extended_delete (a_node)
end
end
restore_node_by_id (a_id: INTEGER_64)
@@ -306,7 +361,7 @@ feature -- Change: Node
l_time: DATE_TIME
do
create l_time.make_now_utc
write_information_log (generator + ".restore_node {" + a_id.out + "}")
write_information_log (generator + ".restore_node_by_id {" + a_id.out + "}")
error_handler.reset
create l_parameters.make (1)
@@ -440,10 +495,10 @@ feature {NONE} -- Queries
sql_update_node : STRING = "UPDATE nodes SET revision=:revision, type=:type, title=:title, summary=:summary, content=:content, format=:format, publish=:publish, changed=:changed, status=:status, author=:author WHERE nid=:nid;"
-- SQL update node.
sql_delete_node: STRING = "UPDATE nodes SET changed=:changed, status =:status WHERE nid=:nid"
sql_trash_node: STRING = "UPDATE nodes SET changed=:changed, status =:status WHERE nid=:nid"
-- Soft deletion with free metadata.
sql_trash_node: STRING = "DELETE FROM nodes WHERE nid=:nid"
sql_delete_node: STRING = "DELETE FROM nodes WHERE nid=:nid"
-- Physical deletion with free metadata.
sql_restore_node: STRING = "UPDATE nodes SET changed=:changed, status =:status WHERE nid=:nid"
@@ -456,6 +511,20 @@ feature {NONE} -- Queries
Sql_last_insert_node_revision: STRING = "SELECT MAX(revision) FROM node_revisions;"
Sql_last_insert_node_revision_for_nid: STRING = "SELECT MAX(revision) FROM node_revisions WHERE nid=:nid;"
sql_select_available_parents_for_node : STRING = "[
SELECT node.nid, node.revision, node.type, title, summary, content, format, author, publish, created, changed, status
FROM nodes node LEFT JOIN page_nodes pn ON node.nid = pn.nid AND node.nid != :nid
WHERE node.nid != :nid AND pn.parent != :nid AND node.status != -1 GROUP BY node.nid, node.revision;
]"
sql_select_children_of_node: STRING = "[
SELECT node.nid, node.revision, node.type, title, summary, content, format, author, publish, created, changed, status
FROM nodes node LEFT JOIN page_nodes pn ON node.nid = pn.nid
WHERE pn.parent = :nid AND node.status != -1 GROUP BY node.nid, node.revision;
]"
sql_delete_node_revisions: STRING = "DELETE FROM node_revisions WHERE nid=:nid;"
feature {NONE} -- Sql Queries: USER_ROLES collaborators, author
Select_user_author: STRING = "SELECT uid, name, password, salt, email, users.status, users.created, signed FROM nodes INNER JOIN users ON nodes.author=users.uid AND nodes.nid = :nid AND nodes.revision = :revision;"

View File

@@ -55,7 +55,7 @@ feature -- Persistence
error_handler.reset
-- Check existing record, if any.
if attached node_data (a_node) as d then
l_update := True
l_update := a_node.revision = d.revision
l_previous_parent_id := d.parent_id
end
if not has_error then
@@ -112,9 +112,22 @@ feature -- Persistence
end
end
delete_node (a_node: CMS_PAGE)
-- <Precursor>
local
l_parameters: STRING_TABLE [ANY]
do
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)
end
end
feature {NONE} -- Implementation
node_data (a_node: CMS_NODE): detachable TUPLE [parent_id: INTEGER_64]
node_data (a_node: CMS_NODE): detachable TUPLE [revision: INTEGER_64; parent_id: INTEGER_64]
-- Node extension data for node `a_node' as tuple.
local
l_parameters: STRING_TABLE [ANY]
@@ -129,17 +142,20 @@ feature {NONE} -- Implementation
n := sql_rows_count
if n = 1 then
-- nid, revision, parent
Result := [sql_read_integer_64 (3)]
Result := [sql_read_integer_64 (2), sql_read_integer_64 (3)]
else
check unique_data: n = 0 end
end
end
ensure
accepted_revision: Result /= Void implies Result.revision <= a_node.revision
end
feature -- SQL
sql_select_node_data: STRING = "SELECT nid, revision, parent FROM page_nodes WHERE nid =:nid AND revision<=:revision ORDER BY revision DESC LIMIT 1;"
sql_select_node_data: STRING = "SELECT nid, revision, parent FROM page_nodes WHERE nid=:nid AND revision<=:revision ORDER BY revision DESC LIMIT 1;"
sql_insert_node_data: STRING = "INSERT INTO page_nodes (nid, revision, parent) VALUES (:nid, :revision, :parent);"
sql_update_node_data: STRING = "UPDATE page_nodes SET nid=:nid, revision=:revision, parent=:parent WHERE nid=:nid AND revision=:revision;"
sql_delete_node_data: STRING = "DELETE FROM page_nodes WHERE nid=:nid;"
end

View File

@@ -29,6 +29,10 @@ feature -- Access
date: DATE_TIME
-- Time of the event item.
author_name: detachable READABLE_STRING_32
-- Optional author name.
-- It is possible to have author_name /= Void and author = Void.
author: detachable CMS_USER
-- Optional author.
@@ -41,10 +45,19 @@ feature -- Access
feature -- Element change
set_author_name (n: like author_name)
-- Set `author_name' to `n'.
do
author_name := n
end
set_author (u: like author)
-- Set `author' to `u'.
do
author := u
if u /= Void and author_name = Void then
set_author_name (u.name)
end
end
set_information (a_info: like information)

View File

@@ -11,9 +11,13 @@ inherit
feature -- Invocation
populate_recent_changes (a_changes: CMS_RECENT_CHANGE_CONTAINER; a_sources: LIST [READABLE_STRING_8])
recent_changes_sources: detachable LIST [READABLE_STRING_8]
-- Source provided by Current hook.
deferred
end
populate_recent_changes (a_changes: CMS_RECENT_CHANGE_CONTAINER; a_current_user: detachable CMS_USER)
-- Populate recent changes inside `a_changes' according to associated parameters.
-- Also provide sources of information.
deferred
end

View File

@@ -58,25 +58,36 @@ feature -- Handler
r: CMS_RESPONSE
l_changes: CMS_RECENT_CHANGE_CONTAINER
l_sources: ARRAYED_LIST [READABLE_STRING_8]
dt, prev_dt: detachable DATE
dt, prev_dt: detachable DATE_TIME
prev_info: detachable READABLE_STRING_8
ch: detachable CMS_RECENT_CHANGE_ITEM
htdate: HTTP_DATE
l_content: STRING
l_form: CMS_FORM
l_select: WSF_FORM_SELECT
l_size_field: WSF_FORM_NUMBER_INPUT
l_date_field: WSF_FORM_HIDDEN_INPUT
l_submit: WSF_FORM_SUBMIT_INPUT
l_until_date: detachable DATE_TIME
l_until_date_timestamp: INTEGER_64
l_filter_source: detachable READABLE_STRING_8
l_size: NATURAL_32
l_query: STRING
opt: WSF_FORM_SELECT_OPTION
l_user: detachable CMS_USER
i: INTEGER
do
if attached {WSF_STRING} req.query_parameter ("date") as p_until_date then
create htdate.make_from_timestamp (p_until_date.value.to_integer_64)
l_until_date_timestamp := p_until_date.value.to_integer_64
create htdate.make_from_timestamp (l_until_date_timestamp)
l_until_date := htdate.date_time
-- l_until_date.second_add (-1)
end
if attached {WSF_STRING} req.query_parameter ("filter") as p_filter then
if attached {WSF_STRING} req.query_parameter ("source") as p_filter then
l_filter_source := p_filter.url_encoded_value
if l_filter_source.is_empty then
l_filter_source := Void
end
end
if attached {WSF_STRING} req.query_parameter ("size") as p_size then
l_size := p_size.integer_value.to_natural_32
@@ -87,22 +98,33 @@ feature -- Handler
create {GENERIC_VIEW_CMS_RESPONSE} r.make (req, res, api)
if r.has_permission ("view recent changes") then
l_user := r.user
create l_changes.make (l_size, l_until_date, l_filter_source)
create l_content.make (1024)
if attached r.hooks.subscribers ({CMS_RECENT_CHANGES_HOOK}) as lst then
create l_sources.make (lst.count)
across
lst as ic
loop
if attached {CMS_RECENT_CHANGES_HOOK} ic.item as h then
h.populate_recent_changes (l_changes, l_sources)
if attached h.recent_changes_sources as h_sources then
l_sources.append (h_sources)
if
l_filter_source = Void
or else across h_sources as h_ic some h_ic.item.is_case_insensitive_equal (l_filter_source) end
then
h.populate_recent_changes (l_changes, l_user)
end
end
end
end
create l_form.make (req.percent_encoded_path_info, "recent-changes")
l_form.set_method_get
create l_select.make ("source")
l_select.set_label ("Sources")
create opt.make ("", "...")
create opt.make ("", "Any source")
l_select.add_option (opt)
across
l_sources as ic
@@ -114,12 +136,25 @@ feature -- Handler
l_select.add_option (opt)
end
l_form.extend (l_select)
create l_size_field.make_with_text ("size", l_size.out)
l_size_field.set_size (25)
l_size_field.set_label ("Items per page")
l_form.extend (l_size_field)
if l_until_date /= Void then
create l_date_field.make_with_text ("date", l_until_date_timestamp.out)
l_form.extend (l_date_field)
end
create l_submit.make_with_text ("op", "Filter")
l_form.extend (l_submit)
l_form.extend_html_text ("<br/>")
l_form.append_to_html (create {CMS_TO_WSF_THEME}.make (r, r.theme), l_content)
end
l_changes.reverse_sort
l_content.append ("<table class=%"recent-changes%" style=%"border-spacing: 5px;%">")
l_content.append ("<table class=%"recent-changes%">")
l_content.append ("<thead>")
l_content.append ("<tr>")
l_content.append ("<th>Date</th>")
@@ -135,20 +170,24 @@ feature -- Handler
l_changes as ic
loop
ch := ic.item
dt := ch.date.date
if dt /~ prev_dt then
dt := ch.date
if prev_dt = Void or else dt.date /~ prev_dt.date then
l_content.append ("<tr>")
l_content.append ("<td class=%"title%" colspan=%"5%">")
l_content.append (dt.formatted_out ("ddd, dd mmm yyyy"))
l_content.append (dt.date.formatted_out ("ddd, dd mmm yyyy"))
l_content.append ("</td>")
l_content.append ("</tr>")
end
prev_dt := dt
l_content.append ("<tr>")
l_content.append ("<td class=%"date%">")
create htdate.make_from_date_time (ch.date)
htdate.append_to_rfc1123_string (l_content)
if dt /~ prev_dt then
create htdate.make_from_date_time (dt)
htdate.append_to_rfc1123_string (l_content)
else
l_content.append ("<span class=%"same-value%">''</span>")
end
l_content.append ("</td>")
l_content.append ("<td class=%"source%">" + ch.source + "</td>")
l_content.append ("<td class=%"resource%">")
l_content.append (r.link (ch.link.title, ch.link.location, Void))
@@ -156,14 +195,32 @@ feature -- Handler
l_content.append ("<td class=%"user%">")
if attached ch.author as u then
l_content.append (r.link (u.name, "user/" + u.id.out, Void))
elseif attached ch.author_name as un then
l_content.append (r.html_encoded (un))
end
l_content.append ("</td>")
l_content.append ("<td class=%"info%">")
if attached ch.information as l_info then
l_content.append ("<strong>" + l_info + "</strong> ")
if attached ch.information as l_info and then not l_info.is_empty then
if prev_dt ~ dt and prev_info ~ l_info then
l_content.append ("<span class=%"same-value%">''</span>")
else
i := l_info.index_of ('%N', 1)
if i > 0 and i < l_info.count then
l_content.append (l_info.substring (1, i - 1))
l_content.append ("<span class=%"tooltip%">")
l_content.append (l_info.substring (i, l_info.count))
l_content.append ("</span>")
else
l_content.append (l_info)
end
end
prev_info := l_info
else
prev_info := Void
end
l_content.append ("</td>")
l_content.append ("</tr>%N")
prev_dt := dt
end
l_content.append ("</tbody>")
l_content.append ("</table>%N")

View File

@@ -86,13 +86,19 @@ feature -- Access
local
retried: BOOLEAN
f: FILE
l_chain: NOTIFICATION_CHAIN_MAILER
l_storage_mailer: NOTIFICATION_STORAGE_MAILER
l_mailer: detachable NOTIFICATION_MAILER
do
if not retried then
if attached text_item ("mailer.smtp") as l_smtp then
create {NOTIFICATION_SMTP_MAILER} mailer.make (l_smtp)
create {NOTIFICATION_SMTP_MAILER} l_mailer.make (l_smtp)
elseif attached text_item ("mailer.sendmail") as l_sendmail then
create {NOTIFICATION_SENDMAIL_MAILER} mailer.make_with_location (l_sendmail)
elseif attached text_item ("mailer.output") as l_output then
create {NOTIFICATION_SENDMAIL_MAILER} l_mailer.make_with_location (l_sendmail)
end
-- If a mailer.ouput is set, set a notification chain with potential previous mailer
-- and file storage.
if attached text_item ("mailer.output") as l_output then
if l_output.is_case_insensitive_equal ("@stderr") then
f := io.error
elseif l_output.is_case_insensitive_equal ("@stdout") then
@@ -104,10 +110,18 @@ feature -- Access
f.close
end
end
create {NOTIFICATION_STORAGE_MAILER} mailer.make (create {NOTIFICATION_EMAIL_FILE_STORAGE}.make (f))
else
create {NOTIFICATION_STORAGE_MAILER} mailer.make (create {NOTIFICATION_EMAIL_FILE_STORAGE}.make (io.error))
create {NOTIFICATION_STORAGE_MAILER} l_storage_mailer.make (create {NOTIFICATION_EMAIL_FILE_STORAGE}.make (f))
if l_mailer /= Void then
create l_chain.make (l_mailer)
l_chain.set_next (l_storage_mailer)
l_mailer := l_chain
else
l_mailer := l_storage_mailer
end
elseif l_mailer = Void then
create {NOTIFICATION_STORAGE_MAILER} l_mailer.make (create {NOTIFICATION_EMAIL_FILE_STORAGE}.make (io.error))
end
mailer := l_mailer
else
check valid_mailer: False end
-- FIXME: should we report persistent error message? If yes, see how.

View File

@@ -995,6 +995,7 @@ feature {NONE} -- Execution
page: CMS_HTML_PAGE_RESPONSE
utf: UTF_CONVERTER
h: HTTP_HEADER
l_new_location: READABLE_STRING_8
do
if attached {READABLE_STRING_GENERAL} values.item ("optional_content_type") as l_type then
create cms_page.make_typed (utf.utf_32_string_to_utf_8_string_8 (l_type))
@@ -1010,12 +1011,12 @@ feature {NONE} -- Execution
if attached redirection as l_location then
-- FIXME: find out if this is safe or not.
if l_location.has_substring ("://") then
-- h.put_location (l_location)
response.redirect_now (l_location)
l_new_location := l_location
else
-- h.put_location (request.absolute_url (l_location, Void))
response.redirect_now (absolute_url (l_location, Void))
l_new_location := absolute_url (l_location, Void)
end
-- h.put_location (l_new_location)
response.redirect_now (l_new_location)
else
h.put_header_object (header)

View File

@@ -20,9 +20,10 @@ feature -- Generation
custom_prepare (page: CMS_HTML_PAGE)
do
set_status_code ({HTTP_STATUS_CODE}.bad_request)
page.register_variable (absolute_url (request.percent_encoded_path_info, Void), "request")
page.set_status_code ({HTTP_STATUS_CODE}.bad_request)
page.register_variable (page.status_code.out, "code")
page.set_status_code (status_code)
page.register_variable (status_code.out, "code")
end
feature -- Execution

View File

@@ -20,9 +20,10 @@ feature -- Generation
custom_prepare (page: CMS_HTML_PAGE)
do
set_status_code ({HTTP_STATUS_CODE}.forbidden)
page.register_variable (absolute_url (request.percent_encoded_path_info, Void), "request")
page.set_status_code ({HTTP_STATUS_CODE}.forbidden)
page.register_variable (page.status_code.out, "code")
page.set_status_code (status_code)
page.register_variable (status_code.out, "code")
end
feature -- Execution

View File

@@ -20,9 +20,10 @@ feature -- Generation
custom_prepare (page: CMS_HTML_PAGE)
do
set_status_code ({HTTP_STATUS_CODE}.internal_server_error)
page.register_variable (absolute_url (location, Void), "request")
page.set_status_code ({HTTP_STATUS_CODE}.internal_server_error)
page.register_variable (page.status_code.out, "code")
page.set_status_code (status_code)
page.register_variable (status_code.out, "code")
end
feature -- Execution

View File

@@ -20,9 +20,10 @@ feature -- Generation
custom_prepare (page: CMS_HTML_PAGE)
do
set_status_code ({HTTP_STATUS_CODE}.not_found)
page.register_variable (absolute_url (request.percent_encoded_path_info, Void), "request")
page.set_status_code ({HTTP_STATUS_CODE}.not_found)
page.register_variable (page.status_code.out, "code")
page.set_status_code (status_code)
page.register_variable (status_code.out, "code")
end
feature -- Execution

View File

@@ -20,9 +20,10 @@ feature -- Generation
custom_prepare (page: CMS_HTML_PAGE)
do
set_status_code ({HTTP_STATUS_CODE}.not_implemented)
page.register_variable (absolute_url (request.percent_encoded_path_info, Void), "request")
page.set_status_code ({HTTP_STATUS_CODE}.not_implemented)
page.register_variable (page.status_code.out, "code")
page.set_status_code (status_code)
page.register_variable (status_code.out, "code")
end
feature -- Execution

39
tools/roc.bat Normal file
View File

@@ -0,0 +1,39 @@
@echo off
setlocal
if "%ROC_TOOL_PATH%" == "" goto LOCAL_ROC_TOOL
goto start
:LOCAL_ROC_TOOL
if exist "%~dp0roc.exe" set ROC_TOOL_PATH=%~dp0
if "%ROC_TOOL_PATH%" == "" goto SEARCH_ROC_TOOL
goto START
:SEARCH_ROC_TOOL
for %%f in (roc.exe) do (
if exist "%%~dp$PATH:f" set ROC_TOOL_PATH="%%~dp$PATH:f"
)
if "%ROC_TOOL_PATH%" == "" goto BUILD_ROC_TOOL
echo Using roc.exe from %ROC_TOOL_PATH%
goto START
:BUILD_ROC_TOOL
set ROC_SRCDIR=%~dp0roc
set ROC_COMPDIR=%~dp0.roc-comp
mkdir %ROC_COMPDIR%
call ecb -config %ROC_SRCDIR%\roc.ecf -finalize -c_compile -project_path %ROC_COMPDIR%
copy %ROC_COMPDIR%\EIFGENs\roc\F_code\roc.exe %~dp0roc.exe
rd /q/s %ROC_COMPDIR%
set ROC_TOOL_PATH=%~dp0
goto START
:START
echo Calling %ROC_TOOL_PATH%roc.exe %*
call %ROC_TOOL_PATH%roc.exe %*
goto END
:END
endlocal
exit /B 0