Search in sources :

Example 6 with App

use of net.i2p.router.web.App in project i2p.i2p by i2p.

the class HomeHelper method renderConfig.

private String renderConfig(Collection<App> apps) {
    StringBuilder buf = new StringBuilder(1024);
    buf.append("<table class=\"homelinkedit\"><tr><th title=\"").append(_t("Mark for deletion")).append("\">").append(_t("Remove")).append("</th><th></th><th>").append(_t("Name")).append("</th><th>").append(_t("URL")).append("</th></tr>\n");
    for (App app : apps) {
        buf.append("<tr><td align=\"center\"><input type=\"checkbox\" class=\"optbox\" name=\"delete_").append(app.name).append("\" id=\"").append(app.name).append("\"></td><td align=\"center\">");
        if (app.icon != null) {
            buf.append("<img height=\"16\" alt=\"\" src=\"").append(app.icon).append("\">");
        }
        buf.append("</td><td align=\"left\"><label for=\"").append(app.name).append("\">").append(DataHelper.escapeHTML(app.name)).append("</label></td><td align=\"left\"><a href=\"");
        String url = DataHelper.escapeHTML(app.url);
        buf.append(url).append("\">");
        // truncate before escaping
        if (app.url.length() > 50)
            buf.append(DataHelper.escapeHTML(app.url.substring(0, 48))).append("&hellip;");
        else
            buf.append(url);
        buf.append("</a></td></tr>\n");
    }
    buf.append("<tr id=\"addnew\"><td colspan=\"2\" align=\"center\"><b>").append(_t("Add")).append(":</b>" + "</td><td align=\"left\"><input type=\"text\" name=\"nofilter_name\"></td>" + "<td align=\"left\"><input type=\"text\" size=\"40\" name=\"nofilter_url\"></td></tr>");
    buf.append("</table>\n");
    return buf.toString();
}
Also used : App(net.i2p.router.web.App)

Example 7 with App

use of net.i2p.router.web.App in project i2p.i2p by i2p.

the class HomeHelper method saveApps.

static void saveApps(RouterContext ctx, String prop, Collection<App> apps, boolean full) {
    StringBuilder buf = new StringBuilder(1024);
    for (App app : apps) {
        buf.append(app.name).append(S);
        if (full)
            buf.append(app.desc).append(S);
        buf.append(app.url).append(S);
        if (full)
            buf.append(app.icon).append(S);
    }
    ctx.router().saveConfig(prop, buf.toString());
}
Also used : App(net.i2p.router.web.App)

Aggregations

App (net.i2p.router.web.App)7 TreeSet (java.util.TreeSet)2 ArrayList (java.util.ArrayList)1 Collection (java.util.Collection)1 HashSet (java.util.HashSet)1 Iterator (java.util.Iterator)1 Map (java.util.Map)1 Set (java.util.Set)1 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)1 PortMapper (net.i2p.util.PortMapper)1