mirror of https://github.com/BOINC/boinc.git
54 lines
1.3 KiB
PHP
54 lines
1.3 KiB
PHP
|
<?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;
|
||
|
}
|
||
|
|
||
|
?>
|