diff --git a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/web/WizardBean.java b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/web/WizardBean.java new file mode 100644 index 000000000..779df4417 --- /dev/null +++ b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/web/WizardBean.java @@ -0,0 +1,25 @@ +package net.i2p.i2ptunnel.web; + +/** + * A temporary data holder for the wizard pages + * + * Warning - This class is not part of the i2ptunnel API, and at some point + * it will be moved from the jar to the war. + * Usage by classes outside of i2ptunnel.war is deprecated. + */ +public class WizardBean extends EditBean { + private boolean _isClient; + public WizardBean() { super(); } + + /** + * Whether the tunnel being set up is a client tunnel or not. + * @since 0.8.13 + */ + public void setIsClient(String isClient) { + _isClient = Boolean.valueOf(isClient); + } + /** @since 0.8.13 */ + public boolean getIsClient() { + return _isClient; + } +} diff --git a/apps/i2ptunnel/jsp/web.xml b/apps/i2ptunnel/jsp/web.xml index d333d2936..d8d51c823 100644 --- a/apps/i2ptunnel/jsp/web.xml +++ b/apps/i2ptunnel/jsp/web.xml @@ -18,6 +18,11 @@ /edit + + net.i2p.i2ptunnel.jsp.wizard_jsp + /wizard + + 30 diff --git a/apps/i2ptunnel/jsp/wizard.jsp b/apps/i2ptunnel/jsp/wizard.jsp new file mode 100644 index 000000000..6daae14fb --- /dev/null +++ b/apps/i2ptunnel/jsp/wizard.jsp @@ -0,0 +1,421 @@ +<% + // NOTE: Do the header carefully so there is no whitespace before the <%@page pageEncoding="UTF-8" +%><%@page contentType="text/html" import="net.i2p.i2ptunnel.web.WizardBean" +%> + + + +<% String pageStr = request.getParameter("page"); + /* Get the number of the page we came from */ + int lastPage = 0; + if (pageStr != null) { + try { + lastPage = Integer.parseInt(pageStr); + if (lastPage > 7 || lastPage < 0) { + lastPage = 0; + } + } catch (NumberFormatException nfe) { + lastPage = 0; + } + } + /* Determine what page to display now */ + int curPage = 1; + if ("Previous page".equals(request.getParameter("action"))) { + curPage = lastPage - 1; + } else { + curPage = lastPage + 1; + } + if (curPage > 7 || curPage <= 0) { + curPage = 1; + } + /* Fetch and format a couple of regularly-used values */ + boolean tunnelIsClient = Boolean.valueOf(request.getParameter("isClient")); + String tunnelType = request.getParameter("type"); + /* Special case - don't display page 4 for server tunnels */ + if (curPage == 4 && !tunnelIsClient) { + if ("Previous page".equals(request.getParameter("action"))) { + curPage = curPage - 1; + } else { + curPage = curPage + 1; + } + } +%> + + + <%=intl._("I2P Tunnel Manager - Tunnel Creation Wizard")%> + + + + + + <% if (wizardBean.allowCSS()) { + %> + + <% } + %> + + + + +
"> + +
+
+ <% + if (curPage == 1) { + %>

<%=intl._("Server or client tunnel?")%>

<% + } else if (curPage == 2) { + %>

<%=intl._("Tunnel type")%>

<% + } else if (curPage == 3) { + %>

<%=intl._("Tunnel name and description")%>

<% + } else if (curPage == 4 && tunnelIsClient) { + %>

<%=intl._("Tunnel destination")%>

<% + } else if (curPage == 5) { + %>

<%=intl._("Binding address and port")%>

<% + } else if (curPage == 6) { + %>

<%=intl._("Tunnel auto-start")%>

<% + } else if (curPage == 7) { + %>

<%=intl._("Wizard completed")%>

<% + } %> + + + +
+ +
+
+
+ + <% /* Page 1 - Whether to make a client or server tunnel */ + + if (curPage == 1) { + %>

+ <%=intl._("The first thing to decide is whether you want to create a client or server tunnel.")%> +

+
+ + + + +
<% + } else { + %><% + } /* curPage 1 */ + + /* End page 1 */ %> + + <% /* Page 2 - Tunnel type */ + + if (curPage == 2) { + %>

+ <%=intl._("There are several types of tunnels to choose from:")%> +

+
    <% + if (tunnelIsClient) { + %> +
  • <%=intl._("Standard")%>
  • +
  • HTTP
  • +
  • IRC
  • +
  • SOCKS 4/4a/5
  • +
  • SOCKS IRC
  • +
  • CONNECT
  • +
  • Streamr
  • <% + } else { + %> +
  • <%=intl._("Standard")%>
  • +
  • HTTP
  • +
  • HTTP bidir
  • +
  • IRC
  • +
  • Streamr
  • <% + } + %> +
+

+ <%=intl._("The above might look better as a table, possibly.")%> +

+
+ <% + if (tunnelIsClient) { + %><% + } else { + %><% + } /* tunnelIsClient */ %> +
<% + } else { + %><% + } /* curPage 2 */ + + /* End page 2 */ %> + + <% /* Page 3 - Name and description */ + + if (curPage == 3) { + %>

+ <%=intl._("Choose a name and description for your tunnel.")%> + <%=intl._("These can be anything you want - they are just for ease of identifying the tunnel in the routerconsole.")%> +

+
+ + " class="freetext" /> +
+
+ + " class="freetext" /> +
<% + } else { + %>" /> + " /><% + } /* curPage 3 */ + + /* End page 3 */ %> + + <% /* Page 4 - Target destination or proxy list */ + + if (tunnelIsClient) { + if ("httpclient".equals(tunnelType) || "connectclient".equals(tunnelType) || "sockstunnel".equals(tunnelType) || "socksirctunnel".equals(tunnelType)) { + if (curPage == 4) { + %>

+ <%=intl._("Some blurb explaining that this is the list of proxies that the client tunnel should try if the requested URL is not an I2P URL.")%> +

+
+ + " class="freetext" /> +
<% + } else { + %>" /><% + } /* curPage 4 */ + } else if ("client".equals(tunnelType) || "ircclient".equals(tunnelType) || "streamrclient".equals(tunnelType)) { + if (curPage == 4) { + %>

+ <%=intl._("Some blurb explaining that this is the I2P destination that the client tunnel should point to.")%> +

+
+ + " class="freetext" /> + (<%=intl._("name or destination")%>; <%=intl._("b32 not recommended")%>) +
<% + } else { + %>" /><% + } /* curPage 4 */ + } + } /* tunnelIsClient */ + + /* End page 4 */ %> + + <% /* Page 5 - Binding ports and addresses*/ + + if ((tunnelIsClient && "streamrclient".equals(tunnelType)) || (!tunnelIsClient && !"streamrserver".equals(tunnelType))) { + if (curPage == 5) { + %>

+ <%=intl._("Some blurb explaining that this is the IP that the service is running on, and that the tunnel should direct requests to.")%> + <%=intl._("For some reason streamrclient also uses this.")%> +

+
+ + " class="freetext" /> +
<% + } else { + %>" /><% + } /* curPage 5 */ + } /* streamrclient or !streamrserver */ %> + <% + if (!tunnelIsClient) { + if (curPage == 5) { + %>

+ <%=intl._("Some blurb explaining that this is the port that the service is running on, and that the tunnel should direct requests to.")%> +

+
+ + " class="freetext" /> +
<% + } else { + %>" /><% + } /* curPage 5 */ + } /* !tunnelIsClient */ %> + <% + if (tunnelIsClient || "httpbidirserver".equals(tunnelType)) { + if (curPage == 5) { + %>

+ <%=intl._("Some blurb explaining that this is the port that the client tunnel will be accessed from locally.")%> + <%=intl._("This is also the client port for the httpbidirserver tunnel.")%> +

+
+ + " class="freetext" /> +
<% + } else { + %>" /><% + } /* curPage 5 */ + } /* tunnelIsClient or httpbidirserver */ %> + <% + if ((tunnelIsClient && !"streamrclient".equals(tunnelType)) || "httpbidirserver".equals(tunnelType) || "streamrserver".equals(tunnelType)) { + if (curPage == 5) { + %>

+ <%=intl._("Some blurb explaining what Reachable By is.")%> + <%=intl._("Note that it is relevant to most Client tunnels, and httpbidirserver and streamrserver tunnels.")%> + <%=intl._("So the wording may need to change slightly for the client vs. server tunnels.")%> +

+
+ + +
<% + } else { + %>" /><% + } /* curPage 5 */ + } /* (tunnelIsClient && !streamrclient) || httpbidirserver || streamrserver */ + + /* End page 5 */ %> + + <% /* Page 6 - Automatic start */ + + if (curPage == 6) { + %>

+ <%=intl._("Some blurb that explains what Auto Start does.")%> +

+
+ + class="tickbox" /> + <%=intl._("(Check the Box for 'YES')")%> +
<% + } else { + if ("1".equals(request.getParameter("startOnLoad"))) { + %>" /><% + } + } /* curPage 6 */ + + /* End page 6 */ %> + + <% /* Page 7 - Wizard complete */ + + if (curPage == 7) { + %>

+ <%=intl._("Some blurb explaining that the wizard is finished, and that the tunnel will now be created and possibly started.")%> + <%=intl._("There should also be a blurb about the fact that the tunnel will be created with default values, and that these may require tuning.")%> +

+ + + + + + + + + + <% + if (!"streamrclient".equals(tunnelType)) { + %> + + <% + } /* !streamrclient */ %> + + <% + if (tunnelIsClient) { /* Client-only defaults */ + if (!"streamrclient".equals(tunnelType)) { + %> + <% + } + if ("httpclient".equals(tunnelType) || "connectclient".equals(tunnelType) || "sockstunnel".equals(tunnelType) || "socksirctunnel".equals(tunnelType)) { + %> + + + <% + } + if ("httpclient".equals(tunnelType)) { + %><% + } /* httpclient */ + } else { /* Server-only defaults */ + %> + + + + + + + + + + + <% + } /* tunnelIsClient */ + } /* curPage 7 */ + + /* End page 7 */ %> +
+ +
+
+ +
+ +
+ + + +