Author: hqm
Date: 2007-08-07 13:48:53 -0700 (Tue, 07 Aug 2007)
New Revision: 5956
Added:
openlaszlo/branches/wafflecone/WEB-INF/lps/lfc/data/LzDataProvider.lzs
Modified:
openlaszlo/branches/wafflecone/WEB-INF/lps/lfc/data/Library.lzs
openlaszlo/branches/wafflecone/WEB-INF/lps/lfc/data/LzDataRequest.lzs
openlaszlo/branches/wafflecone/WEB-INF/lps/lfc/data/LzDataset.lzs
openlaszlo/branches/wafflecone/WEB-INF/lps/lfc/data/LzHTTPDataProvider.lzs
openlaszlo/branches/wafflecone/WEB-INF/lps/lfc/kernel/dhtml/LzHTTPLoader.js
openlaszlo/branches/wafflecone/WEB-INF/lps/lfc/kernel/dhtml/LzXMLTranslator.js
openlaszlo/branches/wafflecone/WEB-INF/lps/lfc/kernel/swf/LzHTTPLoader.as
openlaszlo/branches/wafflecone/WEB-INF/lps/schema/lzx.rnc
Log:
Change 20070807-hqm-8 by [EMAIL PROTECTED] on 2007-08-07 15:45:03 EDT
in /cygdrive/c/users/hqm/openlaszlo/wafflecone
for http://svn.openlaszlo.org/openlaszlo/branches/wafflecone
Summary:
New Features: make datarequest and dataprovider extendable in LZX code
Bugs Fixed: LPP-4404, LPP-4401
Bug: LPP-4404
Technical Reviewer: pkang
QA Reviewer: (pending)
Doc Reviewer: (pending)
Documentation:
Release Notes:
Details:
added datarequest to the schema as a primitive LzNode equivalent
made base LzDataProvider class
also fix for LPP-4401- namespace prefix bug when loading DHTML data
Tests:
Modified: openlaszlo/branches/wafflecone/WEB-INF/lps/lfc/data/Library.lzs
===================================================================
--- openlaszlo/branches/wafflecone/WEB-INF/lps/lfc/data/Library.lzs
2007-08-07 19:17:42 UTC (rev 5955)
+++ openlaszlo/branches/wafflecone/WEB-INF/lps/lfc/data/Library.lzs
2007-08-07 20:48:53 UTC (rev 5956)
@@ -13,6 +13,7 @@
// new DataProvider classes
#include "data/LzDataRequest.lzs"
+#include "data/LzDataProvider.lzs"
#include "data/LzHTTPDataProvider.lzs"
#include "data/LzDataset.lzs"
Added: openlaszlo/branches/wafflecone/WEB-INF/lps/lfc/data/LzDataProvider.lzs
Property changes on:
openlaszlo/branches/wafflecone/WEB-INF/lps/lfc/data/LzDataProvider.lzs
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:mime-type
+ application/octet-stream
Modified: openlaszlo/branches/wafflecone/WEB-INF/lps/lfc/data/LzDataRequest.lzs
===================================================================
--- openlaszlo/branches/wafflecone/WEB-INF/lps/lfc/data/LzDataRequest.lzs
2007-08-07 19:17:42 UTC (rev 5955)
+++ openlaszlo/branches/wafflecone/WEB-INF/lps/lfc/data/LzDataRequest.lzs
2007-08-07 20:48:53 UTC (rev 5956)
@@ -20,8 +20,13 @@
* @lzxname datarequest
*/
-class LzDataRequest {
+class LzDataRequest extends LzNode {
+ /** @access private
+ * @modifiers override
+ */
+ static var tagname = 'datarequest';
+
/* Status value constants */
static var SUCCESS = 'success';
static var TIMEOUT = 'timeout';
Modified: openlaszlo/branches/wafflecone/WEB-INF/lps/lfc/data/LzDataset.lzs
===================================================================
--- openlaszlo/branches/wafflecone/WEB-INF/lps/lfc/data/LzDataset.lzs
2007-08-07 19:17:42 UTC (rev 5955)
+++ openlaszlo/branches/wafflecone/WEB-INF/lps/lfc/data/LzDataset.lzs
2007-08-07 20:48:53 UTC (rev 5956)
@@ -605,7 +605,10 @@
dreq.method = this.querytype;
// For back compatibility with 'lzpostbody'
- var lzpostbody = this.params.getValue('lzpostbody');
+ var lzpostbody = null;
+ if (this.params) {
+ lzpostbody = this.params.getValue('lzpostbody');
+ }
if (lzpostbody != null) {
dreq.postbody = lzpostbody;
}
Modified:
openlaszlo/branches/wafflecone/WEB-INF/lps/lfc/data/LzHTTPDataProvider.lzs
===================================================================
--- openlaszlo/branches/wafflecone/WEB-INF/lps/lfc/data/LzHTTPDataProvider.lzs
2007-08-07 19:17:42 UTC (rev 5955)
+++ openlaszlo/branches/wafflecone/WEB-INF/lps/lfc/data/LzHTTPDataProvider.lzs
2007-08-07 20:48:53 UTC (rev 5956)
@@ -9,16 +9,19 @@
* @access public
*/
+
/**
* <p>
- * <class>LzHTTPDataRequest</class> implements the DataProvider interface, to
support HTTP data requests.
- * @shortdesc An abstract class to represent data requests.
+ * <class>LzHTTPDataProvider</class> implements the DataProvider interface,
to support HTTP data requests.
+ * @shortdesc DataProvider which implements HTTP request transport
* @lzxname httpdataprovider
*/
-class LzHTTPDataProvider extends LzNode {
+
+class LzHTTPDataProvider extends LzDataProvider {
+
/** @access private
* @param LzHTTPDataRequest dreq: The data request
*/
@@ -61,6 +64,15 @@
/**
+ * Interrupts any load in progress for the given dataset.
+ * @access protected
+ * @param LzDataRequest dreq: The data request for which to interrupt the
load.
+ */
+ function abortLoadForRequest( dreq ) {
+ dreq.loader.abort();
+ }
+
+ /**
* @access private
*/
function doRequest ( dreq ) {
@@ -118,16 +130,19 @@
var lzpostbody = dreq.postbody;
- var names = qparams.getNames();
- for ( var i in names ){
- var name = names[i];
- // Strip out special case key "lzpostbody", it declares a raw
- // string content to post.
- if (!proxied && name == 'lzpostbody') {
- lzpostbody = qparams.getValue(name);
- } else {
- q += sep + name + '=' +
encodeURIComponent(qparams.getValue(name));
- sep = '&';
+
+ if (qparams != null) {
+ var names = qparams.getNames();
+ for ( var i in names ){
+ var name = names[i];
+ // Strip out special case key "lzpostbody", it declares a raw
+ // string content to post.
+ if (!proxied && name == 'lzpostbody') {
+ lzpostbody = qparams.getValue(name);
+ } else {
+ q += sep + name + '=' +
encodeURIComponent(qparams.getValue(name));
+ sep = '&';
+ }
}
}
@@ -251,6 +266,14 @@
}
+/**
+ * <p>
+ * <class>LzHTTPDataRequest</class> implements the DataProvider interface, to
support HTTP data requests.
+ * @shortdesc A class to represent HTTP data requests.
+ * @lzxname httpdatarequest
+ */
+
+
class LzHTTPDataRequest extends LzDataRequest {
var method = "GET"; // : String; // GET, POST, PUT, DELETE
var postbody; // : String
@@ -282,6 +305,7 @@
var nsprefix = false;
+ /** The LZX DOM element containing the loaded data */
var xmldata = null;
// time it took to load
var loadtime = 0;
Modified:
openlaszlo/branches/wafflecone/WEB-INF/lps/lfc/kernel/dhtml/LzHTTPLoader.js
===================================================================
--- openlaszlo/branches/wafflecone/WEB-INF/lps/lfc/kernel/dhtml/LzHTTPLoader.js
2007-08-07 19:17:42 UTC (rev 5955)
+++ openlaszlo/branches/wafflecone/WEB-INF/lps/lfc/kernel/dhtml/LzHTTPLoader.js
2007-08-07 20:48:53 UTC (rev 5956)
@@ -134,7 +134,7 @@
reqtype: reqtype,
sendheaders: this.options.sendheaders,
trimwhitespace: this.options.trimwhitespace,
- nsprefix: this.options.trimwhitespace,
+ nsprefix: this.options.nsprefix,
url: LzBrowser.toAbsoluteURL(url, this.secure),
timeout: this.timeout,
cache: this.options.cacheable,
Modified:
openlaszlo/branches/wafflecone/WEB-INF/lps/lfc/kernel/dhtml/LzXMLTranslator.js
===================================================================
---
openlaszlo/branches/wafflecone/WEB-INF/lps/lfc/kernel/dhtml/LzXMLTranslator.js
2007-08-07 19:17:42 UTC (rev 5955)
+++
openlaszlo/branches/wafflecone/WEB-INF/lps/lfc/kernel/dhtml/LzXMLTranslator.js
2007-08-07 20:48:53 UTC (rev 5956)
@@ -15,7 +15,7 @@
var LzXMLTranslator = new Object;
LzXMLTranslator.copyXML = function (xmldoc, trimwhitespace, nsprefix) {
- var lfcnode = LzXMLTranslator.copyBrowserXML(xmldoc, true, trimwhitespace);
+ var lfcnode = LzXMLTranslator.copyBrowserXML(xmldoc, true, trimwhitespace,
nsprefix);
return lfcnode;
}
@@ -24,7 +24,7 @@
LzXMLTranslator.stringTrimPat = new RegExp("(^[\t\n\r ]*|[\t\n\r ]*$)", "g");
LzXMLTranslator.slashPat = new RegExp("/", "g");
-LzXMLTranslator.copyBrowserXML = function (node, ignorewhite, trimwhite) {
+LzXMLTranslator.copyBrowserXML = function (node, ignorewhite, trimwhite,
nsprefix) {
if (! node) return node;
var nv = node.nodeValue;
var lfcnode = null;
@@ -58,18 +58,37 @@
if (attrnode) {
var attrname = attrnode.name;
var attrval = attrnode.value;
- cattrs[attrname] = attrval;
+ var nattrname = attrname;
+
+ if (!nsprefix) {
+ // strip namespace prefixes
+ var colpos = attrname.indexOf(':');
+ if (colpos >= 0) {
+ nattrname = attrname.substring(colpos+1);
+ }
+ }
+
+ cattrs[nattrname] = attrval;
}
}
}
+ var nname = node.nodeName;
+ if (nname && !nsprefix) {
+ // strip namespace prefix
+ var npos = nname.indexOf(':');
+ if (npos >= 0) {
+ nname = nname.substring(npos+1);
+ }
+ }
- lfcnode = new LzDataElement(node.nodeName, cattrs);
+
+ lfcnode = new LzDataElement(nname, cattrs);
var children = node.childNodes;
var newchildren = [];
for (var i = 0; i < children.length; i++ ) {
var child = children[i];
- var lfcchild = LzXMLTranslator.copyBrowserXML(child, ignorewhite,
trimwhite);
+ var lfcchild = LzXMLTranslator.copyBrowserXML(child, ignorewhite,
trimwhite, nsprefix);
//Debug.debug('lfcchild = ', lfcchild);
if (lfcchild != null) {
newchildren.push(lfcchild);
Modified:
openlaszlo/branches/wafflecone/WEB-INF/lps/lfc/kernel/swf/LzHTTPLoader.as
===================================================================
--- openlaszlo/branches/wafflecone/WEB-INF/lps/lfc/kernel/swf/LzHTTPLoader.as
2007-08-07 19:17:42 UTC (rev 5955)
+++ openlaszlo/branches/wafflecone/WEB-INF/lps/lfc/kernel/swf/LzHTTPLoader.as
2007-08-07 20:48:53 UTC (rev 5956)
@@ -75,7 +75,7 @@
}
LzHTTPLoader.prototype.abort = function () {
- // nyi
+ this.lzloader.abort();
}
LzHTTPLoader.prototype.setOption = function (key, val) {
Modified: openlaszlo/branches/wafflecone/WEB-INF/lps/schema/lzx.rnc
===================================================================
--- openlaszlo/branches/wafflecone/WEB-INF/lps/schema/lzx.rnc 2007-08-07
19:17:42 UTC (rev 5955)
+++ openlaszlo/branches/wafflecone/WEB-INF/lps/schema/lzx.rnc 2007-08-07
20:48:53 UTC (rev 5956)
@@ -107,6 +107,7 @@
toplevelElements = (
(viewElement | scriptElement | styleSheetElement | asset | font)*
+ & datarequest*
& datasource*
& connectiondatasource*
& dataset*
@@ -277,6 +278,7 @@
attribute ondata {script}?
+
#
# View Content
#
@@ -347,6 +349,7 @@
[a:defaultValue="false"] attribute paused {boolean}? &
attribute target {reference}?
+
#
# View elements
#
@@ -943,6 +946,9 @@
element node {nodeContent}
+datarequest =
+ element datarequest {nodeContent}
+
layout =
element layout {
_______________________________________________
Laszlo-checkins mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-checkins