forked from I2P_Developers/i2p.i2p
Wizard: Ajax fixes for IE (thx zlatinb) (summary bar also)
Form notices on results panel Hide results if skipped
This commit is contained in:
@ -224,7 +224,7 @@ public class MLabRunner {
|
|||||||
results.put("down", down_bps);
|
results.put("down", down_bps);
|
||||||
results.put("server_host", server_host);
|
results.put("server_host", server_host);
|
||||||
if (server_city != null)
|
if (server_city != null)
|
||||||
results.put("server_city", server_city);
|
results.put("server_city", server_city.replace("_", ", "));
|
||||||
if (server_country != null)
|
if (server_country != null)
|
||||||
results.put("server_country", server_country);
|
results.put("server_country", server_country);
|
||||||
listener.complete(results);
|
listener.complete(results);
|
||||||
|
@ -46,6 +46,19 @@ public class WizardHandler extends FormHandler {
|
|||||||
}
|
}
|
||||||
if ("4".equals(page)) {
|
if ("4".equals(page)) {
|
||||||
startNDT();
|
startNDT();
|
||||||
|
} else if ("5".equals(page)) {
|
||||||
|
synchronized (_helper) {
|
||||||
|
if (_helper.isNDTSuccessful()) {
|
||||||
|
addFormNotice(_t("Bandwidth test completed successfully"));
|
||||||
|
} else if (_helper.isNDTComplete()) {
|
||||||
|
addFormError(_t("Bandwidth test failed"));
|
||||||
|
} else if (_helper.isNDTRunning()) {
|
||||||
|
addFormError(_t("Bandwidth test did not complete"));
|
||||||
|
} else {
|
||||||
|
// didn't run at all?
|
||||||
|
addFormError(_t("Bandwidth test did not complete"));
|
||||||
|
}
|
||||||
|
}
|
||||||
} else if ("6".equals(page)) {
|
} else if ("6".equals(page)) {
|
||||||
Map<String, String> changes = new HashMap<String, String>();
|
Map<String, String> changes = new HashMap<String, String>();
|
||||||
boolean updated = updateRates(changes);
|
boolean updated = updateRates(changes);
|
||||||
|
@ -55,6 +55,10 @@ public class WizardHelper extends HelperBase {
|
|||||||
return _listener != null && !_listener.isComplete();
|
return _listener != null && !_listener.isComplete();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public synchronized boolean isNDTSuccessful() {
|
||||||
|
return isNDTComplete() && getUpBandwidth() > 0 && getDownBandwidth() > 0;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return HTML-escaped status string or ""
|
* @return HTML-escaped status string or ""
|
||||||
*/
|
*/
|
||||||
|
@ -6,6 +6,8 @@ function ajax(url, target, refresh) {
|
|||||||
req = new XMLHttpRequest();
|
req = new XMLHttpRequest();
|
||||||
req.onreadystatechange = function() {ajaxDone(url, target, refresh);};
|
req.onreadystatechange = function() {ajaxDone(url, target, refresh);};
|
||||||
req.open("GET", url, true);
|
req.open("GET", url, true);
|
||||||
|
// IE https://www.jamesmaurer.com/ajax-refresh-problem-w-ie-not-refreshing.asp
|
||||||
|
req.setRequestHeader("If-Modified-Since","Sat, 1 Jan 2000 00:00:00 GMT");
|
||||||
req.send(null);
|
req.send(null);
|
||||||
// IE/Windows ActiveX version
|
// IE/Windows ActiveX version
|
||||||
} else if (window.ActiveXObject) {
|
} else if (window.ActiveXObject) {
|
||||||
@ -13,6 +15,8 @@ function ajax(url, target, refresh) {
|
|||||||
if (req) {
|
if (req) {
|
||||||
req.onreadystatechange = function() {ajaxDone(target);};
|
req.onreadystatechange = function() {ajaxDone(target);};
|
||||||
req.open("GET", url, true);
|
req.open("GET", url, true);
|
||||||
|
// IE https://www.jamesmaurer.com/ajax-refresh-problem-w-ie-not-refreshing.asp
|
||||||
|
req.setRequestHeader("If-Modified-Since","Sat, 1 Jan 2000 00:00:00 GMT");
|
||||||
req.send(null);
|
req.send(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,8 @@ function ajax(url, target, refresh) {
|
|||||||
req = new XMLHttpRequest();
|
req = new XMLHttpRequest();
|
||||||
req.onreadystatechange = function() {ajaxDone(url, target, refresh);};
|
req.onreadystatechange = function() {ajaxDone(url, target, refresh);};
|
||||||
req.open("GET", url, true);
|
req.open("GET", url, true);
|
||||||
|
// IE https://www.jamesmaurer.com/ajax-refresh-problem-w-ie-not-refreshing.asp
|
||||||
|
req.setRequestHeader("If-Modified-Since","Sat, 1 Jan 2000 00:00:00 GMT");
|
||||||
req.send(null);
|
req.send(null);
|
||||||
// IE/Windows ActiveX version
|
// IE/Windows ActiveX version
|
||||||
} else if (window.ActiveXObject) {
|
} else if (window.ActiveXObject) {
|
||||||
@ -13,6 +15,8 @@ function ajax(url, target, refresh) {
|
|||||||
if (req) {
|
if (req) {
|
||||||
req.onreadystatechange = function() {ajaxDone(target);};
|
req.onreadystatechange = function() {ajaxDone(target);};
|
||||||
req.open("GET", url, true);
|
req.open("GET", url, true);
|
||||||
|
// IE https://www.jamesmaurer.com/ajax-refresh-problem-w-ie-not-refreshing.asp
|
||||||
|
req.setRequestHeader("If-Modified-Since","Sat, 1 Jan 2000 00:00:00 GMT");
|
||||||
req.send(null);
|
req.send(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -29,7 +33,8 @@ function ajaxDone(url, target, refresh) {
|
|||||||
// output 1 for complete, 0 + status string for in progress
|
// output 1 for complete, 0 + status string for in progress
|
||||||
fails = 0;
|
fails = 0;
|
||||||
var status;
|
var status;
|
||||||
if (req.responseText.startsWith("1")) {
|
// IE doesn't support startsWith()
|
||||||
|
if (req.responseText.indexOf("1") == 0) {
|
||||||
results = doneMessage;
|
results = doneMessage;
|
||||||
running = false;
|
running = false;
|
||||||
done = true;
|
done = true;
|
||||||
|
@ -163,6 +163,10 @@
|
|||||||
%>
|
%>
|
||||||
<jsp:useBean class="net.i2p.router.web.helpers.ConfigNetHelper" id="nethelper" scope="request" />
|
<jsp:useBean class="net.i2p.router.web.helpers.ConfigNetHelper" id="nethelper" scope="request" />
|
||||||
<jsp:setProperty name="nethelper" property="contextId" value="<%=i2pcontextId%>" />
|
<jsp:setProperty name="nethelper" property="contextId" value="<%=i2pcontextId%>" />
|
||||||
|
<%
|
||||||
|
if (request.getParameter("skipbw") == null) {
|
||||||
|
// don't display this if we skipped the test
|
||||||
|
%>
|
||||||
<h3><%=intl._t("Bandwidth Test Results")%></h3>
|
<h3><%=intl._t("Bandwidth Test Results")%></h3>
|
||||||
<table class="configtable">
|
<table class="configtable">
|
||||||
<tr><td><%=intl._t("Test running?")%></td><td><%=wizhelper.isNDTRunning()%></td></tr>
|
<tr><td><%=intl._t("Test running?")%></td><td><%=wizhelper.isNDTRunning()%></td></tr>
|
||||||
@ -174,6 +178,9 @@
|
|||||||
<tr><td><%=intl._t("Upstream Bandwidth")%></td><td><%=net.i2p.data.DataHelper.formatSize2Decimal(wizhelper.getUpBandwidth())%>Bps</td></tr>
|
<tr><td><%=intl._t("Upstream Bandwidth")%></td><td><%=net.i2p.data.DataHelper.formatSize2Decimal(wizhelper.getUpBandwidth())%>Bps</td></tr>
|
||||||
<tr><td><%=intl._t("Share of Bandwidth for I2P")%></td><td><%=Math.round(net.i2p.router.web.helpers.WizardHelper.BW_SCALE * 100)%>%</td></tr>
|
<tr><td><%=intl._t("Share of Bandwidth for I2P")%></td><td><%=Math.round(net.i2p.router.web.helpers.WizardHelper.BW_SCALE * 100)%>%</td></tr>
|
||||||
</table>
|
</table>
|
||||||
|
<%
|
||||||
|
} // skipbw
|
||||||
|
%>
|
||||||
<h3><%=intl._t("Bandwidth Configuration")%></h3>
|
<h3><%=intl._t("Bandwidth Configuration")%></h3>
|
||||||
<table id="bandwidthconfig" class="configtable">
|
<table id="bandwidthconfig" class="configtable">
|
||||||
<tr><td class="infohelp" colspan="2">
|
<tr><td class="infohelp" colspan="2">
|
||||||
|
Reference in New Issue
Block a user