2010-09-02 19:14:59 +00:00
|
|
|
<?
|
|
|
|
include "common.inc.php";
|
|
|
|
?>
|
2010-10-08 18:43:20 +00:00
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<script type="text/javascript" src="js/jquery/1.3.2/jquery.min.js"></script>
|
|
|
|
<script type="text/javascript">
|
|
|
|
$(document).ready(function(){
|
|
|
|
$.get('api/role/list', {}, function(results){
|
|
|
|
var list, disabled;
|
|
|
|
var selector = [];
|
|
|
|
selector[0] = $('<select name="role_id"></select>');
|
|
|
|
selector[1] = $('<select name="role_id"></select>');
|
|
|
|
eval('list = ' + results);
|
|
|
|
for(n in list['roles']){
|
|
|
|
disabled = '';
|
|
|
|
if(list['roles'][n].registration == 'not available'){
|
|
|
|
disabled = ' disabled ';
|
|
|
|
}
|
|
|
|
selector[0].append($('<option ' + disabled + ' value="' + list['roles'][n].id + '">' + list['roles'][n].name + '</option>'));
|
|
|
|
selector[1].append($('<option ' + disabled + ' value="' + list['roles'][n].id + '">' + list['roles'][n].name + '</option>'));
|
|
|
|
}
|
|
|
|
$('#rolediv_1').prepend(selector[0]);
|
|
|
|
$('#rolediv_2').prepend(selector[1]);
|
|
|
|
});
|
|
|
|
});
|
2010-10-28 21:22:12 +00:00
|
|
|
|
|
|
|
function submitAccountUpdate(){
|
|
|
|
// using this to avoid passing blank values to the account update API
|
|
|
|
var submitDat = {}, field, value, n, hasvals = false;
|
|
|
|
for(n = 0; n < 4; n++){
|
|
|
|
switch(n){
|
|
|
|
case 0: field = 'username'; value = $('#username').val(); break;
|
|
|
|
case 1: field = 'password'; value = $('#password').val(); break;
|
|
|
|
case 2: field = 'email'; value = $('#email').val(); break;
|
|
|
|
case 3: field = 'link_username_to_email'; value = $('[name=' + field + ']:checked').val(); break;
|
|
|
|
}
|
|
|
|
if(value != undefined && value != ''){
|
|
|
|
eval('submitDat.' + field + ' = value;');
|
|
|
|
hasvals = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(hasvals){
|
|
|
|
$.post('api/account/edit', submitDat,
|
|
|
|
function(result){
|
|
|
|
alert(result);
|
|
|
|
}
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function dateListForConference() {
|
|
|
|
var o=document.getElementById('conferences_id');
|
|
|
|
window.location.href='api/dates/'+o.value;
|
|
|
|
return false;
|
|
|
|
}
|
2010-10-08 18:43:20 +00:00
|
|
|
</script>
|
2010-10-28 21:22:12 +00:00
|
|
|
|
2010-10-08 18:43:20 +00:00
|
|
|
</head>
|
|
|
|
<body>
|
2010-09-02 18:53:48 +00:00
|
|
|
|
2010-11-18 17:24:18 +00:00
|
|
|
<h1>Test API Page</h1>
|
|
|
|
<a href="apidoc.php">API Documentation</a><br />
|
|
|
|
<a href="doc/dictionary.php">Registration Group/Fields Dictionary Documentation</a><br/>
|
|
|
|
|
|
|
|
<h2>General Commands</h2>
|
2010-09-02 19:01:49 +00:00
|
|
|
|
2010-09-02 19:14:59 +00:00
|
|
|
Login
|
2010-09-02 18:53:48 +00:00
|
|
|
<form method="post" action="api/auth/login">
|
|
|
|
<input type="text" name="username">
|
|
|
|
<input type="password" name="password">
|
|
|
|
<input type="submit" value="Login">
|
|
|
|
</form>
|
|
|
|
|
2010-09-02 19:14:59 +00:00
|
|
|
Logout
|
2010-09-02 18:53:48 +00:00
|
|
|
<form method="post" action="api/auth/logout">
|
|
|
|
<input type="submit" value="Logout">
|
|
|
|
</form>
|
|
|
|
|
|
|
|
<a href="api/conferences">Conference List</a><br />
|
2010-09-02 19:14:59 +00:00
|
|
|
Switch Conference
|
2010-09-02 18:53:48 +00:00
|
|
|
<form method="post" action="api/conferences/switch">
|
|
|
|
<input type="text" size=2 name="conferences_id">
|
|
|
|
<input type="submit" value="Switch Conference">
|
|
|
|
</form>
|
|
|
|
<a href="api/dates">Dates List (current conference)</a><br />
|
2010-09-02 19:14:59 +00:00
|
|
|
<form method="post" onsubmit="return dateListForConference()">
|
|
|
|
Date List
|
|
|
|
<input type="text" size=2 id="conferences_id" name="conferences_id">
|
|
|
|
<input type="submit" value="Conference Date List">
|
|
|
|
</form>
|
2010-09-02 18:53:48 +00:00
|
|
|
|
2010-11-18 17:24:18 +00:00
|
|
|
<h2>Account Settings</h2>
|
2010-10-28 21:22:12 +00:00
|
|
|
<strong>Edit account information</strong>
|
|
|
|
Username: <input type="text" id="username"></input><br/>
|
|
|
|
Password: <input type="text" id="password"></input><br/>
|
|
|
|
email: <input type="text" id="email"></input><br/>
|
|
|
|
Link username to email? <input type="radio" name="link_username_to_email" value="yes"></input>Yes <input type="radio" name="link_username_to_email" value="no"></input>No<br/>
|
|
|
|
<button onclick = "submitAccountUpdate(); return false;">Update account information</button>
|
|
|
|
|
2010-11-18 17:24:18 +00:00
|
|
|
<h2>Teacher Specific Commands</h2>
|
2010-09-02 19:01:49 +00:00
|
|
|
<a href="api/scienceolympics/teams/list">Science Olympic Teams List</a><br />
|
|
|
|
|
|
|
|
<form method="post" action="api/scienceolympics/teams/add">
|
|
|
|
<input type="text" name="teamname">
|
|
|
|
<input type="submit" value="Add Team">
|
|
|
|
</form>
|
|
|
|
|
|
|
|
<form method="post" action="api/scienceolympics/teams/delete">
|
|
|
|
<input type="text" size=2 name="id">
|
|
|
|
<input type="submit" value="Delete Team">
|
|
|
|
</form>
|
|
|
|
|
|
|
|
<form method="post" action="api/scienceolympics/teams/edit">
|
|
|
|
<input type="text" size=2 name="id">
|
|
|
|
<input type="text" name="teamname">
|
|
|
|
<input type="submit" value="Edit Team">
|
|
|
|
</form>
|
|
|
|
|
2010-11-18 17:24:18 +00:00
|
|
|
<h2>User Stuff</h2>
|
2010-11-18 15:59:22 +00:00
|
|
|
<a href="api/user/view/">View the user</a><br/>
|
2010-11-23 20:58:38 +00:00
|
|
|
Invite a user:<br/>
|
|
|
|
<form method="post" action="api/user/invite">
|
|
|
|
username: <input type="text" name="username"></input><br/>
|
|
|
|
password: <input type="text" name="password"></input><br/>
|
|
|
|
email address: <input type="text" name="email"></input><br/>
|
|
|
|
role id: <input type="text" name="roles_id"></input><br/>
|
|
|
|
<input type="submit" value="Invite User"></input>
|
|
|
|
</form>
|
2010-11-18 15:59:22 +00:00
|
|
|
|
2010-11-18 17:24:18 +00:00
|
|
|
<h2>Event Schedule</h2>
|
2010-09-28 20:09:31 +00:00
|
|
|
<a href="api/schedule/list">Schedule Listing</a><br/>
|
2010-09-29 21:23:54 +00:00
|
|
|
|
2010-09-28 20:09:31 +00:00
|
|
|
<a href="api/locations/list">Location Listing</a><br/>
|
2010-09-29 21:23:54 +00:00
|
|
|
|
|
|
|
Register a team for a scheduled event<br/>
|
|
|
|
<form method="post" action="api/schedule/register">
|
|
|
|
Team Id: <input type="text" name="team_id"></input>,
|
|
|
|
Schedule ID: <input type="text" name="schedule_id"></input>
|
|
|
|
<input type="submit" value="Register"></input>
|
2010-09-28 20:09:31 +00:00
|
|
|
</form>
|
|
|
|
|
2010-09-29 21:23:54 +00:00
|
|
|
Un-Register a team for a scheduled event<br/>
|
|
|
|
<form method="post" action="api/schedule/unregister">
|
|
|
|
Team Id: <input type="text" name="team_id"></input>,
|
|
|
|
Schedule ID: <input type="text" name="schedule_id"></input>
|
|
|
|
<input type="submit" value="Unregister"></input>
|
|
|
|
</form>
|
|
|
|
|
2010-11-18 17:24:18 +00:00
|
|
|
<h2>Roles</h2>
|
2010-10-08 18:43:20 +00:00
|
|
|
<a href="api/role/list">Get a list of roles for this conference</a><br/>
|
2010-09-29 21:23:54 +00:00
|
|
|
|
2010-10-08 18:43:20 +00:00
|
|
|
Add a role to this account
|
|
|
|
<form method="post" action="api/role/add">
|
|
|
|
<div id="rolediv_1">
|
|
|
|
Password: <input name="password" type="password"></input>
|
|
|
|
<input type="submit" value="Add Role"></input>
|
|
|
|
</div>
|
|
|
|
</form>
|
2010-09-28 20:09:31 +00:00
|
|
|
|
2010-10-08 18:43:20 +00:00
|
|
|
Remove a role from this account
|
|
|
|
<form method="post" action="api/role/remove">
|
|
|
|
<div id="rolediv_2">
|
|
|
|
<input type="submit" value="Remove Role"></input>
|
|
|
|
</div>
|
|
|
|
</form>
|
2010-09-28 20:09:31 +00:00
|
|
|
|
2010-11-18 17:24:18 +00:00
|
|
|
<h2>Registration Fields</h2>
|
|
|
|
<a href="api/registration/dictionary">View the dictionary of registration fields</a>
|
|
|
|
<a href="doc/dictionary.php">View Documentation Generated by this API call</a><br/>
|
|
|
|
<br />
|
2010-10-25 23:55:38 +00:00
|
|
|
(leave all blank to use currently logged in users fields)<br />
|
|
|
|
<form method="post" action="api/registration/fields">
|
|
|
|
<?
|
|
|
|
foreach($roles AS $role=>$r) {
|
2010-10-25 23:58:48 +00:00
|
|
|
echo "<label><input type=\"checkbox\" name=\"roles[]\" value=\"{$r['type']}\">$role</label><br />\n";
|
2010-10-25 23:55:38 +00:00
|
|
|
}?>
|
|
|
|
<input type="submit" value="List Registration Fields for Selected Roles">
|
|
|
|
</form>
|
2010-10-27 16:40:17 +00:00
|
|
|
|
2010-11-18 17:24:18 +00:00
|
|
|
<h2>Schools</h2>
|
2010-10-27 16:40:17 +00:00
|
|
|
<a href="api/school/list">School Listing</a><br/>
|
|
|
|
|
|
|
|
<form method="post" action="api/user/connect_to_school">
|
|
|
|
<input type="text" size=4 name="schools_id">
|
|
|
|
<input type="text" size=6 name="accesscode">
|
|
|
|
<input type="submit" value="Set user's school">
|
|
|
|
</form>
|
|
|
|
|
|
|
|
|
2010-11-18 17:24:18 +00:00
|
|
|
<h2>Session Variables</h2>
|
2010-09-02 19:14:59 +00:00
|
|
|
<?
|
|
|
|
echo json_encode($_SESSION);
|
|
|
|
?>
|
|
|
|
|
2010-09-02 19:01:49 +00:00
|
|
|
|
2010-09-02 18:53:48 +00:00
|
|
|
</body>
|
|
|
|
</html>
|
|
|
|
|
|
|
|
|