From 21e747a114d6139910c438bdf3ea965071cd1d93 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Tue, 8 Jan 2013 18:40:06 -0800 Subject: [PATCH] - improvements to remote job submission web pages --- html/inc/submit.inc | 4 +-- html/user/manage_app.php | 14 ++++----- html/user/manage_project.php | 42 +++++++++++++++++---------- html/user/submit.php | 56 +++++++++++++++++++++++++++--------- html/user/submit_example.php | 1 + 5 files changed, 79 insertions(+), 38 deletions(-) diff --git a/html/inc/submit.inc b/html/inc/submit.inc index 5e6ed7b2eb..b8d89ff1ef 100644 --- a/html/inc/submit.inc +++ b/html/inc/submit.inc @@ -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) { $req->authenticator "; - 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) { diff --git a/html/user/manage_app.php b/html/user/manage_app.php index 715f3673bb..ffade152f4 100644 --- a/html/user/manage_app.php +++ b/html/user/manage_app.php @@ -107,7 +107,7 @@ function permissions_form($app) { $user = BoincUser::lookup_id($busa->user_id); echo " - $user->name ($user->id) + $user->name (ID: $user->id) id checked> "; @@ -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": diff --git a/html/user/manage_project.php b/html/user/manage_project.php index db03b5f9ae..e9a271c0a8 100644 --- a/html/user/manage_project.php +++ b/html/user/manage_project.php @@ -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 " - $user->name (ID: $user->id) - user_id>Edit permissions + + user_id>$user->name + (ID: $user->id) "; echo ""; @@ -41,32 +42,45 @@ function user_row($u) { $app = BoincApp::lookup_id($ua->app_id); echo "$app->name "; } + if (count($uas) == 0) { + echo "---"; + } } echo "\n"; echo "$u->quota\n"; - echo " + echo ""; + if ($u->logical_start_time > time()) { + echo local_time_str($u->logical_start_time); + } else { + echo "---"; + } + echo " "; } function handle_list() { - page_head("Project-wide management functions"); - echo "

User permissions and quotas

- The following users are allowed to submit jobs. + page_head("Job submission access control"); + echo "The following users are allowed to submit jobs.

"; - 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
Click to change permissions or quota", + "Can submit jobs for", + "Quota", + "Current priority
Later time = lower priority" + ); 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 "Return to project-wide management functions"; - 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); diff --git a/html/user/submit.php b/html/user/submit.php index 4d8d7c5608..6f28752b1d 100644 --- a/html/user/submit.php +++ b/html/user/submit.php @@ -47,6 +47,7 @@ function show_all_link($batches, $state, $limit, $user, $app) { echo "Showing the most recent $limit of $n batches. Show all $n +

"; } } @@ -191,10 +192,12 @@ function handle_main($user) { } page_head("Job submission and control"); + + // show links to per-app job submission pages + // echo "

Submit jobs

\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 ""; - if ($user_submit->manage_all || $x) { - echo "

Administer applications

- "; $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); } diff --git a/html/user/submit_example.php b/html/user/submit_example.php index aa6f566a72..b1480f4138 100644 --- a/html/user/submit_example.php +++ b/html/user/submit_example.php @@ -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;