Author: solomax
Date: Tue Dec 11 04:29:33 2012
New Revision: 1419992

URL: http://svn.apache.org/viewvc?rev=1419992&view=rev
Log:
Host auto-detection is added is added to networking test

Modified:
    
incubator/openmeetings/trunk/singlewebapp/WebContent/openmeetings/networktesting-config.xml
    
incubator/openmeetings/trunk/singlewebapp/WebContent/src/base/mainMethods.lzx
    
incubator/openmeetings/trunk/singlewebapp/WebContent/swf10/networkTesting/networktesting.lzx

Modified: 
incubator/openmeetings/trunk/singlewebapp/WebContent/openmeetings/networktesting-config.xml
URL: 
http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/WebContent/openmeetings/networktesting-config.xml?rev=1419992&r1=1419991&r2=1419992&view=diff
==============================================================================
--- 
incubator/openmeetings/trunk/singlewebapp/WebContent/openmeetings/networktesting-config.xml
 (original)
+++ 
incubator/openmeetings/trunk/singlewebapp/WebContent/openmeetings/networktesting-config.xml
 Tue Dec 11 04:29:33 2012
@@ -22,7 +22,7 @@
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
     xsi:noNamespaceSchemaLocation="networktesting-config.xsd">
 
-    <hostAddress>192.168.56.101</hostAddress>
+    <hostAddress></hostAddress>
     <rtmpPort>1935</rtmpPort>
     <httpPort>5080</httpPort>
     <uriContext>/openmeetings</uriContext>

Modified: 
incubator/openmeetings/trunk/singlewebapp/WebContent/src/base/mainMethods.lzx
URL: 
http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/WebContent/src/base/mainMethods.lzx?rev=1419992&r1=1419991&r2=1419992&view=diff
==============================================================================
--- 
incubator/openmeetings/trunk/singlewebapp/WebContent/src/base/mainMethods.lzx 
(original)
+++ 
incubator/openmeetings/trunk/singlewebapp/WebContent/src/base/mainMethods.lzx 
Tue Dec 11 04:29:33 2012
@@ -130,7 +130,7 @@
 
     <method name="getTestingUrl">
     <![CDATA[
-        return getUrl() + 'networktesting.swf10.swf?lzproxied=solo';
+        return getUrl() + 'networktesting' + ($debug ? 'debug' : '') + 
'.swf10.swf?lzproxied=solo';
     ]]>
     </method>
         

Modified: 
incubator/openmeetings/trunk/singlewebapp/WebContent/swf10/networkTesting/networktesting.lzx
URL: 
http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/WebContent/swf10/networkTesting/networktesting.lzx?rev=1419992&r1=1419991&r2=1419992&view=diff
==============================================================================
--- 
incubator/openmeetings/trunk/singlewebapp/WebContent/swf10/networkTesting/networktesting.lzx
 (original)
+++ 
incubator/openmeetings/trunk/singlewebapp/WebContent/swf10/networkTesting/networktesting.lzx
 Tue Dec 11 04:29:33 2012
@@ -21,6 +21,13 @@
 <canvas width="100%" height="100%" title="NetworkTesting">
 
        <switch>
+        <when property="$as3">
+            <passthrough>
+                import flash.external.ExternalInterface;
+            </passthrough>
+        </when>
+    </switch>
+       <switch>
                <when property="$debug">
                        <method name="doDebugInit">
                                canvas.setAttribute('debug', true);
@@ -47,16 +54,34 @@
     <attribute name="uriContext" type="string" value="/openmeetings" />
     <attribute name="rtmpUriPath" type="string" 
value="/openmeetings/hibernate" />
 
-    <method name="getSettings">
-        var settingsPtr = canvas.settings.getPointer();
-
-        canvas.setAttribute("host", 
settingsPtr.xpathQuery("config/hostAddress/text()"));
-        canvas.setAttribute("rtmpPort", 
settingsPtr.xpathQuery("config/rtmpPort/text()"));
-        canvas.setAttribute("httpPort", 
settingsPtr.xpathQuery("config/httpPort/text()"));
-
-        canvas.setAttribute("uriContext", 
settingsPtr.xpathQuery("config/uriContext/text()"));
-        canvas.setAttribute("rtmpUriPath", 
settingsPtr.xpathQuery("config/rtmpUriPath/text()"));
-    </method>
+       <method name="getSettings">
+               var settingsPtr = canvas.settings.getPointer();
+               
+               canvas.setAttribute("host", 
settingsPtr.xpathQuery("config/hostAddress/text()"));
+               if (!canvas.host) {
+                       // trying to get host from JS call
+                       var url:String = 
ExternalInterface.call("window.location.href.toString");
+                       // in case of IE or some other security issues we will 
fail ...
+                       url = url ? url : canvas.proxyurl;
+                       if (url) {
+                               if ($debug) Debug.write("url ", url);
+                               var paramsIdx = url.indexOf("?");
+                               if (paramsIdx != -1) {
+                                       url = url.substr(0, paramsIdx);
+                               }
+                               if ($debug) Debug.write("url ", url);
+                               url = url.substr(url.indexOf("//") + 2);
+                               var portIdx = url.indexOf(":");
+                               canvas.setAttribute("host", url.substr(0, 
portIdx != -1 ? portIdx : url.indexOf("/")));
+                               if ($debug) Debug.write("canvas.host ", 
canvas.host);
+                       }
+               }
+               canvas.setAttribute("rtmpPort", 
settingsPtr.xpathQuery("config/rtmpPort/text()"));
+               canvas.setAttribute("httpPort", 
settingsPtr.xpathQuery("config/httpPort/text()"));
+               
+               canvas.setAttribute("uriContext", 
settingsPtr.xpathQuery("config/uriContext/text()"));
+               canvas.setAttribute("rtmpUriPath", 
settingsPtr.xpathQuery("config/rtmpUriPath/text()"));
+       </method>
 
     <method name="showTests">
         var tests = new lz.TestsView(canvas, {name:"testsView"});


Reply via email to