[Zope-CVS] CVS: Packages/MoZTop/moztop/content/zopetop - contents.rdf:1.1 file.js:1.1 registry_demo.xul:1.1 tasks.rdf:1.1 test-out.rdf:1.1 test-out.xul:1.1 test-tree.rdf:1.1 test-tree.xul:1.1 zopelogo.png:1.1 zopetop:1.1 zopetop.css:1.1 zopetop.js:1.1 zopetop.xul:1.1 zopetopOverlay.xul:1.1
Stephan Richter
srichter@cbu.edu
Wed, 8 Jan 2003 14:01:43 -0500
Update of /cvs-repository/Packages/MoZTop/moztop/content/zopetop
In directory cvs.zope.org:/tmp/cvs-serv26830/moztop/content/zopetop
Added Files:
contents.rdf file.js registry_demo.xul tasks.rdf test-out.rdf
test-out.xul test-tree.rdf test-tree.xul zopelogo.png zopetop
zopetop.css zopetop.js zopetop.xul zopetopOverlay.xul
Log Message:
Moved things around to allow for a better build process.
First untested commit of the install.js file, which manages the install and
a Makefile, so building the XPI is simpler.
=== Added File Packages/MoZTop/moztop/content/zopetop/contents.rdf ===
<?xml version="1.0"?>
<RDF:RDF xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:chrome="http://www.mozilla.org/rdf/chrome#">
<RDF:Seq about="urn:mozilla:package:root">
<RDF:li resource="urn:mozilla:package:zopetop"/>
</RDF:Seq>
<RDF:Description about="urn:mozilla:package:zopetop"
chrome:displayName="Zopetop for Zope 3"
chrome:author="Zope Corp. and Contributors"
chrome:name="zopetop">
</RDF:Description>
<RDF:Seq about="urn:mozilla:overlays">
<RDF:li resource="chrome://communicator/content/tasksOverlay.xul"/>
</RDF:Seq>
<RDF:Seq about="chrome://communicator/content/tasksOverlay.xul">
<RDF:li>chrome://zopetop/content/zopetopOverlay.xul</RDF:li>
</RDF:Seq>
</RDF:RDF>
=== Added File Packages/MoZTop/moztop/content/zopetop/file.js === (677/777 lines abridged)
/*** -*- Mode: Javascript; tab-width: 2;
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 Collabnet code.
The Initial Developer of the Original Code is Collabnet.
Portions created by Collabnet are
Copyright (C) 2000 Collabnet. All
Rights Reserved.
Contributor(s): Pete Collins, Doug Turner, Brendan Eich, Warren Harris, Eric Plaster
File API (The purpose of this file is to make it a little easier to do file IO from js)
file.js
Function List
// Constructor
File(aPath) // creates the File object and sets the file path
open(aMode, aPermissions); // open a file handle for reading, writing or appending. permissions are optional.
close(); // closes a file handle
exists(); // check to see if a file exists
read(); // returns the contents of a file
readline(); // returns the next line in the file.
write(aContents); // writes the contents out to file.
eof(); // check 'end of file' status
// file attributes
permissions(); // returns the files permissions
dateModified(); // returns the last modified date in locale string
size(); // returns the file size
// file string manipulation
path(); // returns the path
leaf(); // leaf is the endmost file string ex: foo.html in /myDir/foo.html
extension(); // returns a file extension if there is one
dirPath() // returns the dir part of a path
[-=- -=- -=- 677 lines omitted -=- -=- -=-]
" dateModified();\n" +
" size();\n" +
" extension();\n" +
" dirPath();\n" +
" nsIFile();\n" +
" help();\n";
dump(help+"\n");
return "";
},
/********************* CLOSE ****************************/
close : function()
{
/***************** Destroy Instances *********************/
if(this.fileInst) delete this.fileInst;
if(this.fileChannel) delete this.fileChannel;
if(this.inputStream) delete this.inputStream;
if(this.transport) delete this.transport;
if(this.mode) this.mode=null;
if(this.outStream) {
this.outStream.close();
delete this.outStream;
}
if(this.lineBuffer) this.lineBuffer=null;
this.position = 0;
/***************** Destroy Instances *********************/
return JSFILE_OK;
},
dumpError: function(e, type, number, skipclose)
{
dump("-----======[ ERROR ]=====-----\n");
dump("Error in "+JSLIB_FILE+": "+type+"\n");
if(e) {
dump("Name: "+e.name+"\n");
dump("Message: "+e.message+"\n");
dump("Result: 0x"+e.result.toString(16)+"\n");
dump("Location: "+e.location+"\n");
}
dump("NS_ERROR_NUMBER: "+number+"\n");
dump("------------------------------\n");
if(skipclose) {
this.close();
}
return number;
}
};
=== Added File Packages/MoZTop/moztop/content/zopetop/registry_demo.xul ===
<?xml version="1.0"?> <!-- -*- Mode: HTML -*- -->
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
<window width="400" height="300"
onload="initTaskList();"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script>
<![CDATA[
var RDF =
Components
.classes["@mozilla.org/rdf/rdf-service;1"]
.getService(Components.interfaces.nsIRDFService);
var DS =
Components
.classes["@mozilla.org/rdf/datasource;1?name=in-memory-datasource"]
.createInstance(Components.interfaces.nsIRDFDataSource);
function initTaskList()
{
addTask();
// Add the datasource to the outliner
var outliner = document.getElementById("TaskList");
outliner.database.AddDataSource(DS);
outliner.setAttribute("ref", "urn:tasks:root");
}
// This will remember the index of the last child we've added
var taskCount = 0;
function addTask()
{
// Add a new child urn:tasks:1.x beneath urn:tasks:1.
DS.Assert(RDF.GetResource("urn:tasks:" + taskCount),
RDF.GetResource("http://home.netscape.com/NC-rdf#taskid"),
RDF.GetLiteral(taskCount),
true);
DS.Assert(RDF.GetResource("urn:tasks:" + taskCount),
RDF.GetResource("http://home.netscape.com/NC-rdf#name"),
RDF.GetLiteral("Add"),
true);
DS.Assert(RDF.GetResource("urn:tasks:" + taskCount),
RDF.GetResource("http://home.netscape.com/NC-rdf#descr"),
RDF.GetLiteral("DESCRIPTION " + (8 - taskCount)),
true);
DS.Assert(RDF.GetResource("urn:tasks:" + taskCount),
RDF.GetResource("http://home.netscape.com/NC-rdf#progress"),
RDF.GetLiteral("97%"),
true);
DS.Assert(RDF.GetResource("urn:tasks:root"),
RDF.GetResource("http://home.netscape.com/NC-rdf#child"),
RDF.GetResource("urn:tasks:" + taskCount),
true);
++taskCount;
}
]]>
</script>
<vbox flex="1">
<hbox>
<button onclick="addTask();" label="Make Task" />
</hbox>
<outliner flex="1" id="TaskList" datasources="rdf:null"
flags="dont-build-content"
containment="http://home.netscape.com/NC-rdf#child">
<outlinercols>
<outlinercol id="taskid" flex="1" label="Id" sort="?taskid"
primary="true" />
<splitter/>
<outlinercol id="name" label="Name" sort="?name" flex="2"/>
<splitter/>
<outlinercol id="description" label="Description" sort="?descr" flex="10"/>
<splitter/>
<outlinercol id="progress" label="Progress" sort="?progress" flex="3"/>
</outlinercols>
<template>
<rule>
<conditions>
<outlineritem uri="?uri" />
<member container="?uri" child="?task" />
</conditions>
<bindings>
<binding subject="?task"
predicate="http://home.netscape.com/NC-rdf#taskid"
object="?taskid" />
<binding subject="?task"
predicate="http://home.netscape.com/NC-rdf#name"
object="?name" />
<binding subject="?task"
predicate="http://home.netscape.com/NC-rdf#descr"
object="?descr" />
<binding subject="?task"
predicate="http://home.netscape.com/NC-rdf#progress"
object="?progress" />
</bindings>
<action>
<outlinerchildren>
<outlineritem uri="?task">
<outlinerrow>
<outlinercell label="?taskid" />
<outlinercell label="?name" />
<outlinercell label="?descr" />
<outlinercell label="?progress" />
</outlinerrow>
</outlineritem>
</outlinerchildren>
</action>
</rule>
</template>
</outliner>
</vbox>
</window>
=== Added File Packages/MoZTop/moztop/content/zopetop/tasks.rdf ===
<?xml version="1.0"?>
<RDF:RDF xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:tasks="http://www.zope.org/rdf#">
<RDF:Description about="urn:tasks:101">
<tasks:taskid>UpdateLimit</tasks:taskid>
<tasks:description>Update the item limit of {ContainerId}.</tasks:description>
<tasks:progress>70%</tasks:progress>
</RDF:Description>
<RDF:Description about="urn:tasks:102">
<tasks:taskid>DeleteItems</tasks:taskid>
<tasks:description>Deletes specified items from {ContainerId}.</tasks:description>
<tasks:progress>30%</tasks:progress>
</RDF:Description>
<RDF:Description about="urn:tasks:103">
<tasks:taskid>AddImage</tasks:taskid>
<tasks:description>Add Image {ImageId} to Container {ContainerId}.</tasks:description>
<tasks:progress>93%</tasks:progress>
</RDF:Description>
<RDF:Seq about="urn:tasks:data">
<RDF:li resource="urn:tasks:101" />
<RDF:li resource="urn:tasks:102" />
<RDF:li resource="urn:tasks:103" />
</RDF:Seq>
</RDF:RDF>
=== Added File Packages/MoZTop/moztop/content/zopetop/test-out.rdf ===
<?xml version="1.0"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:nc="http://home.netscape.com/NC-rdf#">
<rdf:Seq about="urn:root">
<rdf:li>
<rdf:Description ID="ch1" nc:name="Introduction to JavaScript" nc:page="12" />
</rdf:li>
<rdf:li>
<rdf:Description ID="ch2" nc:name="Lexical Structure" nc:page="13" />
</rdf:li>
<rdf:li>
<rdf:Description ID="ch3" nc:name="Data Types and Values" nc:page="15" />
</rdf:li>
</rdf:Seq>
<!--
<rdf:Seq about="#ch1">
<rdf:li>
<rdf:Description ID="ch1.1" nc:name="JavaScript Myths" nc:page="16" />
</rdf:li>
<rdf:li>
<rdf:Description ID="ch1.2" nc:name="JavaScript Versions" nc:page="19" />
</rdf:li>
</rdf:Seq>
<rdf:Seq about="#ch1.1">
<rdf:li>
<rdf:Description ID="ch1.1.1" nc:name="JavaScript Is Not Java" nc:page="20" />
</rdf:li>
</rdf:Seq>
<rdf:Seq about="#ch2">
<rdf:li>
<rdf:Description ID="ch2.1" nc:name="Case Sensitivity" nc:page="21" />
</rdf:li>
</rdf:Seq>
<rdf:Seq about="#ch3">
<rdf:li>
<rdf:Description ID="ch3.1" nc:name="Numbers" nc:page="30" />
</rdf:li>
</rdf:Seq>
-->
</rdf:RDF>
=== Added File Packages/MoZTop/moztop/content/zopetop/test-out.xul ===
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
<window xmlns:html="http://www.w3.org/1999/xhtml"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
align="vertical">
<outliner width="600" height="300"
datasources="test-out.rdf"
ref="urn:root">
<outlinercols>
<outlinercol id="ChapterColumn" flex="1" label="Chapter"
primary="true" />
</outlinercols>
<template>
<rule>
<outlinerchildren>
<outlineritem>
<outlinerrow>
<outlinercell label="rdf:http://home.netscape.com/NC-rdf#name" />
</outlinerrow>
</outlineritem>
</outlinerchildren>
</rule>
</template>
</outliner>
</window>
=== Added File Packages/MoZTop/moztop/content/zopetop/test-tree.rdf ===
<?xml version="1.0"?>
<RDF:RDF xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:NC="http://home.netscape.com/NC-rdf#">
<RDF:Seq ID="urn:root">
<RDF:li>
<RDF:Description ID="R0" NC:Name="Number Zero">
<NC:child>
<RDF:Description ID="R0_1" NC:Name="Number One Point One">
<NC:child>
<RDF:Description ID="R0_1_1" NC:Name="Number One Point One Point One" />
</NC:child>
</RDF:Description>
</NC:child>
<NC:child>
<RDF:Description ID="R0_2" NC:Name="Number One Point Two" />
</NC:child>
</RDF:Description>
<RDF:Description ID="R1" NC:Name="Number One">
<NC:child>
<RDF:Description ID="R1_1" NC:Name="Number One Point One">
<NC:child>
<RDF:Description ID="R1_1_1" NC:Name="Number One Point One Point One" />
</NC:child>
</RDF:Description>
</NC:child>
<NC:child>
<RDF:Description ID="R1_2" NC:Name="Number One Point Two" />
</NC:child>
</RDF:Description>
<RDF:Description ID="R2" NC:Name="Number Two" />
<RDF:Description ID="R3" NC:Name="Number Three" />
</RDF:li>
</RDF:Seq>
</RDF:RDF>
=== Added File Packages/MoZTop/moztop/content/zopetop/test-tree.xul ===
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
align="vertical" id="foo">
<tree datasources="file://Program Files/mozilla.org/Mozilla/chrome/zopetop/content/zopetop/test-tree.rdf"
flex="1"
ref="test-tree.rdf#root">
<template>
<treechildren>
<treeitem uri="rdf:*">
<treerow>
<treecell class="treecell-indent"
label="rdf:http://home.netscape.com/NC-rdf#Name" />
</treerow>
</treeitem>
</treechildren>
</template>
<treehead>
<treerow>
<treecell label="Name" />
</treerow>
</treehead>
</tree>
<outliner id="explorer" flex="1"
width="200" height="300"
datasources="rdf:test-tree.rdf"
ref="urn:root">
<outlinercols>
<outlinercol id="Name" label="Name" flex="1" primary="true"/>
</outlinercols>
<template>
<rule iscontainer="false">
<outlinerrow>
<outlinercell label="rdf:http://home.netscape.com/NC-rdf#Name"/>
</outlinerrow>
</rule>
<!--
<rule>
<outlinerchildren>
<outlineritem>
<outlinerrow>
<outlinercell label="rdf:http://home.netscape.com/NC-rdf#Name"
onclick="alert('bar');"/>
</outlinerrow>
</outlineritem>
</outlinerchildren>
</rule>
-->
</template>
</outliner>
</window>
=== Added File Packages/MoZTop/moztop/content/zopetop/zopelogo.png ===
<Binary-ish file>
=== Added File Packages/MoZTop/moztop/content/zopetop/zopetop ===
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://zopetop/content/zopetop.css" type="text/css"?>
<!--
<?xul-overlay href="chrome://zopetop/content/Menu/KeySetOverlay.xul"?>
<?xul-overlay href="chrome://zopetop/content/Menu/MenuOverlay.xul"?>
<?xul-overlay href="chrome://zopetop/content/Menu/ToolBarOverlay.xul"?>
<?xul-overlay href="chrome://zopetop/content/Inspector/InspectorOverlay.xul"?>
<?xul-overlay href="chrome://zopetop/content/Main/MainOverlay.xul"?>
<?xul-overlay href="chrome://zopetop/content/StatusBar/StatusBarOverlay.xul"?>
-->
<!DOCTYPE window [
<!ENTITY % zopetopDTD SYSTEM "chrome://zopetop/locale/zopetop.dtd">
%zopetopDTD;
]>
<window
title = "ZopeTop for Zope 3"
id = "zopetop-main-window"
xmlns = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:html = "http://www.w3.org/1999/xhtml"
width = "800"
height = "600"
orient = "vertical"
persist = "screenX screenY width height sizemode"
onload = "startProgram();"
onclose = "return closeProgram();">
<!--
<script type="application/x-javascript" src="zopetop.js"/>
<script type="application/x-javascript" src="StatusBar/TaskManager.js"/>
<keyset id="menu-keyset"/>
<toolbox>
<menubar id="zopetop-menubar"/>
<toolbar id="zopetop-toolbar"/>
</toolbox>
<box orient="horizontal" flex="10">
<tabbox id="inspector"/>
<splitter collapse="before">
<spacer flex="1"/><grippy/><spacer flex="1"/>
</splitter>
<box id="main" />
</box>
<splitter collapse="after">
<spacer flex="1"/><grippy/><spacer flex="1"/>
</splitter>
<tabbox id="statusbar"/>
-->
</window>
=== Added File Packages/MoZTop/moztop/content/zopetop/zopetop.css ===
@import url(chrome://global/skin/);
#document
{
font-size: 10pt;
}
=== Added File Packages/MoZTop/moztop/content/zopetop/zopetop.js ===
// Constants
var RDF = null;
var myDatasource = null;
//var myDatasourceURL = "file:///usr/local/mozilla/chrome/zopetop/content/zopetop/Data/foldercontents.rdf"
//var myDatasourceURL = "chrome://zopetop/content/zopetop/Data/foldercontents.rdf"
var myDatasourceURL = "http://pegasus/~ctheune/foldercontents.rdf"
function startProgram() {
setupExplorerDS();
initTaskList();
}
function closeProgram() {
}
/* 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);
}
/* 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(){
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);
}
=== Added File Packages/MoZTop/moztop/content/zopetop/zopetop.xul ===
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://zopetop/content/zopetop.css" type="text/css"?>
<?xul-overlay href="chrome://zopetop/content/Menu/KeySetOverlay.xul"?>
<?xul-overlay href="chrome://zopetop/content/Menu/MenuOverlay.xul"?>
<?xul-overlay href="chrome://zopetop/content/Menu/ToolBarOverlay.xul"?>
<?xul-overlay href="chrome://zopetop/content/Inspector/ExplorerOverlay.xul"?>
<?xul-overlay href="chrome://zopetop/content/Main/MainOverlay.xul"?>
<?xul-overlay href="chrome://zopetop/content/StatusBar/StatusBarOverlay.xul"?>
<!DOCTYPE window [
<!ENTITY % zopetopDTD SYSTEM "chrome://zopetop/locale/zopetop.dtd">
%zopetopDTD;
]>
<window
title = "ZopeTop for Zope 3"
id = "zopetop-main-window"
xmlns = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:html = "http://www.w3.org/1999/xhtml"
width = "800"
height = "600"
orient = "vertical"
persist = "screenX screenY width height sizemode"
onload = "startProgram();"
onclose = "return closeProgram();">
<script type="application/x-javascript" src="zopetop.js"/>
<script type="application/x-javascript" src="StatusBar/TaskManager.js"/>
<keyset id="menu-keyset"/>
<toolbox>
<menubar id="zopetop-menubar"/>
<toolbar id="zopetop-toolbar"/>
</toolbox>
<box orient="horizontal" flex="10">
<tree id="explorer"/>
<splitter collapse="before" />
<!-- <spacer flex="1"/><grippy/><spacer flex="1"/>
</splitter> -->
<box id="main" />
</box>
<splitter collapse="after">
<spacer flex="1"/><grippy/><spacer flex="1"/>
</splitter>
<tabbox id="statusbar"/>
</window>
=== Added File Packages/MoZTop/moztop/content/zopetop/zopetopOverlay.xul ===
<?xml version="1.0"?>
<!DOCTYPE window SYSTEM "chrome://zopetop/locale/zopetopOverlay.dtd">
<overlay id="zopetopOverlay" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script type="application/x-javascript">
function runZopetop()
{
window.openDialog('chrome://zopetop/content/', '_blank', 'chrome,dialog=no');
}
</script>
<menupopup id="taskPopup">
<menuitem label="&menu-tasks-zopetop:label;" oncommand="runZopetop();"/>
<menuseparator/>
</menupopup>
</overlay>