%@page contentType="text/html"%><%@page pageEncoding="UTF-8"%><%
// note that for the helper we use a session scope, not a request scope,
// so that we can access the NDT test results.
// The MLabHelper singleton will prevent multiple simultaneous tests, even across sessions.
// page ID
final int LAST_PAGE = 7;
String pg = request.getParameter("page");
int ipg;
if (pg == null) {
ipg = 1;
} else {
try {
ipg = Integer.parseInt(pg);
if (request.getParameter("prev") != null) {
// previous button handling
if (ipg == 6)
ipg = 3;
else
ipg -= 2;
}
if (ipg <= 0 || ipg > LAST_PAGE) {
ipg = 1;
} else if (ipg == 4 && request.getParameter("skipbw") != null) {
ipg++; // skip bw test
}
} catch (NumberFormatException nfe) {
ipg = 1;
}
}
// detect completion
boolean done = request.getParameter("done") != null || request.getParameter("skip") != null;
if (done) {
// tell wizard helper we're done
String i2pcontextId = request.getParameter("i2p.contextId");
try {
if (i2pcontextId != null) {
session.setAttribute("i2p.contextId", i2pcontextId);
} else {
i2pcontextId = (String) session.getAttribute("i2p.contextId");
}
} catch (IllegalStateException ise) {}
wizhelper.setContextId(i2pcontextId);
wizhelper.complete();
// redirect to /home
response.setStatus(307);
response.setHeader("Cache-Control","no-cache");
String req = request.getRequestURL().toString();
int slash = req.indexOf("/welcome");
if (slash >= 0)
req = req.substring(0, slash) + "/home";
else // shouldn't happen
req = "http://127.0.0.1:7657/home";
response.setHeader("Location", req);
// force commitment
response.getOutputStream().close();
return;
}
%>
<%@include file="css.jsi" %>
<%=intl.title("New Install Wizard")%>
<%
wizhelper.setContextId(i2pcontextId);
if (ipg == 4) {
%>
<%
}
%>
<%
if (ipg == 4) {
%>
<%
} else {
%>
<%
}
%>
<%=intl._t("New Install Wizard")%> <%=ipg%>/<%=LAST_PAGE%>
<%
// Bind the session-scope Helper to the request-scope Handler
formhandler.setWizardHelper(wizhelper);
%>
<%@include file="formhandler.jsi" %>