// user to the db
            // the caller wishes to add a new
            // user to the db
            case "add_user":
                $uname = $_POST['ajax_uname'];
                $passwd = $_POST['ajax_passwd'];
                $fname = $_POST['ajax_fname'];
                $lname = $_POST['ajax_lname'];
                $email = $_POST['ajax_email'];
                $active = $_POST['ajax_active'];
                add_user($uname, $passwd, $fname, $lname, $email, $active);
                // regenerate the user list
                // and send back the new list
                // as xml
                get_user_list($user_list);
                $xml = generate_object_list_xml($user_list, "");
                echo $xml;
                break;
        }
    }
}
///
/// get_user_list()
/// get the user list from the
/// database
///
function get_user_list(&$user_list)
{
    $user_list = array();
    $sql_str = "SELECT " . "uid, " . "uname " . "FROM " . "tng_user ";
    $dbconn =& new DBConn();
                     populate_forms($obj_list, $uid, false);
                     break;
             }
             break;
         case "group":
             switch ($obj_set) {
                 case "allowed":
                     populate_groups($obj_list, $uid, true);
                     break;
                 case "disallowed":
                     populate_groups($obj_list, $uid, false);
                     break;
             }
             break;
     }
     $xml = generate_object_list_xml($obj_list, "");
     //$html = generate_html($xml, $xslt_user);
     echo $xml;
     break;
     // the user wishes to grant permissions
     // to a certain object to a certain user
 // the user wishes to grant permissions
 // to a certain object to a certain user
 case "grant_perm":
     $obj_type = $_POST['ajax_obj_type'];
     $obj_id = $_POST['ajax_obj_id'];
     $uid = $_POST['uid'];
     $action = "grant";
     switch ($obj_type) {
         case "layer":
             toggle_layer_permission($obj_id, $uid, $action);
     $where_clause = "WHERE pid = " . $_POST['sub_id'];
     $xml = perform_search($where_clause);
     echo $xml;
     break;
     // get files
 // get files
 case "get_sub_files":
     $files = get_files($_POST['sub_id']);
     $xml = generate_object_list_xml($files);
     echo $xml;
     break;
     // get layers
 // get layers
 case "get_sub_layers":
     $layers = get_layers($_POST['sub_id']);
     $xml = generate_object_list_xml($layers);
     echo $xml;
     break;
     // display form
 // display form
 case "display_form":
     display_form($_POST['sub_id']);
     // nothing echoed back. see method.
     break;
     // update name of submission
 // update name of submission
 case "update_sub_name":
     update_sub_name($_POST['sub_id'], escape_special_chars($_POST['sub_name']));
     // nothing echoed back. see method.
     break;
     // update name of submission
     $obj_set = $_POST['ajax_object_set'];
     $form_id = $_POST['form_id'];
     $schema_list = array();
     // now check if the request was
     // for the set of linked schemas
     // or unlinked schemas.
     // call appropriate method accordingly
     switch ($obj_set) {
         case "linked":
             get_schemas($schema_list, $form_id, true);
             break;
         case "unlinked":
             get_schemas($schema_list, $form_id, false);
             break;
     }
     $xml = generate_object_list_xml($schema_list, "");
     echo $xml;
     break;
     // the user wishes to link a schema
     // to a form
 // the user wishes to link a schema
 // to a form
 case "link":
     $attr_table_id = $_POST['schema_id'];
     $form_id = $_POST['form_id'];
     toggle_schema_linkage($attr_table_id, $form_id, "link");
     // nothing echoed back
     break;
     // request to unlink a schema from
     // a form
 // request to unlink a schema from
     break;
     // request for a list of users who've made a submission
 // request for a list of users who've made a submission
 case "get_sub_users":
     $xml = generate_object_list_xml($list_sub_users);
     //$html = generate_html($xml, $xslt_user);
     echo $xml;
     break;
     // request for list of searchable fields for a
     // specific form.
 // request for list of searchable fields for a
 // specific form.
 case "get_spec_field":
     $form_id = $_POST['form_id'];
     $searchable_fields =& get_searchable_fields($form_id);
     $xml = generate_object_list_xml($searchable_fields);
     //$html = generate_html($xml, $xslt_user);
     echo $xml;
     break;
     // perform a search
     // use strip slashes to escape backslashes added
     // by http to escape single quotes.
 // perform a search
 // use strip slashes to escape backslashes added
 // by http to escape single quotes.
 case "perform_search":
     $where_clause = stripslashes($_POST['where_clause']);
     //$where_clause = str_replace($tmp, "\\", "");
     $xml = perform_search($where_clause);
     echo $xml;
     break;