function process_request($request) { // perform userinfuser registration $ui = new UserInfuser("*****@*****.**", "0658a511-d890-4e51-ba9e-126d6c0a12f2"); $ui->update_user(qa_get_logged_in_email(), qa_get_logged_in_userid(), "", ""); $ui->award_points(qa_get_logged_in_email(), 1000); $pw = $ui->get_widget(qa_get_logged_in_email(), "points", 100, 100); $lw = $ui->get_widget(qa_get_logged_in_email(), "leaderboard", 600, 300); $qa_content = qa_content_prepare(); $qa_content['title'] = 'Example plugin page'; $qa_content['error'] = 'An example error'; $qa_content['custom'] = 'Some <B>custom html</B>'; $qa_content['form'] = array('tags' => 'METHOD="POST" ACTION="' . qa_self_html() . '"', 'style' => 'wide', 'ok' => qa_post_text('okthen') ? 'You clicked OK then!' : null, 'title' => 'Form title', 'fields' => array('request' => array('label' => 'The request' . qa_get_logged_in_userid(), 'tags' => 'NAME="request"', 'value' => qa_html($request), 'error' => qa_html('Another error'))), 'buttons' => array('ok' => array('tags' => 'NAME="okthen"', 'label' => 'OK then', 'value' => '1')), 'hidden' => array('hiddenfield' => '1')); $qa_content['custom_2'] = '<P><BR>More <I>custom html</I></P>'; $qa_content['custom_3'] = $pw . $lw; return $qa_content; }
checkstr(lineno(), $gi->get_widget($testId, "trophy_case", 100, 100), "100"); print $gi->get_widget($testId, "rank", 400, 200); print $gi->get_widget($testId, "notifier", 400, 200); print $gi->get_widget($testId, "trophy_case", 400, 200); print $gi->get_widget($testId, "points", 400, 200); print $gi->get_widget($testId, "leaderboard", 400, 200); print $gi->get_widget($testId, "milestones", 400, 200); print "ANONYMOUS WIDGETS"; print $gi->get_widget("", "rank", 400, 200); print $gi->get_widget("", "notifier", 400, 200); print $gi->get_widget("", "trophy_case", 400, 200); print $gi->get_widget("", "points", 400, 200); print $gi->get_widget("", "leaderboard", 400, 200); print $gi->get_widget("", "milestones", 400, 200); $gi = new UserInfuser($account, $apiKey); $ui_bad = new UserInfuser($account . "x", $apiKey . "x"); $ui_bad->enable_local_testing(); $ui_bad->enable_debug(); $gi->enable_local_testing(); $gi->enable_debug(); $ret = __sync_url_post($prime_path, $argsdict); checkstr(lineno(), $ret, "success"); $ret = __sync_url_post($delete_path, $argsdict); checkstr(lineno(), $ret, "success"); $ret = __sync_url_post($prime_path, $argsdict); checkstr(lineno(), $ret, "success"); checkjson(lineno(), $gi->get_user_data("user_no_exist"), "failed"); # Test with non existing account and api key checkerr(lineno(), $ui_bad->update_user("user_no_exist"), True); checkjson(lineno(), $ui_bad->get_user_data("user_no_exist"), "failed"); # Test with bad api key, but good account