Update of /cvsroot/monetdb/pathfinder/runtime/xrpc/admin
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv6612

Modified Files:
        admin.js 
Log Message:
In an XRPC response message, an empty collection (as the result of
document deletion) does not have a "numDocs" attribute.  Using "UNKNOWN"
to indicate an empty collection is very confusing, hence, we now filter
out those empty collection tuples.



Index: admin.js
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/runtime/xrpc/admin/admin.js,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- admin.js    27 May 2007 23:44:00 -0000      1.9
+++ admin.js    2 Jun 2007 19:54:36 -0000       1.10
@@ -28,6 +28,10 @@
     if(cols.length == 0){
         cTable.innerHTML = '<h3>No (documents) collections in the 
database</h3>\n';
         return;
+    } else if( (cols.length == 1) &&
+               (cols[0].getAttribute("numDocs") == null) ){
+        cTable.innerHTML = '<h3>No (documents) collections in the 
database</h3>\n';
+        return;
     }
 
     var i;
@@ -37,24 +41,25 @@
         var size = cols[i].getAttribute("size");
         var numDocs = cols[i].getAttribute("numDocs");
 
-        if(updatable == null) updatable = "UNKNOWN";
-        if(size == null) size = "UNKNOWN";
-        if(numDocs == null) numDocs = "UNKNOWN";
+        if(numDocs != null) {
+            if(updatable == null) updatable = "UNKNOWN";
+            if(size == null) size = "UNKNOWN";
 
-        cTableBody += '<tr>\n';
-        cTableBody += '<td>'+colName+'</td>\n';
-        cTableBody += '<td>'+updatable+'</td>\n';
-        cTableBody += '<td>'+size+'</td>\n';
-        cTableBody += '<td>'+numDocs+'</td>\n';
-        cTableBody +=
-            '<td>'+
-            '<input type="button" name="viewCol" value="view" 
onclick="top.doDocuments(\''+ colName + '\')" />'+
-            '</td>\n';
-        cTableBody +=
-            '<td>'+
-            '<input type="button" name="delCol" value="delete" 
onclick="top.doDelCol(\'' + colName+ '\')" />'+
-            '</td>\n';
-        cTableBody += '</tr>\n';
+            cTableBody += '<tr>\n';
+            cTableBody += '<td>'+colName+'</td>\n';
+            cTableBody += '<td>'+updatable+'</td>\n';
+            cTableBody += '<td>'+size+'</td>\n';
+            cTableBody += '<td>'+numDocs+'</td>\n';
+            cTableBody +=
+                '<td>'+
+                '<input type="button" name="viewCol" value="view" 
onclick="top.doDocuments(\''+ colName + '\')" />'+
+                '</td>\n';
+            cTableBody +=
+                '<td>'+
+                '<input type="button" name="delCol" value="delete" 
onclick="top.doDelCol(\'' + colName+ '\')" />'+
+                '</td>\n';
+            cTableBody += '</tr>\n';
+        }
     }
 
     cTable.innerHTML = 
@@ -74,8 +79,14 @@
 
 function doAllDocumentsCallback(response) {
     var docs = response.getElementsByTagName("document");
+    var dTable = top.content.document.getElementById("div1");
     var dTableBody = "";
 
+    if(docs == null || docs.length == 0){
+        dTable.innerHTML = '<h3>No documents in the database</h3>\n';
+        return;
+    }
+
     var i;
     for(i = 0; i < docs.length; i++){
         var docName   = docs[i].firstChild.nodeValue;
@@ -103,7 +114,6 @@
         dTableBody += '</tr>\n';
     }
 
-    var dTable = top.content.document.getElementById("div1");
     dTable.innerHTML = 
         '<h2>All documents in the database:</h2>\n' +
         '<table width="30%" border="1">\n' +


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Monetdb-pf-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-pf-checkins

Reply via email to