Skip to content

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

*) blacklists will only displayed partly now with 50 entries per page by default, this should make it easier to administrate large lists

low012910c2aaed6bc
diff --git a/htroot/Blacklist_p.html b/htroot/Blacklist_p.html
index 9be0d1609..0b4317920 100644
--- a/htroot/Blacklist_p.html
+++ b/htroot/Blacklist_p.html
@@ -116,16 +116,38 @@
<input type="submit" />
</div>
</form>
+
+ <form name ="selectRange" action="Blacklist_p.html" method="post">
+ <input type="hidden" name="currentBlacklist" value="#[currentBlacklist]#" />
+ <input type="hidden" name="action" value="selectRange" />
+ <p>Show entries:
+ <select name="offset" size="1" onChange="document.selectRange.submit();">
+ #{subListOffset}#
+ <option value="#[value]#" #(selected)#::selected="selected"#(/selected)#>#[fvalue]# - #[tvalue]#</option>
+ #{/subListOffset}#
+ </select>
+ &nbsp;
+ Entries per page:
+ <select name="size" size="1" onChange="document.selectRange.submit();">
+ #{subListSize}#
+ <option value="#[value]#" #(selected)#::selected="selected"#(/selected)#>#[text]#</option>
+ #{/subListSize}#
+ </select>
+ &nbsp;
+ <input type="submit" value="Go" />
+ </p>
+ </form>
+
::
<p>Edit existing pattern(s):</p>
- <form action="Blacklist_p.html" method="post" enctype="multipart/form-data">
+ <form name="editBlacklistEntry" action="Blacklist_p.html" method="post" enctype="multipart/form-data">
<div>
<input type="hidden" name="currentBlacklist" value="#[currentBlacklist]#" />
+ <input type="hidden" name="action" value="editBlacklistEntry" />
#{editList}#
<input type="text" name="editedBlacklistEntry.#[count]#" size="50" value="#[item]#"/>
<input type="hidden" name="selectedBlacklistEntry.#[count]#" value="#[item]#"/>
#{/editList}#
- <input type="hidden" name="action" value="editBlacklistEntry" />
<br /><br />
<input type="submit" value="Save URL pattern(s)" />
</div>
diff --git a/htroot/Blacklist_p.java b/htroot/Blacklist_p.java
index 0454c1c45..fd7a9afdb 100644
--- a/htroot/Blacklist_p.java
+++ b/htroot/Blacklist_p.java
@@ -347,6 +347,8 @@ public class Blacklist_p {
prop.put(DISABLED + EDIT + "editList", selectedEntries.length);
}
}
+ } else if (action.equals("selectRange")) {
+ blacklistToUse = post.get("currentBlacklist");
}
}
@@ -367,7 +369,22 @@ public class Blacklist_p {
// display them
boolean dark = true;
- for (int j=0;j<sortedlist.length;++j){
+ int from = 0;
+ int size = 50;
+ int to = sortedlist.length;
+ if (post != null) {
+ from = post.getInt("offset", 0);
+ size = post.getInt("size", 50);
+ to = from + size;
+ }
+ if (from > sortedlist.length || from < 0) {
+ from = 0;
+ }
+ if (to > sortedlist.length || size < 1) {
+ to = sortedlist.length;
+ }
+
+ for (int j = from; j < to; ++j){
final String nextEntry = sortedlist[j];
if (nextEntry.length() == 0) continue;
@@ -379,6 +396,43 @@ public class Blacklist_p {
entryCount++;
}
prop.put(DISABLED + EDIT + "Itemlist", entryCount);
+
+ // create selection of sublist
+ entryCount = 0;
+ int end = -1;
+ if (sortedlist.length > 0) {
+ while (end < sortedlist.length) {
+ prop.put(DISABLED + EDIT + "subListOffset_" + entryCount + "_value", (entryCount * to));
+ end = (entryCount + 1) * to;
+ if (end > sortedlist.length) {
+ end = sortedlist.length;
+ }
+ prop.put(DISABLED + EDIT + "subListOffset_" + entryCount + "_fvalue", (entryCount * to) + 1);
+ prop.put(DISABLED + EDIT + "subListOffset_" + entryCount + "_tvalue", end);
+ entryCount++;
+ }
+ } else {
+ prop.put(DISABLED + EDIT + "subListOffset_0_value", 0);
+ prop.put(DISABLED + EDIT + "subListOffset_0_fvalue", 0);
+ prop.put(DISABLED + EDIT + "subListOffset_0_tvalue", 0);
+ entryCount++;
+ }
+ prop.put(DISABLED + EDIT + "subListOffset", entryCount);
+
+ // create selection of list size
+ int[] sizes = {10,25,50,100,250,-1};
+ for (int i = 0; i < sizes.length; i++) {
+ prop.put(DISABLED + EDIT + "subListSize_" + i + "_value", sizes[i]);
+ if (sizes[i] == -1) {
+ prop.put(DISABLED + EDIT + "subListSize_" + i + "_text", "all");
+ } else {
+ prop.put(DISABLED + EDIT + "subListSize_" + i + "_text", sizes[i]);
+ }
+ if (sizes[i] == size) {
+ prop.put(DISABLED + EDIT + "subListSize_" + i + "_selected", 1);
+ }
+ }
+ prop.put(DISABLED + EDIT + "subListSize", sizes.length);
}
// List BlackLists