Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
I
intranet-rest
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
project-open
intranet-rest
Commits
1166570b
Commit
1166570b
authored
Oct 05, 2016
by
Frank Bergmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- TaskTree action now returns errors in JSON error format
suitable to be parsed by Sencha ExtJS
parent
9d0dbf62
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
52 additions
and
43 deletions
+52
-43
project-task-tree-action.adp
www/data-source/project-task-tree-action.adp
+1
-1
project-task-tree-action.tcl
www/data-source/project-task-tree-action.tcl
+51
-42
No files found.
www/data-source/project-task-tree-action.adp
View file @
1166570b
{success:true, message: 'Successfully performed action=@action@'}
\ No newline at end of file
{success:@success@, message: '@message@'}
\ No newline at end of file
www/data-source/project-task-tree-action.tcl
View file @
1166570b
...
...
@@ -14,58 +14,67 @@
set
debug_p 0
# ---------------------------------------------------------------
#
Security
#
# ---------------------------------------------------------------
# Check that the user is logged in
set
current_user_id
[
auth::require_login
]
ns_log Notice
"project-task-tree-action: query_hash_pairs=
$query
_hash_pairs"
array
set var_hash
$query
_hash_pairs
set
action
$var
_hash
(
action
)
# Parse the JSON POST data
set
post_content
[
ns_conn content
]
array
set json_hash
[
util::json::parse
$post
_content
]
ns_log Notice
"project-task-tree-action: json_hash=
[
array
get json_hash
]
"
# ---------------------------------------------------------------
# Check for single update
# ---------------------------------------------------------------
if
{[
info
exists json_hash
(
_object_
)]}
{
set json_list
$json
_hash
(
_object_
)
ns_log Notice
"project-task-tree-action: object: json_list=
$json
_list"
im_rest_project_task_tree_action -pass 1 -action
$action
-var_hash_list
$json
_list
im_rest_project_task_tree_action -pass 2 -action
$action
-var_hash_list
$json
_list
}
# ---------------------------------------------------------------
# Check for multiple updates
# ---------------------------------------------------------------
if
{[
info
exists json_hash
(
_array_
)]}
{
set json_array
$json
_hash
(
_array_
)
ns_log Notice
"project-task-tree-action: pass=1, array=
$json
_array"
foreach array_elem
$json
_array
{
ns_log Notice
"project-task-tree-action: pass=1, array_elem=
$array
_elem"
set obj
[
lindex
$array
_elem 0
]
set json_list
[
lindex
$array
_elem 1
]
ns_log Notice
"project-task-tree-action: pass=1, decomposing array_elem:
$obj
=
$json
_list"
# Default values for JSON return message
set
success
"true"
set
message
"Successfully performed action=
$action
"
if
{[
catch
{
# Parse the JSON POST data
sset post_content
[
ns_conn content
]
array set json_hash
[
util::json::parse
$post
_content
]
ns_log Notice
"project-task-tree-action: json_hash=
[
array
get json_hash
]
"
# ---------------------------------------------------------------
# Check for single update
# ---------------------------------------------------------------
if
{[
info
exists json_hash
(
_object_
)]}
{
set json_list
$json
_hash
(
_object_
)
ns_log Notice
"project-task-tree-action: object: json_list=
$json
_list"
im_rest_project_task_tree_action -pass 1 -action
$action
-var_hash_list
$json
_list
im_rest_project_task_tree_action -pass 2 -action
$action
-var_hash_list
$json
_list
}
ns_log Notice
"project-task-tree-action: pass=2, array=
$json
_array"
foreach array_elem
$json
_array
{
ns_log Notice
"project-task-tree-action: pass=2, array_elem=
$array
_elem"
set obj
[
lindex
$array
_elem 0
]
set json_list
[
lindex
$array
_elem 1
]
ns_log Notice
"project-task-tree-action: pass=2, decomposing array_elem:
$obj
=
$json
_list"
im_rest_project_task_tree_action -pass 2 -action
$action
-var_hash_list
$json
_list
# ---------------------------------------------------------------
# Check for multiple updates
# ---------------------------------------------------------------
if
{[
info
exists json_hash
(
_array_
)]}
{
set json_array
$json
_hash
(
_array_
)
ns_log Notice
"project-task-tree-action: pass=1, array=
$json
_array"
foreach array_elem
$json
_array
{
ns_log Notice
"project-task-tree-action: pass=1, array_elem=
$array
_elem"
set obj
[
lindex
$array
_elem 0
]
set json_list
[
lindex
$array
_elem 1
]
ns_log Notice
"project-task-tree-action: pass=1, decomposing array_elem:
$obj
=
$json
_list"
im_rest_project_task_tree_action -pass 1 -action
$action
-var_hash_list
$json
_list
}
ns_log Notice
"project-task-tree-action: pass=2, array=
$json
_array"
foreach array_elem
$json
_array
{
ns_log Notice
"project-task-tree-action: pass=2, array_elem=
$array
_elem"
set obj
[
lindex
$array
_elem 0
]
set json_list
[
lindex
$array
_elem 1
]
ns_log Notice
"project-task-tree-action: pass=2, decomposing array_elem:
$obj
=
$json
_list"
im_rest_project_task_tree_action -pass 2 -action
$action
-var_hash_list
$json
_list
}
}
}
}
err_msg
]}
{
set success
"false"
set message
[
im_rest_error -format json -http_status 404 -message
"Internal Error:
[
ad_print_stack_trace
]
"
]
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment