Moved window controls, autoscrolling debug window limited in height

pull/73/head
jonsowman 2010-05-31 16:33:52 +01:00
rodzic 1aa1ca8d4c
commit d3ace2f023
4 zmienionych plików z 64 dodań i 32 usunięć

Wyświetl plik

@ -3,6 +3,8 @@ require_once("includes/functions.inc.php");
$action = $_GET['action'];
$software_available = array("gfs", "gfs_hd");
switch($action) {
case "getCSV":
$uuid = $_GET['uuid'];
@ -35,7 +37,7 @@ case "getModelByUUID":
} else {
// populate the array, JSON encode it and return
$pred_model = parse_ini_file("preds/".$uuid."/scenario.ini");
if ( verifyModel($pred_model) ){
if ( verifyModel($pred_model, $software_available) ){
$pred_model['valid'] == true;
} else {
$pred_model['valid'] == false;
@ -46,8 +48,6 @@ case "getModelByUUID":
break;
case "submitForm":
$software_available = array("gfs", "gfs_hd");
$pred_model = array();
if ( isset($_POST['submit'])) {

Wyświetl plik

@ -69,6 +69,8 @@ a { text-decoration: underline; color: #333; cursor: pointer; }
left: 0; bottom: 0;
border-left: none;
border-bottom: none;
max-height: 400px;
overflow: scroll;
}
#input_form {
@ -77,25 +79,19 @@ a { text-decoration: underline; color: #333; cursor: pointer; }
height:350px;
width: 400px;
padding: 5px;
bottom: 0; right: 0;
}
#scenario_info {
position: absolute;
top: 25px;
right: 0px;
border-right: none;
height:100px;
height:70px;
width: 400px;
padding: 5px;
top: -115px;
overflow: hidden;
}
#bottom_right {
right: 0;
bottom: 0;
width: 400px;
padding: 0px;
}
td.right-td {
text-align: right;
}

Wyświetl plik

@ -57,15 +57,24 @@ function initialize() {
}
}
});
//$("#input_form").draggable({containment: '#map_canvas'});
$("#input_form").draggable({containment: '#map_canvas'});
if ( current_uuid != '0' ) {
appendDebug("Got an old UUID to plot:<br>" + current_uuid);
appendDebug("Trying to populate form with scenario data");
populateFormByUUID(current_uuid);
appendDebug("Trying to get flight path from server...");
getCSV(current_uuid);
}
$("#debuginfo").hide();
$("#scenario_template").hide();
$("#showHideDebug").click(function() {
toggleDebugWindow();
toggleWindow("scenario_template", "showHideDebug", "Show Debug", "Hide Debug");
});
$("#showHideDebug_status").click(function() {
toggleWindow("scenario_template", "showHideDebug", "Show Debug", "Hide Debug");
});
$("#showHideForm").click(function() {
toggleWindow("input_form", "showHideForm", "Show Launch Card",
"Hide Launch Card");
});
}
@ -78,9 +87,7 @@ function initialize() {
<div id="map_canvas" style="width:100%; height:100%"></div>
<div id="scenario_template" class="box">
<h1>Debug Window -
<a><span id="showHideDebug">Show</span></a></span>
</h1>
<h1>Debug Window</h1>
<span id="debuginfo">No Messages</span>
</div>
@ -88,15 +95,17 @@ function initialize() {
<div id="prediction_progress"></div>
<div id="prediction_percent"></div>
<br>
<div id="prediction_status"></div>
<span id="prediction_status"></span><br>
<a><span id="showHideDebug_status">Toggle Debug</span></a></span>
</div>
<div id="bottom_right" class="box">
<div id="scenario_info" class="box">
info on scenario
<h1>Scenario Information</h1>
<a><span id="showHideDebug">Show Debug</span></a></span> |
<a><span id="showHideForm">Hide Launch Card</span></a></span>
</div>
<div id="input_form">
<div id="input_form" class="box">
<form action="" id="modelForm" name="modelForm">
<table>
<tr>
@ -176,8 +185,7 @@ info on scenario
</tr>
</table>
</form>
</div></div>
</div>
</body>
</html>

Wyświetl plik

@ -21,9 +21,22 @@ function predSub() {
$("#status_message").fadeIn(250);
}
function populateFormByUUID(pred_uuid) {
$.get("ajax.php", { "action":"getModelByUUID", "uuid":pred_uuid }, function(data) {
if ( !data.valid ) {
appendDebug("Populating form by UUID failed");
appendDebug("The server said the model it made was invalid");
} else {
// we're good to go, populate the form
alert(data);
}
}, 'json');
}
function handlePred(pred_uuid) {
$("#prediction_status").html("Searching for wind data...");
$("#input_form").hide("slide", { direction: "down" }, 500);
$("#scenario_info").hide("slide", { direction: "up" }, 500);
$("#map_canvas").fadeTo(1000, 0.2);
// ajax to poll for progress
ajaxEventHandle = setInterval("getJSONProgress('"+pred_uuid+"')", 2000);
@ -70,6 +83,9 @@ function processProgress(progress) {
$("#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.");
@ -205,16 +221,28 @@ function appendDebug(appendage, clear) {
} else {
$("#debuginfo").html("");
}
// keep the debug window scrolled to bottom
$("#scenario_template").animate({scrollTop: $('#scenario_template')[0].scrollHeight});
}
function toggleDebugWindow() {
if( $("#debuginfo").css('display') != "none" ){
$("#debuginfo").hide("slide", { direction: "down" }, 500);
$("#showHideDebug").html("Show");
function toggleWindow(window_name, linker, onhide, onshow, force) {
if ( force == null ) {
if( $("#"+window_name).css('display') != "none" ){
$("#"+window_name+"").hide("slide", { direction: "down" }, 500);
$("#"+linker).html(onhide);
} else {
$("#debuginfo").show("slide", { direction: "down" }, 500);
$("#showHideDebug").html("Hide");
$("#"+window_name).show("slide", { direction: "down" }, 500);
$("#"+linker).html(onshow);
}
} else if ( force == "hide" ) {
$("#"+window_name+"").hide("slide", { direction: "down" }, 500);
$("#"+linker).html(onhide);
} else if ( force == "show") {
$("#"+window_name).show("slide", { direction: "down" }, 500);
$("#"+linker).html(onshow);
} else {
appendDebug("toggleWindow force parameter unrecognised");
}
}
// launch site dropdown switcher