Skip to content

Commit

Permalink
*) added peer-search to Network.html
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@3347 6c8d7289-2bf4-0310-a012-ef5d649a1542
  • Loading branch information
hydrox committed Feb 7, 2007
1 parent 9c2101a commit faad869
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
6 changes: 6 additions & 0 deletions htroot/Network.html
Expand Up @@ -30,6 +30,12 @@ <h2>Manually contacting Peer</h2>
<p>no remote #[peertype]# peer for this list known</p>
::
<p>Showing #[num]# entries from a total of #[total]# peers.</p>
<form action="Network.html?page=#[page]#" method="get" enctype="multipart/form-data" accept-charset="UTF-8">
<fieldset>
Search for a peername (RegExp allowed):
<input type="text" name="match" value="#[searchpattern]#" /><input type="hidden" name="page" value="#[page]#" /><input type="submit" name="search" value="Search" />
</fieldset>
</form>
<table class="networkTable" border="0" cellpadding="2" cellspacing="1">
<tr class="TableHeader" valign="bottom">
<td>send&nbsp;<strong>M</strong>essage/<br />show&nbsp;<strong>P</strong>rofile/<br />edit&nbsp;<strong>W</strong>iki<br />&nbsp;</td>
Expand Down
17 changes: 15 additions & 2 deletions htroot/Network.java
Expand Up @@ -7,7 +7,7 @@
//
// $LastChangedDate$
// $LastChangedRevision$
// $LastChangedBy: $
// $LastChangedBy$
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -51,6 +51,8 @@
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import de.anomic.http.httpHeader;
import de.anomic.http.httpc;
Expand Down Expand Up @@ -294,9 +296,19 @@ record = yacyCore.newsPool.get(yacyNewsPool.INCOMING_DB, c);
int PPM;
double QPM;
long myValue=0, nextValue=0, prevValue=0, nextPPM=0, myPPM=0;
Pattern peerSearchPattern = null;
if(post.containsKey("search")) {
peerSearchPattern = Pattern.compile(post.get("match", ""));
}
while (e.hasMoreElements() && conCount < maxCount) {
seed = (yacySeed) e.nextElement();
if (seed != null) {
if(post.containsKey("search")) {
Matcher m = peerSearchPattern.matcher (seed.getName());
if (!m.find ()) {
continue;
}
}
prop.put(STR_TABLE_LIST + conCount + "_updatedProfile", 0);
prop.put(STR_TABLE_LIST + conCount + "_updatedWikiPage", 0);
prop.put(STR_TABLE_LIST + conCount + "_updatedBlog", 0);
Expand Down Expand Up @@ -452,7 +464,7 @@ record = yacyCore.newsPool.get(yacyNewsPool.INCOMING_DB, c);
prop.put("table_total", ((page == 1) && (iAmActive)) ? (size + 1) : size );
prop.put("table_complete", ((complete)? 1 : 0) );

if( (!post.containsKey("order") && !post.containsKey("sort")) && page==1){
if( (!post.containsKey("order") && !post.containsKey("sort") && !post.containsKey("search")) && page==1){
int percent=(int)((float)(myValue-prevValue)/(float)(nextValue-prevValue)*100);
long indexdiff=nextValue-myValue;
long ppmdiff=myPPM-nextPPM;
Expand All @@ -476,6 +488,7 @@ record = yacyCore.newsPool.get(yacyNewsPool.INCOMING_DB, c);
}
prop.put("page", page);
prop.put("table_page", page);
prop.put("table_searchpattern", post.get("match", ""));
switch (page) {
case 1 : prop.put("table_peertype", "senior/principal"); break;
case 2 : prop.put("table_peertype", "senior/principal"); break;
Expand Down

0 comments on commit faad869

Please sign in to comment.