Author: max
Date: 2008-02-29 18:32:24 -0800 (Fri, 29 Feb 2008)
New Revision: 8145
Modified:
openlaszlo/trunk/lps/components/extensions/html.lzx
openlaszlo/trunk/lps/components/extensions/test/html.lzx
openlaszlo/trunk/lps/includes/source/iframemanager.js
Log:
Change 20080229-maxcarlson-c by [EMAIL PROTECTED] on 2008-02-29 12:04:27 PST
in /Users/maxcarlson/openlaszlo/trunk-clean
for http://svn.openlaszlo.org/openlaszlo/trunk
Summary: Add API to enable/disable history for the html tag
New Features:
Bugs Fixed: LPP-5530 - The history mechanism is incompatible with the html tag
Technical Reviewer: promanik
QA Reviewer: [EMAIL PROTECTED]
Doc Reviewer: (pending)
Documentation:
Release Notes:
Details: extensions/test/html.lzx - Add history attribute example.
extensions/html.lzx - Add history attribute to html tag. If true, iframe
chagnes will be added to the browser history. If false, iframe reloads are not
added.
iframemanager.js - Set frame name based on id if not specified. Store frame
names for lookup for in setSrc().
Tests: Change the history attribute in extensions/test/html.lzx to false and
notice that reloading addresses doesn't add browser history entries.
Modified: openlaszlo/trunk/lps/components/extensions/html.lzx
===================================================================
--- openlaszlo/trunk/lps/components/extensions/html.lzx 2008-03-01 02:28:06 UTC
(rev 8144)
+++ openlaszlo/trunk/lps/components/extensions/html.lzx 2008-03-01 02:32:24 UTC
(rev 8145)
@@ -1,5 +1,5 @@
<!-- * X_LZ_COPYRIGHT_BEGIN ***************************************************
-* Copyright 2007 Laszlo Systems, Inc. All Rights Reserved. *
+* Copyright 2007-2008 Laszlo Systems, Inc. All Rights Reserved. *
* Use is subject to license terms. *
* X_LZ_COPYRIGHT_END ****************************************************** -->
@@ -22,8 +22,8 @@
,setPosition: function(id, x, y, width, height, v) {
LzBrowser.callJS('Lz.iframemanager.setPosition', false, id, x, y,
width, height, v);
}
- ,setSrc: function(id, src) {
- LzBrowser.callJS('Lz.iframemanager.setSrc', null, id, src);
+ ,setSrc: function(id, src, history) {
+ LzBrowser.callJS('Lz.iframemanager.setSrc', null, id, src, history);
}
,setVisible: function(id, v) {
LzBrowser.callJS('Lz.iframemanager.setVisible', false, id, v);
@@ -49,8 +49,8 @@
<attribute name="heightoffset" type="number" value="0"/>
<attribute name="loading" type="boolean" value="false"/>
<attribute name="appendto" value="null"/>
- <attribute name="iframe" value="null"/>
<attribute name="ready" value="false"/>
+ <attribute name="history" value="true"/>
<attribute name="target" value="null" setter="this.setTarget(target)"/>
<attribute name="framename" value="" type="string"/>
@@ -86,7 +86,7 @@
this.src = s;
this.setAttribute('loading', true);
if (this['iframeid']) {
- Lz.iframemanager.setSrc(this.iframeid, s);
+ Lz.iframemanager.setSrc(this.iframeid, s, this.history);
} else {
this.srcset = s;
}
@@ -120,7 +120,7 @@
this.iframeid = id;
this.__updatepos();
if (this['isfront']) this.bringToFront();
- if (this['srcset']) Lz.iframemanager.setSrc(id, this.srcset);
+ if (this['srcset']) Lz.iframemanager.setSrc(id, this.srcset,
this.history);
this.setAttribute('ready', true);
</method>
<method name="__gotload">
Modified: openlaszlo/trunk/lps/components/extensions/test/html.lzx
===================================================================
--- openlaszlo/trunk/lps/components/extensions/test/html.lzx 2008-03-01
02:28:06 UTC (rev 8144)
+++ openlaszlo/trunk/lps/components/extensions/test/html.lzx 2008-03-01
02:32:24 UTC (rev 8145)
@@ -21,7 +21,7 @@
</handler>
</button>
<text name="status" y="3" fontstyle="bold"
visible="${parent.main.loading}">Loading...</text>
- <html name="main" heightoffset="-74" widthoffset="-19" xoffset="7"
yoffset="50">
+ <html name="main" heightoffset="-74" widthoffset="-19" xoffset="7"
yoffset="50" history="true">
<handler name="oninit">
this.bringToFront();
</handler>
Modified: openlaszlo/trunk/lps/includes/source/iframemanager.js
===================================================================
--- openlaszlo/trunk/lps/includes/source/iframemanager.js 2008-03-01
02:28:06 UTC (rev 8144)
+++ openlaszlo/trunk/lps/includes/source/iframemanager.js 2008-03-01
02:32:24 UTC (rev 8145)
@@ -5,6 +5,7 @@
Lz.iframemanager = {
__highestz: 0
,__frames: {}
+ ,__namebyid: {}
,create: function(owner, name, appendto) {
//alert(owner + ', ' + name + ', ' + appendto)
var i = document.createElement('iframe');
@@ -14,8 +15,9 @@
var id = '__lz' + Lz.iframemanager.__highestz++;
Lz.iframemanager.__frames[id] = i;
- if (name == null) name = '';
+ if (name == null || name == 'null') name = id;
if (name != "") Lz.__setAttr(i, 'name', name);
+ this.__namebyid[id] = name;
if (appendto == null || appendto == "undefined") {
appendto = document.body;
@@ -50,12 +52,20 @@
,getFrame: function(id) {
return Lz.iframemanager.__frames[id];
}
- ,setSrc: function(id, s) {
+ ,setSrc: function(id, s, history) {
//console.log('setSrc', id, s)
- var iframe = Lz.iframemanager.getFrame(id);
- if (! iframe) return;
- Lz.__setAttr(iframe, 'src', s);
- return true;
+ if (history) {
+ var iframe = Lz.iframemanager.getFrame(id);
+ if (! iframe) return;
+ Lz.__setAttr(iframe, 'src', s);
+ return true;
+ } else {
+ var id = Lz.iframemanager.__namebyid[id];
+ var iframe = window[id];
+ if (! iframe) return;
+ iframe.location.replace(s);
+ return true;
+ }
}
,setPosition: function(id, x, y, width, height, visible) {
//Debug.write('setPosition', id);
_______________________________________________
Laszlo-checkins mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-checkins