[Zope-CVS] CVS: Packages/Moztop/moztop/content - connection-wizard.js:1.1 global.js:1.1 menuentryOverlay.xul:1.1 rdfds.js:1.1 connection-wizard.xul:1.5 contents.rdf:1.2 moztop.js:1.8 moztop.xul:1.6 setup.js.in:1.2 file.js:NONE moztopOverlay.xul:NONE registry_demo.xul:NONE test-out.xul:NONE test-tree.xul:NONE

Stephan Richter srichter@cbu.edu
Wed, 15 Jan 2003 23:11:56 -0500


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

Modified Files:
	connection-wizard.xul contents.rdf moztop.js moztop.xul 
	setup.js.in 
Added Files:
	connection-wizard.js global.js menuentryOverlay.xul rdfds.js 
Removed Files:
	file.js moztopOverlay.xul registry_demo.xul test-out.xul 
	test-tree.xul 
Log Message:
- Major code cleanup:

  o Removed unused files.

  o Added Headers to Javascript files.

  o Reorganized Javascript a bit. However, there is still enough left 
    to do.

  o Added Documentation strings.

- Finally got Connection Wizard working.


=== Added File Packages/Moztop/moztop/content/connection-wizard.js ===
/*****************************************************************************
*
* 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.
*
******************************************************************************
Handles that the wizard truely adds the new site.

$Id: connection-wizard.js,v 1.1 2003/01/16 04:11:20 srichter Exp $

******************************************************************************/

/* 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);

    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);
}


=== Added File Packages/Moztop/moztop/content/global.js ===
/*****************************************************************************
*
* 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.
*
******************************************************************************
Global Javascript library that collects some of the most important constants,
variables and functions that are not sensible to reloading. Note that this is
*not* the right file to define global RDF datasources! 

$Id: global.js,v 1.1 2003/01/16 04:11:20 srichter Exp $

******************************************************************************/

/* We really need to grab the RDF Service only once. */
var RDF =
  Components
  .classes["@mozilla.org/rdf/rdf-service;1"]
  .getService(Components.interfaces.nsIRDFService);


/* This function gets the document of a Window having the correct id. This is
 * exremly important when dealing with dialogs and other secondary windows. */
function getDocumentOfWindowWithId(id) {
    var win = null;
    var wmediator =
	Components.classes['@mozilla.org/appshell/window-mediator;1'].
	getService(Components.interfaces.nsIWindowMediator);
    var openwindows = wmediator.getEnumerator(null);
    
    while (openwindows.hasMoreElements()) {
	win = openwindows.getNext();
	if (win.document.getElementById(id) != null) {
	    return win.document;
	}
    }
    return null;
}


=== Added File Packages/Moztop/moztop/content/menuentryOverlay.xul ===
<?xml version="1.0"?>

<overlay id="menuentryOverlay" 
         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">

<script type="application/x-javascript">

function runMoztop() {
  window.openDialog('chrome://moztop/content/', '_blank', 'chrome,dialog=no');
}
	
</script>

<menupopup id="taskPopup">
  <menuitem label="Moztop 0.1 (Zope 3 IDE)" oncommand="runMoztop();" />
  <menuseparator/>
</menupopup>

</overlay>


=== Added File Packages/Moztop/moztop/content/rdfds.js === (660/760 lines abridged)
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
 * The contents of this file are subject to the Mozilla Public
 * License Version 1.1 (the "License"); you may not use this file
 * except in compliance with the License. You may obtain a copy of
 * the License at http://www.mozilla.org/MPL/
 *
 * Software distributed under the License is distributed on an "AS
 * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
 * implied. See the License for the specific language governing
 * rights and limitations under the License.
 *
 * The Original Code is rdfds
 *
 * The Initial Developer of the Original Code is Neil Deakin
 * Portions created by Neil Deakin are Copyright (C) 2002 Neil Deakin.
 * All Rights Reserved.
 *
 * Contributor(s):
 */

