better integration of server list in interactive search

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@7870 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
orbiter 13 years ago
parent 606c5a9b40
commit 8e03b8ee8b

@ -89,42 +89,14 @@
</fieldset>
</form>
#(servertable)#::
<p>
The following servers had been detected:
</p>
<form id="servertable" action="CrawlStartScanner_p.html" method="post" enctype="multipart/form-data" accept-charset="UTF-8" ><fieldset>
<legend><label for="servertable">Available server within the given IP range</label></legend>
<table class="sortable" border="0" cellpadding="2" cellspacing="1">
<tr class="TableHeader" valign="bottom">
<th class="sorttable_nosort"><input type="checkbox" name="allswitch" onclick="checkAll(this.form.id, this.checked);" /></th>
<th>Protocol</th>
<th>IP</th>
<th>URL</th>
<th>Access</th>
<th>Process</th>
</tr>
#{list}#
<tr class="TableCellLight">
<td align="left"><input type="checkbox" name="item_#[count]#" value="mark_#[pk]#" #(preselected)#::checked="checked"#(/preselected)# /></td>
<td>#[protocol]#</td>
<td><a href="#[url]#">#[ip]#</a></td>
<td><a href="#[url]#">#[url]#</a></td>
#(accessUnknown)#::<td class="info">unknown</td>#(/accessUnknown)#
#(accessEmpty)#::<td class="info">empty</td>#(/accessEmpty)#
#(accessGranted)#::<td class="commit">granted</td>#(/accessGranted)#
#(accessDenied)#::<td class="error">denied</td>#(/accessDenied)#
#(process)#<td class="info">not in index</td>::<td class="commit">indexed</td>#(/process)#
</tr>
#{/list}#
</table>
<p>
<input type="hidden" name="num" value="#[num]#" />
<input type="submit" name="crawl" value="Add Selected Servers to Crawler" />
</p>
</fieldset></form>
#(/servertable)#
<iframe name="target"
src="/ServerScannerList.html?embedded=&edit="
width="100%"
height="410"
frameborder="0"
scrolling="auto"
id="target">
</iframe>
#%env/templates/footer.template%#
</body>

@ -28,7 +28,6 @@ import java.util.Map;
import java.util.Set;
import java.util.TreeMap;
import net.yacy.cora.document.ASCII;
import net.yacy.cora.protocol.Domains;
import net.yacy.cora.protocol.RequestHeader;
import net.yacy.cora.protocol.Scanner;
@ -57,7 +56,6 @@ public class CrawlStartScanner_p {
SearchEventCache.cleanupEvents(true);
prop.put("noserverdetected", 0);
prop.put("servertable", 0);
prop.put("hosts", "");
prop.put("intranet.checked", sb.isIntranetMode() ? 1 : 0);
@ -186,7 +184,6 @@ public class CrawlStartScanner_p {
String urlString;
DigestURI u;
try {
int i = 0;
final Iterator<Map.Entry<Scanner.Service, Scanner.Access>> se = Scanner.scancacheEntries();
Map.Entry<Scanner.Service, Scanner.Access> host;
while (se.hasNext()) {
@ -199,7 +196,6 @@ public class CrawlStartScanner_p {
path += "&crawlingURL=" + urlString;
WorkTables.execAPICall("localhost", (int) sb.getConfigLong("port", 8090), sb.getConfig(SwitchboardConstants.ADMIN_ACCOUNT_B64MD5, ""), path, u.hash());
}
i++;
} catch (MalformedURLException e) {
Log.logException(e);
}
@ -210,49 +206,6 @@ public class CrawlStartScanner_p {
}
}
// write scan table
if (Scanner.scancacheSize() > 0) {
// make a comment cache
final Map<byte[], String> apiCommentCache = WorkTables.commentCache(sb);
// show scancache table
prop.put("servertable", 1);
String urlString;
DigestURI u;
table: while (true) {
try {
int i = 0;
final Iterator<Map.Entry<Scanner.Service, Scanner.Access>> se = Scanner.scancacheEntries();
Map.Entry<Scanner.Service, Scanner.Access> host;
while (se.hasNext()) {
host = se.next();
try {
u = new DigestURI(host.getKey().url());
urlString = u.toNormalform(true, false);
prop.put("servertable_list_" + i + "_pk", ASCII.String(u.hash()));
prop.put("servertable_list_" + i + "_count", i);
prop.putHTML("servertable_list_" + i + "_protocol", u.getProtocol());
prop.putHTML("servertable_list_" + i + "_ip", host.getKey().getInetAddress().getHostAddress());
prop.putHTML("servertable_list_" + i + "_url", urlString);
prop.put("servertable_list_" + i + "_accessUnknown", host.getValue() == Access.unknown ? 1 : 0);
prop.put("servertable_list_" + i + "_accessEmpty", host.getValue() == Access.empty ? 1 : 0);
prop.put("servertable_list_" + i + "_accessGranted", host.getValue() == Access.granted ? 1 : 0);
prop.put("servertable_list_" + i + "_accessDenied", host.getValue() == Access.denied ? 1 : 0);
prop.put("servertable_list_" + i + "_process", Scanner.inIndex(apiCommentCache, urlString) == null ? 0 : 1);
prop.put("servertable_list_" + i + "_preselected", host.getValue() == Access.granted && Scanner.inIndex(apiCommentCache, urlString) == null ? 1 : 0);
i++;
} catch (MalformedURLException e) {
Log.logException(e);
}
}
prop.put("servertable_list", i);
prop.put("servertable_num", i);
break table;
} catch (ConcurrentModificationException e) {
continue table;
}
}
}
return prop;
}

@ -74,6 +74,7 @@ function preparepage(str) {
document.getElementById("searchresults").innerHTML = resultList();
}
document.getElementById("searchnavigation").innerHTML = resultNavigation();
document.getElementById("serverlist").innerHTML = "";
hideDownloadScript();
}

@ -72,6 +72,10 @@ To see a list of all APIs, please visit the <a href="http://www.yacy-websuche.de
</div>
<div id="downloadscript" style="clear:both;"></div>
<div id="searchresults" style="clear:both;">
<!-- <div><img src="PerformanceGraph.png" id="graph" alt="PerformanceGraph" width="660" height="240"/></div> -->
</div>
<div id="serverlist" style="clear:both;">
#(serverlist)#::
<iframe name="target"
src="/ServerScannerList.html?embedded="
width="100%"
@ -80,7 +84,7 @@ To see a list of all APIs, please visit the <a href="http://www.yacy-websuche.de
scrolling="auto"
id="target">
</iframe>
<!-- <div><img src="PerformanceGraph.png" id="graph" alt="PerformanceGraph" width="660" height="240"/></div> -->
#(/serverlist)#
</div>
<script type="text/javascript">
//<![CDATA[

@ -53,6 +53,7 @@ public class yacyinteractive {
prop.putHTML("startRecord", startRecord);
prop.putHTML("maximumRecords", maximumRecords);
prop.putHTML("querys", query.replaceAll(" ", "+"));
prop.put("serverlist", query.length() == 0 ? 1 : 0);
return prop;
}
}

@ -105,7 +105,7 @@ public class Scanner extends Thread {
}
}
private final static Map<Service, Access> scancache = new HashMap<Service, Access>();
private final static Map<Service, Access> scancache = new ConcurrentHashMap<Service, Access>();
//private static long scancacheUpdateTime = 0;
//private static long scancacheValidUntilTime = Long.MAX_VALUE;
private static Set<InetAddress> scancacheScanrange = new HashSet<InetAddress>();

Loading…
Cancel
Save