[Laszlo-checkins] r6715 - in openlaszlo/trunk: WEB-INF/lps/lfc/kernel/swf/dojo WEB-INF/lps/lfc/kernel/swf/dojo/flash6 WEB-INF/lps/lfc/services/platform/swf WEB-INF/lps/lfc/views lps/admin lps/components/extensions lps/components/extensions/test lps/includes/source
max@openlaszlo.org
max at openlaszlo.org
Tue Oct 2 16:03:12 PDT 2007
Author: max
Date: 2007-10-02 16:03:03 -0700 (Tue, 02 Oct 2007)
New Revision: 6715
Modified:
openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf/dojo/Library.lzs
openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf/dojo/flash6/DojoExternalInterface.as
openlaszlo/trunk/WEB-INF/lps/lfc/services/platform/swf/LzHistory.as
openlaszlo/trunk/WEB-INF/lps/lfc/views/LaszloCanvas.lzs
openlaszlo/trunk/lps/admin/dev-console.lzx.swf
openlaszlo/trunk/lps/components/extensions/html.lzx
openlaszlo/trunk/lps/components/extensions/test/html-swf.jsp
openlaszlo/trunk/lps/components/extensions/test/html.lzx
openlaszlo/trunk/lps/includes/source/embednew.js
openlaszlo/trunk/lps/includes/source/iframemanager.js
openlaszlo/trunk/lps/includes/source/lzhistory.js
Log:
ehange 20071002-maxcarlson-a by maxcarlson at plastik on 2007-10-02 11:15:45 PDT
in /Users/maxcarlson/openlaszlo/trunk-clean
for http://svn.openlaszlo.org/openlaszlo/trunk
Summary: Fix html tag
New Features:
Bugs Fixed: LPP-4784 - OL4.0.5, <html> tag and SWF : http://www.openlaszlo.org/lps4/lps/components/extensions/test/html-swf.jsp NOT WOKING
Technical Reviewer: promanik
QA Reviewer: jcrowley
Doc Reviewer: (pending)
Documentation:
Release Notes:
Details: DojoExternalInterface.as - Better debugging info, make sure resultsChecker function is named, clear out _root._callbackID when done looking for results.
Library.lzs - Add default values for _root._currenthistory and _root._callbackID to prevent exceptions in IE.
LzHistory.as - Use _root._currenthistory to communicate current history state in swf7 to prevent concurrency issues calling into/out of flash simultaneously.
LaszloCanvas.lzs - Set canvas id passed in to init arguments.
test/html.lzx - Use w3.org as default URL to prevent runtime exceptions - openlaszlo.org fails to run some javascript when laoded in an iframe.
html-swf.js - Update to new wrapper format.
html.lzx - Pass in canvas id for callbacks. Add support for sendToBack(). Always update position when iframeid is set.
embednew.js - Pass id into flashargs to set canvas.id.
lzhistory.js - Watch _currenthistory for history state changes for swf7 in _checklocationhash(). __setFlash() only sets history state if _callbackID is null. Otherwise it waits 10ms.
iframemanager.js - Reorder init(). Add support for sendToBack().
dev-console.lzx.swf - Rebuild with default values for _root._currenthistory and _root. _callbackID to prevent exceptions in IE.
Tests: http://localhost:8080/trunk-clean/lps/components/extensions/test/html-swf.jsp and http://localhost:8080/trunk-clean/lps/components/extensions/test/html.zlx run in swf7, swf8 and dhtml. http://localhost:8080/trunk-clean/test/history/history.lzx passes in swf7, swf8 and dhtml. Tested under IE 6, 7 and Firefox 2 OS X.
Modified: openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf/dojo/Library.lzs
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf/dojo/Library.lzs 2007-10-02 19:35:15 UTC (rev 6714)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf/dojo/Library.lzs 2007-10-02 23:03:03 UTC (rev 6715)
@@ -1,5 +1,5 @@
//* A_LZ_COPYRIGHT_BEGIN ******************************************************
-//* Copyright 2001-2006 Laszlo Systems, Inc. All Rights Reserved. *
+//* Copyright 2001-2007 Laszlo Systems, Inc. All Rights Reserved. *
//* Use is subject to license terms. *
//* A_LZ_COPYRIGHT_END ********************************************************
@@ -9,3 +9,7 @@
} else {
#include "kernel/swf/dojo/flash6/DojoExternalInterface.as"
}
+
+// required for GetVariable to not fail in IE/ActiveX
+_root._currenthistory = null;
+_root._callbackID = null;
Modified: openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf/dojo/flash6/DojoExternalInterface.as
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf/dojo/flash6/DojoExternalInterface.as 2007-10-02 19:35:15 UTC (rev 6714)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf/dojo/flash6/DojoExternalInterface.as 2007-10-02 23:03:03 UTC (rev 6715)
@@ -93,7 +93,7 @@
_root._returnResult = undefined;
fscommand("call", methodName);
- //getURL("javascript:alert('FLASH:call " + methodName + "')");
+ //Debug.write("call", methodName, resultsCallback);
// immediately return if the caller is not waiting for return results
if(resultsCallback == undefined || resultsCallback == null){
@@ -101,10 +101,12 @@
}
// check at regular intervals for return results
- var resultsChecker = function(){
+ var resultsChecker = function resultsChecker(){
if((typeof _root._returnResult != "undefined")&&
(_root._returnResult != "undefined")){
clearInterval(_root._callbackID);
+ _root._callbackID = null;
+ //Debug.write('resultsChecker clear', _root._callbackID);
resultsCallback.call(null, _root._returnResult);
}
};
Modified: openlaszlo/trunk/WEB-INF/lps/lfc/services/platform/swf/LzHistory.as
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/services/platform/swf/LzHistory.as 2007-10-02 19:35:15 UTC (rev 6714)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/services/platform/swf/LzHistory.as 2007-10-02 23:03:03 UTC (rev 6715)
@@ -85,7 +85,12 @@
this.offset = o;
//Debug.write('onhistory ', o, this.__lzhistq);
if (this.onoffset.ready) this.onoffset.sendEvent(o);
- LzBrowser.callJS('Lz.history.__receivedhistory', false, o + '');
+ if ($swf7) {
+ _root._currenthistory = o + '';
+ } else {
+ LzBrowser.callJS('Lz.history.__receivedhistory', false, o + '');
+ }
+ return true;
}
/**
Modified: openlaszlo/trunk/WEB-INF/lps/lfc/views/LaszloCanvas.lzs
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/views/LaszloCanvas.lzs 2007-10-02 19:35:15 UTC (rev 6714)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/views/LaszloCanvas.lzs 2007-10-02 23:03:03 UTC (rev 6715)
@@ -203,6 +203,7 @@
LzPlatform.initCanvas(this);
+ this.id = LzBrowser.getInitArg('id')
}
/**
Modified: openlaszlo/trunk/lps/admin/dev-console.lzx.swf
===================================================================
(Binary files differ)
Modified: openlaszlo/trunk/lps/components/extensions/html.lzx
===================================================================
--- openlaszlo/trunk/lps/components/extensions/html.lzx 2007-10-02 19:35:15 UTC (rev 6714)
+++ openlaszlo/trunk/lps/components/extensions/html.lzx 2007-10-02 23:03:03 UTC (rev 6715)
@@ -17,7 +17,7 @@
LzBrowser.callJS('Lz.iframemanager.create', function (id) {
Lz.iframemanager.owners[id] = owner;
owner.setiframeid(id);
- }, "", name, appendto);
+ }, canvas.id, name, appendto);
}
,setPosition: function(id, x, y, width, height, v) {
LzBrowser.callJS('Lz.iframemanager.setPosition', false, id, x, y, width, height, v);
@@ -31,6 +31,9 @@
,bringToFront: function(id) {
LzBrowser.callJS('Lz.iframemanager.bringToFront', null, id);
}
+ ,sendToBack: function(id) {
+ LzBrowser.callJS('Lz.iframemanager.sendToBack', null, id);
+ }
,__gotload: function(id) {
if (Lz.iframemanager.owners[id]) Lz.iframemanager.owners[id].__gotload();
}
@@ -109,15 +112,13 @@
var height = this.target.getAttributeRelative("height", canvas) + this.heightoffset;
if (this['iframeid']) {
Lz.iframemanager.setPosition(this.iframeid, x, y, width, height, this.visible);
- } else {
- this.cachepos = true;
}
</method>
<!--- @access private -->
<method name="setiframeid" args="id">
//Debug.write('setiframeid', id, this)
this.iframeid = id;
- if (this['cachepos']) this.__updatepos();
+ this.__updatepos();
if (this['isfront']) this.bringToFront();
if (this['srcset']) Lz.iframemanager.setSrc(id, this.srcset);
this.setAttribute('ready', true);
@@ -128,8 +129,14 @@
this.onload.sendEvent();
</method>
<method name="bringToFront">
+ if (this['isfront'] == true) return;
this.isfront = true;
if (this['iframeid']) Lz.iframemanager.bringToFront(this.iframeid);
</method>
+ <method name="sendToBack">
+ if (this['isfront'] == false) return;
+ this.isfront = false;
+ if (this['iframeid']) Lz.iframemanager.sendToBack(this.iframeid);
+ </method>
</class>
</library>
Modified: openlaszlo/trunk/lps/components/extensions/test/html-swf.jsp
===================================================================
--- openlaszlo/trunk/lps/components/extensions/test/html-swf.jsp 2007-10-02 19:35:15 UTC (rev 6714)
+++ openlaszlo/trunk/lps/components/extensions/test/html-swf.jsp 2007-10-02 23:03:03 UTC (rev 6715)
@@ -47,14 +47,10 @@
border: 0 none;
overflow: hidden;
}
+ body {
+ background-color: #ffffff;
+ }
- body
- {
- height: 100%;
- width: 100%;
- background-color: #ffffff;
- }
-
img { border: 0 none; }
</style></head>
<body><script type="text/javascript">
Modified: openlaszlo/trunk/lps/components/extensions/test/html.lzx
===================================================================
--- openlaszlo/trunk/lps/components/extensions/test/html.lzx 2007-10-02 19:35:15 UTC (rev 6714)
+++ openlaszlo/trunk/lps/components/extensions/test/html.lzx 2007-10-02 23:03:03 UTC (rev 6715)
@@ -7,7 +7,7 @@
<class name="browser" extends="window" resizable="true" bgcolor="silver">
<simplelayout axis="x"/>
- <edittext name="txt" text="http://openlaszlo.org/" width="300"/>
+ <edittext name="txt" text="http://w3.org/" width="300"/>
<button>Load
<method event="onclick">
parent.main.setAttribute('src', parent.txt.getText());
Modified: openlaszlo/trunk/lps/includes/source/embednew.js
===================================================================
--- openlaszlo/trunk/lps/includes/source/embednew.js 2007-10-02 19:35:15 UTC (rev 6714)
+++ openlaszlo/trunk/lps/includes/source/embednew.js 2007-10-02 23:03:03 UTC (rev 6715)
@@ -87,6 +87,7 @@
if (properties.accessible == 'true') {
queryvals.flashvars += '&accessible=true';
}
+ queryvals.flashvars += '&id=' + properties.id;
var url = queryvals.url + '?' + queryvals.query;
Modified: openlaszlo/trunk/lps/includes/source/iframemanager.js
===================================================================
--- openlaszlo/trunk/lps/includes/source/iframemanager.js 2007-10-02 19:35:15 UTC (rev 6714)
+++ openlaszlo/trunk/lps/includes/source/iframemanager.js 2007-10-02 23:03:03 UTC (rev 6715)
@@ -13,27 +13,29 @@
var id = '__lz' + Lz.iframemanager.__highestz++;
Lz.iframemanager.__frames[id] = i;
- Lz.__setAttr(i, 'id', id);
if (name == null) name = '';
if (name != "") Lz.__setAttr(i, 'name', name);
- i.__gotload = Lz.iframemanager.__gotload;
- Lz.__setAttr(i, 'onload', 'Lz.iframemanager.__gotload("' + id + '")');
if (appendto == null || appendto == "undefined") {
appendto = document.body;
}
appendto.appendChild(i);
+ Lz.__setAttr(i, 'id', id);
var iframe = Lz.iframemanager.getFrame(id);
+ Lz.__setAttr(iframe, 'onload', 'Lz.iframemanager.__gotload("' + id + '")');
+ iframe.__gotload = Lz.iframemanager.__gotload;
+ iframe._defaultz = 99900 + Lz.iframemanager.__highestz;
+ iframe.style.zIndex = iframe._defaultz;
if (document.getElementById && !(document.all) ) {
iframe.style.border = '0';
} else if (document.all) {
- Lz.__setAttr(iframe, 'frameborder', '0');
+ Lz.__setAttr(iframe, 'border', '0');
Lz.__setAttr(iframe, 'allowtransparency', 'true');
}
iframe.style.position = 'absolute';
- return id;
+ return id + '';
}
,getFrame: function(id) {
return Lz.iframemanager.__frames[id];
@@ -83,10 +85,18 @@
iframe.style.zIndex = 100000 + Lz.iframemanager.__highestz;
return true;
}
+ ,sendToBack: function(id) {
+ //console.log('sendToBack', id)
+ //Debug.write('bringToFront', id);
+ var iframe = Lz.iframemanager.getFrame(id);
+ if (! iframe) return;
+ iframe.style.zIndex = iframe._defaultz;
+ return true;
+ }
,__gotload: function(id) {
//Debug.write('__gotload', id);
- //console.log('__gotload', id);
var iframe = Lz.iframemanager.getFrame(id);
+ //console.log('__gotload', iframe, iframe.skiponload);
if (! iframe) return;
if (iframe.skiponload) {
iframe.skiponload = false;
@@ -97,7 +107,7 @@
iframe.owner.__gotload();
} else {
//console.log('calling method', 'Lz.iframemanager.__gotload(\'' + id + '\')');
- Lz.callMethod('Lz.iframemanager.__gotload(\'' + id + '\')');
+ Lz[iframe.owner].callMethod('Lz.iframemanager.__gotload(\'' + id + '\')');
}
}
}
Modified: openlaszlo/trunk/lps/includes/source/lzhistory.js
===================================================================
--- openlaszlo/trunk/lps/includes/source/lzhistory.js 2007-10-02 19:35:15 UTC (rev 6714)
+++ openlaszlo/trunk/lps/includes/source/lzhistory.js 2007-10-02 23:03:03 UTC (rev 6715)
@@ -53,7 +53,6 @@
if (currstate != '') {
doc.location.hash = '#' + currstate;
_this._parse(currstate)
- _this._currentstate = currstate;
}
} else {
if (currstate != '') {
@@ -101,6 +100,18 @@
this._parse(h);
}
}
+ if (dojo.flash.obj && Lz.loaded) {
+ var p = dojo.flash.obj.get();
+ if (p) {
+ var cid = p.GetVariable("_callbackID");
+ if (cid != 'null') return;
+ var val = p.GetVariable("_currenthistory");
+ if (val && val != 'null' && val != Lz.history._lasthash) {
+ //alert('val ' + val);
+ Lz.history._lasthash = val;
+ }
+ }
+ }
}
,/** */
set: function(s) {
@@ -171,7 +182,9 @@
} else {
//alert('_parse test' + h + ', ' + _this._lasthash);
//history id
- if (Lz.callMethod && h != Lz.history._lasthash) Lz.callMethod("LzHistory.receiveHistory(" + h + ")");
+ if (Lz.loaded && Lz.callMethod && h != Lz.history._lasthash) {
+ _this.__setFlash(h);
+ }
if (Lz.__dhtmlhistoryready && LzHistory && LzHistory['receiveHistory']) {
//alert('dhtml ' + h);
LzHistory.receiveHistory(h);
@@ -198,5 +211,18 @@
Lz.history._lasthash = h + '';
//alert('__receivedhistory '+ Lz.history._lasthash);
}
+ ,/** @access private called from flash */
+ __setFlash: function(h) {
+ var p = dojo.flash.obj.get();
+ if (p) {
+ var cid = p.GetVariable("_callbackID") + '';
+ if (cid == 'null') {
+ Lz.callMethod("LzHistory.receiveHistory(" + h + ")");
+ } else {
+ setTimeout('Lz.history.__setFlash(' + h + ')', 10);
+ //alert('busy');
+ }
+ }
+ }
};
window.onload = Lz.history.init;
More information about the Laszlo-checkins
mailing list