source: apps/routerconsole/jsp/welcome.jsp @ f8f6375

Last change on this file since f8f6375 was f8f6375, checked in by zzz <zzz@…>, 21 months ago

New install setup wizard
Work in progress, run on first install disabled.
Language and bw settings should work,
other panes todo.

  • Property mode set to 100644
File size: 8.2 KB
Line 
1<%@page contentType="text/html"%><%@page pageEncoding="UTF-8"%><jsp:useBean class="net.i2p.router.web.helpers.WizardHelper" id="wizhelper" scope="request" /><%
2    // page ID
3    final int LAST_PAGE = 7;
4    String pg = request.getParameter("page");
5    int ipg;
6    if (pg == null) {
7        ipg = 1;
8    } else {
9        try {
10            ipg = Integer.parseInt(pg);
11            if (request.getParameter("prev") != null) {
12                // previous button handling
13                if (ipg == 6)
14                    ipg = 3;
15                else
16                    ipg -= 2;
17            }
18            if (ipg <= 0 || ipg > LAST_PAGE) {
19                ipg = 1;
20            } else if (ipg == 4 && request.getParameter("skipbw") != null) {
21                ipg++;  // skip bw test
22            }
23        } catch (NumberFormatException nfe) {
24            ipg = 1;
25        }
26    }
27
28    // detect completion
29    boolean done = request.getParameter("done") != null || request.getParameter("skip") != null;
30    if (done) {
31        // tell wizard helper we're done
32        String i2pcontextId = request.getParameter("i2p.contextId");
33        try {
34            if (i2pcontextId != null) {
35                session.setAttribute("i2p.contextId", i2pcontextId);
36            } else {
37                i2pcontextId = (String) session.getAttribute("i2p.contextId");
38            }
39        } catch (IllegalStateException ise) {}
40        wizhelper.setContextId(i2pcontextId);
41        wizhelper.complete();
42
43        // redirect to /home
44        response.setStatus(307);
45        String req = request.getRequestURL().toString();
46        int slash = req.indexOf("/welcome");
47        if (slash >= 0)
48            req = req.substring(0, slash) + "/home";
49        else // shouldn't happen
50            req = "http://127.0.0.1:7657/home";
51        response.setHeader("Location", req);
52        // force commitment
53        response.getOutputStream().close();
54        return;
55    }
56%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
57<html><head>
58<%@include file="css.jsi" %>
59<%=intl.title("New Install Wizard")%>
60<%
61    if (ipg == 4) {
62%>
63<script src="/js/ajax.js" type="text/javascript"></script>
64<script type="text/javascript">
65  var failMessage = "<hr><b><%=intl._t("Router is down")%><\/b>";
66  function requestAjax1() { ajax("/welcomexhr.jsp?requestURI=<%=request.getRequestURI()%>", "xhr", "1000"); }
67  function initAjax() { setTimeout(requestAjax1, <%=intl.getRefresh()%>000);  }
68</script>
69<%
70    }
71%>
72</head>
73<%
74    if (ipg == 4) {
75%>
76<body onload="initAjax()">
77<%
78    } else {
79%>
80<body>
81<%
82    }
83%>
84<h2><%=intl._t("New Install Wizard")%> <%=ipg%>/<%=LAST_PAGE%></h2>
85<div id="wizard">
86<jsp:useBean class="net.i2p.router.web.helpers.WizardHandler" id="formhandler" scope="request" />
87<%@include file="formhandler.jsi" %>
88<form action="" method="POST">
89<input type="hidden" name="nonce" value="<%=pageNonce%>">
90<input type="hidden" name="action" value="blah" >
91<input type="hidden" name="page" value="<%=(ipg + 1)%>" >
92<%
93
94    if (ipg == 1) {
95        // language selection
96%>
97<jsp:useBean class="net.i2p.router.web.helpers.ConfigUIHelper" id="uihelper" scope="request" />
98<jsp:setProperty name="uihelper" property="contextId" value="<%=i2pcontextId%>" />
99<%-- needed for CSS: --%><div id="config_ui">
100<%-- needed for lang setting in css.jsi: --%><input type="hidden" name="consoleNonce" value="<%=net.i2p.router.web.CSSHelper.getNonce()%>" >
101<h3 id="langheading"><%=uihelper._t("Router Console Language")%></h3>
102<div id="langsettings">
103<jsp:getProperty name="uihelper" property="langSettings" />
104</div></div>
105<%
106
107    } else if (ipg == 2) {
108        // I2P Philosophy
109        // license info?
110%>
111<h3><%=intl._t("Why I2P?")%></h3>
112<p>TODO</p>
113<%
114
115    } else if (ipg == 3) {
116        // Overview of bandwidth test
117%>
118<h3><%=intl._t("Bandwidth Test")%></h3>
119<p>
120<%=intl._t("I2P will now test your internet connection to identify the optimal speed settings.")%>
121<%=intl._t("Applying these settings will maximize your download speed using the third-party M-Lab service.")%>
122<%=intl._t("M-Lab collects and publishes the IP address of the client that conducted the measurement.")%>
123<%=intl._t("FIXME! This is necessary to understand and describe experimental results, including to identify which Internet service provider the test was conducted from.")%>
124<%=intl._t("Please review the M-Lab privacy policies linked below.")%>
125<%=intl._t("If you do not wish to run the M-Lab bandwidth test, you may skip it by clicking the button below.")%>
126</p><p>
127<a href="https://www.measurementlab.net/privacy/" target="_blank"><%=intl._t("M-Lab Privacy Policy")%></a>
128<br><a href="https://github.com/m-lab/mlab-ns/blob/master/MLAB-NS_PRIVACY_POLICY.md" target="_blank"><%=intl._t("M-Lab Name Server Privacy Policy")%></a>
129</p>
130
131
132<%
133
134    } else if (ipg == 4) {
135        // Bandwidth test in progress (w/ AJAX)
136%>
137<h3><%=intl._t("Bandwidth Test in Progress")%></h3>
138<p>TODO</p>
139<%
140
141    } else if (ipg == 5) {
142        // Bandwidth test results
143        // and/or manual bw entry?
144%>
145<jsp:useBean class="net.i2p.router.web.helpers.ConfigNetHelper" id="nethelper" scope="request" />
146<jsp:setProperty name="nethelper" property="contextId" value="<%=i2pcontextId%>" />
147<h3><%=intl._t("Bandwidth Test Results")%></h3>
148<table class="configtable">
149<tr><td>
150Test results go here
151</td></tr>
152</table>
153<h3><%=intl._t("Bandwidth Configuration")%></h3>
154<table id="bandwidthconfig" class="configtable">
155<tr><td class="infohelp" colspan="2">
156<%=intl._t("I2P will work best if you configure your rates to match the speed of your internet connection.")%>
157</td></tr>
158<tr><td><input style="text-align: right; width: 5em;" name="inboundrate" type="text" size="5" maxlength="5" value="<jsp:getProperty name="nethelper" property="inboundBurstRate" />" >
159<%=intl._t("KBps In")%>
160</td><td>(<jsp:getProperty name="nethelper" property="inboundBurstRateBits" />)</td>
161</tr><tr>
162<%-- display burst, set standard, handler will fix up --%>
163<td><input style="text-align: right; width: 5em;" name="outboundrate" type="text" size="5" maxlength="5" value="<jsp:getProperty name="nethelper" property="outboundBurstRate" />" >
164<%=intl._t("KBps Out")%>
165</td><td>(<jsp:getProperty name="nethelper" property="outboundBurstRateBits" />)</td>
166</tr><tr>
167<td><jsp:getProperty name="nethelper" property="sharePercentageBox" /> <%=intl._t("Share")%></td>
168<td>(<jsp:getProperty name="nethelper" property="shareRateBits" />)
169</td></tr>
170<tr><td class="infohelp" colspan="2">
171<% int share = Math.round(nethelper.getShareBandwidth() * 1.024f);
172    if (share < 12) {
173        out.print("<b>");
174        out.print(intl._t("NOTE"));
175        out.print("</b>: ");
176        out.print(intl._t("You have configured I2P to share only {0} KBps.", share));
177        out.print("\n");
178
179        out.print(intl._t("I2P requires at least 12KBps to enable sharing. "));
180        out.print(intl._t("Please enable sharing (participating in tunnels) by configuring more bandwidth. "));
181        out.print(intl._t("It improves your anonymity by creating cover traffic, and helps the network."));
182    } else {
183        out.print(intl._t("You have configured I2P to share {0} KBps.", share));
184        out.print("\n");
185
186        out.print(intl._t("The higher the share bandwidth the more you improve your anonymity and help the network."));
187    }
188%></td></tr>
189</table>
190<%
191
192    } else if (ipg == 6) {
193        // Browser setup
194%>
195<h3><%=intl._t("Browser Setup")%></h3>
196<p>TODO</p>
197<%
198
199    } else if (ipg == LAST_PAGE) {
200        // Done
201%>
202<h3><%=intl._t("Finished")%></h3>
203<p>TODO</p>
204<%
205
206    } else {
207%>
208<p>unknown wizard page</p>
209<%
210    }
211%>
212<div class="wizardbuttons">
213<table class="configtable"><tr><td class="optionsave">
214<%
215    if (ipg != 1) {
216%>
217<input type="submit" class="go" name="prev" value="<%=intl._t("Previous")%>" >
218<%
219    }
220    if (ipg != LAST_PAGE) {
221%>
222<input type="submit" class="cancel" name="skip" value="<%=intl._t("Skip Setup")%>" >
223<%
224        if (ipg == 3) {
225%>
226<input type="submit" class="cancel" name="skipbw" value="<%=intl._t("Skip Bandwidth Test")%>" >
227<%
228        } else if (ipg == 4) {
229%>
230<input type="submit" class="cancel" name="cancelbw" value="<%=intl._t("Cancel Bandwidth Test")%>" >
231<%
232        }
233%>
234<input type="submit" class="go" name="next" value="<%=intl._t("Next")%>" >
235<%
236    } else {
237%>
238<input type="submit" class="go" name="done" value="<%=intl._t("Finished")%>" >
239<%
240    }
241%>
242</td></tr></table>
243</form>
244</div></body></html>
Note: See TracBrowser for help on using the repository browser.