Fixed loss of search modifiers on bookmark, recommand or delete result

pull/167/head
luccioman 7 years ago
parent 0cdee4e26a
commit fa65fb1a03

@ -541,17 +541,10 @@ public class yacysearchitem {
// check if url exists in bookmarks // check if url exists in bookmarks
boolean bookmarkexists = sb.bookmarksDB.getBookmark(urlhash) != null; boolean bookmarkexists = sb.bookmarksDB.getBookmark(urlhash) != null;
prop.put("content_authorized_bookmark", !bookmarkexists); prop.put("content_authorized_bookmark", !bookmarkexists);
// bookmark icon check for YMarks
//prop.put("content_authorized_bookmark", sb.tables.bookmarks.hasBookmark("admin", urlhash) ? "0" : "1"); final StringBuilder linkBuilder = QueryParams.navurl(RequestHeader.FileType.HTML, theSearch.query.offset / theSearch.query.itemsPerPage(),
theSearch.query, null, false, true);
/* Bookmark, delete and recommend action links share the same URL prefix */ final int baseUrlLength = linkBuilder.length();
StringBuilder linkBuilder = new StringBuilder();
final String actionLinkPrefix = linkBuilder.append("yacysearch.html?query=").append(origQ.replace(' ', '+'))
.append("&Enter=Search&count=").append(theSearch.query.itemsPerPage()).append("&offset=")
.append((theSearch.query.neededResults() - theSearch.query.itemsPerPage())).append("&resource=")
.append(resource).append("&time=3").append("&meanCount=").append(theSearch.query.getMaxSuggestions())
.append("&auth").toString();
linkBuilder.setLength(0);
String encodedURLString; String encodedURLString;
try { try {
@ -560,27 +553,15 @@ public class yacysearchitem {
ConcurrentLog.warn("YACY_SEARCH_ITEM", "UTF-8 encoding is not supported!"); ConcurrentLog.warn("YACY_SEARCH_ITEM", "UTF-8 encoding is not supported!");
encodedURLString = crypt.simpleEncode(resultUrlstring); encodedURLString = crypt.simpleEncode(resultUrlstring);
} }
final String bookmarkLink = linkBuilder.append(actionLinkPrefix).append("&bookmarkref=").append(urlhash) final String bookmarkLink = linkBuilder.append("&bookmarkref=").append(urlhash)
.append("&bookmarkurl=").append(encodedURLString).append("&urlmaskfilter=.*") .append("&bookmarkurl=").append(encodedURLString).toString();
.toString(); linkBuilder.setLength(baseUrlLength);
linkBuilder.setLength(0);
/* Delete and recommend action links share the same URL suffix */ String deleteLink = linkBuilder.append("&deleteref=").append(urlhash).toString();
String encodedRanking; linkBuilder.setLength(baseUrlLength);
try {
encodedRanking = URLEncoder.encode(crypt.simpleEncode(theSearch.query.ranking.toExternalString()), StandardCharsets.UTF_8.name()); String recommendLink = linkBuilder.append("&recommendref=").append(urlhash).toString();
} catch (UnsupportedEncodingException e1) { linkBuilder.setLength(baseUrlLength);
ConcurrentLog.warn("YACY_SEARCH_ITEM", "UTF-8 encoding is not supported!");
encodedRanking = crypt.simpleEncode(resultUrlstring);
}
String actionLinkSuffix = linkBuilder.append(urlhash)
.append("&urlmaskfilter=.*").append("&order=").append(encodedRanking).toString();
linkBuilder.setLength(0);
String deleteLink = linkBuilder.append(actionLinkPrefix).append("&deleteref=").append(actionLinkSuffix).toString();
linkBuilder.setLength(0);
String recommendLink = linkBuilder.append(actionLinkPrefix).append("&recommendref=").append(actionLinkSuffix).toString();
linkBuilder.setLength(0);
prop.put("content_authorized_bookmark_bookmarklink", bookmarkLink); prop.put("content_authorized_bookmark_bookmarklink", bookmarkLink);
prop.put("content_authorized_recommend_deletelink", deleteLink); prop.put("content_authorized_recommend_deletelink", deleteLink);

Loading…
Cancel
Save