Package freenet.clients.http.bookmark

Examples of freenet.clients.http.bookmark.BookmarkItem


    final String addCategory = NodeL10n.getBase().getString("BookmarkEditorToadlet.addCategory");

    boolean hasFriends = core.node.getDarknetConnections().length > 0;

    for(int i = 0; i < items.size(); i++) {
      BookmarkItem item =  items.get(i);
       
      String itemPath = URLEncoder.encode(path + item.getName(), false);
      HTMLNode li = new HTMLNode("li", "class", "item", item.getVisibleName());
            String explain = item.getShortDescription();
            if(explain != null && explain.length() > 0) {
              li.addChild("#", " (");
              li.addChild("#", explain);
              li.addChild("#", ")");
            }
View Full Code Here


          form.addChild("label", "for", "name", (NodeL10n.getBase().getString("BookmarkEditorToadlet.nameLabel") + ' '));
          form.addChild("input", new String[]{"type", "id", "name", "size", "value"}, new String[]{"text", "name", "name", "20", !isNew ? bookmark.getVisibleName() : ""});

          form.addChild("br");
          if(("edit".equals(action) && bookmark instanceof BookmarkItem) || "addItem".equals(action) || "share".equals(action)) {
            BookmarkItem item = isNew ? null : (BookmarkItem) bookmark;
            String key = !isNew ? item.getKey() : "";
            form.addChild("label", "for", "key", (NodeL10n.getBase().getString("BookmarkEditorToadlet.keyLabel") + ' '));
            form.addChild("input", new String[] {"type", "id", "name", "size", "value"}, new String[] {"text", "key", "key", "50", key});
            form.addChild("br");
            if("edit".equals(action) || "addItem".equals(action)) {
              form.addChild("label", "for", "descB", (NodeL10n.getBase().getString("BookmarkEditorToadlet.descLabel") + ' '));
              form.addChild("br");
              form.addChild("textarea", new String[]{"id", "name", "row", "cols"}, new String[]{"descB", "descB", "3", "70"}, (isNew ? "" : item.getDescription()));
              form.addChild("br");
              form.addChild("label", "for", "descB", (NodeL10n.getBase().getString("BookmarkEditorToadlet.explainLabel") + ' '));
              form.addChild("br");
              form.addChild("textarea", new String[]{"id", "name", "row", "cols"}, new String[]{"explain", "explain", "3", "70"}, (isNew ? "" : item.getShortDescription()));
              form.addChild("br");
            }
            form.addChild("label", "for", "hasAnActivelink", (NodeL10n.getBase().getString("BookmarkEditorToadlet.hasAnActivelinkLabel") + ' '));
            if(!isNew && item.hasAnActivelink())
              form.addChild("input", new String[]{"type", "id", "name", "checked"}, new String[]{"checkbox", "hasAnActivelink", "hasAnActivelink", String.valueOf(item.hasAnActivelink())});
            else
              form.addChild("input", new String[]{"type", "id", "name"}, new String[]{"checkbox", "hasAnActivelink", "hasAnActivelink"});
            if(core.node.getDarknetConnections().length > 0 && ("addItem".equals(action) || "share".equals(action))) {
              form.addChild("br");
              form.addChild("br");
              HTMLNode peerTable = form.addChild("table", "class", "darknet_connections");
              peerTable.addChild("th", "colspan", "2", NodeL10n.getBase().getString("QueueToadlet.recommendToFriends"));
              for(DarknetPeerNode peer : core.node.getDarknetConnections()) {
                HTMLNode peerRow = peerTable.addChild("tr", "class", "darknet_connections_normal");
                peerRow.addChild("td", "class", "peer-marker").addChild("input", new String[] { "type", "name" }, new String[] { "checkbox", "node_" + peer.hashCode() });
                peerRow.addChild("td", "class", "peer-name").addChild("#", peer.getName());
              }
              form.addChild("label", "for", "descB", (NodeL10n.getBase().getString("BookmarkEditorToadlet.publicDescLabel") + ' '));
              form.addChild("br");
              form.addChild("textarea", new String[]{"id", "name", "row", "cols"}, new String[]{"descB", "publicDescB", "3", "70"}, (isNew ? "" : item.getDescription()));
              form.addChild("br");
            }
          }

          form.addChild("input", new String[]{"type", "name", "value"}, new String[]{"hidden", "bookmark", bookmarkPath});
View Full Code Here

        if("edit".equals(action)) {
          bookmarkManager.renameBookmark(bookmarkPath, name);
          boolean hasAnActivelink = req.isPartSet("hasAnActivelink");
          if(bookmark instanceof BookmarkItem) {
            BookmarkItem item = (BookmarkItem) bookmark;
            item.update(new FreenetURI(req.getPartAsStringFailsafe("key", MAX_KEY_LENGTH)), hasAnActivelink, req.getPartAsStringFailsafe("descB", MAX_KEY_LENGTH), req.getPartAsStringFailsafe("explain", MAX_EXPLANATION_LENGTH));
            sendBookmarkFeeds(req, item, req.getPartAsStringFailsafe("publicDescB", MAX_KEY_LENGTH));
          }
          bookmarkManager.storeBookmarks();

          pageMaker.getInfobox("infobox-success", NodeL10n.getBase().getString("BookmarkEditorToadlet.changesSavedTitle"), content, "bookmark-error", false).
            addChild("p", NodeL10n.getBase().getString("BookmarkEditorToadlet.changesSaved"));

        } else if("addItem".equals(action) || "addCat".equals(action)) {

          Bookmark newBookmark = null;
          if("addItem".equals(action)) {
            FreenetURI key = new FreenetURI(req.getPartAsStringFailsafe("key", MAX_KEY_LENGTH));
            /* TODO:
             * <nextgens> I suggest you implement a HTTPRequest.getBoolean(String name) using Fields.stringtobool
             * <nextgens> HTTPRequest.getBoolean(String name, boolean default) even
             *
             * - values as "on", "true", "yes" should be accepted.
             */
            boolean hasAnActivelink = req.isPartSet("hasAnActivelink");
            if (name.contains("/")) {
              pageMaker.getInfobox("infobox-error", NodeL10n.getBase().getString("BookmarkEditorToadlet.invalidNameTitle"), content, "bookmark-error", false).
                addChild("#", NodeL10n.getBase().getString("BookmarkEditorToadlet.invalidName"));
            } else
              newBookmark = new BookmarkItem(key, name, req.getPartAsStringFailsafe("descB", MAX_KEY_LENGTH), req.getPartAsStringFailsafe("explain", MAX_EXPLANATION_LENGTH), hasAnActivelink, ctx.getAlertManager());
          } else
            if (name.contains("/")) {
              pageMaker.getInfobox("infobox-error", NodeL10n.getBase().getString("BookmarkEditorToadlet.invalidNameTitle"), content, "bookmark-error", false).
                addChild("#", NodeL10n.getBase().getString("BookmarkEditorToadlet.invalidName"));
            } else
View Full Code Here

        List<BookmarkItem> items = cat.getItems();
        if (items.size() > 0) {
            // FIXME CSS noborder ...
            HTMLNode table = list.addChild("li").addChild("table", new String[]{"border", "style"}, new String[]{"0", "border: none"});
            for (int i = 0; i < items.size(); i++) {
                BookmarkItem item = items.get(i);
                HTMLNode row = table.addChild("tr");
                HTMLNode cell = row.addChild("td", "style", "border: none");
                if (item.hasAnActivelink() && !noActiveLinks) {
                    String initialKey = item.getKey();
                    String key = '/' + initialKey + (initialKey.endsWith("/") ? "" : "/") + "activelink.png";
                    cell.addChild("a", "href", '/' + item.getKey()).addChild("img", new String[]{"src", "height", "width", "alt", "title"},
                            new String[]{ key, "36", "108", "activelink", item.getDescription()});
                } else {
                    cell.addChild("#", " ");
                }
                cell = row.addChild("td", "style", "border: none");
                cell.addChild("a", new String[]{"href", "title", "class"}, new String[]{ '/' + item.getKey(), item.getDescription(), "bookmark-title"}, item.getVisibleName());
                String explain = item.getShortDescription();
                if(explain != null && explain.length() > 0) {
                  cell.addChild("#", " (");
                  cell.addChild("#", explain);
                  cell.addChild("#", ")");
                }
View Full Code Here

TOP

Related Classes of freenet.clients.http.bookmark.BookmarkItem

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.