Skip to content

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

Blacklist import from file, exclude comment lines

reger2411c4a1b45ca5
diff --git a/htroot/BlacklistImpExp_p.java b/htroot/BlacklistImpExp_p.java
index 2027ec698..0235cd75f 100644
--- a/htroot/BlacklistImpExp_p.java
+++ b/htroot/BlacklistImpExp_p.java
@@ -58,7 +58,7 @@ public class BlacklistImpExp_p {
// if we have not chosen a blacklist until yet we use the first file
if (blacklistToUse == null && dirlist != null && !dirlist.isEmpty()) {
- blacklistToUse = dirlist.get(0);
+ blacklistToUse = Blacklist.defaultBlacklist(sb.listsPath);
}
// List known hosts for BlackList retrieval
diff --git a/htroot/sharedBlacklist_p.html b/htroot/sharedBlacklist_p.html
index 922c614db..3fba2b52f 100644
--- a/htroot/sharedBlacklist_p.html
+++ b/htroot/sharedBlacklist_p.html
@@ -9,14 +9,21 @@
var selectForm = document.forms.namedItem(name);
var count = selectForm.elements["num"].value;
for(i = 0; i<= count; i++){
- selectForm.elements["item" + i].checked = true;
+ //If it isn't "undefined" and it isn't "null", then it exists.
+ if(typeof(selectForm.elements["item" + i]) != 'undefined' && selectForm.elements["item" + i] != null) {
+ //thecheckbox.checked = true;
+ selectForm.elements["item" + i].checked = true;
+ }
}
}
+
function deselectall(name){
var selectForm = document.forms.namedItem(name);
var count = selectForm.elements["num"].value;
for(i = 0; i<= count; i++){
- selectForm.elements["item" + i].checked = false;
+ if(typeof(selectForm.elements["item" + i]) != 'undefined' && selectForm.elements["item" + i] != null){
+ selectForm.elements["item" + i].checked = false;
+ }
}
}
-->
@@ -65,7 +72,7 @@
<select name="currentBlacklist" size="1">
#{blackLists}#
- <option value="#[name]#">#[name]#</option>
+ <option value="#[name]#" #[options]#>#[name]#</option>
#{/blackLists}#
</select>
@@ -79,7 +86,13 @@
</tr>#{urllist}#
<tr class="TableCell#(dark)#Light::Dark#(/dark)#" class="small">
<td>#[url]#</td>
- <td><input type="checkbox" name="item#[count]#" value="#[url]#" /></td>
+ <td>
+ #(toimport)#
+ &nbsp;
+ ::
+ <input type="checkbox" name="item#[count]#" value="#[url]#" />
+ #(/toimport)#
+ </td>
</tr>#{/urllist}#
<tr class="small" style="background-color: #eeeeee">
<td colspan="2">
diff --git a/htroot/sharedBlacklist_p.java b/htroot/sharedBlacklist_p.java
index 73709d058..c22059c12 100644
--- a/htroot/sharedBlacklist_p.java
+++ b/htroot/sharedBlacklist_p.java
@@ -119,6 +119,11 @@ public class sharedBlacklist_p {
if (dirlist != null) {
for (final String element : dirlist) {
prop.putXML("page_blackLists_" + blacklistCount + "_name", element);
+ if (selectedBlacklistName.equalsIgnoreCase(element)) {
+ prop.putXML("page_blackLists_" + blacklistCount + "_options","selected");
+ } else {
+ prop.putXML("page_blackLists_" + blacklistCount + "_options","");
+ }
blacklistCount++;
}
}
@@ -288,7 +293,14 @@ public class sharedBlacklist_p {
prop.put("page_urllist_" + count + "_dark", count % 2 == 0 ? "0" : "1");
/* We do not use here putHTML as we don't want '+' characters to be decoded as spaces by application/x-www-form-urlencoded encoding */
prop.put("page_urllist_" + count + "_url", CharacterCoding.unicode2html(tmp, true));
- prop.put("page_urllist_" + count + "_count", count);
+ // exclude comment lines
+ if (tmp.startsWith("#") || tmp.startsWith("//") || tmp.startsWith(";")) {
+ prop.put("page_urllist_" + count + "_toimport", "0");
+ } else {
+ prop.put("page_urllist_" + count + "_toimport", "1");
+ prop.put("page_urllist_" + count + "_toimport_count", count);
+ prop.put("page_urllist_" + count + "_toimport_url", CharacterCoding.unicode2html(tmp, true));
+ }
count++;
}
}