Approved!

On Wed, Sep 8, 2010 at 10:54 PM, Max Carlson wrote:

Change maxcarlson-20100908-xEW by maxcarl...@friendly on 2010-09-08 13:50:26 PDT
    in /Users/maxcarlson/openlaszlo/trunk-clean
    for http://svn.openlaszlo.org/openlaszlo/trunk

Summary: Update html example to show/test callRPC() functionality

Bugs Fixed: LPP-9190 - Add generic events to html tag

Technical Reviewer: promanik
QA Reviewer: hminsky

Release Notes: If the HTML loaded into your <html/> component includes lps/includes/iframestub.js, you can send events into the parent OL <html/> object with the browser Javascript method lz.sendEvent(name, value). Likewise, the <html/> component now has a lz.html.callRPC() method that allows browser Javascript to be invoked in iframes, similar to lz.html.callJavascripti(). You need to register javascript functions for callback with pmrpc for them to be available, e.g.:

<script>
...
pmrpc.register( {
  publicProcedureName: "myMethod",
  procedure: function(methodName, args) {
    ...
  }
} );
</script>

Note that both of these methods work with HTML loaded from different domains, thanks to the wonderful pmrpc library. Please note that pmrpc requires IE 8 and above.
See http://code.google.com/p/pmrpc/ for more details about pmrpc.

Details: *.xslt - Don't include excanvas.js for IE 9.

pmrpc - Move json2.js include to embednew.js. Add comment about json2.js being included by embednew.js.

embednew - Don't warn if excanvas is missing in IE 9. Load json2.js for IE 8 and below.

iframemanager-library - Add comment about json2.js being included by embednew.js

iframemanager - asyncCallback() attempts to unparse JSON args for DHTML. Use methodName arg as pamrpc method name for callRPC calls. Comment out callRPC error message since it always seems to get called in IE 8.

iframestub - Include json2.js. Remove callRPC() callback, which was a giant security hole. lz.sendEvent() now tries to call the iframemanager directly, falling back to pmrpc if that fails.

html - Improve tests for callJavascript(), add tests for callRPC(), add handler for message event sent by html-test.html.

html-test - Include iframestub.js. Modify func3 to change background color of the page, modify setBGColor() to return its value. Register func3 for callbacks with pmrpc, add button in HTML to test lz.sendEvent().

Tests: examples/extensions/html.lzx should work correctly with the 'Call (bad) methdo/rpc' buttons once 'Load' is clicked. 'Send event to LZX' should send structured data that's visible in firebug or with the debugger on. Tested in DHTML and swf10 in IE 8, Firefox and Safari 5.

Files:
M       WEB-INF/lps/templates/html-response_jp.xslt
M       WEB-INF/lps/templates/html-response.xslt
M       WEB-INF/lps/templates/app-console_jp.xslt
M       WEB-INF/lps/templates/app-console.xslt
M       lps/includes/source/pmrpc.js
M       lps/includes/source/build.xml
M       lps/includes/source/embednew.js
M       lps/includes/source/iframemanager-library.lzs
M       lps/includes/source/iframemanager.js
M       lps/includes/source/iframestub.js
M       examples/extensions/html.lzx
M       examples/extensions/html-test.html

Changeset: http://svn.openlaszlo.org/openlaszlo/patches/maxcarlson-20100908-xEW.tar

Reply via email to