- improvements to remote job submission web pages

This commit is contained in:
David Anderson 2013-01-08 18:40:06 -08:00 committed by Oliver Bock
parent d79c9584f2
commit 21e747a114
5 changed files with 79 additions and 38 deletions

View File

@ -103,7 +103,7 @@ function do_http_op($req, $xml, $op) {
$post = array();
$post["request"] = $xml;
$cwd = getcwd();
if ($op == "submit_batch) {
if ($op == "submit_batch") {
foreach ($req->jobs as $job) {
foreach ($job->input_files as $file) {
if ($file->mode == "inline") {
@ -180,7 +180,7 @@ function boinc_query_batches($req) {
<authenticator>$req->authenticator</authenticator>
</query_batches>
";
list($reply, $errmsg) = do_http_op($req, $req_xml);
list($reply, $errmsg) = do_http_op($req, $req_xml, "");
if ($errmsg) return array(null, $errmsg);
$batches = array();
foreach ($reply->batch as $batch) {

View File

@ -107,7 +107,7 @@ function permissions_form($app) {
$user = BoincUser::lookup_id($busa->user_id);
echo "
<tr>
<td>$user->name ($user->id)</td>
<td>$user->name (ID: $user->id)</td>
<td><input type=checkbox name=user_$user->id checked></td>
</tr>
";
@ -211,16 +211,16 @@ if (!$bus->manage_all) {
$action = get_str("action", true);
switch ($action) {
case "":
main_page($app); break;
//case "":
// main_page($app); break;
case "app_version_form":
app_version_form($app); break;
case "app_version_action":
app_version_action($app); break;
case "permissions_form":
permissions_form($app); break;
case "permissions_action":
permissions_action($app); break;
//case "permissions_form":
// permissions_form($app); break;
//case "permissions_action":
// permissions_action($app); break;
case "batches_form":
batches_form($app); break;
case "batches_action":

View File

@ -19,7 +19,7 @@
// Interface for project-wide functions:
// - control user quotas and permissions to submit jobs
// - create apps
// - create apps (not implemented yet)
require_once("../inc/submit_db.inc");
require_once("../inc/util.inc");
@ -28,8 +28,9 @@ function user_row($u) {
$user = BoincUser::lookup_id($u->user_id);
echo "
<tr>
<td>$user->name (ID: $user->id)
<a href=manage_project.php?action=edit_form&user_id=$u->user_id>Edit permissions</a>
<td>
<a href=manage_project.php?action=edit_form&user_id=$u->user_id>$user->name</a>
(ID: $user->id)
</td>
";
echo "<td>";
@ -41,32 +42,45 @@ function user_row($u) {
$app = BoincApp::lookup_id($ua->app_id);
echo "$app->name ";
}
if (count($uas) == 0) {
echo "---";
}
}
echo "</td>\n";
echo "<td>$u->quota</td>\n";
echo "<td>
echo "<td>";
if ($u->logical_start_time > time()) {
echo local_time_str($u->logical_start_time);
} else {
echo "---";
}
echo "
</td>
</tr>
";
}
function handle_list() {
page_head("Project-wide management functions");
echo "<h3>User permissions and quotas</h3>
The following users are allowed to submit jobs.
page_head("Job submission access control");
echo "The following users are allowed to submit jobs.
<p>
";
show_button("manage_project.php?action=add_form",
"Add user", "Allow a new user to submit jobs"
);
$us = BoincUserSubmit::enum("");
start_table();
table_header("User", "Can submit jobs for", "Quota");
table_header(
"User<br><span class=note>Click to change permissions or quota</span>",
"Can submit jobs for",
"Quota",
"Current priority<br><span class=note>Later time = lower priority</span>"
);
foreach ($us as $u) {
user_row($u);
}
end_table();
show_button("manage_project.php?action=add_form",
"Add user", "Allow a new user to submit jobs"
);
page_tail();
}
@ -137,9 +151,7 @@ function handle_edit_action() {
if ($quota != $us->quota) {
$us->update("quota=$quota");
}
page_head("Update successful");
echo "<a href=manage_project.php>Return to project-wide management functions</a>";
page_tail();
header('Location: manage_project.php');
}
function handle_add_form() {
@ -171,7 +183,7 @@ function handle_add_action() {
$user = get_logged_in_user();
$bus = BoincUserSubmit::lookup_userid($user->id);
if (!$bus) {
die("no access");
error_page("no access");
}
$action = get_str('action', true);

View File

@ -47,6 +47,7 @@ function show_all_link($batches, $state, $limit, $user, $app) {
echo "Showing the most recent $limit of $n batches.
<a href=submit.php?action=show_all&state=$state&userid=$userid&appid=$appid>Show all $n</a>
<p>
";
}
}
@ -191,10 +192,12 @@ function handle_main($user) {
}
page_head("Job submission and control");
// show links to per-app job submission pages
//
echo "<h2>Submit jobs</h2>
<ul>
";
$x = "";
foreach ($submit_urls as $appname=>$submit_url) {
$appname = BoincDb::escape_string($appname);
$app = BoincApp::lookup("name='$appname'");
@ -203,22 +206,47 @@ function handle_main($user) {
if ($usa || $user_submit->submit_all) {
echo "<li> <a href=$submit_url> $app->user_friendly_name </a>";
}
if ($usa && $usa->manage) {
$x .= "<li> <a href=submit.php?action=admin&app_id=$app->id>$app->user_friendly_name</a>
";
}
echo "</ul>\n";
// show links to admin pages if relevant
//
$usas = BoincUserSubmitApp::enum("user_id=$user->id");
$app_admin = false;
foreach ($usas as $usa) {
if ($usa->manage) {
$app_admin = true;
break;
}
}
echo "</ul>";
if ($user_submit->manage_all || $x) {
echo "<h2>Administer applications</h2>
<ul>
$x
";
if ($user_submit->manage_all || $add_admin) {
echo "<h2>Administrative functions</h2><ul>\n";
if ($user_submit->manage_all) {
echo "<li><a href=submit.php?action=admin&app_id=0>All applications</a>";
echo "<li>All applications<br>
<a href=submit.php?action=admin&app_id=0>Batches</a>
&middot;
<a href=manage_project.php>Users</a>
";
$apps = BoincApp::enum("");
foreach ($apps as $app) {
echo "<li>$app->user_friendly_name<br>
<a href=submit.php?action=admin&app_id=$app->id>Batches</a>
&middot;
<a href=manage_app.php?app_id=$app->id&action=app_version_form>Versions</a>
";
}
} else {
foreach ($usas as $usa) {
$app = BoincApp::lookup_id($usa->app_id);
echo "<li>$app->user_friendly_name<br>
<a href=submit.php?action=admin&app_id=$app->id>Batches</a>
&middot;
<a href=manage_app.php?app_id=$app->id&action=app_version_form>Versions</a>
";
}
}
echo "</ul>\n";
}
echo "</ul>";
$batches = BoincBatch::enum("user_id = $user->id order by id desc");
show_batches($batches, PAGE_SIZE, $user, null);
@ -245,11 +273,11 @@ function handle_admin($user) {
if ($app_id) {
$app = BoincApp::lookup_id($app_id);
if (!$app) error_page("no such app");
page_head("Administer $app->user_friendly_name");
page_head("Administer batches for $app->user_friendly_name");
$batches = BoincBatch::enum("app_id = $app_id order by id desc");
show_batches($batches, PAGE_SIZE, null, $app);
} else {
page_head("Administer all apps");
page_head("Administer batches (all apps)");
$batches = BoincBatch::enum("true order by id desc");
show_batches($batches, PAGE_SIZE, null, null);
}

View File

@ -248,6 +248,7 @@ function form_to_request() {
$req->jobs = Array();
$f->source = $input_url;
$f->mode = "remote";
for ($x=$param_lo; $x<$param_hi; $x += $param_inc) {
$job = null;