WatchCrawler is working NOW!

Thx to theli.


git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@1557 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
allo 19 years ago
parent ebc5b1eafb
commit fd7af851bf

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

@ -2,40 +2,100 @@ function handleResponse(){
if(http.readyState == 4){
var response = http.responseXML;
indexingTable=document.getElementById("indexingTable");
if(response != null){
entries=response.getElementsByTagName("entry");
}
//skip the Tableheade
row=indexingTable.firstChild.nextSibling.nextSibling;
row=indexingTable.firstChild.nextSibling.firstChild.nextSibling.nextSibling;
while(row != null){ //delete old entries
indexingTable.removeChild(row);
row=indexingTable.firstChild.nextSibling.nextSibling;
indexingTable.firstChild.nextSibling.removeChild(row);
row=indexingTable.firstChild.nextSibling.firstChild.nextSibling.nextSibling;
}
dark=false;
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
//TODO: add them by Name
field=entries[i].firstChild;
while(field != null){
if(field.nodeType == 1 && field.firstChild!=null && field.nodeName != "inProcess"){//Element
col=document.createElement("td");
text=document.createTextNode(field.firstChild.nodeValue);
col.appendChild(text);
row.appendChild(col);
if(field.nodeType == 1 && field.firstChild!=null){//Element
if(field.nodeName=="initiator"){
initiator=field.firstChild.nodeValue;
}else if(field.nodeName=="depth"){
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;
}
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");
}else{
row.setAttribute("class", "TableCellLight");
}
indexingTable.appendChild(row);
indexingTable.firstChild.nextSibling.appendChild(row);
dark=!dark;
}
}
}
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;
}

Loading…
Cancel
Save