You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openmeetings.apache.org by so...@apache.org on 2015/11/26 12:11:10 UTC

svn commit: r1716605 - in /openmeetings/branches/3.1.x/openmeetings-flash/src/main/swf/modules/conference/tabcontent/fileexplorer: dynamicFileName.lzx fileExplorer.lzx library.lzx restCall.lzx

Author: solomax
Date: Thu Nov 26 11:11:10 2015
New Revision: 1716605

URL: http://svn.apache.org/viewvc?rev=1716605&view=rev
Log:
[OPENMEETINGS-1279] restCall helper is created and used as singleton

Added:
    openmeetings/branches/3.1.x/openmeetings-flash/src/main/swf/modules/conference/tabcontent/fileexplorer/restCall.lzx
Modified:
    openmeetings/branches/3.1.x/openmeetings-flash/src/main/swf/modules/conference/tabcontent/fileexplorer/dynamicFileName.lzx
    openmeetings/branches/3.1.x/openmeetings-flash/src/main/swf/modules/conference/tabcontent/fileexplorer/fileExplorer.lzx
    openmeetings/branches/3.1.x/openmeetings-flash/src/main/swf/modules/conference/tabcontent/fileexplorer/library.lzx

Modified: openmeetings/branches/3.1.x/openmeetings-flash/src/main/swf/modules/conference/tabcontent/fileexplorer/dynamicFileName.lzx
URL: http://svn.apache.org/viewvc/openmeetings/branches/3.1.x/openmeetings-flash/src/main/swf/modules/conference/tabcontent/fileexplorer/dynamicFileName.lzx?rev=1716605&r1=1716604&r2=1716605&view=diff
==============================================================================
--- openmeetings/branches/3.1.x/openmeetings-flash/src/main/swf/modules/conference/tabcontent/fileexplorer/dynamicFileName.lzx (original)
+++ openmeetings/branches/3.1.x/openmeetings-flash/src/main/swf/modules/conference/tabcontent/fileexplorer/dynamicFileName.lzx Thu Nov 26 11:11:10 2015
@@ -53,7 +53,7 @@
 	
 	<method name="addFolder">
         <![CDATA[
-            if ($debug) Debug.write("moveFile HTTP 1: ");
+            if ($debug) Debug.write("addFolder HTTP 1: ");
             var downloadurl = canvas.getUrl()+'services/FileService/addFolderSelfInternal?'
                             +'SID='+canvas.sessionId
                             +'&parentId='+this.parentId
@@ -61,8 +61,8 @@
                             +'&roomId='+hib.currentroomid
                             +'&isOwner='+this.isOwner;
             
-            this.addFolderSelf.setAttribute("src",downloadurl);
-            if ($debug) Debug.write("addFolderSelf doRequest ",downloadurl);
+            this.addFolderSelf.setAttribute("src", downloadurl);
+            if ($debug) Debug.write("addFolderSelf doRequest ", downloadurl);
             this.addFolderSelf.doRequest();
         ]]>
     </method>

Modified: openmeetings/branches/3.1.x/openmeetings-flash/src/main/swf/modules/conference/tabcontent/fileexplorer/fileExplorer.lzx
URL: http://svn.apache.org/viewvc/openmeetings/branches/3.1.x/openmeetings-flash/src/main/swf/modules/conference/tabcontent/fileexplorer/fileExplorer.lzx?rev=1716605&r1=1716604&r2=1716605&view=diff
==============================================================================
--- openmeetings/branches/3.1.x/openmeetings-flash/src/main/swf/modules/conference/tabcontent/fileexplorer/fileExplorer.lzx (original)
+++ openmeetings/branches/3.1.x/openmeetings-flash/src/main/swf/modules/conference/tabcontent/fileexplorer/fileExplorer.lzx Thu Nov 26 11:11:10 2015
@@ -33,9 +33,9 @@
 			</passthrough>
 		</when>
 	</switch>
-    <attribute name="parentFolderId" value="-2" type="number" />
-    
-    <attribute name="_selected" value="null" />
+	<attribute name="parentFolderId" value="-2" type="number" />
+	<attribute name="_selected" value="null" />
+	<attribute name="rootFileLoader" />
     
     <event name="onClose"/>
     
