[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] api/interface class.interface_xmlrpc.php, 1.1.2.1, 1
From: |
Dan Kuykendall <address@hidden> |
Subject: |
[Phpgroupware-cvs] api/interface class.interface_xmlrpc.php, 1.1.2.1, 1.1.2.2 |
Date: |
Sat, 01 Nov 2003 17:36:28 +0000 |
Update of /cvsroot/phpgroupware/api/interface
In directory subversions:/tmp/cvs-serv6237/api/interface
Modified Files:
Tag: proposal-branch
class.interface_xmlrpc.php
Log Message:
added initial introspection support to xmlrpc layer
Index: class.interface_xmlrpc.php
===================================================================
RCS file: /cvsroot/phpgroupware/api/interface/Attic/class.interface_xmlrpc.php,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -C2 -d -r1.1.2.1 -r1.1.2.2
*** class.interface_xmlrpc.php 31 Oct 2003 04:33:47 -0000 1.1.2.1
--- class.interface_xmlrpc.php 1 Nov 2003 17:36:26 -0000 1.1.2.2
***************
*** 26,29 ****
--- 26,30 ----
class api_interface
{
+ var $methodName;
var $op;
var $inputs;
***************
*** 170,173 ****
--- 171,181 ----
$xml_result =
$GLOBALS['phpgw']->base_xml->export_xml();
$api_data = xml2var($xml_result);
+
+ if($this->methodName == 'system.listMethods')
+ {
+ $this->get_method_list($api_data);
+ return;
+ }
+
if(empty($this->method_result) &&
isset($api_data['APP']))
{
***************
*** 278,284 ****
}
! $this->op =
$this->xml_vals[$this->xml_index['methodName'][0]]['value'];
! $GLOBALS['methodCall'] = xml2var($xmlrpc_input);
if(count($this->xml_index['params']) == 2)
--- 286,302 ----
}
! $this->methodName =
$this->xml_vals[$this->xml_index['methodName'][0]]['value'];
! switch ($this->methodName)
! {
! case 'system.listMethods':
! unset($this->op);
! break;
! case 'system.logout':
! $this->op = 'api.base.logout';
! break;
! default:
! $this->op = $this->methodName;
! }
if(count($this->xml_index['params']) == 2)
***************
*** 536,539 ****
--- 554,652 ----
return '<string>'.$param.'</string>';
}
+ }
+
+ function get_method_list($api_data)
+ {
+ if(isset($api_data['API'][0]['apps']['apps_item']))
+ {
+ $applist =
$api_data['API'][0]['apps']['apps_item'];
+ }
+ else
+ {
+ $applist = $api_data['API']['apps'][0];
+ }
+ $applist[] = array('name'=>'api');
+ foreach($applist as $key=>$val)
+ {
+ $appname = $val['name'];
+ if (is_dir(PHPGW_ROOT.SEP.$val['name']))
+ {
+ if ($dh =
opendir(PHPGW_ROOT.SEP.$appname))
+ {
+ while (($file = readdir($dh))
!== false)
+ {
+ if(substr($file, 0, 6)
== 'class.')
+ {
+ $classname =
substr($file, 6, strlen($file)-10);
+
include_once(PHPGW_ROOT.SEP.$appname.SEP.$file);
+ }
+ }
+ closedir($dh);
+ }
+ }
+ }
+ foreach($GLOBALS['docs']['classes'] as
$class=>$class_data)
+ {
+ $pos = strpos($class,'_');
+ $appname = substr($class,0,$pos);
+ $classname = substr($class,($pos + 1));
+
+ if(is_array($class_data['functions']))
+ {
+ foreach($class_data['functions'] as
$function=>$function_data)
+ {
+ $method =
$appname.'.'.$classname.'.'.$function;
+
if($GLOBALS['phpgw']->acl->check($method, 1)
+ || $method ==
'api.base.login'
+ || $method ==
'api.base.logout'
+ || $method ==
'api.base.about'
+ )
+ {
+ $allow_methods[$method]
= $function_data;
+ }
+ }
+ }
+ }
+ if(is_array($allow_methods))
+ {
+ /* I dont think this follows the standard, but
I need to find some good examples of how it SHOULD look. Dan */
+ $result = "<?xml version=\"1.0\"
?>\n<introspection version=\"1.0\">\n<methodList>\n<struct>\n";
+ foreach($allow_methods as
$methodname=>$methodname_data)
+ {
+ if($methodname_data['type'] == 'public')
+ {
+ $result .= "<member>\n";
+ $result .=
"<name>$methodname</name>\n";
+ $result .=
"<purpose>".$methodname_data['abstract']."</purpose>\n";
+
if(is_array($methodname_data['params']))
+ {
+ //$result .=
"<struct>\n<member>\n";
+ $result .= "<params>\n";
+
foreach($methodname_data['params'] as $paramname=>$paramname_data)
+ {
+ $result .=
"<param>\n";
+ $result .=
"<name>$paramname</name>\n";
+ $result .=
"<type>".$paramname_data['type']."</type>\n";
+ $result .=
"<description>".$paramname_data['desc']."</description>\n";
+
if($paramname_data['default'] == '##REQUIRD##' | $paramname_data['default'] ==
'required')
+ {
+ $result
.= "<optional>false</optional>\n";
+ }
+ else
+ {
+ $result
.= "<optional>true</optional>\n";
+ }
+ $result .=
"</param>\n";
+ }
+ $result .=
"</params>\n";
+ //$result .=
"</struct>\n</member>\n";
+ }
+ $result .= "</member>\n";
+ }
+ }
+ $result .=
"</struct>\n</methodList>\n</introspection>";
+ }
+ $this->output($result);
+ exit;
}
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] api/interface class.interface_xmlrpc.php, 1.1.2.1, 1.1.2.2,
Dan Kuykendall <address@hidden> <=
- Prev by Date:
[Phpgroupware-cvs] phpsysinfo/templates/classic/images bar_left.gif, 1.1.1.1, 1.1.1.1.4.1 bar_middle.gif, 1.1.1.1, 1.1.1.1.4.1 bar_right.gif, 1.1.1.1, 1.1.1.1.4.1 redbar_left.gif, 1.1.1.1, 1.1.1.1.4.1 redbar_middle.gif, 1.1.1.1, 1.1.1.1.4.1 redbar_right.gif, 1.1.1.1, 1.1.1.1.4.1
- Next by Date:
[Phpgroupware-cvs] phpgwapi/inc class.schema_proc.inc.php, 1.2.2.3, 1.2.2.4 class.schema_proc_mssql.inc.php, 1.2.2.2, 1.2.2.3 class.schema_proc_mysql.inc.php, 1.6.2.3, 1.6.2.4 class.schema_proc_pgsql.inc.php, 1.5.2.5, 1.5.2.6
- Previous by thread:
[Phpgroupware-cvs] phpsysinfo/templates/classic/images bar_left.gif, 1.1.1.1, 1.1.1.1.4.1 bar_middle.gif, 1.1.1.1, 1.1.1.1.4.1 bar_right.gif, 1.1.1.1, 1.1.1.1.4.1 redbar_left.gif, 1.1.1.1, 1.1.1.1.4.1 redbar_middle.gif, 1.1.1.1, 1.1.1.1.4.1 redbar_right.gif, 1.1.1.1, 1.1.1.1.4.1
- Next by thread:
[Phpgroupware-cvs] phpgwapi/inc class.schema_proc.inc.php, 1.2.2.3, 1.2.2.4 class.schema_proc_mssql.inc.php, 1.2.2.2, 1.2.2.3 class.schema_proc_mysql.inc.php, 1.6.2.3, 1.6.2.4 class.schema_proc_pgsql.inc.php, 1.5.2.5, 1.5.2.6
- Index(es):