[Zope-CVS] CVS: Packages/Moztop/moztop/content - connection-wizard.xul:1.3 moztop.js:1.3

Stephan Richter srichter@cbu.edu
Mon, 13 Jan 2003 21:44:16 -0500


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

Modified Files:
	connection-wizard.xul moztop.js 
Log Message:
Made Zope 3-based content RDF apply to Paul's structure changes and
made refresh work again. Unfortunately it is a big hack right now.

Also, Adding and deleting Sites should work, but it does not, but no 
errors are thrown... I am lost there.


=== Packages/Moztop/moztop/content/connection-wizard.xul 1.2 => 1.3 ===
--- Packages/Moztop/moztop/content/connection-wizard.xul:1.2	Mon Jan 13 17:45:45 2003
+++ Packages/Moztop/moztop/content/connection-wizard.xul	Mon Jan 13 21:43:44 2003
@@ -4,7 +4,28 @@
 <?xml-stylesheet href="chrome://moztop/skin" type="text/css"?>
 
 <wizard id="add-conn-wizard" title="Create a new Connection to Zope 3"
+  onwizardfinish="return createSite();"
   xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+
+  <script type="application/x-javascript" 
+          src="chrome://moztop/content/Inspector/Sites.js"/>
+
+  <script type="application/x-javascript">
+    function createSite() {
+      var servername = document.getElementById(
+		         "field_servername").getAttribute("value");
+      var port = document.getElementById(
+		         "field_port").getAttribute("value");
+      var username = document.getElementById(
+		         "field_username").getAttribute("value");
+      var password = document.getElementById(
+		         "field_password").getAttribute("value");
+      username = 'foo';
+      password = 'bar';
+      // addSite(servername, port, username, password);
+      addSite("foo", "foo", "foo", "foo");
+    }
+  </script>
 
   <wizardpage>
     <description>


=== Packages/Moztop/moztop/content/moztop.js 1.2 => 1.3 ===
--- Packages/Moztop/moztop/content/moztop.js:1.2	Mon Jan 13 16:32:38 2003
+++ Packages/Moztop/moztop/content/moztop.js	Mon Jan 13 21:43:44 2003
@@ -1,8 +1,14 @@
-var myDatasourceURL = "http://localhost:8080/@@contents.rdf"
+var RDF =
+  Components
+  .classes["@mozilla.org/rdf/rdf-service;1"]
+  .getService(Components.interfaces.nsIRDFService);
+
+var contentsURL = "http://localhost:8080/@@contents.rdf"
 
 function startProgram() {
   initTaskList();
   initExplorer();
+  initSites();
 }
 
 function closeProgram() {
@@ -26,8 +32,8 @@
 function initExplorer() {
   var rdf = Components.classes["@mozilla.org/rdf/rdf-service;1"]
                   .getService(Components.interfaces.nsIRDFService);
-  var ds = rdf.GetDataSource(myDatasourceURL);
-  var tree = document.getElementById('explorer');
+  var ds = rdf.GetDataSource(contentsURL);
+  var tree = document.getElementById('navigationtree');
   tree.database.AddDataSource(ds);
   tree.setAttribute("ref", "urn:explorer:data");
   tree.builder.rebuild();
@@ -37,10 +43,13 @@
 function reloadContentData() {
     var RDF = Components.classes["@mozilla.org/rdf/rdf-service;1"]
                 .getService(Components.interfaces.nsIRDFService);
-    var ds = RDF.GetDataSource(myDatasourceURL);
+    var tree = document.getElementById('navigationtree');
+    // XXX There are some issues using this variant:
+    var ds = RDF.GetDataSource(contentsURL);
+    // var ds = tree.database.GetDataSources().getNext()
     ds = ds.QueryInterface(
 	      Components.interfaces.nsIRDFRemoteDataSource);
     ds.Refresh(false);
-    var tree = document.getElementById('explorer');
+    alert('Updated!');
     tree.builder.rebuild();
 }