Index: Dev/branches/jQueryUI/api.php
===================================================================
--- Dev/branches/jQueryUI/api.php	(revision 246)
+++ Dev/branches/jQueryUI/api.php	(revision 247)
@@ -1,5 +1,5 @@
 <?php
 
-require_once 'classes//master.php';
+require_once 'classes/master.php';
 
 $rawInput = $HTTP_RAW_POST_DATA;
@@ -21,4 +21,5 @@
                 $user = $user_results[0];
                 if ($password == $user->password) {
+                    $output['uid'] = $user->uid;
                     $returnValue = 200;
                 }
@@ -36,15 +37,86 @@
                 $user->password = $password;
                 $user->save();
+                $output['uid'] = $user->uid;
                 $returnValue = 200;
             }
             break;
     }
+
+    if (isset($input->uid)) {
+        $user_results = User::get(array("uid" => $input->uid));
+        if (!empty($user_results)) {
+            $user = $user_results[0];
+            switch ($input->action) {
+                case "createObject":
+                    $uid = null;
+                    switch (strtolower($input->args->type)) {
+                        case "application":
+                            $newApp = new Application(null,
+                                            $input->args->values->title,
+                                            $input->args->values->description,
+                                            $input->args->values->style);
+                            $newApp->save();
+                            $uid = $newApp->uid;
+                            $returnValue = 200;
+                            break;
+                        case "survey":
+                            $newSurvey = new Survey(null,
+                                            $input->args->values->title,
+                                            $input->args->values->description,
+                                            $user, null);
+                            $newSurvey->save();
+                            $uid = $newSurvey->uid;
+                            $returnValue = 200;
+                            break;
+                        case "dashboard":
+                            //TODO
+                            break;
+                        case "question":
+                            $newQuestion = new Question(null,
+                                            $input->args->values->qCode,
+                                            $input->args->values->title,
+                                            $input->args->values->dataType,
+                                            $input->args->values->description,
+                                            $input->args->values->category,
+                                            array());
+                            $newQuestion->save();
+                            $uid = $newQuestion->uid;
+                            $returnValue = 200;
+                            break;
+                        case "session":
+                            $newSession = new Session(null,
+                                            $input->args->values->title,
+                                            $user, new DateTime(), null, null);
+                            $newSession->save();
+                            $uid = $newSession->uid;
+                            $returnValue = 200;
+                            break;
+                    }
+                    $output['uid'] = $uid;
+                    break;
+                case "getObject":
+                    $type = $input->args->type;
+                    $objects = $type::get(array("uid" => $input->args->uid));
+                    if (!empty($objects)) {
+                        $output->object = $objects[0];
+                        $returnValue = 200;
+                    }
+                    break;
+                case "getObjects":
+                    $type = $input->args->type;
+                    $output['objects'] = $type::get($input->args->predicates);
+                    $returnValue = 200;
+                    break;
+            }
+        } else {
+            $returnValue = 403;
+        }
+    }
 }
 
-header("HTTP/1.1 ".$returnValue);
+header("HTTP/1.1 " . $returnValue);
 header("Content-Type: application/json");
 header("Cache-Control: no-cache, must-revalidate");
 header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
 echo(json_encode($output));
-
 ?>
