Accepts old UUIDs in the URL

pull/73/head
jonsowman 2010-05-31 13:25:38 +01:00
rodzic 68578133c8
commit 57347ffab5
3 zmienionych plików z 13 dodań i 9 usunięć

Wyświetl plik

@ -6,7 +6,7 @@ $action = $_GET['action'];
switch($action) { switch($action) {
case "getCSV": case "getCSV":
$uuid = $_GET['uuid']; $uuid = $_GET['uuid'];
$fh = fopen("preds/".$uuid."/flight_path.csv", "r"); $fh = fopen("preds/".$uuid."/flight_path.csv", "r") or die("No CSV for UUID");
$data = array(); $data = array();
while (!feof($fh)) { while (!feof($fh)) {
$line = trim(fgets($fh)); $line = trim(fgets($fh));

Wyświetl plik

@ -21,7 +21,7 @@ google.load("jqueryui", "1.8.1");
<script type="text/javascript"> <script type="text/javascript">
var ajaxEventHandle; var ajaxEventHandle;
var running_uuid = '<?php echo ( isset($_GET['uuid'])? $_GET['uuid'] : "0" ); ?>'; var current_uuid = '<?php echo ( isset($_GET['uuid'])? $_GET['uuid'] : "0" ); ?>';
var map; var map;
var map_items = []; var map_items = [];
@ -49,18 +49,22 @@ function initialize() {
appendDebug("The server rejected the submitted form data"); appendDebug("The server rejected the submitted form data");
} else { } else {
appendDebug("The server accepted the form data"); appendDebug("The server accepted the form data");
running_uuid = data_split[1]; // update the global current_uuid variable
appendDebug("The server gave us uuid:<br>" + running_uuid); current_uuid = data_split[1];
appendDebug("The server gave us uuid:<br>" + current_uuid);
appendDebug("Starting to poll for progress JSON"); appendDebug("Starting to poll for progress JSON");
handlePred(running_uuid); handlePred(current_uuid);
} }
} }
}); });
//$("#input_form").draggable({containment: '#map_canvas'}); //$("#input_form").draggable({containment: '#map_canvas'});
// if ( running_uuid != 0 ) handlePred(running_uuid); if ( current_uuid != '0' ) {
appendDebug("Got an old UUID to plot:<br>" + current_uuid);
appendDebug("Trying to get flight path from server...");
getCSV(current_uuid);
}
$("#debuginfo").hide(); $("#debuginfo").hide();
$("#showHideDebug").click(function() { $("#showHideDebug").click(function() {
// $("#debuginfo").show("slide", { direction: "down" }, 500);
toggleDebugWindow(); toggleDebugWindow();
}); });
} }

Wyświetl plik

@ -77,7 +77,7 @@ function processProgress(progress) {
// stop polling for JSON // stop polling for JSON
clearInterval(ajaxEventHandle); clearInterval(ajaxEventHandle);
// parse the data // parse the data
getCSV(running_uuid); getCSV(current_uuid);
} else if ( progress['pred_running'] != true ) { } else if ( progress['pred_running'] != true ) {
$("#prediction_status").html("Waiting for predictor to run..."); $("#prediction_status").html("Waiting for predictor to run...");
appendDebug("Server says: predictor not yet running..."); appendDebug("Server says: predictor not yet running...");
@ -188,8 +188,8 @@ function parseCSV(lines) {
} }
function clearMapItems() { function clearMapItems() {
if(map_items.length > 0) {
appendDebug("Clearing previous map trace"); appendDebug("Clearing previous map trace");
if(map_items) {
for(i in map_items) { for(i in map_items) {
map_items[i].setMap(null); map_items[i].setMap(null);
} }