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

Paul Everitt paul@zope.com
Tue, 28 Jan 2003 16:25:06 -0500


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

Modified Files:
	connection-wizard.js connection-wizard.xul moztop.js 
Log Message:
Adding and deleting sites works with the Connect button

=== Packages/Moztop/moztop/content/connection-wizard.js 1.1 => 1.2 ===
--- Packages/Moztop/moztop/content/connection-wizard.js:1.1	Wed Jan 15 23:11:20 2003
+++ Packages/Moztop/moztop/content/connection-wizard.js	Tue Jan 28 16:24:33 2003
@@ -19,28 +19,13 @@
 
 /* Create a site from the wizard */
 function createSite() {
-    /* Setting up variables */
-    var ds = new RDFDataSource();
-    var doc = getDocumentOfWindowWithId("moztop-main-window");
-    var sources = doc.getElementById('sites-tree').database.GetDataSources();
 
-    /* Initialize RDFDataSource */
-    sources.getNext(); // XXX: Hack!
-    ds.Init(sources.getNext().QueryInterface(
-		Components.interfaces.nsIRDFDataSource));
-    
-    /* Write the data into the datasource. */ 
-    var sites = ds.getNode("urn:sites:data");
-    var newsite = ds.getNode("urn:sites:data:" + 
-			 document.getElementById("field_servername").value);
-    sites.addChild(newsite);
+    /* Setting up variables */
+  var newsite_name = document.getElementById("newsite_name").value;
+  var newsite_url = document.getElementById("newsite_url").value;
+  var newsite_username = document.getElementById("newsite_username").value;
+  var newsite_password = document.getElementById("newsite_password").value;
 
-    newsite.addTarget("http://www.zope.org/rdf/site#servername", 
-		      document.getElementById("field_servername").value);
-    newsite.addTarget("http://www.zope.org/rdf/site#serverport", 
-		      document.getElementById("field_port").value);
-    newsite.addTarget("http://www.zope.org/rdf/site#username", 
-	      document.getElementById("field_username").selectedItem.label);
-    newsite.addTarget("http://www.zope.org/rdf/site#password",
-		      document.getElementById("field_password").value);
+  // Now we call addSite in Explorer/Explorer.js
+  addSite(newsite_name, newsite_url, newsite_username, newsite_password);
 }


=== Packages/Moztop/moztop/content/connection-wizard.xul 1.5 => 1.6 ===
--- Packages/Moztop/moztop/content/connection-wizard.xul:1.5	Wed Jan 15 23:11:20 2003
+++ Packages/Moztop/moztop/content/connection-wizard.xul	Tue Jan 28 16:24:33 2003
@@ -10,28 +10,30 @@
   <script type="application/x-javascript" src="global.js"/>
   <script type="application/x-javascript" src="rdfds.js"/>
   <script type="application/x-javascript" src="connection-wizard.js"/>
+  <script src="chrome://moztop/content/Explorer/Explorer.js"/>
 
   <wizardpage>
     <description>
-      This Wizard will help you to connect to a new server.
+      This Wizard will help you to connect to a new site.
     </description>
-    <label value="Server:"/>
-    <textbox id="field_servername" value="www.zope3.org"/>
-    <label value="Port:"/>
-    <textbox id="field_port" value="8081"/>
+    <label value="Site name:"/>
+    <textbox id="newsite_name" value="localhost"/>
+    <label value="Site URL:"/>
+    <textbox id="newsite_url" value="http://localhost:8080/"/>
   </wizardpage>
 
   <wizardpage description="Available Users">
     <label value="Please select a user:"/>
-    <menulist id="field_username" label="Username">
+    <menulist id="newsite_username" label="Username">
       <menupopup>
-        <menuitem label="ev (Paul Everitt)"/>
-        <menuitem label="srichter (Stephan Richter)"/>
-        <menuitem label="zope3 (Zope 3 USer)"/>
+        <menuitem label="gandalf (Default Zope 3 Manager)" value="gandalf"/>
+        <menuitem label="ev (Paul Everitt)" value="ev"/>
+        <menuitem label="srichter (Stephan Richter)" value="srichter"/>
+        <menuitem label="zope3 (Zope 3 USer)" value="zope3"/>
       </menupopup>
     </menulist>
     <label value="Enter the password:"/>
-    <textbox id="field_password" type="password" value="" />
+    <textbox id="newsite_password" type="password" value="" />
   </wizardpage>
 
 </wizard>


=== Packages/Moztop/moztop/content/moztop.js 1.13 => 1.14 ===
--- Packages/Moztop/moztop/content/moztop.js:1.13	Sat Jan 25 12:43:58 2003
+++ Packages/Moztop/moztop/content/moztop.js	Tue Jan 28 16:24:33 2003
@@ -27,7 +27,6 @@
 function startProgram() {
   initTaskList();
   initExplorer();
-  initSites();
 }
 
 /* Function that is executed when Moztop is started. */
@@ -55,14 +54,24 @@
     // tree.database.AddDataSource(ds);
     // tree.setAttribute("ref", "urn:explorer:data");
 		
-		var prefsdir = getProfileURL();
-		var sitesds = new RDFDataSource(prefsdir + "/moztop_sites.rdf");
-		var typesds = new RDFDataSource(prefsdir + "/moztop_types.rdf");
+  var prefsdir = getProfileURL();
+  var sitesds = new RDFDataSource(prefsdir + "/moztop_sites.rdf");
+  var typesds = new RDFDataSource(prefsdir + "/moztop_types.rdf");
+  var ds = new RDFDataSource(prefsdir + "/moztop_foo_bar.rdf");
+
+  var fish=ds.getNode("urn:animals:fish");
+  var shark=ds.getNode("urn:animals:greatwhiteshark");
+  fish.addChild(shark);
+
+  shark.addTarget("http://www.some-ficticious-zoo.com/rdf#name","Great White Shark");
+  
+
+  ds.save();
 		
-    var explorer=document.getElementById("navigationtree");
-    explorer.database.AddDataSource(sitesds.getRawDataSource());
-    explorer.database.AddDataSource(typesds.getRawDataSource());
-    explorer.builder.rebuild();		
+  var explorer=document.getElementById("explorertree");
+  explorer.database.AddDataSource(sitesds.getRawDataSource());
+  explorer.database.AddDataSource(typesds.getRawDataSource());
+  explorer.builder.rebuild();		
 }
 
 /* Reload Explorer datasource */