pageMaker.getInfobox("infobox-error", error, content, "bookmark-url-decode-error", false).
addChild("#", NodeL10n.getBase().getString("BookmarkEditorToadlet.urlDecodeError"));
writeHTMLReply(ctx, 200, "OK", pageNode.generate());
return;
}
Bookmark bookmark;
if(bookmarkPath.endsWith("/"))
bookmark = bookmarkManager.getCategoryByPath(bookmarkPath);
else
bookmark = bookmarkManager.getItemByPath(bookmarkPath);
if(bookmark == null) {
pageMaker.getInfobox("infobox-error", error, content, "bookmark-does-not-exist", false).
addChild("#", NodeL10n.getBase().getString("BookmarkEditorToadlet.bookmarkDoesNotExist", new String[]{"bookmark"}, new String[]{bookmarkPath}));
this.writeHTMLReply(ctx, 200, "OK", pageNode.generate());
return;
} else
if("del".equals(action)) {
String[] bm = new String[]{"bookmark"};
String[] path = new String[]{bookmarkPath};
String queryTitle = NodeL10n.getBase().getString("BookmarkEditorToadlet." + ((bookmark instanceof BookmarkItem) ? "deleteBookmark" : "deleteCategory"));
HTMLNode infoBoxContent = pageMaker.getInfobox("infobox-query", queryTitle, content, "bookmark-delete", false);
String query = NodeL10n.getBase().getString("BookmarkEditorToadlet." + ((bookmark instanceof BookmarkItem) ? "deleteBookmarkConfirm" : "deleteCategoryConfirm"), bm, path);
infoBoxContent.addChild("p").addChild("#", query);
HTMLNode confirmForm = ctx.addFormChild(infoBoxContent, "", "confirmDeleteForm");
confirmForm.addChild("input", new String[]{"type", "name", "value"}, new String[]{"hidden", "bookmark", bookmarkPath});
confirmForm.addChild("input", new String[]{"type", "name", "value"}, new String[]{"submit", "cancel", NodeL10n.getBase().getString("Toadlet.cancel")});
confirmForm.addChild("input", new String[]{"type", "name", "value"}, new String[]{"submit", "confirmdelete", NodeL10n.getBase().getString("BookmarkEditorToadlet.confirmDelete")});
} else if("cut".equals(action))
cutedPath = bookmarkPath;
else if("paste".equals(action) && cutedPath != null) {
bookmarkManager.moveBookmark(cutedPath, bookmarkPath);
bookmarkManager.storeBookmarks();
cutedPath = null;
} else if("edit".equals(action) || "addItem".equals(action) || "addCat".equals(action) || "share".equals(action)) {
boolean isNew = "addItem".equals(action) || "addCat".equals(action);
String header;
if("edit".equals(action))
header = NodeL10n.getBase().getString("BookmarkEditorToadlet.edit" + ((bookmark instanceof BookmarkItem) ? "Bookmark" : "Category") + "Title");
else if("addItem".equals(action))
header = NodeL10n.getBase().getString("BookmarkEditorToadlet.addNewBookmark");
else if("share".equals(action))
header = NodeL10n.getBase().getString("BookmarkEditorToadlet.share");
else
header = NodeL10n.getBase().getString("BookmarkEditorToadlet.addNewCategory");
HTMLNode actionBoxContent = pageMaker.getInfobox("infobox-query", header, content, "bookmark-action", false);
HTMLNode form = ctx.addFormChild(actionBoxContent, "", "editBookmarkForm");
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() : "";