I2P Address: [http://git.idk.i2p]

Skip to content
Snippets Groups Projects
Commit 98e7a6d2 authored by str4d's avatar str4d
Browse files

Change pagination to use POSTed variable instead of query parameter

All wizard pages now have the URL /i2ptunnel/wizard
parent 3af2f297
No related branches found
No related tags found
No related merge requests found
...@@ -8,22 +8,25 @@ ...@@ -8,22 +8,25 @@
<jsp:useBean class="net.i2p.i2ptunnel.web.WizardBean" id="wizardBean" scope="request" /> <jsp:useBean class="net.i2p.i2ptunnel.web.WizardBean" id="wizardBean" scope="request" />
<jsp:useBean class="net.i2p.i2ptunnel.web.Messages" id="intl" scope="request" /> <jsp:useBean class="net.i2p.i2ptunnel.web.Messages" id="intl" scope="request" />
<% String pageStr = request.getParameter("page"); <% String pageStr = request.getParameter("page");
int curPage = 1; int lastPage = 0;
if (pageStr != null) { if (pageStr != null) {
try { try {
curPage = Integer.parseInt(pageStr); lastPage = Integer.parseInt(pageStr);
if (curPage > 7 || curPage <= 0) { if (lastPage > 7 || lastPage < 0) {
curPage = 1; lastPage = 0;
} }
} catch (NumberFormatException nfe) { } catch (NumberFormatException nfe) {
curPage = 1; lastPage = 0;
} }
} }
int curPage = 1;
if ("Previous page".equals(request.getParameter("action"))) { if ("Previous page".equals(request.getParameter("action"))) {
curPage = curPage - 2; curPage = lastPage - 1;
if (curPage <= 0) { } else {
curPage = 1; curPage = lastPage + 1;
} }
if (curPage > 7 || curPage <= 0) {
curPage = 1;
} }
boolean tunnelIsClient = Boolean.valueOf(request.getParameter("isClient")); boolean tunnelIsClient = Boolean.valueOf(request.getParameter("isClient"));
String tunnelType = request.getParameter("type"); String tunnelType = request.getParameter("type");
...@@ -46,7 +49,7 @@ ...@@ -46,7 +49,7 @@
<div id="pageHeader"> <div id="pageHeader">
</div> </div>
<form method="post" action="<%=(curPage == 7 ? "list" : "wizard?page="+(curPage+1)) %>"> <form method="post" action="<%=(curPage == 7 ? "list" : "wizard") %>">
<div id="wizardPanel" class="panel"> <div id="wizardPanel" class="panel">
<div class="header"> <div class="header">
...@@ -66,7 +69,7 @@ ...@@ -66,7 +69,7 @@
} else if (curPage == 7) { } else if (curPage == 7) {
%><h4><%=intl._("Wizard completed")%></h4><% %><h4><%=intl._("Wizard completed")%></h4><%
} %> } %>
<input type="hidden" name="page" value="<%=request.getParameter("page")%>" /> <input type="hidden" name="page" value="<%=curPage%>" />
<input type="hidden" name="tunnel" value="null" /> <input type="hidden" name="tunnel" value="null" />
<input type="hidden" name="nonce" value="<%=wizardBean.getNextNonce()%>" /> <input type="hidden" name="nonce" value="<%=wizardBean.getNextNonce()%>" />
</div> </div>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment