[Zope-CVS] CVS: Packages/Moztop/moztop/content/messages - datasourcebrowser.xul:1.1 rdfbrowser.js:1.1 rdfbrowseroverlay.xul:1.1 messagesoverlay.xul:1.2

Paul Everitt paul@zope.com
Sat, 22 Mar 2003 09:27:34 -0500


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

Modified Files:
	messagesoverlay.xul 
Added Files:
	datasourcebrowser.xul rdfbrowser.js rdfbrowseroverlay.xul 
Log Message:
Added beginnings of an RDF browser, minor cleanups in data source managers

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

<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
<?xml-stylesheet href="chrome://moztop/skin" type="text/css"?>

<dialog
   title      = "Moztop RDF Browser"
   id         = "moztop-rdfbrowser-window"
   xmlns      = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
   xmlns:html = "http://www.w3.org/1999/xhtml"
   width      = "640"
   height     = "480"
   orient     = "vertical"
   persist    = "screenX screenY width height sizemode"
   onload     = "initRDFBrowser()">

  <script src="chrome://moztop/content/lib/rdfds.js"/>
  <script>

    function initRDFBrowser () {


        /* The navigation tree was passed in as the first argument */
	var tree = window.arguments[0];

	var sources = tree.database.GetDataSources();
	if (sources.hasMoreElements()) {
	    dump("\nanother...");
	    thisdatasource = new RDFDataSource();
	    dsource=sources.getNext();
	    thisdatasource.Init(dsource);
	    dump("\n" + thisdatasource.serializeToString());
        } 
    }

  </script>

  <vbox id="rdf-datasources" style="font-size: xx-small">
    <label value="RDF Datasources" 
	   style="font-size: 2em; font-weight: bold"/>

  </vbox>

</dialog>


=== Added File Packages/Moztop/moztop/content/messages/rdfbrowser.js ===
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */


function numberOfResources(rdfdsource) {
    /* Given an RDFNode, return an integer with the number of nodes */

    return 20;

    var nodes = rdfdsource.getAllResources();

    var i = 0;

    while (nodes.hasMoreElements) {
	i++;
	nodes.getNext();
    }

    return i;
}


function makeTabPanel (rdfdsource) {
    /* Build a tabpanel for the serialized contents of a datasource */

    var tabpanel = document.createElement("tabpanel");
    var serialized = rdfdsource.serializeToString();


    var newdescription = document
	.createElementNS("http://www.w3.org/1999/xhtml","div");
    var newtextnode = document.createTextNode(serialized);
    newdescription.appendChild(newtextnode);
    newdescription.setAttribute("style","white-space: pre; overflow: scroll; height: 20em;width: 30em; background-color: white");
    newdescription.appendChild(newtextnode);
    tabpanel.appendChild(newdescription);

    return tabpanel;
}


function updateRDFBrowser() {

    /* Called by the Recalculate button, calcs and builds the tabpanel */

    /* Grab the relevant elements used by all functions */
    var rdftabs = document.getElementById("rdfbrowser-tabs");
    var rdftabpanels = document.getElementById("rdfbrowser-tabpanels");
    var rdfsummary = document.getElementById("rdfbrowser-summary-vbox");
    var tree = document.getElementById(sitesmanager.elementid);

    var sources = tree.database.GetDataSources();

    /* Clear out the existing stuff */


    /* Now iterate over everything and create elements */
    while (sources.hasMoreElements()) {
	var rdfdsource = new RDFDataSource();
	dsource = sources.getNext();
	rdfdsource.Init(dsource);
	var urn = dsource.URI;

	var amsg = document.createElement("description");
	var amsgtext = urn + ": " + numberOfResources(rdfdsource);
	var amsgtext = document.createTextNode(amsgtext);
	amsg.appendChild(amsgtext);
	rdfsummary.appendChild(amsg);

	/* Now create tabs for each datasource's serialized contents */
	var newtab = document.createElement("tab");
	newtab.setAttribute("label","Sites");
	var newtabpanel = makeTabPanel(rdfdsource);

	rdftabs.appendChild(newtab);
	rdftabpanels.appendChild(newtabpanel);

    } 

    return;
}



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

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

<script src="rdfbrowser.js"/>

<tabpanel id="rdfbrowser-panel" orient="vertical" flex="1">

<tabbox>

  <tabs id="rdfbrowser-tabs">
    <tab id="summary-tab" label="Summary"/>
  </tabs>

  <tabpanels id="rdfbrowser-tabpanels" flex="1">

    <tabpanel id="summary-tabpanel">
      <vbox flex="1">
        <hbox>
          <button label="Refresh" oncommand="updateRDFBrowser();"/>
          <spacer flex="1"/>
        </hbox>

        <vbox id="rdfbrowser-summary-vbox" 
	      style="background-color: white" flex="1">
	  <description value="No RDF data has been calculated."/>
        </vbox>
      </vbox>
    </tabpanel>

  </tabpanels>

</tabbox>

</tabpanel>

</overlay>


=== Packages/Moztop/moztop/content/messages/messagesoverlay.xul 1.1 => 1.2 ===
--- Packages/Moztop/moztop/content/messages/messagesoverlay.xul:1.1	Thu Mar 20 12:07:02 2003
+++ Packages/Moztop/moztop/content/messages/messagesoverlay.xul	Sat Mar 22 09:27:02 2003
@@ -3,6 +3,7 @@
 <?xul-overlay href="chrome://moztop/content/messages/logmessagesoverlay.xul"?>
 <?xul-overlay href="chrome://moztop/content/messages/tasksoverlay.xul"?>
 <?xul-overlay href="chrome://moztop/content/messages/transactionsoverlay.xul"?>
+<?xul-overlay href="chrome://moztop/content/messages/rdfbrowseroverlay.xul"?>
 
 <overlay id="MessagesOverlay"
          xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
@@ -13,12 +14,14 @@
     <tab class="messagetab" id="logmessagestab" tooltiptext="Log Messages"/>
     <tab class="messagetab" id="taskstab" tooltiptext="Tasks"/>
     <tab class="messagetab" id="transactionstab" tooltiptext="Transactions"/>
+    <tab class="messagetab" id="rdfbrowsertab" tooltiptext="Browse Datasources"/>
   </tabs>
 
   <tabpanels flex="1">
     <tabpanel id="logmessages-panel"/>
     <tabpanel id="tasks-panel"/>
     <tabpanel id="transactions-panel"/>
+    <tabpanel id="rdfbrowser-panel"/>
   </tabpanels>
 
 </tabbox>