Skip to content

Commit

Permalink
WatchCrawler is working NOW!
Browse files Browse the repository at this point in the history
Thx to theli.


git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@1557 6c8d7289-2bf4-0310-a012-ef5d649a1542
  • Loading branch information
allo committed Feb 6, 2006
1 parent ebc5b1e commit fd7af85
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 13 deletions.
4 changes: 3 additions & 1 deletion htroot/WatchCrawler.html
@@ -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>
Expand All @@ -13,6 +13,7 @@ <h2>Watch Crawler</h2>
<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>
Expand All @@ -22,6 +23,7 @@ <h2>Watch Crawler</h2>
<th class="small">Size</th>
<th class="small">Delete</th>
</tr>
</tbody>
</table>

#%env/templates/footer.template%#
Expand Down
84 changes: 72 additions & 12 deletions htroot/js/WatchCrawler.js
Expand Up @@ -2,40 +2,100 @@ function handleResponse(){
if(http.readyState == 4){
var response = http.responseXML;
indexingTable=document.getElementById("indexingTable");
entries=response.getElementsByTagName("entry");
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;
}

0 comments on commit fd7af85

Please sign in to comment.