diff --git a/html/user/buda.php b/html/user/buda.php index c5271ae058..be1afb68ba 100644 --- a/html/user/buda.php +++ b/html/user/buda.php @@ -44,17 +44,10 @@ function app_list($notice=null) { text_start(); echo "

BUDA (BOINC Universal Docker App) - lets you submit Docker jobs through a web interface; + lets you submit Docker jobs using a web interface; you don't need to log into the BOINC server.

- To use BUDA, you set up a 'science app' and one or more 'variants'. - Each variant includes a Dockerfile, - a main program to run within the container, - and any other files that are needed. -

- Typically there is a variant named 'cpu' that uses one CPU. - The names of other variants are plan class names; - these can be versions that use a GPU or multiple CPUs. + BUDA overview. "; echo "

Science apps

"; @@ -73,14 +66,14 @@ function show_app($dir) { global $buda_root; echo "
$dir\n"; start_table('table-striped'); - table_header('Variant name (click for details)', 'Submit jobs'); + table_header('Variant name
click for details', 'Submit jobs'); $pcs = scandir("$buda_root/$dir"); foreach ($pcs as $pc) { if ($pc[0] == '.') continue; table_row( "$pc", button_text( - "buda_submit.php?app=$dir&variant=$pc", "Submit" + "buda_submit.php?app=$dir&variant=$pc", "Submission form" ) ); } @@ -134,15 +127,25 @@ function variant_form($user) { $app = get_str('app'); if (!is_valid_filename($app)) die('bad arg'); - page_head("Create variant of Docker app $app"); + page_head("Create a variant of Docker app $app"); + echo " + Details are here. + "; + $sb = '
From your file sandbox'; form_start('buda.php'); form_input_hidden('app', $app); form_input_hidden('action', 'variant_action'); form_input_text('Plan class', 'variant'); - form_select('Dockerfile', 'dockerfile', $sbitems); - form_select_multiple('Application files', 'app_files', $sbitems); - form_input_text('Input file names', 'input_file_names'); - form_input_text('Output file names', 'output_file_names'); + form_select("Dockerfile$sb", 'dockerfile', $sbitems); + form_select_multiple("Application files$sb", 'app_files', $sbitems); + form_input_text( + 'Input file names
Space-separated', + 'input_file_names' + ); + form_input_text( + 'Output file names
Space-separated', + 'output_file_names' + ); form_submit('OK'); form_end(); page_tail(); diff --git a/html/user/buda_submit.php b/html/user/buda_submit.php index 36aab6b9c4..26c9d40fbd 100644 --- a/html/user/buda_submit.php +++ b/html/user/buda_submit.php @@ -47,7 +47,7 @@ function submit_form($user) { form_input_hidden('app', $app); form_input_hidden('variant', $variant); form_select("Batch zip file $desc", 'batch_file', $sbitems_zip); - form_input_text('Command line arguments', 'cmdline'); + form_input_text('Command-line arguments', 'cmdline'); form_checkbox( "Enabled debugging output
Write Docker commands and output to stderr.", 'wrapper_verbose' diff --git a/html/user/sandbox.php b/html/user/sandbox.php index 9fa6037b97..c6e2987cb1 100644 --- a/html/user/sandbox.php +++ b/html/user/sandbox.php @@ -32,28 +32,37 @@ display_errors(); -function list_files($user, $notice) { - $dir = sandbox_dir($user); - if (!is_dir($dir)) error_page("Can't open sandbox directory"); - page_head("File sandbox"); - if ($notice) { - echo "

$notice


"; - } +function add_form() { + page_head('Upload files to your sandbox'); echo " + There are several ways to upload files:

+


Upload files from this computer

-

- NOTE: if you upload text files from Windows, + "; + form_start('sandbox.php', 'post', 'ENCTYPE="multipart/form-data"'); + form_general('', + "NOTE: if you upload text files from Windows, they will be given CRLF line endings. - Then, if they are shell scripts, they won't work on Linux. - Add shell scripts using 'Add text file' below. -

- + If they are shell scripts, they won't work on Linux. + Add shell scripts using 'Add text file' below." + ); + form_input_hidden('action', 'upload_file'); + form_general('', + '' + ); + form_submit('Upload'); + form_end(); +if (0) { + echo "

+ "; +} + echo "

Add text file

"; @@ -72,9 +81,20 @@ function list_files($user, $notice) { form_input_text('URL', 'url'); form_submit('OK'); form_end(); + page_tail(); +} + +function list_files($user) { + $dir = sandbox_dir($user); + if (!is_dir($dir)) error_page("Can't open sandbox directory"); + page_head("File sandbox"); + $notice = get_str('notice', true); + if ($notice) { + echo "

$notice


"; + } echo " -
-

Sandbox contents

+

+ Your 'File sandbox' is where you store files to this BOINC server. "; $files = array(); foreach (scandir($dir) as $f) { @@ -86,7 +106,7 @@ function list_files($user, $notice) { } else { sort($files); start_table(); - table_header("Name

(click to view text files)

", "Modified", "Size (bytes)", "MD5", "Delete","Download"); + table_header("Name
(click to view text files)", "Modified", "Size (bytes)", "MD5", "Delete","Download"); foreach ($files as $f) { [$md5, $size] = sandbox_parse_info_file($user, $f); $path = "$dir/$f"; @@ -108,6 +128,7 @@ function list_files($user, $notice) { } end_table(); } + show_button('sandbox.php?action=add_form', 'Upload files'); page_tail(); } @@ -139,12 +160,13 @@ function upload_file($user) { $notice .= "Uploaded file $name
"; } - list_files($user, $notice); + header(sprintf('Location: sandbox.php?notice=%s', urlencode($notice))); } function add_file($user) { $dir = sandbox_dir($user); $name = post_str('name'); + if (!$name) error_page('No name given'); if (file_exists("$dir/$name")) { error_page("file $name exists"); } @@ -155,8 +177,8 @@ function add_file($user) { [$md5, $size] = get_file_info("$dir/$name"); write_info_file("$dir/.md5/$name", $md5, $size); - $notice = "Uploaded file $name
"; - list_files($user, $notice); + $notice = "Added file $name ($size bytes)"; + header(sprintf('Location: sandbox.php?notice=%s', urlencode($notice))); } function get_file($user) { @@ -169,7 +191,7 @@ function get_file($user) { } copy($url, $path); $notice = "Fetched file from $url
"; - list_files($user, $notice); + header(sprintf('Location: sandbox.php?notice=%s', urlencode($notice))); } // delete a sandbox file. @@ -180,7 +202,7 @@ function delete_file($user) { unlink("$dir/$name"); unlink("$dir/.md5/$name"); $notice = "$name was deleted from your sandbox
"; - list_files($user, $notice); + header(sprintf('Location: sandbox.php?notice=%s', urlencode($notice))); } function download_file($user) { @@ -208,13 +230,14 @@ function view_file($user) { if (!$action) $action = post_str('action', true); switch ($action) { -case '': list_files($user,""); break; +case '': list_files($user); break; case 'upload_file': upload_file($user); break; case 'add_file': add_file($user); break; case 'get_file': get_file($user); break; case 'delete_file': delete_file($user); break; case 'download_file': download_file($user); break; case 'view_file': view_file($user); break; +case 'add_form': add_form($user); break; default: error_page("no such action: $action"); }