/* This is a library for easier access to RDF datasources and resources.
 * It contains four objects, RDFDataSource, RDFNode, RDFLiteral. and
 * RDFEnumerator.
 *
 * An RDF DataSource is a graph of nodes and literals. The constructor
 * for RDFDataSource takes one argument, a URI of an RDF file to use.
 * If the URI exists, the contents of the RDF file are loaded. If it
 * does not exist, resources can be added to it and then written using
 * this save method. If the URL argument is null, a blank datasource
 * is created.
 *
 * This library is designed for convenience not for efficiency.
 *
 * The API is documented at:
 *   http://www.xulplanet.com/tutorials/xultu/rdfds/
 *
 * Example:
 *
 * var ds=new RDFDataSource("file:///main/mozilla/mimtest.rdf");
 * var node=ds.getNode("urn:xpimaker:packlist");
 * var child=ds.getNode("urn:xpimaker:packlist:appinfo");
 * child=node.addChild(child);
 * child.addTarget("http://www.xulplanet.com/rdf/xpimaker#appname","Find Files");
 * ds.save();
 *
 */

var RDFService = "@mozilla.org/rdf/rdf-service;1";
RDFService = Components.classes[RDFService].getService();
RDFService = RDFService.QueryInterface(Components.interfaces.nsIRDFService);

[-=- -=- -=- 660 lines omitted -=- -=- -=-]

}

RDFLiteral.prototype.getSources=
  function (prop)
{
  prop=this.makeres(prop);
  return new RDFEnumerator(
    this.datasource.GetSources(prop,this.source,true),this.datasource);
}

RDFLiteral.prototype.type="Literal";


function RDFEnumerator(enumeration,dsource)
{
  this.enumeration=enumeration;
  this.datasource=dsource;
}

RDFEnumerator.prototype.hasMoreElements=
  function ()
{
  return this.enumeration.hasMoreElements();
}

RDFEnumerator.prototype.getNext=
  function ()
{
  var res=null;
  var val=this.enumeration.getNext();

  if (val!=null){
    try {
      val=val.QueryInterface(Components.interfaces.nsIRDFResource);
      res=new RDFNode();
      res.Init(val,this.datasource);
    }
    catch (ex){
      try {
        val=val.QueryInterface(Components.interfaces.nsIRDFLiteral);
        res=new RDFLiteral();
        res.Init(val,this.datasource);
      }
      catch (ex2){
      }
    }
  }
  return res;
}



=== Packages/Moztop/moztop/content/connection-wizard.xul 1.4 => 1.5 ===
--- Packages/Moztop/moztop/content/connection-wizard.xul:1.4	Tue Jan 14 11:29:03 2003
+++ Packages/Moztop/moztop/content/connection-wizard.xul	Wed Jan 15 23:11:20 2003
@@ -7,27 +7,9 @@
   onwizardfinish="return createSite();"
   xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
 
-  <script type="application/x-javascript" 
-        src="chrome://moztop/content/Inspector/rdfds.js"/>
-  <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>
+  <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"/>
 
   <wizardpage>
     <description>
@@ -41,13 +23,15 @@
 
   <wizardpage description="Available Users">
     <label value="Please select a user:"/>
-    <listbox id="field_username">
-      <listitem label="ev (Paul Everitt)"/>
-      <listitem label="srichter (Stephan Richter)"/>
-      <listitem label="zope3 (Zope 3 USer)"/>
-    </listbox>
+    <menulist id="field_username" label="Username">
+      <menupopup>
+        <menuitem label="ev (Paul Everitt)"/>
+        <menuitem label="srichter (Stephan Richter)"/>
+        <menuitem label="zope3 (Zope 3 USer)"/>
+      </menupopup>
+    </menulist>
     <label value="Enter the password:"/>
-    <textbox id="field_password" type="password" />
+    <textbox id="field_password" type="password" value="" />
   </wizardpage>
 
 </wizard>


=== Packages/Moztop/moztop/content/contents.rdf 1.1 => 1.2 ===
--- Packages/Moztop/moztop/content/contents.rdf:1.1	Tue Jan 14 11:29:03 2003
+++ Packages/Moztop/moztop/content/contents.rdf	Wed Jan 15 23:11:20 2003
@@ -8,7 +8,7 @@
   </RDF:Seq>
 
   <RDF:Description about="urn:mozilla:package:moztop"
-        chrome:displayName="Moztop for Zope 3"
+        chrome:displayName="Moztop 0.1 (Zope 3 IDE)"
         chrome:author="Zope Corp. and Contributors"
         chrome:name="moztop">
   </RDF:Description>
