forked from I2P_Developers/i2p.i2p
* susidns:
- IDN toASCII improvements (old bean) - Add 'other' filter - Fix jsp 500s
This commit is contained in:
@@ -281,31 +281,42 @@ public class AddressbookBean
|
||||
boolean changed = false;
|
||||
if (action.equals(_("Add")) || action.equals(_("Replace"))) {
|
||||
if( addressbook != null && hostname != null && destination != null ) {
|
||||
String oldDest = (String) addressbook.get(hostname);
|
||||
if (destination.equals(oldDest)) {
|
||||
message = _("Host name {0} is already in addressbook, unchanged.", hostname);
|
||||
} else if (oldDest != null && !action.equals(_("Replace"))) {
|
||||
message = _("Host name {0} is already in addressbook with a different destination. Click \"Replace\" to overwrite.", hostname);
|
||||
} else {
|
||||
boolean valid = true;
|
||||
try {
|
||||
Destination dest = new Destination(destination);
|
||||
} catch (DataFormatException dfe) {
|
||||
valid = false;
|
||||
}
|
||||
if (valid) {
|
||||
addressbook.put( hostname, destination );
|
||||
changed = true;
|
||||
if (oldDest == null)
|
||||
message = _("Destination added for {0}.", hostname);
|
||||
else
|
||||
message = _("Destination changed for {0}.", hostname);
|
||||
// clear form
|
||||
hostname = null;
|
||||
destination = null;
|
||||
try {
|
||||
// throws IAE with translated message
|
||||
String host = AddressBean.toASCII(hostname);
|
||||
String displayHost = host.equals(hostname) ? hostname :
|
||||
hostname + " (" + host + ')';
|
||||
|
||||
String oldDest = (String) addressbook.get(host);
|
||||
if (destination.equals(oldDest)) {
|
||||
message = _("Host name {0} is already in addressbook, unchanged.", displayHost);
|
||||
} else if (oldDest != null && !action.equals(_("Replace"))) {
|
||||
message = _("Host name {0} is already in addressbook with a different destination. Click \"Replace\" to overwrite.", displayHost);
|
||||
} else {
|
||||
message = _("Invalid Base 64 destination.");
|
||||
boolean valid = true;
|
||||
try {
|
||||
Destination dest = new Destination(destination);
|
||||
} catch (DataFormatException dfe) {
|
||||
valid = false;
|
||||
}
|
||||
if (valid) {
|
||||
addressbook.put( host, destination );
|
||||
changed = true;
|
||||
if (oldDest == null)
|
||||
message = _("Destination added for {0}.", displayHost);
|
||||
else
|
||||
message = _("Destination changed for {0}.", displayHost);
|
||||
// clear form
|
||||
hostname = null;
|
||||
destination = null;
|
||||
} else {
|
||||
message = _("Invalid Base 64 destination.");
|
||||
}
|
||||
}
|
||||
} catch (IllegalArgumentException iae) {
|
||||
message = iae.getMessage();
|
||||
if (message == null)
|
||||
message = _("Invalid host name \"{0}\".", hostname);
|
||||
}
|
||||
} else {
|
||||
message = _("Please enter a host name and destination");
|
||||
@@ -317,9 +328,11 @@ public class AddressbookBean
|
||||
int deleted = 0;
|
||||
for (String n : deletionMarks) {
|
||||
addressbook.remove(n);
|
||||
String uni = AddressBean.toUnicode(n);
|
||||
String displayHost = uni.equals(n) ? n : uni + " (" + n + ')';
|
||||
if (deleted++ == 0) {
|
||||
changed = true;
|
||||
name = n;
|
||||
name = displayHost;
|
||||
}
|
||||
}
|
||||
if( changed ) {
|
||||
|
||||
@@ -103,6 +103,7 @@ ${book.loadBookMessages}
|
||||
<a href="addressbook.jsp?filter=y&begin=0&end=99">y</a>
|
||||
<a href="addressbook.jsp?filter=z&begin=0&end=99">z</a>
|
||||
<a href="addressbook.jsp?filter=0-9&begin=0&end=99">0-9</a>
|
||||
<a href="addressbook.jsp?filter=xn--&begin=0&end=99"><%=intl._("other")%></a>
|
||||
<a href="addressbook.jsp?filter=none&begin=0&end=99"><%=intl._("all")%></a></p>
|
||||
<c:if test="${book.hasFilter}">
|
||||
<p><%=intl._("Current filter")%>: ${book.filter}
|
||||
@@ -150,11 +151,11 @@ ${book.loadBookMessages}
|
||||
<c:if test="${book.master || book.router || book.published || book.private}">
|
||||
<td class="checkbox"><input type="checkbox" name="checked" value="${addr.name}" title="<%=intl._("Mark for deletion")%>"></td>
|
||||
</c:if>
|
||||
<td class="names"><a href="${addr.uri}">${addr.displayName}</a>
|
||||
<td class="names"><a href="http://${addr.name}/">${addr.displayName}</a>
|
||||
</td><td class="names">
|
||||
<span class="addrhlpr"><a href="http://${addr.b32}/" title="<%=intl._("Base 32 address")%>">b32</a></span>
|
||||
</td><td class="names">
|
||||
<span class="addrhlpr"><a href="details.jsp?h=${addr.query}" title="<%=intl._("More information on this entry")%>"><%=intl._("details")%></a></span>
|
||||
<span class="addrhlpr"><a href="details.jsp?h=${addr.name}" title="<%=intl._("More information on this entry")%>"><%=intl._("details")%></a></span>
|
||||
</td>
|
||||
<td class="destinations"><textarea rows="1" style="height: 3em;" cols="40" wrap="off" readonly="readonly" name="dest_${addr.name}" >${addr.destination}</textarea></td>
|
||||
</tr>
|
||||
|
||||
Reference in New Issue
Block a user