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
188b087d
Commit
188b087d
authored
Jul 04, 2009
by
po34devklaus
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
-- projects
parent
c1d4b14e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
80 additions
and
0 deletions
+80
-0
xml-rpc-procs.tcl
tcl/xml-rpc-procs.tcl
+80
-0
No files found.
tcl/xml-rpc-procs.tcl
View file @
188b087d
...
...
@@ -18,6 +18,86 @@ ad_library {
@cvs-id $Id$
}
namespace
eval xmlrpc-rest
{}
ad_register_proc GET /intranet-xmlrpc/rest/* xmlrpc-rest::dispatchRest
ad_register_proc POST /intranet-xmlrpc/rest/* xmlrpc-rest::dispatchRest
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
]
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
]
}
default
{
ad_return_complaint 1
"ressource not available"
}
}
}
ad_proc -public xmlrpc-rest::handle_rest_project
{
method path url_query user_id
}
{
@return the URL that is listening for RPC requests
}
{
set output
"
\{\"
ResultSet
\"
:
\n\{\n\"
Result
\"
:
\[\n
"
set search_string
""
set query_list
[
split
$url
_query &
]
# Getting list of projects
set project_options
[
im_project_list -exclude_subprojects_p 0 -exclude_status_id
[
im_project_status_closed
]
-project_id 0
]
# ad_return_complaint 1
$project
_options
# find searchstring
foreach sub_list
$query
_list
{
set query_item
[
split
$sub
_list =
]
if
{
"search_string"
==
[
lindex
$query
_item 0
]
}
{
set search_string
[
lindex
$query
_item 1
]
}
}
# ad_return_complaint 1
$search
_string
foreach sub_list
$project
_options
{
if
{
[
llength
$sub
_list
]
}
{
if
{
0 !=
[
llength
[
lindex
$sub
_list 0
]]
}
{
if
{
[
string
first
[
string
tolower
$search
_string
]
[
string
tolower
[
lindex
$sub
_list 0
]]]
!= -1
}
{
append output
"
\{\"
Project
\"
:
\"
"
append output
[
string
map
{
 
;
""
}
[
lindex
$sub
_list 0
]
]
append output
"
\"\}
,"
}
}
}
}
set output
"
[
string
range
$output
0
[
expr
[
string
length
$output
]
-2
]]
"
append output
"
\]\}\n\}
"
# ad_return_complaint 1
$output
return
$output
}
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