[Zope-CVS] CVS: Packages/Moztop/moztop/content/Inspector - ExplorerOverlay.xul:1.5 Sites.js:1.4 SitesOverlay.xul:1.2
Stephan Richter
srichter@cbu.edu
Mon, 13 Jan 2003 21:44:19 -0500
Update of /cvs-repository/Packages/Moztop/moztop/content/Inspector
In directory cvs.zope.org:/tmp/cvs-serv17260/moztop/content/Inspector
Modified Files:
ExplorerOverlay.xul Sites.js SitesOverlay.xul
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/Inspector/ExplorerOverlay.xul 1.4 => 1.5 ===
--- Packages/Moztop/moztop/content/Inspector/ExplorerOverlay.xul:1.4 Mon Jan 13 17:54:42 2003
+++ Packages/Moztop/moztop/content/Inspector/ExplorerOverlay.xul Mon Jan 13 21:43:46 2003
@@ -5,8 +5,7 @@
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<tabpanel id="explorer-panel">
-<tree flex="1" datasources="chrome://moztop/content/Data/foldercontents.rdf"
- ref="urn:explorer:data" style="width:20em;" id="navigationtree"
+<tree flex="1" datasources="rdf:null" style="width:20em;" id="navigationtree"
containment="http://home.netscape.com/NC-rdf#subitems"
onselect="showtitle(event); return false;">
<treecols>
=== Packages/Moztop/moztop/content/Inspector/Sites.js 1.3 => 1.4 ===
--- Packages/Moztop/moztop/content/Inspector/Sites.js:1.3 Mon Jan 13 15:47:15 2003
+++ Packages/Moztop/moztop/content/Inspector/Sites.js Mon Jan 13 21:43:46 2003
@@ -1,61 +1,54 @@
-var RDFCUtils = '@mozilla.org/rdf/container-utils;1';
-RDFCUtils = Components.classes[RDFCUtils].getService();
-RDFCUtils = RDFCUtils.QueryInterface(
- Components.interfaces.nsIRDFContainerUtils);
-
-var RDFC = '@mozilla.org/rdf/container;1';
-RDFC = Components.classes[RDFC].createInstance();
-RDFC = RDFC.QueryInterface(Components.interfaces.nsIRDFContainer);
-
-var RDF2 =
+var RDF =
Components
.classes["@mozilla.org/rdf/rdf-service;1"]
.getService(Components.interfaces.nsIRDFService);
+var sites_source =
+ Components
+ .classes["@mozilla.org/rdf/datasource;1?name=in-memory-datasource"]
+ .createInstance(Components.interfaces.nsIRDFDataSource);
+
+/* Initialize the Sites datasource */
+function initSites() {
+ var tree = document.getElementById("sites-tree");
+ tree.database.AddDataSource(sites_source);
+ tree.setAttribute("ref", "urn:sites:data");
+ addSite('test.com', '8081', 'srichter', 'bar');
+}
+
function addSite(servername, serverport, username, password) {
- tree = document.getElementById("sites-tree");
- source = tree.database.GetDataSources().getNext();
- source = source.QueryInterface(Components.interfaces.nsIRDFDataSource);
var root = "urn:sites:" + servername+"_"+serverport
- source.Assert(RDF2.GetResource(root),
- RDF2.GetResource("http://www.zope.org/rdf/site#servername"),
- RDF2.GetLiteral(servername),
+ sites_source.Assert(RDF.GetResource(root),
+ RDF.GetResource("http://www.zope.org/rdf/site#servername"),
+ RDF.GetLiteral(servername),
true);
- source.Assert(RDF2.GetResource(root),
- RDF2.GetResource("http://www.zope.org/rdf/site#serverport"),
- RDF2.GetLiteral(serverport),
+ sites_source.Assert(RDF.GetResource(root),
+ RDF.GetResource("http://www.zope.org/rdf/site#serverport"),
+ RDF.GetLiteral(serverport),
true);
- source.Assert(RDF2.GetResource(root),
- RDF2.GetResource("http://www.zope.org/rdf/site#username"),
- RDF2.GetLiteral(username),
+ sites_source.Assert(RDF.GetResource(root),
+ RDF.GetResource("http://www.zope.org/rdf/site#username"),
+ RDF.GetLiteral(username),
true);
- source.Assert(RDF2.GetResource(root),
- RDF2.GetResource("http://www.zope.org/rdf/site#password"),
- RDF2.GetLiteral(password),
+ sites_source.Assert(RDF.GetResource(root),
+ RDF.GetResource("http://www.zope.org/rdf/site#password"),
+ RDF.GetLiteral(password),
true);
- source.Assert(RDF2.GetResource("urn:sites:data"),
- RDF2.GetResource("http://www.zope.org/rdf/site#child"),
- RDF2.GetLiteral(root),
+ sites_source.Assert(RDF.GetResource("urn:sites:data"),
+ RDF.GetResource("http://www.zope.org/rdf/site#child"),
+ RDF.GetLiteral(root),
true);
-
- // Write it all out.
- RDFCUtils.MakeSeq(source, RDF2.GetResource("urn:sites:data"));
- RDFC.Init(source, RDF2.GetResource("urn:sites:data"));
- RDFC.AppendElement(RDF2.GetResource(root), true);
- source.QueryInterface(
- Components.interfaces.nsIRDFRemoteDataSource).Flush();
- tree.builder.rebuild();
}
+
function deleteSelectedSite() {
var tree = document.getElementById("sites-tree");
- source = tree.database.GetDataSources().getNext();
- source = source.QueryInterface(Components.interfaces.nsIRDFDataSource);
+ alert(tree.builder);
var start = new Object();
var end = new Object();
var numRanges = tree.view.selection.getRangeCount();
@@ -66,16 +59,10 @@
var builder = tree.builder.QueryInterface(
Components.interfaces.nsIXULTreeBuilder)
rdf = builder.getResourceAtIndex(v)
- source.Unassert(RDF2.GetResource("urn:sites:data"),
- RDF2.GetResource("http://www.zope.org/rdf/site#child"),
- RDF2.GetResource(rdf.Value));
- RDFCUtils.MakeSeq(source, RDF2.GetResource("urn:sites:data"));
- RDFC.Init(source, RDF2.GetResource("urn:sites:data"));
- RDFC.RemoveElement(RDF2.GetResource(rdf.Value), true);
+ sites_source.Unassert(RDF.GetResource("urn:sites:data"),
+ RDF.GetResource("http://www.zope.org/rdf/site#child"),
+ RDF.GetResource(rdf.Value));
}
}
- source.QueryInterface(
- Components.interfaces.nsIRDFRemoteDataSource).Flush();
- tree.builder.rebuild();
}
=== Packages/Moztop/moztop/content/Inspector/SitesOverlay.xul 1.1.1.1 => 1.2 ===
--- Packages/Moztop/moztop/content/Inspector/SitesOverlay.xul:1.1.1.1 Sun Jan 12 17:30:15 2003
+++ Packages/Moztop/moztop/content/Inspector/SitesOverlay.xul Mon Jan 13 21:43:46 2003
@@ -8,14 +8,14 @@
<tabpanel id="sites-panel">
-<button onclick="addSite('test.com', '8081', 'test', 'test');"
+<button onclick="addSite('test5.com', '8081', 'test', 'test');"
label="Add Site" />
<button onclick="deleteSelectedSite();" label="Delete Site" />
<tree id="sites-tree" flex="1"
+ datasources="rdf:null"
flags="dont-build-content"
- datasources="chrome://moztop/content/Data/connections.rdf"
- ref="urn:sites:data">
+ containment="http://www.zope.org/rdf/site#child">
<treecols>
<treecol id="servername" label="Server Name" primary="true" flex="10"/>
<splitter/>