Ignore:
Timestamp:
04/29/14 18:37:36 (11 years ago)
Author:
tbretz
Message:
Added another accordion for the display of additional controls; removed some obsoslet stuff from the debug text; store waveform data in the object to allow access when retrirveing it to a file.
Location:
trunk/FACT++/www/viewer
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/FACT++/www/viewer/index.html

    r17728 r17732  
    4747<body>
    4848
     49<div id='tooltip' style="position:absolute;display:none;border:1px solid #fdd;padding;2px;background-color:#fee;opacity:0.8"></div>
     50
    4951<div class="myaccordion" id="accordion5">
    5052   <h3><a href="#">Editor 1 (proc)</a></h3>
     
    129131
    130132<div class="ui-widget-content" style="background:#eee;margin-top:-10px">
    131    <input id="submit" type="button" onclick="onSubmit();" value="Submit"></input>
     133   <input id="submit"  type="button" onclick="onSubmit();" value="Submit"></input>
    132134   <span style="float:right;white-space:nowrap;">
    133135      Run file:
     
    276278</div>
    277279
    278 <div id='tooltip' style="position:absolute;display:none;border:1px solid #fdd;padding;2px;background-color:#fee;opacity:0.8"></div>
     280<div class="myaccordion" id="accordion6">
     281   <h3><a href="#">Additional controls</a></h3>
     282</div>
     283<div id="ctrlcontainer" class="ui-widget-content">
     284   <form id="controls" method="POST" style="margin-bottom:0">
     285      <input id="getcamera"   type="button" onclick="onGetCameras();" value="Get camera data"></input>
     286      <input id="getwaveform" type="button" onclick="onGetWaveforms();" value="Get waveforms"></input>
     287      <input id="data" name="data" type="hidden"></input>
     288   </form>
     289</div>
    279290
    280291<div class="myaccordion" id="accordion4">
  • trunk/FACT++/www/viewer/index.js

    r17728 r17732  
    171171{
    172172    $('#submit').prop('disabled', disabled);
     173    $('#getcamera').prop('disabled', disabled);
     174    $('#getwaveforms').prop('disabled', disabled);
    173175    $('#event').prop('disabled', disabled);
    174176    $('#pixel').prop('disabled', disabled);
     
    181183}
    182184
     185function onGetCameras()
     186{
     187    var arr =
     188    [
     189     document.getElementById("camera1").dataAbs,
     190     document.getElementById("camera2").dataAbs,
     191     document.getElementById("camera3").dataAbs,
     192     document.getElementById("camera4").dataAbs,
     193     ];
     194
     195    $('#controls > input[name=data]').val(JSON.stringify(arr));
     196    $('#controls').attr('action','index.php');
     197    $('#controls').submit();
     198}
     199
     200function onGetWaveforms()
     201{
     202    var arr = document.getElementById("waveform").data;
     203
     204    $('#controls > input[name=data]').val(JSON.stringify(arr));
     205    $('#controls').attr('action','index.php');
     206    $('#controls').submit();
     207}
     208
    183209function onReady()
    184210{
     
    224250    setupAccordion('#accordion3', '#waveformcontainer');
    225251    setupAccordion('#accordion4', '#helpcontainer', true);
     252    setupAccordion('#accordion6', '#ctrlcontainer', true);
    226253
    227254    $("#selectfile1").on('change', onFile);
     
    247274function onFilelistReceived(result)
    248275{
    249     var dbg = document.getElementById("debug");
    250 
    251     var pre = document.createElement("pre");
    252     pre.appendChild(document.createTextNode(rc));
    253     dbg.appendChild(pre);
     276    //var dbg = document.getElementById("debug");
     277
     278    //var pre = document.createElement("pre");
     279    //pre.appendChild(document.createTextNode(rc));
     280    //dbg.appendChild(pre);
    254281
    255282    var rc;
     
    329356    var con = document.getElementById("console");
    330357
    331     var pre = document.createElement("pre");
    332     pre.appendChild(document.createTextNode(rc));
    333     dbg.appendChild(pre);
     358    //var pre = document.createElement("pre");
     359    //pre.appendChild(document.createTextNode(rc));
     360    //dbg.appendChild(pre);
    334361
    335362    try
     
    392419        con.appendChild(document.createTextNode(rc.debug));
    393420
    394         debug("return "+JSON.stringify(rc.ret));
    395         debug("");
    396         debug("Execution times:");
     421        //debug("return "+JSON.stringify(rc.ret));
     422        //debug("");
     423        debug("PHP execution:");
    397424        debug("Time Javascripts = "+(rc.timeJs[0]*1000).toFixed(2)+","+(rc.timeJs[1]*1000).toFixed(2)+","+(rc.timeJs[2]*1000).toFixed(2)+ " [ms]");
    398425    }
     
    430457    {
    431458        var waveform = document.getElementById("waveform");
     459        waveform.data = [ ];
    432460
    433461        var data = [[],[],[],[]];
     
    442470            for (var i=0; i<evt.numRoi; i++)
    443471                data[0][i] = [ i, rc.waveform[i] ];
     472
     473            waveform.data[0] = rc.waveform;
    444474        }
    445475
     
    456486                    data[j][i] = [ i, ref[i] ];
    457487
     488                waveform.data[j] = ref;
    458489            }
    459490        }
  • trunk/FACT++/www/viewer/index.php

    r17727 r17732  
    1515
    1616    header($_SERVER["SERVER_PROTOCOL"] . " 200 OK");
    17     header("Cache-Control: public"); // needed for i.e.
    18     header("Content-Type: text/plain");
    19     header("Content-Transfer-Encoding: Text");
    20     header("Content-Disposition: attachment; filename=\"".$name."\"");
     17    header('Cache-Control: public'); // needed for i.e.
     18    header('Content-Type: text/plain');
     19    header('Content-Transfer-Encoding: Text');
     20    header('Content-Disposition: attachment; filename="'.$name.'"');
    2121    print($source);
     22    return;
     23}
     24
     25// This is a pretty weird hack because it does first convert
     26// all data to ascii (json) to print it...
     27if (isset($_POST['data']))
     28{
     29    header($_SERVER["SERVER_PROTOCOL"] . " 200 OK");
     30    header('Cache-Control: public'); // needed for i.e.
     31    header('Content-Type: text/plain');
     32    header('Content-Transfer-Encoding: Text');
     33    header('Content-Disposition: attachment; filename="data.txt"');
     34
     35    $json = json_decode($_POST['data']);
     36
     37    $n   = count($json[0]);
     38    $cnt = count($json);
     39
     40    for ($i=0; $i<$n; $i++)
     41    {
     42        print($i." ".$json[0][$i]);
     43
     44        if ($cnt>1)
     45            print(" ".$json[1][$i]);
     46        if ($cnt>2)
     47            print(" ".$json[2][$i]);
     48        if ($cnt>3)
     49            print(" ".$json[3][$i]);
     50        print("\n");
     51    }
    2252    return;
    2353}
     
    347377// Output result as JSON object
    348378print(json_encode($rc));
    349 
    350379?>
Note: See TracChangeset for help on using the changeset viewer.