[go: nahoru, domu]

Skip to content

Commit

Permalink
add "advanced settings" button
Browse files Browse the repository at this point in the history
  • Loading branch information
luponzo86 committed Mar 8, 2020
1 parent e144eb0 commit 3075498
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 61 deletions.
76 changes: 36 additions & 40 deletions sat_mutagen.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,11 @@

<div class="col-md-6">
<div class="form-group">
<div class="custom-control custom-checkbox" data-toggle="collapse"
data-target="#collapse1">
<input type="checkbox" class="custom-control-input"
name="customPDB_checkbox" id="customPDB_checkbox" autocomplete="off">
<label class="custom-control-label" for="customPDB_checkbox">
use custom PDB structure
<?php faq_link('noPDB', 'when could it be useful?') ?>
</label>
</div>
<button type="button" class="btn btn-outline-info btn-sm"
data-toggle="collapse" data-target="#collapse1"
aria-expanded="false" aria-controls="collapse1">
advanced settings
</button>
</div>
</div>

Expand All @@ -79,28 +75,50 @@

<!-- collapsable row with radio buttons for typing/uploading PDB -->
<div class="panel-collapse collapse" id="collapse1">

<!-- "use custom PDB structure" checkbox -->
<div class="form-row">
<div class="col-md"></div>
<div class="col-md"></div>
<div class="col-md-6">
<div class="form-group">
<div class="custom-control custom-checkbox">
<input type="checkbox" class="custom-control-input"
name="customPDB_checkbox" id="customPDB_checkbox" autocomplete="off"
onchange="document.getElementById('radios').disabled = !this.checked;">
<label class="custom-control-label" for="customPDB_checkbox">
use custom PDB structure
<?php faq_link('noPDB', 'when could it be useful?') ?>
</label>
</div>
</div>
</div>
<div class="col-md"></div>
</div>

<!-- radio buttons controled by "custom PDB" checkbox -->
<fieldset class="ml-4" id="radios" disabled>

<!-- "type PDB code" radio button -->
<div class="form-row">
<div class="col-md"></div>
<div class="col-md-6">
<div class="form-check">
<div class="form-check pb-2">
<input class="form-check-input" type="radio" name="customPDB_radios"
id="customPDBID_radio" value="PDBID" checked>
<div class="form-group">
<div class="input-group input-group-sm">
<input class="form-control" type="text" name="customPDBID" value=""
id="customPDBID" maxlength="4" placeholder="type a PDB code..."
onfocus="document.getElementById('customPDBID_radio').checked=true">
<!-- <small id="PDBIDHelp" class="form-text text-muted">PDB ID</small> -->
</div>
</div>
</div>

<div class="col-md"></div>
</div>

<!-- "upload PDB file" radio button -->
<div class="form-row">
<div class="col-md"></div>

<div class="col-md-6">
<div class="form-check">
<input class="form-check-input" type="radio" name="customPDB_radios"
Expand All @@ -110,37 +128,15 @@
<input type="file" accept=".pdb,.pdb.gz" name="customPDBFile"
id="customPDBFile" autocomplete="off"
onfocus="document.getElementById('customPDBfile_radio').checked=true">
<!-- "custom" upload button -->
<!--
<div class="custom-file">
<input type="file" class="custom-file-input" name="customPDBFile"
id="customPDBFile" accept=".pdb,.pdb.gz"
>
<label class="custom-file-label text-truncate" for="customPDBFile">
Upload PDB file</label>
</div>
-->
<!--
<script>
// JS for updating label after uploading file, in case you are
using "custom" upload button
// NB: does not work...
// see: https://stackoverflow.com/questions/48613992/bootstrap-4-file-input-doesnt-show-the-file-name
$('#customPDBFile').on('change',function(){
// get the filename
var fileName = $(this).val();
// replace the label
$(this).next('.custom-file-label').html(fileName);
})
</script>
-->
</div>
</div>
</div>

<div class="col-md"></div>
</div>
</div>

</fieldset>

</div> <!-- end of collapsable -->



Expand Down
46 changes: 25 additions & 21 deletions submit_job.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,13 +138,6 @@ function save2file($fname, $value) {
mkdir($jobdir);


// // DEBUG: save info
// $output = print_r($_POST, true);
// file_put_contents("${jobdir}/input.log", $output);
// $output = print_r($_FILES, true);
// file_put_contents("${jobdir}/input.log", $output, FILE_APPEND);


// write data to file
chdir($jobdir);

Expand Down Expand Up @@ -214,27 +207,38 @@ function save2file($fname, $value) {
save2file("input-email.txt", $_POST["email"]);
}

chdir($orig_dir);

chdir($orig_dir);

// launch job in the background
$pyscript = "${orig_dir}/src/python/rhapsody_interface.py";
$pid_file = "${jobdir}/PID.tmp";
exec("nohup src/bin/launch_job.sh $jobdir $pyscript < /dev/null " .
">> ${scratch_dir}/launch_job.err 2>&1 & echo $! > $pid_file");

if (false) {
// DEBUG: instead of launching the job, save variables to file and exit
$output = print_r($_POST, true);
echo '<pre>'; print_r($_POST); echo '</pre>';
file_put_contents("${jobdir}/input.log", $output);
$output = print_r($_FILES, true);
echo '<pre>'; print_r($_FILES); echo '</pre>';
file_put_contents("${jobdir}/input.log", $output, FILE_APPEND);
}
else {
// launch job in the background
$pyscript = "${orig_dir}/src/python/rhapsody_interface.py";
$pid_file = "${jobdir}/PID.tmp";
exec("nohup src/bin/launch_job.sh $jobdir $pyscript < /dev/null " .
">> ${scratch_dir}/launch_job.err 2>&1 & echo $! > $pid_file");

// clean workspace from old jobs
exec("nohup src/bin/clean_workspace.sh $scratch_dir < /dev/null " .
">> ${scratch_dir}/old_jobs.log 2>> ${scratch_dir}/old_jobs.err &");
// clean workspace from old jobs
exec("nohup src/bin/clean_workspace.sh $scratch_dir < /dev/null " .
">> ${scratch_dir}/old_jobs.log 2>> ${scratch_dir}/old_jobs.err &");

// go to the progress page
$page = "status.php?id=${jobid}";
echo "<script type='text/javascript'> window.location.href='$page';</script>";

// go to the progress page
$page = "status.php?id=${jobid}";
echo "<script type='text/javascript'> window.location.href='$page';</script>";
// I don't understand why redirect() does not work here...
// redirect("status.php", ["id" => $jobid]);
}

// I don't understand why redirect() does not work here...
// redirect("status.php", ["id" => $jobid]);

exit();
?>

0 comments on commit 3075498

Please sign in to comment.