mirror of https://github.com/BOINC/boinc.git
parent
74fe548296
commit
e866381c4a
|
@ -2,9 +2,8 @@
|
|||
|
||||
$project_news = array(
|
||||
array("July 30, 2008",
|
||||
"BOINC 6.2.14 has been released to the public for all platforms.
|
||||
Please visit the <a href=http://boinc.berkeley.edu/download.php>
|
||||
download</a> page to upgrade now."
|
||||
"BOINC 6.2.14 is now the recommended version for all platforms.
|
||||
<a href=http://boinc.berkeley.edu/download.php>Upgrade now</a>."
|
||||
),
|
||||
array("July 29, 2008",
|
||||
"The <a href=http://qcn.stanford.edu>Quake Catcher Network</a>
|
||||
|
|
|
@ -34,4 +34,13 @@ function bossa_app_lookup($name) {
|
|||
return $app->id;
|
||||
}
|
||||
|
||||
function bossa_lookup_job($instid, &$job, &$inst, &$user) {
|
||||
$inst = BossaJobInst::lookup_id($instid);
|
||||
if (!$inst) return false;
|
||||
$job = BossaJob::lookup_id($inst->job_id);
|
||||
$user = BoincUser::lookup_id($inst->user_id);
|
||||
BossaUser::lookup($user);
|
||||
return true;
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
@ -0,0 +1,172 @@
|
|||
<?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>
|
||||
";
|
||||
}
|
||||
|
||||
?>
|
|
@ -132,7 +132,7 @@ function job_show_instances($job) {
|
|||
<td>$d</td>
|
||||
<td>
|
||||
";
|
||||
echo instance_summary($inst->get_info());
|
||||
echo instance_summary($inst->get_opaque_data());
|
||||
echo "
|
||||
</td>
|
||||
</tr>
|
||||
|
@ -280,6 +280,7 @@ case 'add_app':
|
|||
$time_estimate = get_str('time_estimate');
|
||||
$time_limit = get_str('time_limit');
|
||||
$calibration_frac = get_str('calibration_frac' , true);
|
||||
if (!$calibration_frac) $calibration_frac = 0;
|
||||
$now = time();
|
||||
$app_id = BossaApp::insert("(create_time, name, short_name, description, bolt_course_id, time_estimate, time_limit, calibration_frac) values ($now, '$name', '$short_name', '$description', $courseid, $time_estimate, $time_limit, $calibration_frac)");
|
||||
if ($courseid) {
|
||||
|
|
|
@ -0,0 +1,52 @@
|
|||
<?php
|
||||
|
||||
// Make some jobs for Bossa example 4
|
||||
// Usage:
|
||||
// bossa_example4_make_jobs.php
|
||||
// --dir dir
|
||||
|
||||
require_once("../inc/bossa.inc");
|
||||
|
||||
function make_job($path, $batchid, $appid) {
|
||||
$info = null;
|
||||
$info->path = $path;
|
||||
|
||||
if (!bossa_job_create($appid, $batchid, $info, false)) {
|
||||
exit("bossa_create_job() failed\n");
|
||||
}
|
||||
echo "created job for $path\n";
|
||||
}
|
||||
|
||||
function make_jobs($dir, $appid) {
|
||||
$batchid = bossa_batch_create($appid, date(DATE_RFC822), false);
|
||||
if (!$batchid) {
|
||||
exit("bossa_create_batch() failed\n");
|
||||
}
|
||||
|
||||
$d = opendir("../user/$dir");
|
||||
while ($file = readdir($d)) {
|
||||
if (!strstr($file, ".png") && !strstr($file, ".jpg")) continue;
|
||||
make_job("$dir/$file", $batchid, $appid);
|
||||
}
|
||||
closedir($d);
|
||||
}
|
||||
|
||||
function usage() {
|
||||
exit("Usage: bossa_example4_make_jobs.php --dir d\n");
|
||||
}
|
||||
|
||||
for ($i=1; $i<$argc; $i++) {
|
||||
if ($argv[$i] == '--dir') $dir = $argv[++$i];
|
||||
else usage();
|
||||
}
|
||||
|
||||
if (!$dir) usage();
|
||||
|
||||
if (!is_dir("../user/$dir")) {
|
||||
exit("../user/$dir is not a directory\n");
|
||||
}
|
||||
|
||||
$appid = bossa_app_lookup("bossa_example4");
|
||||
if (!$appid) exit("No application 'bossa_example4'\n");
|
||||
|
||||
make_jobs($dir, $appid);
|
|
@ -41,7 +41,7 @@ function make_jobs($dir, $appid, $calibration) {
|
|||
}
|
||||
|
||||
function usage() {
|
||||
exit("Usage: bossa_example_make_jobs --app_name x --dir d [--calibration]]\n");
|
||||
exit("Usage: php bossa_example_make_jobs.php --app_name x --dir d [--calibration]]\n");
|
||||
}
|
||||
|
||||
$calibration = false;
|
||||
|
|
|
@ -25,7 +25,9 @@ function show_app($app) {
|
|||
} else {
|
||||
$x = "<a href=bossa_get_job.php?bossa_app_id=$app->id>Get job</a>";
|
||||
}
|
||||
row2("$app->name<span class=note><br>$app->description</span>", $x);
|
||||
$est = number_format($app->time_estimate/60., 2);
|
||||
$limit = number_format($app->time_limit/60., 2);
|
||||
row2("$app->name<br><span class=note>$app->description<br>Time: $est min. average, $limit min limit</span>", $x);
|
||||
}
|
||||
|
||||
function show_apps() {
|
||||
|
|
|
@ -0,0 +1,53 @@
|
|||
<?php
|
||||
|
||||
require_once("../inc/util.inc");
|
||||
require_once("../inc/bossa.inc");
|
||||
require_once("../inc/bossa_example4.inc");
|
||||
|
||||
function handle_add($job, $inst) {
|
||||
$f = null;
|
||||
$f->x = get_int('pic_x');
|
||||
$f->y = get_int('pic_y');
|
||||
$f->type = get_str('type');
|
||||
$c = get_str('comment', true);
|
||||
if (strstr($c, "(optional)")) $c = "";
|
||||
$f->comment = $c;
|
||||
$output = $inst->get_opaque_data();
|
||||
$output->features[] = $f;
|
||||
$inst->set_opaque_data($output);
|
||||
header("location: bossa_example4.php?bji=$inst->id");
|
||||
}
|
||||
|
||||
function handle_delete($job, $inst, $index) {
|
||||
$output = $inst->get_opaque_data();
|
||||
$features = $output->features;
|
||||
array_splice($features, $index, 1);
|
||||
$output->features = $features;
|
||||
$inst->set_opaque_data($output);
|
||||
header("location: bossa_example4.php?bji=$inst->id");
|
||||
}
|
||||
|
||||
$bji = get_int("bji");
|
||||
if (!bossa_lookup_job($bji, $job, $inst, $u)) {
|
||||
error_page("No such instance");
|
||||
}
|
||||
$user = get_logged_in_user();
|
||||
if ($u->id != $user->id) {
|
||||
error_page("Not your job");
|
||||
}
|
||||
|
||||
$action = get_str("action", true);
|
||||
switch ($action) {
|
||||
case "add":
|
||||
handle_add($job, $inst);
|
||||
break;
|
||||
case "delete":
|
||||
$index = get_int("index");
|
||||
handle_delete($job, $inst, $index);
|
||||
break;
|
||||
default:
|
||||
job_show($job, $inst, $user);
|
||||
break;
|
||||
}
|
||||
|
||||
?>
|
Loading…
Reference in New Issue