[Zope-CVS] CVS: Packages/Moztop/moztop/content/workspace - genericviewer.xml:1.4 zptpagebindings.xml:1.4
Paul Everitt
paul@zope.com
Mon, 7 Apr 2003 07:21:41 -0400
Update of /cvs-repository/Packages/Moztop/moztop/content/workspace
In directory cvs.zope.org:/tmp/cvs-serv22933/content/workspace
Modified Files:
genericviewer.xml zptpagebindings.xml
Log Message:
Start on properties work
=== Packages/Moztop/moztop/content/workspace/genericviewer.xml 1.3 => 1.4 ===
--- Packages/Moztop/moztop/content/workspace/genericviewer.xml:1.3 Wed Apr 2 16:39:30 2003
+++ Packages/Moztop/moztop/content/workspace/genericviewer.xml Mon Apr 7 07:21:40 2003
@@ -7,9 +7,23 @@
<binding id="genericviewerbinding" extends="xul:tabpanel">
<implementation>
<field name="urn"/>
- <field name="resourcetitle"/>
<field name="sourceurl"/>
+ <property name="resourcetitle">
+ <getter>
+ urn = this.getAttribute("urn");
+ resource = sitesmanager.getResource(urn);
+ rt = resource.getTarget(sitesmanager.titleprop).getValue();
+ return rt;
+ </getter>
+ <setter>
+ urn = this.getAttribute("urn");
+ resource = sitesmanager.getResource(urn);
+ resource.modifyTarget(sitesmanager.titleprop, this.resourcetitle,val);
+ return val;
+ </setter>
+ </property>
+
<property name="content">
<getter>
/* First grab this tab widget, then grab the current contents */
@@ -134,6 +148,19 @@
</method>
<constructor>
+ // First find out if this resource exists (via open resource) or
+ // is being created (view new resource). We'll use presence in the
+ // RDF graph as a good enough answer.
+
+ urn = this.getAttribute("urn");
+ res = sitesmanager.getResource(urn);
+ if (!res) {
+ this.createResource();
+ alert("finished createResource");
+ return;
+ }
+
+ dump("\nkdkdkd;lkjasd;fljas;fjasd fkj");
this.getSourceURL();
// Some shortcuts for grabbing subwidget elements
=== Packages/Moztop/moztop/content/workspace/zptpagebindings.xml 1.3 => 1.4 ===
--- Packages/Moztop/moztop/content/workspace/zptpagebindings.xml:1.3 Wed Apr 2 16:39:30 2003
+++ Packages/Moztop/moztop/content/workspace/zptpagebindings.xml Mon Apr 7 07:21:40 2003
@@ -20,37 +20,38 @@
<xul:tabpanels flex="1">
<xul:zptpagecontentpanel flex="1" id="content-panel"/>
<!-- <xul:midaseditor flex="1" id="content-panel"/> -->
- <xul:zptpagemetadatapanel flex="1" id="properties-panel"/>
+ <xul:zptpagemetadatapanel flex="1" value="x" id="properties-panel"/>
<xul:zptpagepreviewpanel flex="1" id="preview-panel"/>
</xul:tabpanels>
</xul:tabbox>
</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>
--->
+ <implementation>
+ <method name="createResource">
+ <body><![CDATA[
+
+ url = this.getAttribute("urn");
+ thiswidget = this;
+
+ function callback (response) {
+ // Called back by jsdav.PUT
+
+ container = sitesmanager.getSelectedResource();
+ ds = sitesmanager.getDataSource(container.datasource.URI);
+ resource = ds.getNode(url);
+ resource.modifyTarget(sitesmanager.titleprop,
+ thiswidget.resourcetitle,val);
+ alert("Made it here");
+ }
+
+ var jsdav = new DavClient();
+ jsdav.PUT(url, "", null, callback);
+ return;
+ ]]></body>
+
+ </method>
+ </implementation>
</binding>
@@ -103,6 +104,24 @@
</xul:groupbox>
</content>
+
+ <implementation>
+
+ <method name="saveMetaData">
+ <body>
+ titlebox = document.getAnonymousElementByAttribute(this,
+ "id", "field_title");
+ this.parentWidget.resourcetitle = titlebox.value;
+ </body>
+ </method>
+
+ <constructor>
+ titlebox = document.getAnonymousElementByAttribute(this,
+ "id","field_title");
+ titlebox.setAttribute("value",
+ this.parentWidget.resourcetitle);
+ </constructor>
+ </implementation>
</binding>
@@ -117,39 +136,17 @@
<implementation>
<method name="update">
<body>
- dump("\nparentwidget.tagname is " + this.parentWidget.tagName);
- dump("\nthis.parentWidget.urn is " + this.parentWidget.getAttribute("urn"));
sourceurl = this.parentWidget.getAttribute("urn");
var ifr = document.getElementById('preview-frame');
-
if (!ifr.getAttribute('src')) {
- ifr.setAttribute('src',srcurl);
+ ifr.setAttribute('src',sourceurl);
} else {
ifr.webNavigation.reload(ifr.webNavigation.LOAD_FLAGS_NONE);
}
- return false;
</body>
</method>
-
- <method name="loadPreview">
- <body>
- <![CDATA[
- var iframe = document.getElementById('preview-frame');
- urn = document.getAnonymousNodes(this)[0].getAttribute("urn");
-alert("urn is " + urn);
- iframe.setAttribute("src", this.getAttribute("urn"));
- ]]>
- </body>
- </method>
-
-
- <constructor>
- // The constructor assumes that 'urn' is defined in this scope
- var iframe = document.getElementById('preview-frame');
- iframe.setAttribute("src", urn);
- </constructor>
</implementation>
</binding>