tshow simulation inversion status - cosmo - front and backend for Markov-Chain Monte Carlo inversion of cosmogenic nuclide concentrations
 (HTM) git clone git://src.adamsgaard.dk/cosmo
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit f8747a1687441cdefe875a11fdd18699ade97126
 (DIR) parent 9641d85821aab6fe0835e88a465846e77959ad57
 (HTM) Author: Anders Damsgaard <anders.damsgaard@geo.au.dk>
       Date:   Tue, 29 Sep 2015 11:02:12 +0200
       
       show simulation inversion status
       
       Diffstat:
         M index.php                           |      13 +++++++++++++
         M uploadhistory.php                   |      17 ++++++++++++++++-
       
       2 files changed, 29 insertions(+), 1 deletion(-)
       ---
 (DIR) diff --git a/index.php b/index.php
       t@@ -82,6 +82,19 @@ if (isset($_GET['wait_id']) && !empty($_GET['wait_id'])) {
                    <h2 class="header col s12">Please wait</h2>
                </div>
        
       +        <div class="row center">
       +            <h2 class="header col s12 orange">Inversion status: 
       +<?php
       +    if (!$statusfile = fopen("/home/adc/cosmo/input/status_" . $_GET['wait_id'], "r")) {
       +        echo("Error! Sample data not found.");
       +    }
       +
       +    echo fgets($statusfile);
       +    fclose($statusfile);
       +?>
       +            </h2>
       +        </div>
       +
                <div class="row progress center-align s12">
                    <div class="indeterminate"></div>
                </div>
 (DIR) diff --git a/uploadhistory.php b/uploadhistory.php
       t@@ -192,12 +192,27 @@ if (!chmod($outputfile, 0777)) {
        // delete temporary file
        //unlink($tmpfile);
        
       +// Create inversion status output file
       +$statusfile = ("/home/adc/cosmo/input/status_" . $id);
       +if (is_writable($statusfile)) {
       +    if (!$handle = fopen($statusfile, 'w')) {
       +        die("The php server could not open $statusfile.");
       +    }
       +
       +    // write status to file
       +    if (fwrite($handle, "Queued") === false) {
       +        die("The php server could not write the status to $statusfile.");
       +    }
       +
       +} else {
       +    die("The php server output file $statusfile is not writable");
       +}
        
        
        
        // Finally redirect user after processing uploaded data. This header function 
        // call must be before any output!
        //header("Location: /~ad/cosmo");
       -header("Location: /index.php?wait_id=". $id);
       +header("Location: /index.php?wait_id=" . $id);
        
        ?>