From: hickert Date: Wed, 20 Oct 2010 14:03:32 +0000 (+0000) Subject: Updated JsonRpc and JsonRop class X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=a7fffbb218c142a5d92a2ca07f93b5dcc666b705;p=gosa.git Updated JsonRpc and JsonRop class -Replace all jsonclass results with the json remove class factory object. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@20104 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-core/include/class_jsonROP.inc b/gosa-core/include/class_jsonROP.inc index 95fee7707..f7008abcb 100644 --- a/gosa-core/include/class_jsonROP.inc +++ b/gosa-core/include/class_jsonROP.inc @@ -1,41 +1,34 @@ configRegistry->getProperty('core', 'debugLevel'); - $dL->setValue(2048) ; - $dL->save(); - - // Connect to the backend and request the given object. - $rpc = $config->getRpcHandle('http://10.3.64.59:8088','',''); - $res = $rpc->openObject($objectID, 12); + // Check for remove objects we've to create + if(isset($result['__jsonclass__'])){ - // Get all relevant class informations - $classDef = $res['__jsonclass__'][1]; - $type = $classDef[0]; - $ref_id = $classDef[1]; - $object_id = $classDef[2]; - $methods = $classDef[3]; - $properties = $classDef[4]; + // Get all relevant class informations + $classDef = $result['__jsonclass__'][1]; + $type = $classDef[0]; + $ref_id = $classDef[1]; + $object_id = $classDef[2]; + $methods = $classDef[3]; + $properties = $classDef[4]; - // Prepare values - $values = array(); - foreach($properties as $prop){ - $values[$prop] = NULL; - if(isset($res[$prop])) $values[$prop] = $res[$prop]; - } + // Prepare values + $values = array(); + foreach($properties as $prop){ + $values[$prop] = NULL; + if(isset($res[$prop])) $values[$prop] = $res[$prop]; + } - // Build up remote object - $object = new remoteObject($rpc, $type, $properties, $values, $methods, $object_id, $ref_id); - return($object); + // Build up remote object + $object = new remoteObject($rpc, $type, $properties, $values, $methods, $object_id, $ref_id); + return($object); + } + return($result); } } diff --git a/gosa-core/include/class_jsonRPC.inc b/gosa-core/include/class_jsonRPC.inc index 0a67bbf80..dff3870d9 100644 --- a/gosa-core/include/class_jsonRPC.inc +++ b/gosa-core/include/class_jsonRPC.inc @@ -182,7 +182,14 @@ class jsonRPC { print_a(array('CALLED:' => array($method => $params))); print_a(array('RESPONSE' => $response)); } - return($response['result']); + $return = $response['result']; + + // Create remote-object handling using the jsonROP class + if(class_available('jsonROP')){ + $return = jsonROP::inspectJsonResult($return); + } + + return($return); }