Go Max!

On 2006-12-05, at 00:18 EST, [EMAIL PROTECTED] wrote:

Author: max
Date: 2006-12-04 21:18:01 -0800 (Mon, 04 Dec 2006)
New Revision: 2861

Added:
   openlaszlo/branches/legals/lps/admin/dev-console.lzx.js
Modified:
openlaszlo/branches/legals/WEB-INF/lps/lfc/kernel/dhtml/ LzKeyboardKernel.js
   openlaszlo/branches/legals/WEB-INF/lps/lfc/kernel/dhtml/LzSprite.js
   openlaszlo/branches/legals/WEB-INF/lps/templates/app-console.xslt
   openlaszlo/branches/legals/WEB-INF/lps/templates/html-response.xslt
   openlaszlo/branches/legals/lps/admin/dev-console.lzx
   openlaszlo/branches/legals/lps/admin/dev-console.lzx.swf
   openlaszlo/branches/legals/lps/includes/source/embednew.js
Log:
Change 20061204-maxcarlson-q by [EMAIL PROTECTED] computer.local on 2006-12-04 18:48:47 PST
    in /Users/maxcarlson/openlaszlo/legals

Summary: Add DHTML developer's console

New Features:

Bugs Fixed:

Technical Reviewer: promanik
QA Reviewer: ptw
Doc Reviewer: (pending)

Documentation:

Release Notes:

Details: Added lzOptions.dhtmlKeyboardControl: false option to prevent DHTML apps from grabbing keyboard control from the page - allowing the dhtml debugger input control to receive keyboard events. Added support for canvas bgcolor to DHTML. Add lzOptions.appendDivID: 'console' option to specify which div the dhtml app should be appended to. Global query options are properly URI-unesaped. Tweaked wrappers accordingly, updated dev- console.lzx for dhtml support.


Tests: Dev ocnsole works in dhtml and swf now!

Files:
M      WEB-INF/lps/lfc/kernel/dhtml/LzKeyboardKernel.js
M      WEB-INF/lps/lfc/kernel/dhtml/LzSprite.js
M      WEB-INF/lps/templates/html-response.xslt
M      WEB-INF/lps/templates/app-console.xslt
M      lps/includes/source/embednew.js
A      lps/admin/dev-console.lzx.js
M      lps/admin/dev-console.lzx.swf
M      lps/admin/dev-console.lzx

Changeset: http://svn.openlaszlo.org/openlaszlo/patches/20061204- maxcarlson-q.tar

Modified: openlaszlo/branches/legals/WEB-INF/lps/lfc/kernel/dhtml/ LzKeyboardKernel.js
===================================================================
--- openlaszlo/branches/legals/WEB-INF/lps/lfc/kernel/dhtml/ LzKeyboardKernel.js 2006-12-05 04:19:06 UTC (rev 2860) +++ openlaszlo/branches/legals/WEB-INF/lps/lfc/kernel/dhtml/ LzKeyboardKernel.js 2006-12-05 05:18:01 UTC (rev 2861)
@@ -68,6 +68,8 @@
     }
 }

-document.onkeydown = LzKeyboardKernel.__keyboardEvent;
-document.onkeyup = LzKeyboardKernel.__keyboardEvent;
-document.onkeypress = LzKeyboardKernel.__keyboardEvent;
+if (lzOptions.dhtmlKeyboardControl != false) {
+    document.onkeydown = LzKeyboardKernel.__keyboardEvent;
+    document.onkeyup = LzKeyboardKernel.__keyboardEvent;
+    document.onkeypress = LzKeyboardKernel.__keyboardEvent;
+}

Modified: openlaszlo/branches/legals/WEB-INF/lps/lfc/kernel/dhtml/ LzSprite.js
===================================================================
--- openlaszlo/branches/legals/WEB-INF/lps/lfc/kernel/dhtml/ LzSprite.js 2006-12-05 04:19:06 UTC (rev 2860) +++ openlaszlo/branches/legals/WEB-INF/lps/lfc/kernel/dhtml/ LzSprite.js 2006-12-05 05:18:01 UTC (rev 2861)
@@ -16,7 +16,19 @@
         LzSprite.__rootSprite = this;
         var div = document.createElement('div');
         div.className = 'lzcanvasdiv';
-        document.body.appendChild(div);
+        var root = document.body;
+        if (lzOptions.appendDivID != null) {
+            var el = document.getElementById(lzOptions.appendDivID);
+            if (el) root = el;
+        }
+        root.appendChild(div);
+ if (window.bgcolor) root.style.backgroundColor = window.bgcolor;
+        if (window.width) root.style.width = window.width;
+        if (window.height) root.style.height = window.height;
+        if (window.width && window.height) {
+ root.style.clip = 'rect(0px ' + window.width + ' ' + window.height + ' 0px)';
+            root.style.overflow = 'hidden';
+        }
         this.__LZdiv = div;

         this.__writeSplash();
