susidns: Hide identicons if imagegen disabled

Fix div ordering on /details
This commit is contained in:
zzz
2018-03-15 22:27:00 +00:00
parent e139710352
commit 24cb0934c7
3 changed files with 30 additions and 8 deletions

View File

@@ -433,4 +433,11 @@ public class NamingServiceBean extends AddressbookBean
getNamingService().export(out, searchProps);
// No post-filtering for hosts.txt naming services. It is what it is.
}
/**
* @since 0.9.34
*/
public boolean haveImagegen() {
return _context.portMapper().getPort("imagegen") > 0;
}
}

View File

@@ -176,11 +176,21 @@ ${book.loadBookMessages}
</c:if>
</tr>
<%
boolean haveImagegen = book.haveImagegen();
%>
<!-- limit iterator, or "Form too large" may result on submit, and is a huge web page if we don't -->
<c:forEach items="${book.entries}" var="addr" begin="${book.resultBegin}" end="${book.resultEnd}">
<tr class="list${book.trClass}">
<td class="names"><a href="/imagegen/id?s=256&amp;c=${addr.b32}" target="_blank" title="<%=intl._t("View larger version of identicon for this hostname")%>"><img src="/imagegen/id?s=20&amp;c=${addr.b32}"></a><a href="http://${addr.name}/" target="_top">${addr.displayName}</a></td>
<td class="names">
<%
if (haveImagegen) {
%>
<a href="/imagegen/id?s=256&amp;c=${addr.b32}" target="_blank" title="<%=intl._t("View larger version of identicon for this hostname")%>"><img src="/imagegen/id?s=20&amp;c=${addr.b32}"></a>
<%
} // haveImagegen
%>
<a href="http://${addr.name}/" target="_top">${addr.displayName}</a></td>
<td class="names"><span class="addrhlpr"><a href="http://${addr.b32}/" target="_blank" title="<%=intl._t("Base 32 address")%>">b32</a></span></td>
<td class="helper"><a href="http://${addr.name}/?i2paddresshelper=${addr.destination}" target="_blank" title="<%=intl._t("Helper link to share host address with option to add to addressbook")%>">link</a></td>
<td class="names"><span class="addrhlpr"><a href="details?h=${addr.name}&amp;book=${book.book}" title="<%=intl._t("More information on this entry")%>"><%=intl._t("details")%></a></span></td>

View File

@@ -78,6 +78,7 @@
if (addrs == null) {
%><p>Not found: <%=detail%></p><%
} else {
boolean haveImagegen = book.haveImagegen();
// use one nonce for all
String nonce = book.getSerial();
for (i2p.susi.dns.AddressBean addr : addrs) {
@@ -148,7 +149,6 @@
<td class="destinations"><div class="destaddress" tabindex="0"><%=addr.getDestination()%></div></td>
</tr>
</table>
</div>
<div id="buttons">
<form method="POST" action="addressbook">
<p class="buttons">
@@ -161,7 +161,10 @@
<input class="delete" type="submit" name="action" value="<%=intl._t("Delete Entry")%>" >
</p>
</form>
</div>
</div><%-- buttons --%>
<%
if (haveImagegen) {
%>
<div id="visualid">
<h3><%=intl._t("Visual Identification for")%> <span id="idAddress"><%=addr.getName()%></span></h3>
<table>
@@ -173,18 +176,20 @@
<td colspan="2"><a class="fakebutton" href="/imagegen" title="<%=intl._t("Create your own identification images")%>" target="_blank"><%=intl._t("Launch Image Generator")%></a></td>
</tr>
</table>
</div><%-- visualid --%>
<%
} // haveImagegen
%>
<hr>
<%
} // foreach addr
%>
</div>
<%
} // addrs == null
} // detail == null
%>
</div><%-- book --%>
<div id="footer">
<p class="footer">susidns v${version.version} &copy; <a href="${version.url}" target="_top">susi</a> 2005</p>
</div>
</div>
</div><%-- page --%>
</body>
</html>