[Zope-CVS] CVS: Packages/Moztop/moztop/content - moztop.js:1.2
Stephan Richter
srichter@cbu.edu
Mon, 13 Jan 2003 16:33:10 -0500
Update of /cvs-repository/Packages/Moztop/moztop/content
In directory cvs.zope.org:/tmp/cvs-serv6551/moztop/content
Modified Files:
moztop.js
Log Message:
You can now reload the Explorer data.
=== Packages/Moztop/moztop/content/moztop.js 1.1.1.1 => 1.2 ===
--- Packages/Moztop/moztop/content/moztop.js:1.1.1.1 Sun Jan 12 17:30:15 2003
+++ Packages/Moztop/moztop/content/moztop.js Mon Jan 13 16:32:38 2003
@@ -1,13 +1,8 @@
-// Constants
-var RDF = null;
-var myDatasource = null;
-//var myDatasourceURL = "file:///usr/local/mozilla/chrome/moztop/content/Data/foldercontents.rdf"
-//var myDatasourceURL = "chrome://moztop/content/Data/foldercontents.rdf"
-var myDatasourceURL = "http://pegasus/~ctheune/foldercontents.rdf"
+var myDatasourceURL = "http://localhost:8080/@@contents.rdf"
function startProgram() {
initTaskList();
- setupExplorerDS();
+ initExplorer();
}
function closeProgram() {
@@ -27,89 +22,25 @@
'For more information see http://www.zope.org/')
}
-/* Setting Up Explorer Data Source */
-
-var ExplorerObserver = {
- onBeginLoad: function(aSink)
- {},
-
- onInterrupt: function(aSink)
- {},
-
- onResume: function(aSink)
- {},
-
- onEndLoad: function(aSink)
- { //alert("Loading Explorer items done!");
- },
-
- onError: function(aSink, aStatus, aErrorMsg)
- { alert("error! " + aErrorMsg); }
-};
-
-
-function setupExplorerDS() {
- var ExplorerRDF = Components.classes["@mozilla.org/rdf/rdf-service;1"]
- .getService(Components.interfaces.nsIRDFService);
-
- var ds = ExplorerRDF.GetDataSource(myDatasourceURL);
-
- //var remote =
- //ds.QueryInterface(Components.interfaces.nsIRDDataSource);
-
- //var sink =
- // ds.QueryInterface(Components.interfaces.nsIRDFXMLSink);
- // sink.addXMLSinkObserver(ExplorerObserver);
-
-
- outliner = document.getElementById('explorer');
- ds.AddObserver(outliner.builder);
- outliner.database.AddDataSource(ds);
-
+/* Initialize the Explorer datasource */
+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');
+ tree.database.AddDataSource(ds);
+ tree.setAttribute("ref", "urn:explorer:data");
+ tree.builder.rebuild();
}
-
-/* Managing the active object panel */
-
-function activateSelectedObject(event) {
- /* Activate a selected object */
- var index = event.target.parentNode.currentIndex + 1;
- var label = event.target.parentNode.getElementsByTagName('outlinerrow')[index]
- .firstChild.getAttribute('label');
- addActiveObject(label)
-}
-
-function addActiveObject(label) {
- /* Add an Active Object Button to the Panel */
- var panel = document.getElementById("ActiveObjectsPanel");
- var button = document.createElement("button");
- button.setAttribute("id", label);
- button.setAttribute("label", label);
- button.setAttribute("onclick", "wakeupObject(this);");
- panel.appendChild(button);
-}
-
-function wakeupObject(obj) {
-
- var tabbox = document.getElementById('ContentObjectViews');
-
- // create tab
- var tab = document.createElement("tab");
- tab.setAttribute("id", "test");
- tab.setAttribute("label", "Test");
- tabbox.firstChild.appendChild(tab);
-
- var ol = document.getElementById('FolderContentOverlay');
- alert(ol);
-
-}
-
-
-function reloadContentData(){
+/* Reload Explorer datasource */
+function reloadContentData() {
var RDF = Components.classes["@mozilla.org/rdf/rdf-service;1"]
.getService(Components.interfaces.nsIRDFService);
-
- // Get the datasource.
var ds = RDF.GetDataSource(myDatasourceURL);
- ds.Refresh(0);
+ ds = ds.QueryInterface(
+ Components.interfaces.nsIRDFRemoteDataSource);
+ ds.Refresh(false);
+ var tree = document.getElementById('explorer');
+ tree.builder.rebuild();
}