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
3c76c938
Commit
3c76c938
authored
Feb 06, 2014
by
Frank Bergmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- REST:
Fixed return data from PUT on im_hour
parent
006707e8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
9 deletions
+18
-9
intranet-rest-create-procs.tcl
tcl/intranet-rest-create-procs.tcl
+18
-9
No files found.
tcl/intranet-rest-create-procs.tcl
View file @
3c76c938
...
...
@@ -1240,36 +1240,31 @@ ad_proc -private im_rest_post_object_im_hour {
# Extract a key-value list of variables from XML or JSON POST request
array set hash_array
[
im_rest_parse_xml_json_content -rest_otype
$rest
_otype -format
$format
-content
$content
]
ns_log Notice
"im_rest_post_object_
type_
$rest
_otype: hash_array=
[
array
get hash_array
]
"
ns_log Notice
"im_rest_post_object_
$rest
_otype: hash_array=
[
array
get hash_array
]
"
# write hash values as local variables
foreach key
[
array
names hash_array
]
{
set value
$hash
_array
(
$key
)
ns_log Notice
"im_rest_post_object_type_
$rest
_otype: key=
$key
, value=
$value
"
set
$key
$value
}
set hours
$hash
_array
(
hours
)
set hour_id
$hash
_array
(
hour_id
)
if
{
""
==
$hours
|| 0.0 ==
$hours
}
{
# Delete the hour instead of updating it.
# im_hours is not a real object, so we don't need to
# cleanup acs_objects.
ns_log Notice
"im_rest_post_object_im_hour: deleting hours because hours='
$hours
', hour_id=
$hour
_id"
db_dml del_hours
"delete from im_hours where hour_id = :hour_id"
}
else
{
# Update the object. This routine will return a HTTP error in case
# of a database constraint violation
ns_log Notice
"im_rest_post_object_im_hour: updating hours=
$hours
with hour_id=
$hour
_id"
ns_log Notice
"im_rest_post_object_im_hour:
Before
updating hours=
$hours
with hour_id=
$hour
_id"
im_rest_object_type_update_sql
\
-rest_otype
$rest
_otype
\
-rest_oid
$rest
_oid
\
-hash_array
[
array
get hash_array
]
ns_log Notice
"im_rest_post_object_im_hour: After updating hours=
$hours
with hour_id=
$hour
_id"
}
# The update was successful - return a suitable message.
...
...
@@ -1283,7 +1278,21 @@ ad_proc -private im_rest_post_object_im_hour {
</table>
[
im_footer
]
"
}
xml
{
doc_return 200
"text/xml"
"<?xml version='1.0'?>
\n
<object_id id=
\"
$rest
_oid
\"
>
$rest
_oid</object_id>
\n
"
}
xml
{
doc_return 200
"text/xml"
"<?xml version='1.0'?>
\n
<object_id id=
\"
$rest
_oid
\"
>
$rest
_oid</object_id>
\n
"
}
json
{
# doc_return 200
"text/html"
"{
\"
success
\"
: true,
\n\"
object_id
\"
:
$rest
_oid}"
set data_list
[
list
]
foreach key
[
array
names hash_array
]
{
set value
$hash
_array
(
$key
)
lappend data_list
"
\"
$key
\"
:
\"
[
im_quotejson
$value
]
\"
"
}
set data
"
\[
{
[
join
$data
_list
", "
]
}
\]
"
set result
"{
\"
success
\"
:
\"
true
\"
,
\"
message
\"
:
\"
Object updated
\"
,
\"
data
\"
:
$data
}"
doc_return 200
"text/html"
$result
}
}
}
...
...
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