[Zope-CVS] CVS: Packages/Moztop/moztop/content/StatusBar - LogMessageDialog.xul:1.1 StatusBarOverlay.xul:1.2 TaskManager.js:1.4
Paul Everitt
paul@zope.com
Thu, 30 Jan 2003 07:15:06 -0500
Update of /cvs-repository/Packages/Moztop/moztop/content/StatusBar
In directory cvs.zope.org:/tmp/cvs-serv8975/StatusBar
Modified Files:
StatusBarOverlay.xul TaskManager.js
Added Files:
LogMessageDialog.xul
Log Message:
Added a log manager. There is now a third tab in the status
area at the bottom. Log messages go there. Double click on a
message to get a dialog with the text.
This is the first cut at a JS prototype to work with these
tree datasources. It is explained in doc/DatasourceManagers.txt.
=== Added File Packages/Moztop/moztop/content/StatusBar/LogMessageDialog.xul ===
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/global.css" type="text/css"?>
<dialog id="logmessage" title="View Log Message"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
buttons="accept"
onload="loadMessage();"
ondialogaccept="return;">
<script>
function loadMessage () {
var msg = window.arguments[0];
var textspot=document.getElementById("textSpot");
while (textspot.childNodes.length > 0)
textspot.removeChild(textspot.childNodes[0]);
textspot.appendChild(document.createTextNode(msg));
return;
}
</script>
<html:div id="textSpot" xmlns:html="http://www.w3.org/1999/xhtml"
style="white-space: pre; overflow: scroll; height: 20em;
width: 30em; background-color: white">
</html:div>
</dialog>
=== Packages/Moztop/moztop/content/StatusBar/StatusBarOverlay.xul 1.1.1.1 => 1.2 ===
--- Packages/Moztop/moztop/content/StatusBar/StatusBarOverlay.xul:1.1.1.1 Sun Jan 12 17:30:15 2003
+++ Packages/Moztop/moztop/content/StatusBar/StatusBarOverlay.xul Thu Jan 30 07:15:03 2003
@@ -10,40 +10,12 @@
style="padding: 5px;">
<tabs orient="vertical">
- <tab label=""
- style="border: 3px solid;
- border-right: 0px;
- border-bottom-width: 3px;
- -moz-border-top-colors: #000000 #DFE2E6 #D0D7DD;
- -moz-border-right-colors: #C7D0D9 #C7D0D9 #C7D0D9;
- -moz-border-bottom-colors: #000000 #98A7B5;
- -moz-border-left-colors: #000000 #90A0B0 #98A7B5;
- -moz-border-radius-topleft: 3px;
- -moz-border-radius-topright: 0px;
- -moz-border-radius-bottomleft: 3px;
- width: 24px;
- height: 24px;
- background:
- url('chrome://moztop/content/StatusBar/task.gif');
- background-repeat: no-repeat;
- background-position: center center;"/>
- <tab label=""
- style="border: 3px solid;
- border-right: 0px;
- border-bottom-width: 3px;
- -moz-border-top-colors: #000000 #DFE2E6 #D0D7DD;
- -moz-border-right-colors: #C7D0D9 #C7D0D9 #C7D0D9;
- -moz-border-bottom-colors: #000000 #98A7B5;
- -moz-border-left-colors: #000000 #90A0B0 #98A7B5;
- -moz-border-radius-topleft: 3px;
- -moz-border-radius-topright: 0px;
- -moz-border-radius-bottomleft: 3px;
- width: 24px;
- height: 24px;
- background:
- url('chrome://moztop/content/StatusBar/errors.gif');
- background-repeat: no-repeat;
- background-position: center center;"/>
+ <tab id="statusbartasks" class="statusboxpanel"
+ style="background-image: url('chrome://moztop/content/StatusBar/task.gif');"/>
+ <tab id="statusbarerrors" class="statusboxpanel"
+ style="background-image: url('chrome://moztop/content/StatusBar/errors.gif');" />
+ <tab id="statusbarlog" class="statusboxpanel"
+ style="background-image: url('chrome://moztop/content/StatusBar/errors.gif');" />
</tabs>
<tabpanels style="border-top: 3px solid;
border-left: 1px solid;
@@ -81,6 +53,37 @@
</tree>
</tabpanel>
<tabpanel id="transactions-panel" />
+
+
+
+ <tabpanel id="logtab" orient="vertical" flex="1">
+<tree id="logmessages-tree" flex="1" ref="urn:moztop:logmessages"
+ datasources="rdf:null"
+ ondblclick="logmanager.viewSelectedMessage();">
+ <treecols>
+ <treecol id="title" label="Title" primary="true" flex="2" />
+ <splitter/>
+ <treecol id="location" label="Location" flex="1" />
+ <splitter/>
+ <treecol id="time" label="Time" flex="1" />
+ </treecols>
+
+ <template>
+ <rule>
+ <treechildren flex="1">
+ <treeitem uri="rdf:*">
+ <treerow>
+ <treecell label="rdf:http://www.zope.org/rdf/task#title"/>
+ <treecell label="rdf:http://www.zope.org/rdf/task#location"/>
+ <treecell label="rdf:http://www.zope.org/rdf/task#time"/>
+ </treerow>
+ </treeitem>
+ </treechildren>
+ </rule>
+ </template>
+</tree>
+</tabpanel>
+
</tabpanels>
</tabbox>
</overlay>
=== Packages/Moztop/moztop/content/StatusBar/TaskManager.js 1.3 => 1.4 ===
--- Packages/Moztop/moztop/content/StatusBar/TaskManager.js:1.3 Wed Jan 15 23:11:31 2003
+++ Packages/Moztop/moztop/content/StatusBar/TaskManager.js Thu Jan 30 07:15:03 2003
@@ -16,6 +16,84 @@
$Id$
******************************************************************************/
+
+var logds = null;
+
+
+
+function LogManager () {
+
+ // This prototype manages interaction with the log viewer.
+ // It creates an RDFDataSource from rdfds.js, grabs the
+ // existing datasource from the logmessages-tree. It also
+ // knows how to add messages and view the selected message.
+ // Finally, it has a method for viewing the RDF contents in
+ // a popup text box.
+
+ this.elementid = "logmessages-tree";
+ this.ds = new RDFDataSource();
+ this.urn = "urn:moztop:logmessages";
+ this.titleref = "http://www.zope.org/rdf/task#title";
+ this.locationref = "http://www.zope.org/rdf/task#location";
+ this.timeref = "http://www.zope.org/rdf/task#time";
+ this.messageref = "http://www.zope.org/rdf/task#message";
+
+ // this.loadDataSource();
+}
+
+LogManager.prototype.attachDataSource=
+ function()
+{
+
+ // This is called once, when the overlay is first
+ // loaded, to attach the datasource to the tree.
+ var lms=this.ds.getNode(this.urn);
+ lms.makeSeq();
+
+ // Now attach the datasource
+ var logmessages=document.getElementById(this.elementid);
+ logmessages.database.AddDataSource(this.ds.getRawDataSource());
+ logmessages.builder.rebuild();
+
+ // Create a log message on startup
+ this.addMessage('startup','TaskManager.attachDataSource', "Moztop started");
+ return;
+}
+
+LogManager.prototype.addMessage = function (title, location, msg) {
+
+ var d = new Date();
+ var now = d.getHours() + ":" + d.getMinutes() + ":" + d.getSeconds();
+ var rootnode = this.ds.getNode(this.urn);
+ var thismsg = this.ds.getNode(this.urn + ":" + now);
+ rootnode.addChild(thismsg);
+ thismsg.addTarget(this.titleref,title);
+ thismsg.addTarget(this.locationref,location);
+ thismsg.addTarget(this.timeref,now);
+ thismsg.addTarget(this.messageref,msg);
+
+}
+
+LogManager.prototype.viewSelectedMessage = function () {
+
+ // When a user doubleclicks on a message in the log, this
+ // is called. It finds the selected item in the tree
+ // and pops up a dialog box with the contents of the log message.
+
+ var tree = document.getElementById(this.elementid);
+ var index = tree.view.selection.currentIndex;
+ var rdf = tree.view.getItemAtIndex(index).resource;
+
+ // Grab the RDF value and popup a dialog window
+ var n = this.ds.getNode(rdf.Value);
+ var nt = n.getTarget(this.messageref);
+ window.openDialog("chrome://moztop/content/StatusBar/LogMessageDialog.xul",
+ "viewlogmessage","chrome",nt.getValue());
+ //alert('viewing log message ' + nt.getValue());
+
+}
+
+
/* Initialize Tasks datasource. */
var tasks_source =
Components
@@ -24,6 +102,10 @@
/* Initialize the data in the tree object. */
function initTaskList() {
+
+ // Remember that logmanager was defined globally, but not initialized.
+ logmanager = new LogManager();
+ logmanager.attachDataSource();
var tree = document.getElementById("tasks-tree");
tree.database.AddDataSource(tasks_source);
tree.setAttribute("ref", "urn:tasks:data");
@@ -82,4 +164,16 @@
RDF.GetResource(rdf.Value));
}
}
+}
+
+
+function viewLogMessage () {
+ var tree = document.getElementById("logmessages-tree");
+ var index = tree.view.selection.currentIndex;
+ var rdf = tree.view.getItemAtIndex(index).resource;
+
+ // Grab the datasources
+ var n = logds.getNode(rdf.Value);
+ var nt = n.getTarget("http://www.zope.org/rdf/task#title");
+ alert('viewing log message ' + nt);
}