Risks: low, this is well tested and has been to and from the cleaners 3 times.
Rewards: high - and lztest will pass in 4.0.x!

--
Regards,
Max Carlson
OpenLaszlo.org
--- Begin Message ---
Author: max
Date: 2007-04-06 11:36:04 -0700 (Fri, 06 Apr 2007)
New Revision: 4598

Modified:
   
openlaszlo/branches/legals/WEB-INF/lps/lfc/services/platform/dhtml/LzBrowser.js
Log:
Change 20070406-maxcarlson-4 by [EMAIL PROTECTED] on 2007-04-06 08:05:01 PDT
    in /Users/maxcarlson/openlaszlo/legals-clean
    for http://svn.openlaszlo.org/openlaszlo/branches/legals

Summary: UPDATED - fix LzBrowser.getLoadURL() to work with all URL types in 
DHTML

New Features:

Bugs Fixed: LPP-3776 - DHTML apps need to use embedDHTML url, not page load URL 
for proxied loads...

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

Documentation:

Release Notes:

Details: LzBrowser.js - getLoadURL() now handles URLs in the formats 
http:categories.lzx.js, http:/legals-clean/my-apps/solo/categories.lzx.js, 
http://localhost:8080/legals-clean/my-apps/solo/categories.lzx.js, 
categories.lzx.js and /legals-clean/my-apps/solo/categories.lzx.js.  Thanks, 
Mr. Pedantic!

lps.properties - Turn off backtrace.  Why is this still on?

Tests: Did a SOLO build that loads data over http.  Tested with these URLs in 
the generated .lzx.html: http:categories.lzx.js, 
http:/legals-clean/my-apps/solo/categories.lzx.js, 
http://localhost:8080/legals-clean/my-apps/solo/categories.lzx.js, 
categories.lzx.js and /legals-clean/my-apps/solo/categories.lzx.js

Files:
M      WEB-INF/lps/lfc/services/platform/dhtml/LzBrowser.js
M      WEB-INF/lps/config/lps.properties

Changeset: 
http://svn.openlaszlo.org/openlaszlo/patches/20070406-maxcarlson-4.tar


Modified: 
openlaszlo/branches/legals/WEB-INF/lps/lfc/services/platform/dhtml/LzBrowser.js
===================================================================
--- 
openlaszlo/branches/legals/WEB-INF/lps/lfc/services/platform/dhtml/LzBrowser.js 
    2007-04-06 17:22:18 UTC (rev 4597)
+++ 
openlaszlo/branches/legals/WEB-INF/lps/lfc/services/platform/dhtml/LzBrowser.js 
    2007-04-06 18:36:04 UTC (rev 4598)
@@ -65,15 +65,36 @@
   */
 LzBrowser.getLoadURL = function() {
     // get url app was loaded from
-    var o = Lz.__propcache.url;
-    if (o.charAt(0) != '/') {
-        // url is relative (to request url)
-        var l = window.location.toString();
-        var j = l.lastIndexOf('/');
-        l = l.substring(0, j + 1);
-        o = l + Lz.__propcache.url;
+    var url = Lz.__propcache.url;
+    if (! url) url = new String(window.location);
+    var colon = url.indexOf(':');
+    var slash = url.indexOf('/');
+    if (colon > -1) {
+        if (url.indexOf('://') == colon){
+            // absolute URL  http://foo.lzx with protocol - do nothing
+            return url;
+        } else if (url.charAt(colon + 1) == '/') {
+            // absolute URL  http:/foo.lzx with protocol - add a slash
+            url = url.substring(0, colon + 1) + '/' + url.substring(colon + 1);
+            return url;
+        } else {
+            // relative URL - http:foo.lzx - add path from window.location
+            var lzu = new LzURL(new String(window.location));
+            url = url.substring(0, colon + 1) + '/' + lzu.path + 
url.substring(colon + 1)
+            return url;
+        }
+    } else {
+        if ( slash == 0) {
+            // absolute URL begins with slash - do nothing
+            return url;
+        } else {
+            // url is relative (to request url)
+            var loc = new String(window.location);
+            var lastslash = loc.lastIndexOf('/');
+            loc = loc.substring(0, lastslash + 1);
+            return loc + url;
+        }
     }
-    return o;      
 }
 
 
@@ -416,3 +437,4 @@
 LzBrowser.updateAccessibility = function () {
     Accessibility.updateProperties();
 }
+


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

--- End Message ---

Reply via email to