@@ -24,7 +36,7 @@
         if (LzSprite.prototype.quirks.fix_clickable) {
             var cdiv = document.createElement('div');
             cdiv.className = 'lzcanvasclickdiv';
-            document.body.appendChild(cdiv);
+            root.appendChild(cdiv);
             this.__LZclickdiv = cdiv;
         }
     } else {
@@ -421,7 +433,7 @@
                 this.baseurl = lzOptions.ServerRoot;
             }
             this.baseurl += '/';
-            Debug.write('ptype', res.ptype, this.baseurl);
+            //Debug.write('ptype', res.ptype, this.baseurl);
         }

         this.frames = urls;
@@ -865,7 +877,7 @@

 LzSprite.prototype.__getImage = function(url, skiploader) {
     if (this.owner.baseurl) url = this.owner.baseurl + url;
-    Debug.info('__getImage ', url)
+    //Debug.info('__getImage ', url)
     //Debug.info('__getImage ', url, skiploader, im)
     //var ispng = url.substr(url.length - 4, url.length) == '.png';
     if (LzSprite.prototype.quirks.ie_alpha_image_loader) {

Modified: openlaszlo/branches/legals/WEB-INF/lps/templates/app- console.xslt
===================================================================
--- openlaszlo/branches/legals/WEB-INF/lps/templates/app- console.xslt 2006-12-05 04:19:06 UTC (rev 2860) +++ openlaszlo/branches/legals/WEB-INF/lps/templates/app- console.xslt 2006-12-05 05:18:01 UTC (rev 2861)
@@ -86,6 +86,14 @@
           </xsl:choose>
         </title>
<script src="{/canvas/request/@lps}/lps/includes/embed- compressed.js" type="text/javascript"/>
+      <xsl:choose>
+        <xsl:when test="/canvas/@runtime = 'dhtml'">
+        <script type="text/javascript">
+ lzOptions = { ApplicationRoot: 'lps/admin/dev- console.lzx', ServerRoot: '/legals', splashhtml: '&lt;img src="/ legals/lps/includes/spinner.gif">', appendDivID: 'console', dhtmlKeyboardControl: false }; + Lz.dhtmlEmbedLFC('<xsl:value-of select="/canvas/ request/@lps"/>/<xsl:value-of select="/canvas/@lfc"/>');
+        </script>
+        </xsl:when>
+      </xsl:choose>
       </head>
       <body>
         <xsl:if test="/canvas/warnings">
@@ -195,9 +203,18 @@

     <div id="{$consolefooter}">
<!-- an embedded SOLO console app to replace the HTML console -->
-      <script type="text/javascript">
- Lz.swfEmbed({url: '<xsl:value-of select="$lps"/>/lps/admin/ dev-console.lzx.swf?lzappuid=<xsl:value-of select="$appuid"/ >&amp;lzt=swf&amp;appinfo=<xsl:value-of select="$appinfo"/>', bgcolor: '#9494ad', width: '100%', height: '<xsl:value-of select="$consoleheight"/>'});
-      </script>
+      <xsl:choose>
+        <xsl:when test="@runtime = 'dhtml'">
+            <script type="text/javascript">
+ Lz.dhtmlEmbed({url: '<xsl:value-of select="$lps"/>/lps/ admin/dev-console.lzx.js?lzappuid=<xsl:value-of select="$appuid"/ >&amp;lzt=dhtml&amp;appinfo=<xsl:value-of select="$appinfo"/>', bgcolor: '#9494ad', width: '100%', height: '<xsl:value-of select="$consoleheight"/>'});
+            </script>
+        </xsl:when>
+        <xsl:otherwise>
+            <script type="text/javascript">
+ Lz.swfEmbed({url: '<xsl:value-of select="$lps"/>/ lps/admin/dev-console.lzx.swf?lzappuid=<xsl:value-of select="$appuid"/>&amp;lzt=swf&amp;appinfo=<xsl:value-of select="$appinfo"/>', bgcolor: '#9494ad', width: '100%', height: '<xsl:value-of select="$consoleheight"/>'});
+            </script>
+        </xsl:otherwise>
+      </xsl:choose>

       <!-- pop up console debugger window -->
       <!--

Modified: openlaszlo/branches/legals/WEB-INF/lps/templates/html- response.xslt
===================================================================
--- openlaszlo/branches/legals/WEB-INF/lps/templates/html- response.xslt 2006-12-05 04:19:06 UTC (rev 2860) +++ openlaszlo/branches/legals/WEB-INF/lps/templates/html- response.xslt 2006-12-05 05:18:01 UTC (rev 2861)
@@ -91,7 +91,7 @@
           }
         </script>
         <script type="text/javascript">
- lzOptions = { ApplicationRoot: '<xsl:value-of select="/ canvas/request/@fullpath"/>', ServerRoot: '<xsl:value-of select="/ canvas/request/@lps"/>', splashhtml: '&lt;img src="<xsl:value-of select="/canvas/request/@lps"/>/lps/includes/spinner.gif">'}; + lzOptions = { ApplicationRoot: '<xsl:value-of select="/ canvas/request/@fullpath"/>', ServerRoot: '<xsl:value-of select="/ canvas/request/@lps"/>', splashhtml: '&lt;img src="<xsl:value-of select="/canvas/request/@lps"/>/lps/includes/spinner.gif">', appendDivID: 'lzdhtmlappdiv'};
         </script>
<script type="text/javascript" src="{/canvas/request/@lps}/ lps/includes/embed-compressed.js"/>
         <xsl:choose>
@@ -132,9 +132,11 @@
             </OBJECT>
           </xsl:when>
           <xsl:when test="/canvas/@runtime = 'dhtml'">
+          <div id="lzdhtmlappdiv" style="position: absolute;">
             <script type="text/javascript">
Lz.dhtmlEmbed({url: '<xsl:value-of select="/canvas/ request/@url"/>?lzt=object<xsl:value-of select="/canvas/request/ @query_args"/>&amp;_canvas_debug=<xsl:value-of select="/canvas/ @debug"/>', width: '<xsl:value-of select="/canvas/@width"/>', height: '<xsl:value-of select="/canvas/@height"/>', id: '<xsl:value- of select="/canvas/@id"/>'});
             </script>
+          </div>
           </xsl:when>
           <xsl:otherwise>
             <script type="text/javascript">

Modified: openlaszlo/branches/legals/lps/admin/dev-console.lzx
===================================================================
--- openlaszlo/branches/legals/lps/admin/dev-console.lzx 2006-12-05 04:19:06 UTC (rev 2860) +++ openlaszlo/branches/legals/lps/admin/dev-console.lzx 2006-12-05 05:18:01 UTC (rev 2861)
@@ -7,7 +7,7 @@
<!-- ====================================================================== =-->


-<canvas width="100%"  height="370" proxied="false">
+<canvas width="100%"  height="70" proxied="false">
   <debug options="ignorelayout"
     fontsize="12"
     x="800"
@@ -84,7 +84,12 @@

   <method name="deploySOLO">
      var path = escape(app_fullpath.substring(app_lps_root.length));
- var url = app_lps_root + "/lps/admin/solo-deploy.jsp? appurl="+path;
+     if (app_runtime == 'dhtml') {
+ var url = app_lps_root + "/lps/admin/solo-dhtml-deploy.jsp? appurl="+path;
+     } else {
+ var url = app_lps_root + "/lps/admin/solo-deploy.jsp? appurl="+path;
+     }
+
      LzBrowser.loadURL(url);
   </method>

@@ -122,7 +127,7 @@
<resource name="footer_logo" src="../assets/ logo_laszlo_footer.gif"/>

   <view name="main" width="${parent.width}">
- <view name="logo" resource="footer_logo" bgcolor="0x4c4c4c" height="100%"/> + <view name="logo" resource="footer_logo" bgcolor="0x4c4c4c" height="${app_console_debug ? 370 : 71}"/>
       <view name="controls" x="70">
         <view name="firstrow" y="4">
<text fontsize="11" x="8" y="7"><b>Compile Options:</ b></text>
@@ -333,6 +338,8 @@

   <script>
     <![CDATA[
+    if ($dhtml) {
+    } else {
     var receivingLC = new LocalConnection();
     // receives remote app debug message
     receivingLC.debugResult = function(msg, oid)
@@ -354,6 +361,7 @@

     // sequence numbers for eval requests
     canvas.evalseqnum = 0;
+    }

     ]]>
   </script>

Added: openlaszlo/branches/legals/lps/admin/dev-console.lzx.js


Property changes on: openlaszlo/branches/legals/lps/admin/dev- console.lzx.js
___________________________________________________________________
Name: svn:mime-type
   + text/plain
Name: svn:eol-style
   + native

Modified: openlaszlo/branches/legals/lps/admin/dev-console.lzx.swf
===================================================================
(Binary files differ)

Modified: openlaszlo/branches/legals/lps/includes/source/embednew.js
===================================================================
--- openlaszlo/branches/legals/lps/includes/source/embednew.js 2006-12-05 04:19:06 UTC (rev 2860) +++ openlaszlo/branches/legals/lps/includes/source/embednew.js 2006-12-05 05:18:01 UTC (rev 2861)
@@ -130,6 +130,9 @@
             return;
         }
         var url = properties.url;
+        window.bgcolor = properties.bgcolor;
+ window.width = properties.width.indexOf('%') == -1 ? properties.width + 'px' : properties.width; + window.height = properties.height.indexOf('%') == -1 ? properties.height + 'px' : properties.height;

         var sp = url.split('?');
         url = sp[0];
@@ -158,6 +161,7 @@
         var queryargs = this.__parseQuery(querystring);
         var q = '';
         var flashvars = '';
+        var re = new RegExp('\\+', 'g');
         for (var i in queryargs) {
             var v = queryargs[i];
             // add lps vars to query string
@@ -171,7 +175,8 @@
             if (setglobals) {
                 // set globals for all query args per LPP-2781
                 if (window[i] == null) {
-                    window[i] = v;
+                    // sometimes URLs contain '+' - change to spaces
+                    window[i] = unescape(v.replace(re, ' '));
                     //alert(i + ' = ' + v);
                 }
             }


_______________________________________________
Laszlo-checkins mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-checkins

Reply via email to