WatchCrawler is working NOW!

Thx to theli.


git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@1557 6c8d7289-2bf4-0310-a012-ef5d649a1542
This commit is contained in:
allo 2006-02-06 15:12:03 +00:00
parent ebc5b1eafb
commit fd7af851bf
2 changed files with 75 additions and 13 deletions

View File

@ -1,7 +1,7 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html> <html>
<head> <head>
<title>YaCy '#[clientname]#': Watch Crawler</title> <title>YaCy Watch Crawler</title>
#%env/templates/metas.template%# #%env/templates/metas.template%#
<script src="/js/ajax.js"></script> <script src="/js/ajax.js"></script>
<script src="/js/WatchCrawler.js"></script> <script src="/js/WatchCrawler.js"></script>
@ -13,6 +13,7 @@
<p /> <p />
Indexing Queue:<br /> Indexing Queue:<br />
<table border="0" cellpadding="2" cellspacing="1" id="indexingTable"> <table border="0" cellpadding="2" cellspacing="1" id="indexingTable">
<tbody>
<tr class="TableHeader"> <tr class="TableHeader">
<th class="small">Initiator</th> <th class="small">Initiator</th>
<th class="small">Depth</th> <th class="small">Depth</th>
@ -22,6 +23,7 @@ Indexing Queue:<br />
<th class="small">Size</th> <th class="small">Size</th>
<th class="small">Delete</th> <th class="small">Delete</th>
</tr> </tr>
</tbody>
</table> </table>
#%env/templates/footer.template%# #%env/templates/footer.template%#

View File

@ -2,40 +2,100 @@ function handleResponse(){
if(http.readyState == 4){ if(http.readyState == 4){
var response = http.responseXML; var response = http.responseXML;
indexingTable=document.getElementById("indexingTable"); indexingTable=document.getElementById("indexingTable");
entries=response.getElementsByTagName("entry"); if(response != null){
entries=response.getElementsByTagName("entry");
}
//skip the Tableheade //skip the Tableheade
row=indexingTable.firstChild.nextSibling.nextSibling; row=indexingTable.firstChild.nextSibling.firstChild.nextSibling.nextSibling;
while(row != null){ //delete old entries while(row != null){ //delete old entries
indexingTable.removeChild(row); indexingTable.firstChild.nextSibling.removeChild(row);
row=indexingTable.firstChild.nextSibling.nextSibling; row=indexingTable.firstChild.nextSibling.firstChild.nextSibling.nextSibling;
} }
dark=false; dark=false;
for(i=0;i<entries.length;i++){ for(i=0;i<entries.length;i++){
row=document.createElement("tr"); initiator="";
depth="";
modified="";
anchor="";
url="";
size="";
hash="";
inProcess=false;
//simply add all fields chronologically //simply add all fields chronologically
//TODO: add them by Name //TODO: add them by Name
field=entries[i].firstChild; field=entries[i].firstChild;
while(field != null){ while(field != null){
if(field.nodeType == 1 && field.firstChild!=null && field.nodeName != "inProcess"){//Element if(field.nodeType == 1 && field.firstChild!=null){//Element
col=document.createElement("td"); if(field.nodeName=="initiator"){
text=document.createTextNode(field.firstChild.nodeValue); initiator=field.firstChild.nodeValue;
col.appendChild(text); }else if(field.nodeName=="depth"){
row.appendChild(col); depth=field.firstChild.nodeValue;
}else if(field.nodeName=="modified"){
modified=field.firstChild.nodeValue;
}else if(field.nodeName=="anchor"){
anchor=field.firstChild.nodeValue;
}else if(field.nodeName=="url"){
url=field.firstChild.nodeValue;
}else if(field.nodeName=="size"){
size=field.firstChild.nodeValue;
}else if(field.nodeName=="hash"){
hash=field.firstChild.nodeValue;
}else if(field.nodeName=="inProcess"){
if(field.firstChild.nodeValue=="true"){
inProcess=true;
}
}
} }
field=field.nextSibling; field=field.nextSibling;
} }
if(dark){ row=createRow(initiator, depth, modified, anchor, url, size, hash);
//create row
/*col=document.createElement("td");
text=document.createTextNode(initiator);
col.appendChild(text);
row.appendChild(col);*/
if(inProcess){
row.setAttribute("class", "TableCellSummary");
}else if(dark){
row.setAttribute("class", "TableCellDark"); row.setAttribute("class", "TableCellDark");
}else{ }else{
row.setAttribute("class", "TableCellLight"); row.setAttribute("class", "TableCellLight");
} }
indexingTable.appendChild(row); indexingTable.firstChild.nextSibling.appendChild(row);
dark=!dark; dark=!dark;
} }
} }
} }
window.setInterval("sndReq('/xml/queues/indexing_p.xml')", 5000); window.setInterval("sndReq('/xml/queues/indexing_p.xml')", 5000);
function createCol(content){
col=document.createElement("td");
text=document.createTextNode(content);
col.appendChild(text);
return col;
}
function createRow(initiator, depth, modified, anchor, url, size, hash){
row=document.createElement("tr");
row.appendChild(createCol(initiator));
row.appendChild(createCol(depth));
row.appendChild(createCol(modified));
row.appendChild(createCol(anchor));
row.appendChild(createCol(url));
row.appendChild(createCol(size));
//'<a href="IndexCreateIndexingQueue_p.html?deleteEntry='+hash+'">Delete</a>'
//create delete link
col=document.createElement("td");
link=document.createElement("a");
link.setAttribute("href", "IndexCreateIndexingQueue_p.html?deleteEntry="+hash);
text=document.createTextNode("Delete");
link.appendChild(text);
col.appendChild(link)
row.appendChild(col);
return row;
}