[Zope-CVS] CVS: Packages/Moztop/moztop/content/workspace - dtmlpagebindings.xml:1.1 folderbindings.xml:1.1 genericviewer.xml:1.1 zptpagebindings.xml:1.1 folderbindings.xbl:1.3 workspaceoverlay.xul:1.2 zptpagebindings.xbl:1.2
Paul Everitt
paul@zope.com
Wed, 26 Mar 2003 06:04:29 -0500
Update of /cvs-repository/Packages/Moztop/moztop/content/workspace
In directory cvs.zope.org:/tmp/cvs-serv23170/workspace
Modified Files:
folderbindings.xbl workspaceoverlay.xul zptpagebindings.xbl
Added Files:
dtmlpagebindings.xml folderbindings.xml genericviewer.xml
zptpagebindings.xml
Log Message:
Widgets are now constructing themselves based on stuff in
genericviewerbinding.xml. Turned New into a menu button with
Folder, ZPT Page, and Site in it. Beginning of PROPFIND support
for sniffing the DAV source property when opening a resource.
=== Added File Packages/Moztop/moztop/content/workspace/dtmlpagebindings.xml ===
<?xml version="1.0" encoding="iso-latin-1"?>
<bindings
xmlns="http://www.mozilla.org/xbl"
xmlns:html="http://www.w3.org/1999/xhtml"
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<binding id="dtmlpageviewerbinding" extends="genericviewer.xml#genericviewerbinding">
<content>
<xul:vbox flex="1">
<xul:hbox>
<xul:button label="Save"
oncommand="document.getBindingParent(this).save()"/>
<xul:button label="Delete"
oncommand="document.getBindingParent(this).remove()"/>
<xul:spacer flex="1"/>
</xul:hbox>
<xul:tabbox flex="1">
<xul:tabs>
<xul:tab label="Content"/>
<xul:tab label="Meta Data"/>
<xul:tab label="Preview"/>
</xul:tabs>
<xul:tabpanels flex="1">
<xul:dtmlpagecontentpanel flex="1"/>
<xul:dtmlpagemetadatapanel flex="1"/>
<xul:dtmlpagepreviewpanel flex="1"/>
</xul:tabpanels>
</xul:tabbox>
</xul:vbox>
</content>
</binding>
<binding id="dtmlpagecontentpanelbinding" extends="xul:tabpanel">
<content orient="vertical">
<xul:textbox id="field_source" anonid="content_source"
value="" flex="1" multiline="true"
style="font-family: monospace; font-size: 12pt"/>
</content>
<implementation>
<constructor>
</constructor>
</implementation>
</binding>
<binding id="dtmlpagemetadatapanelbinding" extends="xul:tabpanel">
<content orient="vertical">
<xul:groupbox>
<xul:caption label="Edit"/>
<xul:grid flex="1">
<xul:columns>
<xul:column/>
<xul:column flex="1"/>
</xul:columns>
<xul:rows>
<xul:row>
<xul:label control="field_title" value="Title"/>
<xul:textbox id="field_title" flex="1"/>
</xul:row>
<xul:row>
<xul:label control="field_description" value="Description"/>
<xul:textbox id="field_description" flex="1"/>
</xul:row>
<xul:row>
<xul:label value="Created on:" />
<xul:label id="field_created" value="01/01/2003" />
</xul:row>
<xul:row>
<xul:label value="Last modified on:" />
<xul:label id="field_modified" value="01/01/2003" />
</xul:row>
</xul:rows>
</xul:grid>
<xul:box orient="horizontal">
<xul:button onclick="saveMetaData()" label="Save" />
<xul:button onclick="loadMetaData()" label="Refresh" />
<xul:spring flex="100%" />
</xul:box>
</xul:groupbox>
</content>
<implementation>
<constructor>
</constructor>
</implementation>
</binding>
<binding id="dtmlpagepreviewpanelbinding" extends="xul:tabpanel">
<content orient="vertical">
<xul:iframe id="preview-frame" src="" flex="1"/>
<xul:box orient="horizontal">
<xul:button onclick="loadPreview();" label="Reload Content" />
<xul:spring flex="100%" />
</xul:box>
</content>
<implementation>
<constructor>
// The constructor assumes that 'urn' is defined in this scope
var iframe = document.getElementById('preview-frame');
iframe.setAttribute("src", urn);
</constructor>
</implementation>
</binding>
</bindings>
=== Added File Packages/Moztop/moztop/content/workspace/folderbindings.xml ===
<?xml version="1.0" encoding="iso-latin-1"?>
<bindings
xmlns="http://www.mozilla.org/xbl"
xmlns:html="http://www.w3.org/1999/xhtml"
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<binding id="folderviewerbinding" extends="genericviewer.xml#genericviewerbinding">
<content>
<xul:vbox flex="1">
<xul:hbox>
<xul:button label="Save" oncommand="document.getBindingParent(this).save()"/>
<xul:spacer flex="1"/>
</xul:hbox>
<xul:tabbox flex="1">
<xul:tabs>
<xul:tab label="Contents"/>
<xul:tab label="Preview"/>
</xul:tabs>
<xul:tabpanels flex="1">
<xul:foldercontentspanel flex="1"/>
<xul:folderpreviewpanel flex="1"/>
</xul:tabpanels>
</xul:tabbox>
</xul:vbox>
</content>
<implementation>
<field name="urn"/>
<field name="resourcetitle"/>
<property name="content">
<getter>
return null;
</getter>
</property>
<constructor>
</constructor>
<method name="save">
<body><![CDATA[
var targetcontainer = sitesmanager.getSelectedResource();
if (!targetcontainer) {
alert("Please select a folder");
return;
}
var davclient = new DavClient();
davclient.PUT("http://localhost:8380/newfolderA",null,"Folder");
]]></body>
</method>
</implementation>
</binding>
<binding id="foldercontentspanelbinding" extends="xul:tabpanel">
<content>
<xul:vbox flex="10">
<xul:tree flex="10"
style="width: 20em; height: 10em"
id="foldercontentstree" ref="urn:moztop:sites"
datasources="rdf:null"
containment="http://home.netscape.com/NC-rdf#subitems">
<xul:treecols>
<xul:treecol id="ResourceNameColumn" label="Name" primary="true" flex="1"/>
<xul:splitter class="tree-splitter"/>
<xul:treecol id="TypeColumn" label="Type" flex="1"/>
</xul:treecols>
<xul:template>
<xul:rule>
<xul:conditions>
<xul:content uri="?uri" />
<xul:triple subject="?uri"
predicate="http://home.netscape.com/NC-rdf#subitems"
object="?subitems" />
<xul:member container="?subitems" child="?subitem" />
</xul:conditions>
<xul:bindings>
<xul:binding subject="?subitem"
predicate="http://www.oscom.org/rdf#resourcetype"
object="?resourcetype" />
<xul:binding subject="?subitem"
predicate="http://www.purl.org/dc/1.1#title"
object="?name" />
<xul:binding subject="?resourcetype"
predicate="http://www.purl.org/dc/1.1#title"
object="?resourcetypetitle"/>
<xul:binding subject="?resourcetype"
predicate="http://www.oscom.org/rdf#styleid"
object="?styleid"/>
</xul:bindings>
<xul:action>
<xul:treechildren flex="1">
<xul:treeitem uri="?subitem">
<xul:treerow>
<xul:treecell properties="zope-?styleid" label="?name"/>
<xul:treecell label="?resourcetypetitle"/>
</xul:treerow>
</xul:treeitem>
</xul:treechildren>
</xul:action>
</xul:rule>
</xul:template>
</xul:tree>
</xul:vbox>
</content>
<implementation>
<constructor>
// The constructor assumes that 'urn' is defined in this scope
var tree = document.getAnonymousNodes(this)[0].childNodes[0];
var navtree = document.getElementById(sitesmanager.treeId);
sources = navtree.database.GetDataSources();
sources.getNext();
while (sources.hasMoreElements()) {
tree.database.AddDataSource(sources.getNext());
}
tree.ref = urn;
tree.builder.rebuild();
</constructor>
</implementation>
</binding>
<binding id="folderpreviewpanelbinding" extends="xul:tabpanel">
<content orient="vertical">
<xul:iframe id="preview-frame" src="" flex="1"/>
<xul:box orient="horizontal">
<xul:button onclick="loadPreview();" label="Reload Content" />
<xul:spring flex="100%" />
</xul:box>
</content>
<implementation>
<constructor>
// The constructor assumes that 'urn' is defined in this scope
var iframe = document.getElementById('preview-frame');
iframe.setAttribute("src", urn);
</constructor>
</implementation>
</binding>
</bindings>
=== Added File Packages/Moztop/moztop/content/workspace/genericviewer.xml ===
<?xml version="1.0"?>
<bindings xmlns="http://www.mozilla.org/xbl" xmlns:xbl="http://www.mozilla.org/xbl" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<binding id="genericviewerbinding" extends="xul:tabpanel">
<implementation>
<field name="urn"/>
<field name="resourcetitle"/>
<field name="sourceurl"/>
<property name="content">
<getter>
/* First grab this tab widget, then grab the current contents */
var xulns = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
var thisobj = document.getAnonymousNodes(this)[0]
.getElementsByTagNameNS(xulns,"tabpanels")[0].selectedPanel;
var textbox = document
.getAnonymousElementByAttribute(thisobj,
"anonid","content_source");
return textbox.value;
</getter>
<setter>
/* First grab this tab widget, then grab the current contents */
dump("\nin content.setter");
var xulns = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
var thisobj = document.getAnonymousNodes(this)[0]
.getElementsByTagNameNS(xulns,"tabpanels")[0].selectedPanel;
var textbox = document
.getAnonymousElementByAttribute(thisobj,
"anonid","content_source");
textbox.value=val;
return val;
</setter>
</property>
<method name="save">
<body><![CDATA[
var url = this.getAttribute("urn");
// First test, is this a new resource or existing one ?
// A new resource has the weird urn from drafts
if (url == "urn:localsite:drafts:untitled1") {
var targetcontainer = sitesmanager.getSelectedResource();
if (!targetcontainer) {
alert("Please select a folder for " + url);
return;
}
}
var davclient = new DavClient();
davclient.PUT(url,this.content,"PageTemplate");
]]></body>
</method>
<method name="remove">
<body><![CDATA[
/* Sequence: issue delete on server, delete from tree, close tab */
var url = this.getAttribute("urn");
var davclient = new DavClient();
davclient.DELETE("http://localhost:8380/newfolderA");
]]></body>
</method>
<method name="getSourceURL">
<body><![CDATA[
/* Called by the contructor and refresh to get this object's content */
var url = this.getAttribute("urn");
/* First retrieve the DAV source property */
function callback (responseXML, callbackObj) {
/* Called back by the JS DAV PROPFIND function to save state */
dump("\nstarting getSourceURL callback");
var dst = responseXML.getElementsByTagNameNS("DAV:", "dst")[0]
.firstChild.nodeValue;
callbackObj.setAttribute("sourceurl", dst);
callbackObj.getContent();
dump("\nfinishing getSourceURL callback with D:dst=" + dst);
return;
}
var jsdav = new DavClient();
jsdav.callbackObj = this;
var pf = new PropFind();
var p = new Prop("DAV:");
p.addProperty("source");
pf.addProp(p);
jsdav.PROPFIND(url, pf, null, callback);
return;
]]></body>
</method>
<method name="getContent">
<body><![CDATA[
dump("\nstarting getContent");
/* Called by the contructor and refresh to get this object's content */
var sourceurl = this.getAttribute("sourceurl");
/* First retrieve the DAV source property */
function callback (request, callbackObj) {
/* Called back by the JS DAV GET function to save state */
dump("\nstarting getContent callback");
dump("\nrequest.responseText is " + request.responseText);
callbackObj.setAttribute("content", request.responseText);
dump("\nfinishing getContent callback");
return;
}
var jsdav = new DavClient();
jsdav.callbackObj = this;
jsdav.GET(sourceurl, callback);
return;
]]></body>
</method>
<constructor>
this.getSourceURL();
return;
</constructor>
</implementation>
</binding>
<binding id="XXXXXXXgenericviewerbinding" extends="xul:tabpanel">
<content>
<xul:tabbox flex="1">
<xul:tabs oncommand="document.getBindingParent(this).onTabsClick(this);">
<xul:tab label="Contents"/>
<xul:tab label="Source"/>
<xul:tab label="Preview"/>
<xul:tab label="Properties"/>
<xul:tab label="Web Manage"/>
</xul:tabs>
<xul:tabpanels>
<xul:tabpanel flex="1">
<xul:textbox value="Some sample text" flex="1"/>
</xul:tabpanel>
<xul:tabpanel>
<xul:sourceditor/>
</xul:tabpanel>
<xul:tabpanel>
<xul:preview/>
</xul:tabpanel>
<xul:tabpanel>
<xul:label/>
</xul:tabpanel>
<xul:tabpanel>
<xul:label/>
</xul:tabpanel>
</xul:tabpanels>
</xul:tabbox>
<xul:button label="save"/>
</content>
<implementation>
<field name="urn"/>
<field name="resourcetitle"/>
<field name="sourceurl"/>
<field name="previewurl"/>
<field name="saveurl"/>
<constructor>
<![CDATA[
// code by paul
var folderviewer = document.getAnonymousNodes(this)[0].parentNode;
var parent = folderviewer.parentNode.parentNode;
var tabs = parent.getElementsByTagName("tabs")[0];
var rt = this.resourcetitle;
var thistab = document.createElement("tab");
thistab.setAttribute("label",rt);
thistab.setAttribute("id",rt + "-tab");
tabs.appendChild(thistab);
tabs.selectedItem = thistab;
// code by chregu
this.currentPanelEditWidget = document.getAnonymousNodes(this)[0].getElementsByTagNameNS("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul","tabpanels")[0].selectedPanel.childNodes[0];
]]>
</constructor>
<property name="content">
<getter>
return this.currentPanelEditWidget.content;
</getter>
</property>
<method name="onTabsClick">
<parameter name="tabs"/>
<body>
<![CDATA[
tab = tabs.parentNode.selectedTab;
panel = tabs.parentNode.selectedPanel;
panelwidget = panel.childNodes[0];
if (panelwidget.update()) {
this.currentPanelEditWidget = panelwidget;
}
]]>
</body>
</method>
<method name="checkResponse">
<parameter name="xmlHttpReq"/>
<body><![CDATA[
if ((xmlHttpReq.status>=200) && (xmlHttpReq.status<300)) {
window.defaultStatus = "saved successfully";
} else {
alert("save failed with code " + xmlHttpReq.status +
"and message '" + xmlHttpReq.statusText + "'");
}
]]></body>
</method>
<method name="saveIt">
<body>
this.perform("PUT");
</body>
</method>
<method name="deleteIt">
<body>
this.perform("DELETE");
</body>
</method>
<method name="perform">
<parameter name="method"/>
<body>
dump("Starting to save...");
if (this.saveurl != "") {
/*
var p = new XMLHttpRequest();
p.targetcontainer = sitesds.getSelectedResource();
if (!p.targetcontainer) {
alert("Please select a folder");
return;
}
p.thisobj = this;
p.onload = function(e) {
p = e.target;
dump("RESPONSE \n"+ p.responseText);
/* Now add a node to the tree */
var compositeds = sitesds.getCompositeDS();
var node = compositeds.getNode(p.thisobj.sourceurl);
var articleprop = "urn:oscom:resourcetypes:article";
var articleres = compositeds.getNode(articleprop);
node.addTarget(sitesds.resourcetypeprop,articleres);
node.addTarget(sitesds.titleprop,p.thisobj.resourcetitle);
var subitems = p.targetcontainer.getTarget(sitesds.subitemsprop);
subitems.addChild(node);
dump("\nresource added to tree");
}
p.open("PUT",this.saveurl);
p.send(this.content,true);
*/
var xmlHttpReq = new XMLHttpRequest();
xmlHttpReq.container = this;
xmlHttpReq.onload = function(event) {
xmlHttpReq = event.target;
xmlHttpReq.container.checkResponse(xmlHttpReq);
}
xmlHttpReq.open(method,this.saveurl);
xmlHttpReq.send(this.content,true);
}
else {
alert("no saveurl provided");
}
</body>
</method>
</implementation>
</binding>
<binding id="genericsourceeditor" extends="#genericwidget">
<content>
<xul:vbox flex="1">
<xul:textbox name="sourceedit" height="300px" flex="1"/>
</xul:vbox>
</content>
<implementation>
<constructor>
this.sourceFrame = document.getAnonymousNodes(this)[0].getElementsByAttribute('name','sourceedit')[0];
</constructor>
<property name="content">
<getter>
return(this.sourceFrame.value);
</getter>
<setter>
this.sourceFrame.value = val;
</setter>
</property>
<method name="update">
<body>
this.content = this.parentWidget.content;
return true;
</body>
</method>
</implementation>
</binding>
<binding id="genericpreview">
<content>
<xul:vbox flex="1">
<xul:iframe id="iframe" flex="1" src=""/>
</xul:vbox>
</content>
<implementation>
<method name="update">
<body>
var ifr = document.getAnonymousNodes(this)[0].getElementsByTagNameNS('http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul','iframe')[0];
if (!ifr.getAttribute('src')) {
ifr.setAttribute('src',document.getBindingParent(this).previewurl);
} else {
ifr.webNavigation.reload(ifr.webNavigation.LOAD_FLAGS_NONE);
}
return false;
</body>
</method>
</implementation>
</binding>
<binding id="genericwidget">
<implementation>
<constructor>
this.parentWidget = document.getBindingParent(this);
</constructor>
</implementation>
</binding>
</bindings>
=== Added File Packages/Moztop/moztop/content/workspace/zptpagebindings.xml ===
<?xml version="1.0" encoding="iso-latin-1"?>
<bindings
xmlns="http://www.mozilla.org/xbl"
xmlns:html="http://www.w3.org/1999/xhtml"
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<binding id="zptpageviewerbinding" extends="genericviewer.xml#genericviewerbinding">
<content>
<xul:vbox flex="1">
<xul:hbox>
<xul:button label="Save" oncommand="document.getBindingParent(this).save()"/>
<xul:button label="Delete" oncommand="document.getBindingParent(this).delete()"/>
<xul:spacer flex="1"/>
</xul:hbox>
<xul:tabbox flex="1">
<xul:tabs>
<xul:tab label="Content"/>
<xul:tab label="Meta Data"/>
<xul:tab label="Preview"/>
</xul:tabs>
<xul:tabpanels flex="1">
<xul:zptpagecontentpanel flex="1"/>
<xul:zptpagemetadatapanel flex="1"/>
<xul:zptpagepreviewpanel flex="1"/>
</xul:tabpanels>
</xul:tabbox>
</xul:vbox>
</content>
<implementation>
<constructor>
</constructor>
</implementation>
</binding>
<binding id="zptpagecontentpanelbinding" extends="xul:tabpanel">
<content orient="vertical">
<xul:textbox id="field_source" anonid="content_source"
value="" flex="1" multiline="true"
style="font-family: monospace; font-size: 12pt"/>
</content>
<implementation>
<constructor>
</constructor>
</implementation>
</binding>
<binding id="zptpagemetadatapanelbinding" extends="xul:tabpanel">
<content orient="vertical">
<xul:groupbox>
<xul:caption label="Edit"/>
<xul:grid flex="1">
<xul:columns>
<xul:column/>
<xul:column flex="1"/>
</xul:columns>
<xul:rows>
<xul:row>
<xul:label control="field_title" value="Title"/>
<xul:textbox id="field_title" flex="1"/>
</xul:row>
<xul:row>
<xul:label control="field_description" value="Description"/>
<xul:textbox id="field_description" flex="1"/>
</xul:row>
<xul:row>
<xul:label value="Created on:" />
<xul:label id="field_created" value="01/01/2003" />
</xul:row>
<xul:row>
<xul:label value="Last modified on:" />
<xul:label id="field_modified" value="01/01/2003" />
</xul:row>
</xul:rows>
</xul:grid>
<xul:box orient="horizontal">
<xul:button onclick="saveMetaData()" label="Save" />
<xul:button onclick="loadMetaData()" label="Refresh" />
<xul:spring flex="100%" />
</xul:box>
</xul:groupbox>
</content>
<implementation>
<constructor>
</constructor>
</implementation>
</binding>
<binding id="zptpagepreviewpanelbinding" extends="xul:tabpanel">
<content orient="vertical">
<xul:iframe id="preview-frame" src="" flex="1"/>
<xul:box orient="horizontal">
<xul:button onclick="loadPreview();" label="Reload Content" />
<xul:spring flex="100%" />
</xul:box>
</content>
<implementation>
<constructor>
// The constructor assumes that 'urn' is defined in this scope
var iframe = document.getElementById('preview-frame');
iframe.setAttribute("src", urn);
</constructor>
</implementation>
</binding>
</bindings>
=== Packages/Moztop/moztop/content/workspace/folderbindings.xbl 1.2 => 1.3 ===
--- Packages/Moztop/moztop/content/workspace/folderbindings.xbl:1.2 Sat Mar 22 20:33:59 2003
+++ Packages/Moztop/moztop/content/workspace/folderbindings.xbl Wed Mar 26 06:04:28 2003
@@ -6,6 +6,11 @@
<binding id="folderviewerbinding" extends="xul:tabpanel">
<content>
+ <xul:vbox flex="1">
+ <xul:hbox>
+ <xul:button label="Save" oncommand="document.getBindingParent(this).save()"/>
+ <xul:spacer flex="1"/>
+ </xul:hbox>
<xul:tabbox flex="1">
<xul:tabs>
@@ -19,6 +24,7 @@
</xul:tabpanels>
</xul:tabbox>
+ </xul:vbox>
</content>
<implementation>
@@ -26,6 +32,15 @@
<field name="resourcetitle"/>
<constructor>
</constructor>
+ <method name="save">
+ <body>
+ var targetcontainer = sitesmanager.getSelectedResource();
+ if (!targetcontainer) {
+ alert("Please select a folder");
+ return;
+ }
+ </body>
+ </method>
</implementation>
</binding>
@@ -91,6 +106,7 @@
<implementation>
<constructor>
// The constructor assumes that 'urn' is defined in this scope
+ return;
var tree = document.getAnonymousNodes(this)[0].childNodes[0];
var navtree = document.getElementById(sitesmanager.treeId);
sources = navtree.database.GetDataSources();
=== Packages/Moztop/moztop/content/workspace/workspaceoverlay.xul 1.1 => 1.2 ===
--- Packages/Moztop/moztop/content/workspace/workspaceoverlay.xul:1.1 Thu Mar 20 09:33:38 2003
+++ Packages/Moztop/moztop/content/workspace/workspaceoverlay.xul Wed Mar 26 06:04:28 2003
@@ -7,9 +7,13 @@
<tabbox id="active-contents" orient="vertical" flex="1">
+ <hbox>
<tabs id="active-contents-tabs" orient="horizontal">
<tab label="Welcome" />
</tabs>
+ <spacer flex="1"/>
+ <button label="Close Tab" oncommand="removeActiveContentTab();"/>
+ </hbox>
<tabpanels id="active-contents-tabpanels" flex="100%">
<tabpanel id="Welcome-Panel" orient="vertical"
=== Packages/Moztop/moztop/content/workspace/zptpagebindings.xbl 1.1 => 1.2 ===
--- Packages/Moztop/moztop/content/workspace/zptpagebindings.xbl:1.1 Sun Mar 23 00:47:39 2003
+++ Packages/Moztop/moztop/content/workspace/zptpagebindings.xbl Wed Mar 26 06:04:28 2003
@@ -4,7 +4,7 @@
xmlns:html="http://www.w3.org/1999/xhtml"
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
- <binding id="zptpageviewerbinding" extends="xul:tabpanel">
+ <binding id="zptpageviewerbinding" extends="genericviewer.xml#genericviewerbinding">
<content>
<xul:tabbox flex="1">