boinc/html/inc/bossa_example4.inc

173 lines
4.2 KiB
PHP

<?php
require_once("../inc/bossa.inc");
function job_show($job, $inst, $user) {
$output = $inst->get_opaque_data();
$features = $output->features;
$input = $job->get_opaque_data();
$path = $input->path;
show_style();
echo "
<script>
function image_clicked() {
if (document.forms.main.type.value == 'none') {
alert('Please select a feature type');
return false;
} else {
return true;
}
return false;
}
</script>
<form name=main onsubmit=\"javascript: return image_clicked()\" action=bossa_example4.php>
<div style=\"position:relative; top:60; \">
<input type=hidden name=action value=add>
<input type=hidden name=bji value=\"$inst->id\">
<input type=image name=pic src=$path>
";
$size = 100;
$size2 = 50;
$i = 0;
foreach ($features as $f) {
$cx = $f->x - $size2;
$cy = $f->y - $size2;
echo "
<span style=\"width:".$size."px;height:".$size."px;position:absolute;top:".$cy.";left:".$cx.";color:white;border-style:solid;border-width:1px\">
";
$c = $f->comment?"($f->comment)":"";
echo "
<span class=link>
<a href=\"javascript: void(0)\">
<img border=0 align = left src=images/info_icon.png>
<span>
$f->type $c
</span>
</a>
</span>
";
echo "
<a href=bossa_example4.php?bji=$inst->id&action=delete&index=$i><img border=0 align=right src=images/close_button.jpg></a>
</span>
";
$i++;
}
echo "
</div>
";
control_bar($features, $inst);
echo "
</form>
";
}
function job_issued($job, $inst, $user) {
$job->set_priority(0);
}
function job_finished($job, $inst) {
}
function job_timed_out($job, $inst, $user) {
$job->set_priority(1);
}
function job_summary($job) {
$info = $job->get_opaque_data();
return "<a href=".URL_BASE."$info->path>View image</a>";
}
function instance_summary($opaque_data) {
$features = $opaque_data->features;
$x = "";
foreach ($features as $f) {
$c = $f->comment?"($f->comment)":"";
$x .= "$f->type $c <br>";
}
return $x;
}
function show_user_summary($user) {
}
function show_style() {
echo "
<style type=\"text/css\">
body {
font: 15px \"Trebuchet MS\", sans-serif;
}
span.link {
position: relative;
}
span.link a span {
display: none;
}
span.link a:hover {
font-size: 99%;
font-color: #000000;
}
span.link a:hover span {
display: block;
position: absolute;
margin-top: 10px;
margin-left: -10px;
width: 175px; padding: 5px;
z-index: 100;
color: #000000;
background: #ffffcc;
font: 12px \"Arial\", sans-serif;
text-align: left;
text-decoration: none;
}
</style>
";
}
function select_type() {
echo "
<select name=type>
<option value=none> select feature type
<option> Tooth
<option> Skull
<option> Other
</select>
";
}
function control_bar($features, $inst) {
if (count($features)) {
$str1 = "any more";
$str2 = "another";
} else {
$str1 = "any";
$str2 = "a";
}
echo "
<div style=\"position:fixed; top:0px; left:0px; padding-top: 10px; padding-left: 20px; width:100%; background-color:white\">
<input type=hidden name=bji value=\"$inst->id\">
If you see $str2 feature:
";
select_type();
echo "
<script>
function clear_comment() {
document.forms.main.comment.value = '';
}
</script>
<input name=comment onfocus=\"javascript: clear_comment()\" size=30 value=\"enter comment (optional)\">
and click on its center.
<br>
If you don't see $str1 features, click
<a href=bossa_job_finished.php?bji=$inst->id>DONE</a>
</div>
";
}
?>