Skip to content

Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance

update IndexBroser_p add to blacklist button

reger24f28d705cd0f9
diff --git a/htroot/IndexBrowser_p.html b/htroot/IndexBrowser_p.html
index 6843dba02..9ccd6baae 100644
--- a/htroot/IndexBrowser_p.html
+++ b/htroot/IndexBrowser_p.html
@@ -170,7 +170,7 @@ var solr= $.getJSON("solr/collection1/select?q=*:*&start=0&rows=0&wt=json&facet=
<legend style="display: inline">Browser for <a href="#[path]#" target="_blank">#[path]#</a>
<span style="padding-left: 25px">
<form style="display: inline" action="IndexBrowser_p.html?path=#[path]#" id="searchform" method="get" role="search">
- <button type="submit" name="addtoblacklist" class="btn btn-xs btn-default">Add to blacklist</button>
+ <button type="submit" name="addtoblacklist" class="btn btn-xs btn-default">Add to blacklist #(blkadded)#::<span class="text-success glyphicon glyphicon-ok"></span>::<span class="text-danger glyphicon glyphicon-remove">#(/blkadded)#</button>
<input type="text" name="path" value="#[path]#" hidden="true"/>
</form>
</span>
diff --git a/htroot/IndexBrowser_p.java b/htroot/IndexBrowser_p.java
index 58f9be452..bf66476f0 100644
--- a/htroot/IndexBrowser_p.java
+++ b/htroot/IndexBrowser_p.java
@@ -666,10 +666,17 @@ public class IndexBrowser_p {
if (hoststr.startsWith("www.")) { // to allow the automatic matching for www.host.com and host.com
hoststr = hoststr.substring(4);
}
- addBlacklistEntry(
+ final boolean isok = addBlacklistEntry(
blacklistname,
hoststr + "/.*"); // as yacy expands host pattern to match www.host.com as well as host.com no need to prefix with "*."
+ if (isok) {
+ prop.put("files_blkadded", 1); // glyphicon-ok on (display)
+ } else {
+ prop.put("files_blkadded", 2); // failure - glypicon-remove on
+ }
}
+ } else {
+ prop.put("files_blkadded", 0); // glyphicon-ok off
}
}
diff --git a/source/net/yacy/repository/BlacklistHelper.java b/source/net/yacy/repository/BlacklistHelper.java
index 965306358..8c076c3db 100644
--- a/source/net/yacy/repository/BlacklistHelper.java
+++ b/source/net/yacy/repository/BlacklistHelper.java
@@ -58,7 +58,7 @@ public final class BlacklistHelper {
* Adds a new entry to the chosen blacklist.
* @param blacklistToUse the name of the blacklist the entry is to be added to
* @param entry the entry that is to be added
- * @return true when no error occurred and the entry was successfully added
+ * @return true when no error occurred and the entry was successfully added or exists
*/
public static boolean addBlacklistEntry(
final String blacklistToUse,