SusiDNS: Fix adding to empty address book

by doing form processing even if book is empty.
Do all form processing before displays so the
displays reflect any form add/delete.
Broken in 0.9.50 when form processing call was moved.
Hide replace and add alternate buttons if book is empty.
Ref: https://www.reddit.com/r/i2p/comments/wu7nac/how_do_i_add_to_the_private_address_book/
This commit is contained in:
zzz
2022-09-04 08:14:19 -04:00
parent 64632eed4a
commit 554b17fe9a
3 changed files with 18 additions and 3 deletions

View File

@@ -77,6 +77,13 @@
<h3 id="addrtitle"><%=intl._t("Address book")%>: <%=intl._t(book.getBook())%></h3>
<h4 id="storagepath"><%=intl._t("Storage")%>: ${book.displayName}</h4>
<%
// This is what does the form processing.
// We need to do this before any notEmpty test and before loadBookMessages() which displays the entry count.
// Messages will be displayed below.
String formMessages = book.getMessages();
%>
${book.loadBookMessages}
<% if (book.getBook().equals("private")) { %>
@@ -128,15 +135,18 @@ ${book.loadBookMessages}
</div>
</form>
<% } /* book.getEntries().length() > 0 */ %>
</c:if><% /* book.notEmpty */ %>
</div>
</div><% /* headline */ %>
<div id="messages">${book.messages}<%
<% /* need this whether book is empty or not to display the form messages */ %>
<div id="messages"><%=formMessages%><%
if (importMessages != null) {
%><%=importMessages%><%
}
%></div>
<c:if test="${book.notEmpty}">
<div id="filter">
<c:if test="${book.hasFilter}">
<span><%=intl._t("Current filter")%>: <b>${book.filter}</b>
@@ -287,10 +297,12 @@ ${book.loadBookMessages}
</table>
<p class="buttons" id="addnewaddrbutton">
<input class="cancel" type="reset" value="<%=intl._t("Cancel")%>" >
<c:if test="${book.notEmpty}">
<input class="accept" type="submit" name="action" value="<%=intl._t("Replace")%>" >
<% if (!book.getBook().equals("published")) { %>
<input class="add" type="submit" name="action" value="<%=intl._t("Add Alternate")%>" >
<% } %>
</c:if><% /* book.notEmpty */ %>
<input class="add" type="submit" name="action" value="<%=intl._t("Add")%>" >
</p>
</div>

View File

@@ -1,3 +1,6 @@
2022-09-04 zzz
* SusiDNS: Fix adding to empty address book
2022-09-03 zzz
* NetDB: Query connected peers for their RI directly
* UPnP: Fix opening IPv6 ports

View File

@@ -18,7 +18,7 @@ public class RouterVersion {
/** deprecated */
public final static String ID = "Git";
public final static String VERSION = CoreVersion.VERSION;
public final static long BUILD = 5;
public final static long BUILD = 6;
/** for example "-test" */
public final static String EXTRA = "";