update IndexBroser_p add to blacklist button

add feedback to user on success
pull/461/head
reger24 3 years ago
parent d7d977569b
commit f28d705cd0

@ -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> <legend style="display: inline">Browser for <a href="#[path]#" target="_blank">#[path]#</a>
<span style="padding-left: 25px"> <span style="padding-left: 25px">
<form style="display: inline" action="IndexBrowser_p.html?path=#[path]#" id="searchform" method="get" role="search"> <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"/> <input type="text" name="path" value="#[path]#" hidden="true"/>
</form> </form>
</span> </span>

@ -666,10 +666,17 @@ public class IndexBrowser_p {
if (hoststr.startsWith("www.")) { // to allow the automatic matching for www.host.com and host.com if (hoststr.startsWith("www.")) { // to allow the automatic matching for www.host.com and host.com
hoststr = hoststr.substring(4); hoststr = hoststr.substring(4);
} }
addBlacklistEntry( final boolean isok = addBlacklistEntry(
blacklistname, blacklistname,
hoststr + "/.*"); // as yacy expands host pattern to match www.host.com as well as host.com no need to prefix with "*." 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
} }
} }

@ -58,7 +58,7 @@ public final class BlacklistHelper {
* Adds a new entry to the chosen blacklist. * Adds a new entry to the chosen blacklist.
* @param blacklistToUse the name of the blacklist the entry is to be added to * @param blacklistToUse the name of the blacklist the entry is to be added to
* @param entry the entry that is to be added * @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( public static boolean addBlacklistEntry(
final String blacklistToUse, final String blacklistToUse,

Loading…
Cancel
Save