@@ -163,29 +163,23 @@
     
 	<method name="loadFiles">
 	<![CDATA[
-		var url = canvas.getUrl() + 'services/file/room/' + hib.currentroomid;
-		if ($debug) Debug.write("loadFiles ", url);
-		
-		var requestor:URLLoader = new URLLoader();
-		var request:URLRequest = new URLRequest(url);
-		request.method = URLRequestMethod.GET;
-		
-		//Add the URL variables
+		if (!rootFileLoader) {
+			rootFileLoader = new lz.restCall(this, {
+				restUrl: canvas.getUrl() + 'services/file/room/' + hib.currentroomid
+				, restMethod: URLRequestMethod.GET
+				, errorCallback: httpRequestError
+				, successCallback: httpRequestComplete
+				});
+		}
 		var variables:URLVariables = new URLVariables();
 		variables.sid = canvas.sessionId;
-		request.data = variables;
-		
-		//Initiate the transaction
-		requestor = new URLLoader();
-		requestor.addEventListener(Event.COMPLETE, httpRequestComplete);
-		requestor.addEventListener("ioError", httpRequestError);//IOErrorEvent.IOERROR
-		requestor.addEventListener(SecurityErrorEvent.SECURITY_ERROR, httpRequestError);
-		requestor.load(request);
+		rootFileLoader.load(variables);
 	]]>
 	</method>
 	
 	<method name="httpRequestComplete" args="event">
 		var o = JSON.parse(event.target.data);
+		if ($debug) Debug.info("httpRequestComplete ", this);
 		if ($debug) Debug.info("httpRequestComplete ", o);
 		createRootItems(o.fileExplorerObject);
 	</method>

Modified: openmeetings/branches/3.1.x/openmeetings-flash/src/main/swf/modules/conference/tabcontent/fileexplorer/library.lzx
URL: http://svn.apache.org/viewvc/openmeetings/branches/3.1.x/openmeetings-flash/src/main/swf/modules/conference/tabcontent/fileexplorer/library.lzx?rev=1716605&r1=1716604&r2=1716605&view=diff
==============================================================================
--- openmeetings/branches/3.1.x/openmeetings-flash/src/main/swf/modules/conference/tabcontent/fileexplorer/library.lzx (original)
+++ openmeetings/branches/3.1.x/openmeetings-flash/src/main/swf/modules/conference/tabcontent/fileexplorer/library.lzx Thu Nov 26 11:11:10 2015
@@ -27,6 +27,7 @@
     <include href="dynamicFileName.lzx" />
     <include href="dragItemFileExplorer.lzx" />
     <include href="fileExplorer.lzx" />
+	<include href="restCall.lzx" />
 
     <resource name="drag_n_drop_rsc">
     	<!-- APL Author sebawagner --> 

Added: openmeetings/branches/3.1.x/openmeetings-flash/src/main/swf/modules/conference/tabcontent/fileexplorer/restCall.lzx
URL: http://svn.apache.org/viewvc/openmeetings/branches/3.1.x/openmeetings-flash/src/main/swf/modules/conference/tabcontent/fileexplorer/restCall.lzx?rev=1716605&view=auto
==============================================================================
--- openmeetings/branches/3.1.x/openmeetings-flash/src/main/swf/modules/conference/tabcontent/fileexplorer/restCall.lzx (added)
+++ openmeetings/branches/3.1.x/openmeetings-flash/src/main/swf/modules/conference/tabcontent/fileexplorer/restCall.lzx Thu Nov 26 11:11:10 2015
@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+  
+      http://www.apache.org/licenses/LICENSE-2.0
+    	  
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+  
+-->
+<library>
+	<!-- ###################
+	    Class restCall
+	 -->
+	<class name="restCall" >
+		<switch>
+			<when property="$as3">
+				<passthrough>
+					import flash.events.*;
+					import flash.net.*;
+				</passthrough>
+			</when>
+		</switch>
+		<attribute name="restUrl" type="string" />
+		<attribute name="restMethod" type="string" />
+		<attribute name="errorCallback" />
+		<attribute name="successCallback" />
+		<attribute name="requestor" />
+		
+		<handler name="oninit">
+		<![CDATA[
+			if ($debug) Debug.write("restCall:: ", restUrl);
+			requestor = new URLLoader();
+			
+			//Initiate the transaction
+			requestor.addEventListener(Event.COMPLETE, successCallback);
+			requestor.addEventListener("ioError", errorCallback); //IOErrorEvent.IOERROR
+			requestor.addEventListener(SecurityErrorEvent.SECURITY_ERROR, errorCallback);
+		]]>
+		</handler>
+		
+		<method name="load" args="params">
+			var request:URLRequest = new URLRequest(restUrl);
+			request.method = restMethod;
+			//Add the URL variables
+			request.data = params;
+			
+			requestor.load(request);
+		</method>
+	</class>
+</library>