@@ -18,7 +18,7 @@
   </RDF:Seq>
 
   <RDF:Seq about="chrome://communicator/content/tasksOverlay.xul">
-    <RDF:li>chrome://moztop/content/moztopOverlay.xul</RDF:li>
+    <RDF:li>chrome://moztop/content/menuentryOverlay.xul</RDF:li>
   </RDF:Seq> 
 
 </RDF:RDF>


=== Packages/Moztop/moztop/content/moztop.js 1.7 => 1.8 ===
--- Packages/Moztop/moztop/content/moztop.js:1.7	Wed Jan 15 10:06:19 2003
+++ Packages/Moztop/moztop/content/moztop.js	Wed Jan 15 23:11:20 2003
@@ -1,25 +1,45 @@
-var RDF =
-  Components
-  .classes["@mozilla.org/rdf/rdf-service;1"]
-  .getService(Components.interfaces.nsIRDFService);
+/*****************************************************************************
+*
+* 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.
+*
+******************************************************************************
+Here we define variables and functions that are relevant to the main Moztop
+window, which means this *is* the right place to define global RDF 
+datasources. 
 
+$Id$
+
+******************************************************************************/
+
+/* Function that is executed when Moztop is started. */
 function startProgram() {
   initTaskList();
   initExplorer();
   initSites();
 }
 
+/* Function that is executed when Moztop is started. */
 function closeProgram() {
     window.close()
 }
 
+/* Function to generate the 'About Moztop' Dialog. */
 function showAbout() {
-    info = alert('MoZTop - An IDE for Zope 3\n\n' +
+    info = alert('Moztop - An IDE for Zope 3\n\n' +
 	  'MoZTop is an alternative IDE to the one that is being ' +
           'developed in HTML. It offers many advantages that come ' +
 	  'with a true application.')
 }
 
+/* Function to generate the 'About Moztop' Dialog. */
 function showZope3() {
     info = alert('Zope 3\n\n' +
 	  'Zope 3 is a professional award-winning Application Server. ' +


=== Packages/Moztop/moztop/content/moztop.xul 1.5 => 1.6 ===
--- Packages/Moztop/moztop/content/moztop.xul:1.5	Wed Jan 15 10:06:19 2003
+++ Packages/Moztop/moztop/content/moztop.xul	Wed Jan 15 23:11:20 2003
@@ -29,6 +29,7 @@
    onclose    = "return closeProgram();">
 
   <script type="application/x-javascript" src="setup.js"/>
+  <script type="application/x-javascript" src="global.js"/>
   <script type="application/x-javascript" src="moztop.js"/>
   <script type="application/x-javascript" src="StatusBar/TaskManager.js"/>
 


=== Packages/Moztop/moztop/content/setup.js.in 1.1 => 1.2 ===
--- Packages/Moztop/moztop/content/setup.js.in:1.1	Wed Jan 15 10:06:19 2003
+++ Packages/Moztop/moztop/content/setup.js.in	Wed Jan 15 23:11:20 2003
@@ -1,4 +1,22 @@
-/* 
+/*****************************************************************************
+*
+* 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.
+*
+******************************************************************************
+User-specific settings.
+
+$Id$
+
+******************************************************************************/
+/*
   Here you can modify the server settings, so that Moztop will find your Zope 3
   installation. Note that you require a CVS checkout of Zope 3, since Moztop
   will not work with the alpha 1 release (I have made fixes since then)!
@@ -23,5 +41,5 @@
    These are variables that are used by the system to connect to the server. 
    DO NOT EDIT THESE!
 */
-var ZOPE3_URL   = "http://" + servername + ":"  + xmlrpc_port + "/"
+var XMLRPC_BASE = "http://" + servername + ":"  + xmlrpc_port + "/"
 var contentsURL = "http://" + servername + ":" + rdf_port + "/@@contents.rdf"

=== Removed File Packages/Moztop/moztop/content/file.js ===

=== Removed File Packages/Moztop/moztop/content/moztopOverlay.xul ===

=== Removed File Packages/Moztop/moztop/content/registry_demo.xul ===

=== Removed File Packages/Moztop/moztop/content/test-out.xul ===

=== Removed File Packages/Moztop/moztop/content/test-tree.xul ===