[Zope-CVS] CVS: Packages/Moztop/moztop/content/lib - datasourcemanager.js:1.9 ioutils.js:1.2 jsdav.js:1.2 logmanager.js:1.4 sitesmanager.js:1.7

Stephan Richter srichter@cbu.edu
Sat, 22 Mar 2003 14:36:31 -0500


Update of /cvs-repository/Packages/Moztop/moztop/content/lib
In directory cvs.zope.org:/tmp/cvs-serv913/moztop/content/lib

Modified Files:
	datasourcemanager.js ioutils.js jsdav.js logmanager.js 
	sitesmanager.js 
Log Message:
Some cleanup.

Adding DataSources using DataSourceManager work now! Yeah!

Fixed some LogManager issues.


=== Packages/Moztop/moztop/content/lib/datasourcemanager.js 1.8 => 1.9 ===
--- Packages/Moztop/moztop/content/lib/datasourcemanager.js:1.8	Sat Mar 22 10:02:06 2003
+++ Packages/Moztop/moztop/content/lib/datasourcemanager.js	Sat Mar 22 14:36:31 2003
@@ -1,5 +1,3 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-
 /*****************************************************************************
 *
 * Copyright (c) 2002, 2003 Zope Corporation and Contributors.
@@ -63,18 +61,28 @@
 DataSourceManager.prototype.addDataSource = function(rdfurl) {
     /* Add a new datasource to the tree. */
 
+    // Allowing the Data Source Manager namespace to be present in onFullLoad()
+    dsm = this;
+
+    function onFullLoad(datasource) {
+	// Append RDFDataSource to the tree and rebuild
+	tree = document.getElementById(dsm.treeId);
+	tree.database.AddDataSource(datasource.getRawDataSource());
+	tree.builder.rebuild();
+    };
+
+
     // Get the RDF from the specified URL and creata a RDFDataSource
-    if (rdfurl == null) 
+    if (rdfurl == null) { 
 	var ds = new RDFDataSource();
-    else
+	// Calling onFullLoad manually, since it does not do remote things
+	onFullLoad(ds);
+    } else {
 	// For some reason getDataSourceBlocked is not part of the API
 	// anymore, so that we need to use getDataSource
-	var ds = new RDFDataSource(rdfurl, function(request){});
+	var ds = new RDFDataSource(rdfurl, onFullLoad);
+    }
 
-    // Append RDFDataSource to the tree and rebuild
-    tree = document.getElementById(this.treeId);
-    tree.database.AddDataSource(ds.getRawDataSource());
-    tree.builder.rebuild();
     return ds;
 }
 
@@ -144,7 +152,7 @@
 
     // XXX: Iterate through all datasources in the tree database and dump
     //      their serialized data.
-    var tree = document.getElementById(logmanager.treeId);
+    var tree = document.getElementById(this.treeId);
     var sources = tree.database.GetDataSources();
     while (sources.hasMoreElements()) {
 	ds = new RDFDataSource();


=== Packages/Moztop/moztop/content/lib/ioutils.js 1.1 => 1.2 ===
--- Packages/Moztop/moztop/content/lib/ioutils.js:1.1	Sat Mar 22 09:27:01 2003
+++ Packages/Moztop/moztop/content/lib/ioutils.js	Sat Mar 22 14:36:31 2003
@@ -1,13 +1,23 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*****************************************************************************
+*
+* Copyright (c) 2002, 2003 Zope Corporation and Contributors.
+* All Rights Reserved.
+*
+* This software is subject to the provisions of the Zope Public License,
+* Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
+* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+* WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+* WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+* FOR A PARTICULAR PURPOSE.
+*
+******************************************************************************
+IO Utility Functions
 
+$Id$
 
+******************************************************************************/
 
-
-
-/*  ------------    Utility functions below   ------------- */
-
-function getProfileDirURL ()
-{
+function getProfileDirURL() {
 
   // First get the directory service and query interface it to
   // nsIProperties


=== Packages/Moztop/moztop/content/lib/jsdav.js 1.1 => 1.2 ===
--- Packages/Moztop/moztop/content/lib/jsdav.js:1.1	Sat Mar 22 09:27:01 2003
+++ Packages/Moztop/moztop/content/lib/jsdav.js	Sat Mar 22 14:36:31 2003
@@ -1,4 +1,21 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*****************************************************************************
+*
+* Copyright (c) 2002, 2003 Zope Corporation and Contributors.
+* All Rights Reserved.
+*
+* This software is subject to the provisions of the Zope Public License,
+* Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
+* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+* WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+* WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+* FOR A PARTICULAR PURPOSE.
+*
+******************************************************************************
+WebDAV specific methods.
+
+$Id$
+
+******************************************************************************/
 
 SitesManager.prototype.DELETE = function(puturl, putcontent) {
     /* Deleting a resource on the server */


=== Packages/Moztop/moztop/content/lib/logmanager.js 1.3 => 1.4 ===
--- Packages/Moztop/moztop/content/lib/logmanager.js:1.3	Sat Mar 22 10:02:06 2003
+++ Packages/Moztop/moztop/content/lib/logmanager.js	Sat Mar 22 14:36:31 2003
@@ -47,8 +47,7 @@
 }
 
 LogManager.prototype.initialize = function() {
-    this.addDataSource(null);
-    var ds = this.getDataSource();
+    ds = this.addDataSource(null);
     var rootnode = ds.getNode(this.urn);
     rootnode.makeSeq();
 }
@@ -103,7 +102,7 @@
 		      "viewlogmessage", "chrome", msg.getValue());
 }
 
-function dump(msg) {
+function dump2(msg) {
     /* Convinience function to allow dump calls to be redirected to the Log
     Manager. */
     var MAXTITLELENGTH = 40;


=== Packages/Moztop/moztop/content/lib/sitesmanager.js 1.6 => 1.7 ===
--- Packages/Moztop/moztop/content/lib/sitesmanager.js:1.6	Sat Mar 22 10:02:06 2003
+++ Packages/Moztop/moztop/content/lib/sitesmanager.js	Sat Mar 22 14:36:31 2003
@@ -100,19 +100,19 @@
 
     while (sites.hasMoreElements()) {
 	site = sites.getNext();
-	this.openSite(site.getValue());
+	this.loadSite(site.getValue());
     }
     return true;
 }
 
 
-SitesManager.prototype.openSite = function(rsdurl) {
-    /* Open a site by grabbing its contents and types. */
+SitesManager.prototype.loadSite = function(rsdurl) {
+    /* Load a site by grabbing its contents and types. */
 
-    // Allowing the Sites Manager namespace to be present in openThisSite()
+    // Allowing the Sites Manager namespace to be present in loadThisSite()
     sm = this;
 
-    function openThisSite(error) {
+    function loadThisSite(error) {
 	if (request.statusText) {
 	    var response = request.responseXML;
 	    
@@ -132,13 +132,12 @@
 	    // Append types and content RDFDataSources to tree.
 	    sm.addDataSource(typesurl);
 	    sm.addDataSource(contenturl);
-	    sm.dumpDataSources();
 	}
     };
 
     // Trying to get a discovery response from the server
     var request = new XMLHttpRequest();
-    request.onload = openThisSite;
+    request.onload = loadThisSite;
     request.open("GET", rsdurl, false);
     request.send(null);
 }
@@ -159,8 +158,8 @@
     // Save the changes
     this.sitesds.save();
 
-    // Open the site
-    this.connectSite(rsdurl)
+    // Load the site
+    this.loadSite(rsdurl)
     return true;
 }