2007-10-16 23:02:13 +00:00
|
|
|
<?php
|
|
|
|
|
2007-10-18 21:43:25 +00:00
|
|
|
require_once("../inc/bossa.inc");
|
2007-10-16 23:02:13 +00:00
|
|
|
|
|
|
|
// Bossa example.
|
2008-02-11 23:38:31 +00:00
|
|
|
// Show the user an image and ask them to click on the ellipse
|
2007-10-16 23:02:13 +00:00
|
|
|
|
|
|
|
function show_job($bj, $bji) {
|
2007-10-18 21:43:25 +00:00
|
|
|
$info = json_decode($bj->info);
|
2008-02-11 23:38:31 +00:00
|
|
|
$img_url = $info->url;
|
2007-10-16 23:02:13 +00:00
|
|
|
echo "
|
2008-02-13 19:02:44 +00:00
|
|
|
<h2>Find the Ellipse!</h2>
|
2007-10-16 23:02:13 +00:00
|
|
|
<form method=get action=bossa_example.php>
|
2008-02-11 23:38:31 +00:00
|
|
|
Click on the center of the ellipse.
|
|
|
|
If you don't see one, click here:
|
|
|
|
<input type=submit name=submit value=None>
|
2008-02-13 19:02:44 +00:00
|
|
|
<br><br>
|
2008-02-11 23:38:31 +00:00
|
|
|
<input type=hidden name=bji value=$bji->id>
|
|
|
|
<input type=hidden name=completion value=1>
|
|
|
|
<input type=image name=pic src=$img_url>
|
2007-10-16 23:02:13 +00:00
|
|
|
</form>
|
|
|
|
";
|
|
|
|
}
|
|
|
|
|
|
|
|
function handle_job_completion($bj, $bji) {
|
2007-10-18 21:43:25 +00:00
|
|
|
$response = null;
|
2008-02-11 23:38:31 +00:00
|
|
|
if (get_str('submit', true)) {
|
|
|
|
$response->have_ellipse = 0;
|
|
|
|
} else {
|
|
|
|
$response->have_ellipse = 1;
|
2008-02-12 15:04:27 +00:00
|
|
|
$response->cx = get_int('pic_x');
|
|
|
|
$response->cy = get_int('pic_y');
|
2008-02-11 23:38:31 +00:00
|
|
|
}
|
2007-10-18 21:43:25 +00:00
|
|
|
$bji->info = json_encode($response);
|
2007-10-16 23:02:13 +00:00
|
|
|
$bji->completed($bj);
|
2008-02-11 23:38:31 +00:00
|
|
|
Bossa::show_next_job($bj); // show another job immediately
|
2007-10-16 23:02:13 +00:00
|
|
|
}
|
|
|
|
|
2007-10-18 21:43:25 +00:00
|
|
|
Bossa::script_init($user, $bj, $bji);
|
2007-10-16 23:02:13 +00:00
|
|
|
|
2008-02-11 23:38:31 +00:00
|
|
|
if (isset($_GET['completion'])) {
|
2007-10-16 23:02:13 +00:00
|
|
|
handle_job_completion($bj, $bji);
|
|
|
|
} else {
|
|
|
|
show_job($bj, $bji);
|
|
|
|
}
|
|
|
|
|
|
|
|
?>
|