Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
X
xml-rpc
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
xml-rpc
Commits
d93bdce8
Commit
d93bdce8
authored
Aug 08, 2009
by
po34devklaus
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
--dev
parent
f6b87f10
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
63 additions
and
17 deletions
+63
-17
xml-rpc-procs.tcl
tcl/xml-rpc-procs.tcl
+63
-17
No files found.
tcl/xml-rpc-procs.tcl
View file @
d93bdce8
...
...
@@ -29,27 +29,82 @@ ad_proc -public xmlrpc-rest::dispatchRest {} {
@return dispatches REST requests
@author Klaus Hofeditz
}
{
set user_id
[
ad_maybe_redirect_for_registration
]
set urlpieces
[
ns_conn urlv
]
set path
[
lrange
$urlpieces
2
[
llength
$urlpieces
]]
set url_query
[
ns_conn query
]
set header_vars
[
ns_conn form
]
set var_list
[
ad_ns_set_keys
$header
_vars
]
switch
[
lindex
$urlpieces
2
]
{
companies
{
return
[
xmlrpc-rest::handle_rest_company
[
ns_conn method
]
$path
$url
_query
$user
_id
]
}
timesheet
{
return
[
xmlrpc-rest::handle_rest_timesheet
[
ns_conn method
]
$path
$url
_query
$user
_id
]
}
projects
{
doc_return 200
"text/plain"
[
xmlrpc-rest::handle_rest_project
[
ns_conn method
]
$path
$url
_query
$user
_id
]
}
timesheet
{
doc_return 200
"text/plain"
[
xmlrpc-rest::handle_rest_timesheet
[
ns_conn method
]
$path
$url
_query
$user
_id
]
}
projects
{
doc_return 200
"text/plain"
[
xmlrpc-rest::handle_rest_project
[
ns_conn method
]
$path
$url
_query
$user
_id
]
}
action_items
{
doc_return 200
"text/plain"
[
xmlrpc-rest::handle_action_items
[
ns_conn method
]
$path
$url
_query
$user
_id
]
}
default
{
ad_return_complaint 1
"ressource not available"
}
}
}
ad_proc -public xmlrpc-rest::handle_rest_timesheet
{
method path url_query user_id
}
{
handles timesheet actions
}
{
# doc_return 200
"text/plain"
[
lindex
$path
1
]
# doc_return 200
"text/plain"
"
$method
$path
$url
_query
$param
"
set query_list
[
split
$url
_query &
]
foreach sub_list
$query
_list
{
set query_item
[
split
$sub
_list =
]
if
{
"scope"
==
[
lindex
$query
_item 0
]
}
{
set scope
[
lindex
$query
_item 1
]
}
else
if
{
"hours"
==
[
lindex
$query
_item 0
]
}
{
set hours
[
lindex
$query
_item 1
]
}
else
if
{
"hours_curr"
==
[
lindex
$query
_item 0
]
}
{
set hours_curr
[
lindex
$query
_item 1
]
}
}
set task_id
[
lindex
$path
1
]
if
{
"GET"
==$method
}
{
if
{
"today"
==$scope
}
{
doc_return 200
"text/plain"
[
db_string get_view_id
"select hours from im_hours where day::date = now()::date and project_id=
$task
_id"
-default 0
]
}
}
else
if
{
"POST"
==$method
}
{
if
{
"0"
!=$hours_curr
}
{
db_dml update
"update im_hours set hours =
$hours
where day::date = now()::date and project_id=
$task
_id"
}
else
{
set default_currency
[
ad_parameter -package_id
[
im_package_cost_id
]
"DefaultCurrency"
""
"EUR"
]
set billing_rate 0
set billing_currency
""
db_0or1row get_billing_rate
"
select hourly_cost as billing_rate,
currency as billing_currency
from im_employees
where employee_id =
$user
_id
"
if
{
""
==
$billing
_currency
}
{
set billing_currency
$default
_currency
}
set day_julian
[
db_string sysdate_as_julian
"select to_char(sysdate,'J') from dual"
]
db_dml hours_insert
"
insert into im_hours (
user_id, project_id,
day, hours,
billing_rate, billing_currency
) values (
$user
_id,
$task
_id,
to_date(:day_julian,'J'),
$hours
,
:billing_rate, :billing_currency
)"
}
}
}
ad_proc -public xmlrpc-rest::handle_action_items
{
method path url_query user_id
}
{
@return project list / task list
}
{
...
...
@@ -105,6 +160,7 @@ ad_proc -public xmlrpc-rest::handle_rest_project {method path url_query user_id}
@return project list / task list
}
{
set query_list
[
split
$url
_query &
]
...
...
@@ -150,16 +206,6 @@ ad_proc -public xmlrpc-rest::handle_rest_project {method path url_query user_id}
}
ad_proc -public xmlrpc-rest::handle_rest_timesheet
{
method path param
}
{
@return the URL that is listening for RPC requests
}
{
# only project timesheet data day / project
}
# setup nsv array to hold procs that are registered for xml-rpc access
nsv_array set xmlrpc_procs
[
list
]
...
...
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