Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
enabled YMark Import for /Table_YMark_p.html
apfelmaennchenf147a022f897
diff --git a/htroot/Table_YMark_p.html b/htroot/Table_YMark_p.htmlindex 1b59256ec..fddc19a4d 100644--- a/htroot/Table_YMark_p.html+++ b/htroot/Table_YMark_p.html@@ -156,7 +156,7 @@<label for="tags">Tags</label></dt><dd>- <select name="tags" onchange='this.form.submit()'>+ <select name="tags" style="width: 180px" onchange='this.form.submit()'><option value="" selected>select a tag</option>#{tags}#<option value="#[tagName]#">#[tagName]#</option>@@ -167,7 +167,7 @@<label for="folders">Folders</label></dt><dd>- <select name="folders" style="width: 200px" onchange='this.form.submit()'>+ <select name="folders" style="width: 180px" onchange='this.form.submit()'><option value="" selected>select a folder</option>#{folders}#<option value="#[folderName]#">#[folderName]#</option>@@ -176,8 +176,12 @@</dd></dl></fieldset>+ </form><fieldset><legend>Import Bookmarks</legend>+ <form action="/api/ymarks/import_ymark.html" method="post" enctype="multipart/form-data" accept-charset="UTF-8">+ <input type="hidden" name="table" value="#[table]#" />+ <input type="hidden" name="redirect" value="/Table_YMark_p.html?table=#[table]#&count=100" /><dl><dt><label for="importer">Importer:</label>@@ -195,9 +199,9 @@<input type="file" name="bmkfile" id="bmkfile" size="10"/></dd></dl>- <input type="submit" name="importbookmarks" value="import" disabled />+ <input type="submit" name="importbookmarks" value="import" />+ </form></fieldset>- </form></div>#(/showselection)##%env/templates/footer.template%#diff --git a/htroot/Table_YMark_p.java b/htroot/Table_YMark_p.javaindex 3fe06ce0f..139644637 100644--- a/htroot/Table_YMark_p.java+++ b/htroot/Table_YMark_p.java@@ -33,6 +33,9 @@ public class Table_YMark_p {if (table != null)bmk_user = table.substring(0,table.indexOf('_'));+ // currently selected table+ prop.put("showselection_table", table);+// show table selectionint count = 0;Iterator<String> ti = sb.tables.tables();diff --git a/htroot/api/ymarks/import_ymark.html b/htroot/api/ymarks/import_ymark.htmlnew file mode 100644index 000000000..731622a70--- /dev/null+++ b/htroot/api/ymarks/import_ymark.html@@ -0,0 +1,14 @@+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">+<html xmlns="http://www.w3.org/1999/xhtml">+ <head>+ <title>Import Bookmarks</title>+ #(redirect)#::<meta HTTP-EQUIV="REFRESH" content="0; url=#[url]#" />#(/redirect)#+ </head>+ <body>+ #(result)#+ <p>something went wrong</p>+ ::+ <p>done</p>+ #(/result)#+ </body>+</html>\ No newline at end of filediff --git a/htroot/api/ymarks/import_ymark.java b/htroot/api/ymarks/import_ymark.javaindex f6040ccef..c1e93e1fd 100644--- a/htroot/api/ymarks/import_ymark.java+++ b/htroot/api/ymarks/import_ymark.java@@ -29,9 +29,13 @@ public class import_ymark {ByteArrayInputStream byteIn = null;if(isAdmin || isAuthUser) {- final String bmk_user = (isAuthUser ? user.getUserName() : YMarkTables.USER_ADMIN);+ String bmk_user = (isAuthUser ? user.getUserName() : YMarkTables.USER_ADMIN);+ if(isAdmin && post.containsKey("table") && post.get("table").length() > 0) {+ bmk_user = post.get("table").substring(0, post.get("table").indexOf('_'));+ }+if(post.containsKey("bmkfile") && post.containsKey("importer")){- try {+ try {byteIn = new ByteArrayInputStream(post.get("bmkfile$file").getBytes("UTF-8"));} catch (UnsupportedEncodingException e) {//TODO: display an error message@@ -84,11 +88,15 @@ public class import_ymark {}}prop.put("result", "1");- }+ }}} else {prop.put(YMarkTables.USER_AUTHENTICATE,YMarkTables.USER_AUTHENTICATE_MSG);- }+ }+ if(post.containsKey("redirect") && post.get("redirect").length() > 0) {+ prop.put("redirect_url", post.get("redirect"));+ prop.put("redirect", "1");+ }// return rewrite propertiesreturn prop;}diff --git a/htroot/api/ymarks/info.html b/htroot/api/ymarks/info.htmlindex ab21b4e2c..1385061eb 100644--- a/htroot/api/ymarks/info.html+++ b/htroot/api/ymarks/info.html@@ -43,7 +43,7 @@<li><i>type:</i> xbel | rss | rdf</li></ul></li>- <li>import_ymark.xml+ <li>import_ymark.[xml | html]<ul><li><i>bmfile:</i> the bookmark file you want to import<ul>@@ -54,7 +54,9 @@</li></ul></li>- <li><i>importer:</i> html | xbel | surrogates</li>+ <li><i>importer:</i> html | xbel </li>+ <li><i>table:</i> the table you want to import in (admin authentication required)</li>+ <li><i>redirect:</i> you can specify a html redirect (HTTP-EQUIV="REFRESH")</li></ul></li></ul>