Proper user information window, prompts for click after SetWithMap, gives warning after server form data rejected
rodzic
611143195b
commit
b8dd855c9e
|
@ -29,6 +29,19 @@ a { text-decoration: underline; color: #333; cursor: pointer; }
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#error_window {
|
||||||
|
position: absolute;
|
||||||
|
left: 50%;
|
||||||
|
top: 50%;
|
||||||
|
width: 400px;
|
||||||
|
height: 50px;
|
||||||
|
margin-left: -200px;
|
||||||
|
margin-top: -50px;
|
||||||
|
padding: 1em;
|
||||||
|
text-align: center;
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
.box {
|
.box {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
background-color: white;
|
background-color: white;
|
||||||
|
|
|
@ -47,11 +47,13 @@ function initialize() {
|
||||||
url: 'ajax.php?action=submitForm',
|
url: 'ajax.php?action=submitForm',
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
predSub();
|
|
||||||
var data_split = data.split("|");
|
var data_split = data.split("|");
|
||||||
if ( data_split[0] == 0 ) {
|
if ( data_split[0] == 0 ) {
|
||||||
appendDebug("The server rejected the submitted form data");
|
appendDebug("The server rejected the submitted form data");
|
||||||
|
throwError("The server rejected the submitted form data");
|
||||||
|
resetGUI();
|
||||||
} else {
|
} else {
|
||||||
|
predSub();
|
||||||
appendDebug("The server accepted the form data");
|
appendDebug("The server accepted the form data");
|
||||||
// update the global current_uuid variable
|
// update the global current_uuid variable
|
||||||
current_uuid = data_split[1];
|
current_uuid = data_split[1];
|
||||||
|
@ -94,6 +96,9 @@ function initialize() {
|
||||||
toggleWindow("input_form", "showHideForm", "Show Launch Card",
|
toggleWindow("input_form", "showHideForm", "Show Launch Card",
|
||||||
"Hide Launch Card");
|
"Hide Launch Card");
|
||||||
});
|
});
|
||||||
|
$("#closeErrorWindow").click(function() {
|
||||||
|
$("#error_window").fadeOut();
|
||||||
|
});
|
||||||
// plot the initial launch location
|
// plot the initial launch location
|
||||||
plotClick();
|
plotClick();
|
||||||
google.maps.event.addListener(map, 'mousemove', function(event) {
|
google.maps.event.addListener(map, 'mousemove', function(event) {
|
||||||
|
@ -122,6 +127,12 @@ function initialize() {
|
||||||
<a><span id="showHideDebug_status">Toggle Debug</span></a></span>
|
<a><span id="showHideDebug_status">Toggle Debug</span></a></span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div id="error_window" class="box">
|
||||||
|
<span id="error_message">Nothing here!</span>
|
||||||
|
<br /><br />
|
||||||
|
<a id="closeErrorWindow">Close</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div id="scenario_info" class="box">
|
<div id="scenario_info" class="box">
|
||||||
<h1>Scenario Information</h1>
|
<h1>Scenario Information</h1>
|
||||||
<span id="cursor_info">Current mouse position:
|
<span id="cursor_info">Current mouse position:
|
||||||
|
|
|
@ -38,6 +38,11 @@ function showMousePos(GLatLng) {
|
||||||
$("#cursor_lon").html(GLatLng.lng().toFixed(4));
|
$("#cursor_lon").html(GLatLng.lng().toFixed(4));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function throwError(data) {
|
||||||
|
$("#error_message").html(data);
|
||||||
|
$("#error_window").fadeIn();
|
||||||
|
}
|
||||||
|
|
||||||
function handlePred(pred_uuid) {
|
function handlePred(pred_uuid) {
|
||||||
$("#prediction_status").html("Searching for wind data...");
|
$("#prediction_status").html("Searching for wind data...");
|
||||||
$("#input_form").hide("slide", { direction: "down" }, 500);
|
$("#input_form").hide("slide", { direction: "down" }, 500);
|
||||||
|
@ -72,6 +77,20 @@ function getJSONProgress(pred_uuid) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function resetGUI() {
|
||||||
|
$("#status_message").fadeOut(500);
|
||||||
|
// now clear the status window
|
||||||
|
$("#prediction_status").html("");
|
||||||
|
$("#prediction_progress").progressbar("options", "value", 0);
|
||||||
|
$("#prediction_percent").html("");
|
||||||
|
// bring the input form back up
|
||||||
|
toggleWindow("input_form", null, null, null, "show");
|
||||||
|
toggleWindow("scenario_info", null, null, null, "show");
|
||||||
|
// un-fade the map canvas
|
||||||
|
$("#map_canvas").fadeTo(1500, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function processProgress(progress) {
|
function processProgress(progress) {
|
||||||
if ( progress['error'] ) {
|
if ( progress['error'] ) {
|
||||||
clearInterval(ajaxEventHandle);
|
clearInterval(ajaxEventHandle);
|
||||||
|
@ -81,20 +100,10 @@ function processProgress(progress) {
|
||||||
if ( progress['gfs_complete'] == true ) {
|
if ( progress['gfs_complete'] == true ) {
|
||||||
if ( progress['pred_complete'] == true ) { // pred has finished
|
if ( progress['pred_complete'] == true ) { // pred has finished
|
||||||
$("#prediction_status").html("Prediction finished.");
|
$("#prediction_status").html("Prediction finished.");
|
||||||
$("#status_message").fadeOut(500);
|
|
||||||
// now clear the status window
|
|
||||||
$("#prediction_status").html("");
|
|
||||||
$("#prediction_progress").progressbar("options", "value", 0);
|
|
||||||
$("#prediction_percent").html("");
|
|
||||||
// bring the input form back up
|
|
||||||
$("#input_form").show("slide", { direction: "down" }, 500);
|
|
||||||
$("#scenario_info").show("slide", { direction: "up" }, 500);
|
|
||||||
toggleWindow("scenario_template", "showHideDebug", "Show Debug",
|
|
||||||
"Hide Debug", "hide");
|
|
||||||
// un-fade the map canvas
|
|
||||||
$("#map_canvas").fadeTo(1500, 1);
|
|
||||||
appendDebug("Server says: the predictor finished running.");
|
appendDebug("Server says: the predictor finished running.");
|
||||||
appendDebug("Attemping to retrieve flight path from server");
|
appendDebug("Attemping to retrieve flight path from server");
|
||||||
|
// reset the GUI
|
||||||
|
resetGUI();
|
||||||
// stop polling for JSON
|
// stop polling for JSON
|
||||||
clearInterval(ajaxEventHandle);
|
clearInterval(ajaxEventHandle);
|
||||||
// parse the data
|
// parse the data
|
||||||
|
@ -249,8 +258,10 @@ function setFormLatLon(GLatLng) {
|
||||||
function setLatLonByClick(state) {
|
function setLatLonByClick(state) {
|
||||||
if ( state == true ) {
|
if ( state == true ) {
|
||||||
clickListener = google.maps.event.addListener(map, 'click', function(event) {
|
clickListener = google.maps.event.addListener(map, 'click', function(event) {
|
||||||
|
$("#error_window").fadeOut();
|
||||||
setFormLatLon(event.latLng);
|
setFormLatLon(event.latLng);
|
||||||
});
|
});
|
||||||
|
throwError("Now click your desired launch location on the map");
|
||||||
} else if ( state == false ) {
|
} else if ( state == false ) {
|
||||||
google.maps.event.removeListener(clickListener);
|
google.maps.event.removeListener(clickListener);
|
||||||
} else {
|
} else {
|
||||||
|
@ -311,11 +322,15 @@ function toggleWindow(window_name, linker, onhide, onshow, force) {
|
||||||
$("#"+linker).html(onshow);
|
$("#"+linker).html(onshow);
|
||||||
}
|
}
|
||||||
} else if ( force == "hide" ) {
|
} else if ( force == "hide" ) {
|
||||||
$("#"+window_name+"").hide("slide", { direction: "down" }, 500);
|
if( $("#"+window_name).css('display') != "none" ){
|
||||||
$("#"+linker).html(onhide);
|
$("#"+window_name+"").hide("slide", { direction: "down" }, 500);
|
||||||
|
$("#"+linker).html(onhide);
|
||||||
|
}
|
||||||
} else if ( force == "show") {
|
} else if ( force == "show") {
|
||||||
$("#"+window_name).show("slide", { direction: "down" }, 500);
|
if( $("#"+window_name).css('display') == "none" ){
|
||||||
$("#"+linker).html(onshow);
|
$("#"+window_name).show("slide", { direction: "down" }, 500);
|
||||||
|
$("#"+linker).html(onshow);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
appendDebug("toggleWindow force parameter unrecognised");
|
appendDebug("toggleWindow force parameter unrecognised");
|
||||||
}
|
}
|
||||||
|
|
Ładowanie…
Reference in New Issue