tadd percentage to preloader - cosmo - front and backend for Markov-Chain Monte… | |
git clone git://src.adamsgaard.dk/cosmo | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit fe101c9c5247116d226ab606050e7ea9b1cbff1c | |
parent e1a73351e1adc50a0b3b235aa32819cc6dd63434 | |
Author: Anders Damsgaard <[email protected]> | |
Date: Tue, 17 Nov 2015 15:48:45 +0100 | |
add percentage to preloader | |
Diffstat: | |
M index.php | 15 +++++++++++++++ | |
M matlab/m_pakke2014maj11/MetHasLong… | 2 +- | |
2 files changed, 16 insertions(+), 1 deletion(-) | |
--- | |
diff --git a/index.php b/index.php | |
t@@ -38,6 +38,14 @@ if (isset($_GET['wait_id']) && !empty($_GET['wait_id'])) { | |
$status = fgets($statusfile); | |
fclose($statusfile); | |
+ $show_percentage = false; | |
+ if (strpos($status, '<!--') !== false) { | |
+ $percentage = preg_replace('/.*<!--/', '', $status); | |
+ $percentage = preg_replace('/-->/', '', $percentage); | |
+ $percentage = preg_replace('/ /', '', $percentage); | |
+ $show_percentage = true; | |
+ } | |
+ | |
// redirect to results page if computations are complete | |
if (strcmp($status, "Computations complete") == 0) { | |
header("Location: /index.php?results_id=" . $_GET['wait_id']); | |
t@@ -72,7 +80,14 @@ if (isset($_GET['wait_id']) && !empty($_GET['wait_id'])) { | |
</div> | |
<div class="row progress center-align s12"> | |
+<?php | |
+ if ($show_percentage) { ?> | |
+ <div class="determinate" | |
+ style="width: <?php echo($percentage); ?>%"></div> | |
+<?php | |
+ } else { ?> | |
<div class="indeterminate"></div> | |
+<?php } ?> | |
</div> | |
<div class="row center valign-wrapper"> | |
diff --git a/matlab/m_pakke2014maj11/MetHasLongstep4.m b/matlab/m_pakke2014maj1… | |
t@@ -112,7 +112,7 @@ for it=1:N_run | |
fid = fopen(statusfile, 'w'); | |
statusinfo = strcat(num2str(datestr(RemainingTime,13)), ... | |
' remaining', ... | |
- ' <!-- ', num2str(ElapsedTime/TotalTime*100., '%3.0f'), ' -->'); | |
+ ' <!-- ', num2str(ElapsedTime/TotalTime*100., '%3.0f'), '-->'); | |
fprintf(fid, statusinfo); | |
fclose(fid); | |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |