forked from I2P_Developers/i2p.i2p
Console: Rework summary bar services section
Move icon selection from CSS to code Use plugin-configured icon if available
This commit is contained in:
@ -20,6 +20,7 @@ public class NavHelper {
|
|||||||
* console's nav bar, it should be registered with this singleton.
|
* console's nav bar, it should be registered with this singleton.
|
||||||
*
|
*
|
||||||
* @param name pretty name the app will be called in the link
|
* @param name pretty name the app will be called in the link
|
||||||
|
* warning, this is the display name aka ConsoleLinkName, not the plugin name
|
||||||
* @param path full path pointing to the application's root
|
* @param path full path pointing to the application's root
|
||||||
* (e.g. /i2ptunnel/index.jsp), non-null
|
* (e.g. /i2ptunnel/index.jsp), non-null
|
||||||
* @param tooltip HTML escaped text or null
|
* @param tooltip HTML escaped text or null
|
||||||
@ -66,27 +67,49 @@ public class NavHelper {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Translated string is loaded by PluginStarter
|
* Translated string is loaded by PluginStarter
|
||||||
* @param ctx unused
|
* @param buf appended to
|
||||||
*/
|
*/
|
||||||
public static String getClientAppLinks(I2PAppContext ctx) {
|
public static void getClientAppLinks(StringBuilder buf) {
|
||||||
if (_apps.isEmpty())
|
if (_apps.isEmpty())
|
||||||
return "";
|
return;
|
||||||
StringBuilder buf = new StringBuilder(256);
|
|
||||||
List<String> l = new ArrayList<String>(_apps.keySet());
|
List<String> l = new ArrayList<String>(_apps.keySet());
|
||||||
Collections.sort(l);
|
Collections.sort(l);
|
||||||
for (String name : l) {
|
for (String name : l) {
|
||||||
String path = _apps.get(name);
|
String path = _apps.get(name);
|
||||||
if (path == null)
|
if (path == null)
|
||||||
continue;
|
continue;
|
||||||
buf.append(" <a target=\"_blank\" href=\"").append(path).append("\" ");
|
buf.append("<tr><td>");
|
||||||
|
getClientAppImg(buf, name);
|
||||||
|
buf.append("</td><td align=\"left\"><a target=\"_blank\" href=\"").append(path).append("\" ");
|
||||||
String tip = _tooltips.get(name);
|
String tip = _tooltips.get(name);
|
||||||
if (tip != null)
|
if (tip != null)
|
||||||
buf.append("title=\"").append(tip).append("\" ");
|
buf.append("title=\"").append(tip).append("\" ");
|
||||||
buf.append('>').append(name.replace(" ", " ")).append("</a>");
|
buf.append('>').append(name.replace(" ", " ")).append("</a></td></tr>\n");
|
||||||
}
|
}
|
||||||
return buf.toString();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get icon img and append to buf
|
||||||
|
* @param name warning this is the display name aka ConsoleLinkName, not the plugin name
|
||||||
|
* @since 0.9.45
|
||||||
|
*/
|
||||||
|
static void getClientAppImg(StringBuilder buf, String name) {
|
||||||
|
if (_binary.containsKey(name)) {
|
||||||
|
buf.append("<img src=\"/Plugins/pluginicon?plugin=").append(name).append("\" height=\"16\" width=\"16\" alt=\"\">");
|
||||||
|
} else {
|
||||||
|
String iconpath = _icons.get(name);
|
||||||
|
if (iconpath != null) {
|
||||||
|
buf.append("<img src=\"").append(iconpath).append("\" height=\"16\" width=\"16\" alt=\"\">");
|
||||||
|
} else if (name.equals("Orchid")) {
|
||||||
|
buf.append("<img src=\"/themes/console/light/images/flower.png\" alt=\"\">");
|
||||||
|
} else if (name.equals("i2pbote")) {
|
||||||
|
buf.append("<img src=\"/themes/console/light/images/mail_black.png\" alt=\"\">");
|
||||||
|
} else {
|
||||||
|
buf.append("<img src=\"/themes/console/images/plugin.png\" height=\"16\" width=\"16\" alt=\"\">");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* For HomeHelper
|
* For HomeHelper
|
||||||
* @param ctx unused
|
* @param ctx unused
|
||||||
|
@ -199,48 +199,50 @@ class SummaryBarRenderer {
|
|||||||
.append("\">")
|
.append("\">")
|
||||||
.append(_t("I2P Services"))
|
.append(_t("I2P Services"))
|
||||||
.append("</a></h3>\n" +
|
.append("</a></h3>\n" +
|
||||||
|
"<hr class=\"b\"><table id=\"sb_services\">");
|
||||||
"<hr class=\"b\"><table id=\"sb_services\"><tr><td>");
|
|
||||||
|
|
||||||
PortMapper pm = _context.portMapper();
|
PortMapper pm = _context.portMapper();
|
||||||
if (pm.isRegistered(PortMapper.SVC_SUSIMAIL)) {
|
if (pm.isRegistered(PortMapper.SVC_SUSIMAIL)) {
|
||||||
|
buf.append("<tr><td><img src=\"/themes/console/light/images/inbox.png\" height=\"16\" width=\"16\" alt=\"\"></td><td align=\"left\">");
|
||||||
buf.append("<a href=\"/webmail\" target=\"_top\" title=\"")
|
buf.append("<a href=\"/webmail\" target=\"_top\" title=\"")
|
||||||
.append(_t("Anonymous webmail client"))
|
.append(_t("Anonymous webmail client"))
|
||||||
.append("\">")
|
.append("\">")
|
||||||
.append(nbsp(_t("Email")))
|
.append(nbsp(_t("Email")))
|
||||||
.append("</a>\n");
|
.append("</a></td></tr>\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pm.isRegistered(PortMapper.SVC_JSONRPC)) {
|
if (pm.isRegistered(PortMapper.SVC_JSONRPC)) {
|
||||||
|
buf.append("<tr><td><img src=\"/themes/console/images/plugin.png\" height=\"16\" width=\"16\" alt=\"\"></td><td align=\"left\">");
|
||||||
buf.append("<a href=\"/jsonrpc/\" target=\"_top\" title=\"")
|
buf.append("<a href=\"/jsonrpc/\" target=\"_top\" title=\"")
|
||||||
.append(_t("RPC Service"))
|
.append(_t("RPC Service"))
|
||||||
.append("\">")
|
.append("\">")
|
||||||
.append(nbsp(_t("I2PControl")))
|
.append(nbsp(_t("I2PControl")))
|
||||||
.append("</a>\n");
|
.append("</a></td></tr>\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pm.isRegistered(PortMapper.SVC_I2PSNARK)) {
|
if (pm.isRegistered(PortMapper.SVC_I2PSNARK)) {
|
||||||
|
buf.append("<tr><td><img src=\"/themes/console/images/i2psnark.png\" height=\"16\" width=\"16\" alt=\"\"></td><td align=\"left\">");
|
||||||
buf.append("<a href=\"/torrents\" target=\"_top\" title=\"")
|
buf.append("<a href=\"/torrents\" target=\"_top\" title=\"")
|
||||||
.append(_t("Built-in anonymous BitTorrent Client"))
|
.append(_t("Built-in anonymous BitTorrent Client"))
|
||||||
.append("\">")
|
.append("\">")
|
||||||
.append(nbsp(_t("Torrents")))
|
.append(nbsp(_t("Torrents")))
|
||||||
.append("</a>\n");
|
.append("</a></td></tr>\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
String url = getEepsiteURL(pm);
|
String url = getEepsiteURL(pm);
|
||||||
if (url != null) {
|
if (url != null) {
|
||||||
|
buf.append("<tr><td><img src=\"/themes/console/images/server.png\" height=\"16\" width=\"16\" alt=\"\"></td><td align=\"left\">");
|
||||||
buf.append("<a href=\"")
|
buf.append("<a href=\"")
|
||||||
.append(url)
|
.append(url)
|
||||||
.append("\" target=\"_blank\" title=\"")
|
.append("\" target=\"_blank\" title=\"")
|
||||||
.append(_t("Local web server"))
|
.append(_t("Local web server"))
|
||||||
.append("\">")
|
.append("\">")
|
||||||
.append(nbsp(_t("Web Server")))
|
.append(nbsp(_t("Web Server")))
|
||||||
.append("</a>\n");
|
.append("</a></td></tr>\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
buf.append(NavHelper.getClientAppLinks(_context))
|
NavHelper.getClientAppLinks(buf);
|
||||||
|
buf.append("</table>\n");
|
||||||
.append("</td></tr></table>\n");
|
|
||||||
return buf.toString();
|
return buf.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -483,7 +483,7 @@ div.warning {
|
|||||||
margin-top: -4px !important;
|
margin-top: -4px !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
#sb_internals a, #sb_services a, #sb_advanced a, #sb_help a {
|
#sb_internals a, #sb_advanced a, #sb_help a {
|
||||||
padding: 1px 3px;
|
padding: 1px 3px;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
@ -507,6 +507,11 @@ div.warning {
|
|||||||
line-height: 140%;
|
line-height: 140%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#sb_services td:first-child {
|
||||||
|
width: 16px;
|
||||||
|
padding: 1px 2px;
|
||||||
|
}
|
||||||
|
|
||||||
#sb_peersadvanced a {
|
#sb_peersadvanced a {
|
||||||
color: #ee9;
|
color: #ee9;
|
||||||
}
|
}
|
||||||
@ -583,87 +588,6 @@ div.refresh {
|
|||||||
color: #f60;
|
color: #f60;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* "experimental" custom sidebar links for apps */
|
|
||||||
/*
|
|
||||||
#sb_services {
|
|
||||||
width: 192px !important;
|
|
||||||
margin: 0 !important;
|
|
||||||
margin: -7px -10px -9px !important;
|
|
||||||
border-collapse: collapse;
|
|
||||||
background: url(images/camotile.png) repeat fixed left top;
|
|
||||||
}
|
|
||||||
|
|
||||||
#sb_services tr {
|
|
||||||
padding: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
#sb_services td {
|
|
||||||
padding: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
#sb_services a, #sb_services a:hover, #sb_services a:active {
|
|
||||||
border-bottom: 1px solid #151 !important;
|
|
||||||
outline: none !important;
|
|
||||||
display: inline-block;
|
|
||||||
width: calc(100% - 32px) !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
#sb_services a:hover {
|
|
||||||
background: #020;
|
|
||||||
}
|
|
||||||
|
|
||||||
#sb_services a:last-child {
|
|
||||||
border-bottom: 1px solid transparent !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
#sb_services a[href*="mail"], #sb_services a[href*="snark"], #sb_services a[href*="7658"], #sb_services a[href*="bote"] {
|
|
||||||
padding: 5px 5px 5px 26px !important;
|
|
||||||
border: 1px outset transparent;
|
|
||||||
margin: 0 !important;
|
|
||||||
float: left;
|
|
||||||
text-align: left;
|
|
||||||
text-decoration: none;
|
|
||||||
text-transform: uppercase;
|
|
||||||
letter-spacing: 0.1em;
|
|
||||||
white-space: nowrap;
|
|
||||||
text-overflow: ellipsis;
|
|
||||||
overflow: hidden;
|
|
||||||
clear: both;
|
|
||||||
}
|
|
||||||
|
|
||||||
#sb_services a[href*="mail"] {
|
|
||||||
background: #000 url(images/mail.png) 5px center no-repeat;
|
|
||||||
}
|
|
||||||
#sb_services a[href*="mail"]:hover {
|
|
||||||
background: #020 url(images/mail.png) 5px center no-repeat;
|
|
||||||
}
|
|
||||||
|
|
||||||
#sb_services a[href*="bote"] {
|
|
||||||
background: #000 url(images/webmail.png) 5px center no-repeat;
|
|
||||||
}
|
|
||||||
|
|
||||||
#sb_services a[href*="bote"]:hover {
|
|
||||||
background: #020 url(images/webmail.png) 5px center no-repeat;
|
|
||||||
}
|
|
||||||
|
|
||||||
#sb_services a[href*="snark"] {
|
|
||||||
background: #000 url(images/magnet.png) 5px center no-repeat;
|
|
||||||
}
|
|
||||||
|
|
||||||
#sb_services a[href*="snark"]:hover {
|
|
||||||
background: #020 url(images/magnet.png) 5px center no-repeat;
|
|
||||||
}
|
|
||||||
|
|
||||||
#sb_services a[href*="7658"] {
|
|
||||||
background: #000 url(images/webserver.png) 5px center no-repeat;
|
|
||||||
}
|
|
||||||
|
|
||||||
#sb_services a[href*="7658"]:hover {
|
|
||||||
background: #020 url(images/webserver.png) 5px center no-repeat;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
/* end custom sidebar links */
|
|
||||||
|
|
||||||
.routersummary td {
|
.routersummary td {
|
||||||
padding: 0 2px 0 2px;
|
padding: 0 2px 0 2px;
|
||||||
background-image: none !important;
|
background-image: none !important;
|
||||||
|
@ -682,80 +682,28 @@ p:empty + .sb_notice {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#sb_services td {
|
#sb_services td {
|
||||||
padding-top: 4px;
|
text-align: left !important;
|
||||||
padding-bottom: 4px;
|
}
|
||||||
|
|
||||||
|
#sb_services td:first-child {
|
||||||
|
width: 16px;
|
||||||
|
padding: 1px 2px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#sb_services a:link, #sb_services a:visited {
|
#sb_services a:link, #sb_services a:visited {
|
||||||
display: inline-block;
|
padding: 4px 2px 4px 3px;
|
||||||
width: 100%;
|
|
||||||
padding: 4px 2px 4px 24px;
|
|
||||||
text-align: left;
|
text-align: left;
|
||||||
border-bottom: 1px;
|
|
||||||
background: #f8f8ff url(/themes/console/images/plugin.png) 3px center no-repeat;
|
|
||||||
background: rgba(248, 248, 255, 0.8) url(/themes/console/images/plugin.png) 3px center no-repeat;
|
|
||||||
background-size: 16px 16px !important;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#sb_services a:link:last-child {
|
#sb_services a:link:last-child {
|
||||||
border-bottom: none;
|
border-bottom: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
#sb_services a {
|
|
||||||
background-blend-mode: luminosity;
|
|
||||||
vertical-align: sub !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
#sb_services a:hover {
|
#sb_services a:hover {
|
||||||
background-blend-mode: normal;
|
background-blend-mode: normal;
|
||||||
background-color: #e9ecef;
|
background-color: #e9ecef;
|
||||||
}
|
}
|
||||||
|
|
||||||
#sb_services a[href="/susimail/susimail"], #sb_services a[href="/webmail"] {
|
|
||||||
background: #f8f8ff url(images/inbox.png) 3px center no-repeat;
|
|
||||||
background: rgba(248, 248, 255, 0.8) url(images/inbox.png) 3px center no-repeat;
|
|
||||||
}
|
|
||||||
|
|
||||||
#sb_services a[href="/susimail/susimail"]:hover, #sb_services a[href="/webmail"]:hover {
|
|
||||||
background: #e9ecef url(images/inbox.png) 3px center no-repeat;
|
|
||||||
}
|
|
||||||
|
|
||||||
#sb_services a[href="/i2psnark/"], #sb_services a[href="/torrents"] {
|
|
||||||
background: #f8f8ff url(/themes/console/images/i2psnark.png) 3px center no-repeat;
|
|
||||||
background: rgba(248, 248, 255, 0.8) url(/themes/console/images/i2psnark.png) 3px center no-repeat;
|
|
||||||
}
|
|
||||||
|
|
||||||
#sb_services a[href="/i2psnark/"]:hover, #sb_services a[href="/torrents"]:hover {
|
|
||||||
background: #e9ecef url(/themes/console/images/i2psnark.png) 3px center no-repeat;
|
|
||||||
}
|
|
||||||
|
|
||||||
#sb_services a[href="http://127.0.0.1:7658/"] {
|
|
||||||
background: #f8f8ff url(images/server.png) 3px center no-repeat;
|
|
||||||
background: rgba(248, 248, 255, 0.8) url(images/server.png) 3px center no-repeat;
|
|
||||||
}
|
|
||||||
|
|
||||||
#sb_services a[href="http://127.0.0.1:7658/"]:hover {
|
|
||||||
background: #e9ecef url(images/server.png) 3px center no-repeat;
|
|
||||||
}
|
|
||||||
|
|
||||||
#sb_services a[href="/orchid/"] {
|
|
||||||
background: #f8f8ff url(images/flower.png) 3px center no-repeat;
|
|
||||||
background: rgba(248, 248, 255, 0.8) url(images/flower.png) 3px center no-repeat;
|
|
||||||
}
|
|
||||||
|
|
||||||
#sb_services a[href="/orchid/"]:hover {
|
|
||||||
background: #e9ecef url(images/flower.png) 3px center no-repeat;
|
|
||||||
}
|
|
||||||
|
|
||||||
#sb_services a[href*="bote"] {
|
|
||||||
background: #f8f8ff url(images/mail_black.png) 3px center no-repeat;
|
|
||||||
background: rgba(248, 248, 255, 0.8) url(images/mail_black.png) 3px center no-repeat;
|
|
||||||
}
|
|
||||||
|
|
||||||
#sb_services a[href*="bote"]:hover {
|
|
||||||
background: #e9ecef url(images/mail_black.png) 3px center no-repeat;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* end webapp navigation */
|
/* end webapp navigation */
|
||||||
|
|
||||||
.routersummary tr {
|
.routersummary tr {
|
||||||
|
Reference in New Issue
Block a user