Code

Updated json Rop and RPC again
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 20 Oct 2010 14:06:38 +0000 (14:06 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 20 Oct 2010 14:06:38 +0000 (14:06 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@20105 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-core/include/class_jsonROP.inc
gosa-core/include/class_jsonRPC.inc

index f7008abcb248302270f359309664cac64cf55e99..013ed719389f29fa4f30e04387777ecba84473ac 100644 (file)
@@ -1,38 +1,5 @@
 <?php
 
-class jsonROP
-{
-    private $config;
-
-    public static function inspectJsonResult($result)
-    {
-        // Check for remove objects we've to create
-        if(isset($result['__jsonclass__'])){
-
-            // 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]; 
-            }
-
-            // Build up remote object
-            $object = new remoteObject($rpc, $type, $properties, $values, $methods, $object_id, $ref_id);
-            return($object);
-        }        
-        return($result);
-    }
-}
-
-
 class remoteObject
 {
     private $rpcHandle;
index dff3870d9e9319f4eb8037975e591f913ae77bdd..07c53ea3ac75b33cca72e577a254cf3bba1bcd9d 100644 (file)
@@ -184,15 +184,50 @@ class jsonRPC {
         }
         $return = $response['result'];
         
-        // Create remote-object handling using the jsonROP class
-        if(class_available('jsonROP')){
-            $return = jsonROP::inspectJsonResult($return);
-        }
+        // Inspect the result and replace predefined statements with their 
+        //  coresponding classes.
+        $return = $this->inspectJsonResult($return);
 
         return($return);
     }
 
 
+
+    public function inspectJsonResult($result)
+    {
+        // Check for remove objects we've to create
+        if(isset($result['__jsonclass__']) && class_available('remoteObject')){
+
+            // 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];
+            }
+
+            // Build up remote object
+            $object = new remoteObject($rpc, $type, $properties, $values, $methods, $object_id, $ref_id);
+            return($object);
+        }
+        return($result);
+    }
+
+
+
+
+
+
+
+
+
     /*! \brief      This method finally initiates the real RPC requests and handles 
      *               the result from the server.
      *  @param      string  method      The method to call