- wait for the version from the config.xml and from the locale file before checking if

the locale versions are the same. Sometimes, the locale swf file takes a long time to dowwnload
than the config.xml. When the check is performed, the version from the locale swf file is null.
This commit is contained in:
Richard Alam 2012-01-11 21:49:01 +00:00
parent bacb88c280
commit a4e5561ea9
5 changed files with 40 additions and 18 deletions

View File

@ -2,13 +2,13 @@ package org.bigbluebutton.main.events
{ {
import flash.events.Event; import flash.events.Event;
public class AppVersionEvent extends Event public class AppVersionEvent extends Event {
{
public static const APP_VERSION_EVENT:String = "APP VERSION EVENT"; public static const APP_VERSION_EVENT:String = "APP VERSION EVENT";
public var appVersion:String; public var appVersion:String;
public var localVersion:String; public var localeVersion:String;
public var suppressLocaleWarning:Boolean; public var suppressLocaleWarning:Boolean = false;
// If this version is from config.xml (true) or from locale.swf (false)
public var configLocaleVersion:Boolean = false;
public function AppVersionEvent() public function AppVersionEvent()
{ {

View File

@ -24,8 +24,6 @@ package org.bigbluebutton.main.model
import flash.net.URLLoader; import flash.net.URLLoader;
import flash.net.URLRequest; import flash.net.URLRequest;
import flash.utils.Dictionary; import flash.utils.Dictionary;
import org.bigbluebutton.main.events.AppVersionEvent;
import org.bigbluebutton.main.model.modules.ModuleDescriptor; import org.bigbluebutton.main.model.modules.ModuleDescriptor;
public class ConfigParameters { public class ConfigParameters {
@ -53,9 +51,7 @@ package org.bigbluebutton.main.model
private var _modules:Dictionary; private var _modules:Dictionary;
public function ConfigParameters(loadedListener:Function, file:String = FILE_PATH) public function ConfigParameters(loadedListener:Function, file:String = FILE_PATH) {
{
this.numModules = 0; this.numModules = 0;
this.loadedListener = loadedListener; this.loadedListener = loadedListener;
_urlLoader = new URLLoader(); _urlLoader = new URLLoader();

View File

@ -150,7 +150,8 @@ package org.bigbluebutton.main.model.modules
var dispatcher:Dispatcher = new Dispatcher(); var dispatcher:Dispatcher = new Dispatcher();
var versionEvent:AppVersionEvent = new AppVersionEvent(); var versionEvent:AppVersionEvent = new AppVersionEvent();
versionEvent.appVersion = configParameters.version; versionEvent.appVersion = configParameters.version;
versionEvent.localVersion = configParameters.localeVersion; versionEvent.localeVersion = configParameters.localeVersion;
versionEvent.configLocaleVersion = true;
versionEvent.suppressLocaleWarning = configParameters.suppressLocaleWarning; versionEvent.suppressLocaleWarning = configParameters.suppressLocaleWarning;
dispatcher.dispatchEvent(versionEvent); dispatcher.dispatchEvent(versionEvent);
} }

View File

@ -44,16 +44,20 @@
<mx:Script> <mx:Script>
<![CDATA[ <![CDATA[
import com.asfusion.mate.events.Dispatcher; import com.asfusion.mate.events.Dispatcher;
import flash.events.MouseEvent;
import flash.events.MouseEvent;
import flexlib.mdi.containers.MDIWindow; import flexlib.mdi.containers.MDIWindow;
import flexlib.mdi.effects.effectsLib.MDIVistaEffects; import flexlib.mdi.effects.effectsLib.MDIVistaEffects;
import mx.collections.ArrayCollection; import mx.collections.ArrayCollection;
import mx.containers.TitleWindow; import mx.containers.TitleWindow;
import mx.controls.Alert; import mx.controls.Alert;
import mx.core.FlexGlobals; import mx.core.FlexGlobals;
import mx.events.CloseEvent; import mx.events.CloseEvent;
import mx.managers.PopUpManager; import mx.managers.PopUpManager;
import org.bigbluebutton.common.IBbbModuleWindow; import org.bigbluebutton.common.IBbbModuleWindow;
import org.bigbluebutton.common.Images; import org.bigbluebutton.common.Images;
import org.bigbluebutton.common.LogUtil; import org.bigbluebutton.common.LogUtil;
@ -92,6 +96,9 @@
[Bindable] private var logs_icon:Class = images.table; [Bindable] private var logs_icon:Class = images.table;
[Bindable] private var reset_layout_icon:Class = images.layout; [Bindable] private var reset_layout_icon:Class = images.layout;
private var receivedConfigLocaleVer:Boolean = false;
private var receivedResourceLocaleVer:Boolean = false;
public function get mode():String { public function get mode():String {
return _mode; return _mode;
} }
@ -117,10 +124,19 @@
} }
private function handleApplicationVersionEvent(event:AppVersionEvent):void { private function handleApplicationVersionEvent(event:AppVersionEvent):void {
appVersion = event.appVersion; if (event.configLocaleVersion == true) {
localeVersion = event.localVersion; receivedConfigLocaleVer = true;
appVersion = event.appVersion;
localeVersion = event.localeVersion;
LogUtil.debug("!!!!!Received locale version fron config.xml");
} else {
receivedResourceLocaleVer = true;
LogUtil.debug("!!!!!Received locale version fron locale file.");
}
if (!event.suppressLocaleWarning) checkLocaleVersion(localeVersion); if (receivedConfigLocaleVer && receivedResourceLocaleVer) {
if (!event.suppressLocaleWarning) checkLocaleVersion(localeVersion);
}
} }
private function fullScreenHandler(evt:FullScreenEvent):void { private function fullScreenHandler(evt:FullScreenEvent):void {

View File

@ -19,6 +19,7 @@
package org.bigbluebutton.util.i18n package org.bigbluebutton.util.i18n
{ {
import com.adobe.utils.StringUtil; import com.adobe.utils.StringUtil;
import com.asfusion.mate.events.Dispatcher;
import flash.events.Event; import flash.events.Event;
import flash.events.EventDispatcher; import flash.events.EventDispatcher;
@ -37,6 +38,7 @@ package org.bigbluebutton.util.i18n
import org.bigbluebutton.common.LogUtil; import org.bigbluebutton.common.LogUtil;
import org.bigbluebutton.common.events.LocaleChangeEvent; import org.bigbluebutton.common.events.LocaleChangeEvent;
import org.bigbluebutton.main.events.AppVersionEvent;
public class ResourceUtil extends EventDispatcher { public class ResourceUtil extends EventDispatcher {
private static var instance:ResourceUtil = null; private static var instance:ResourceUtil = null;
@ -179,10 +181,17 @@ package org.bigbluebutton.util.i18n
preferredLocale = MASTER_LOCALE; preferredLocale = MASTER_LOCALE;
localeIndex = getIndexForLocale(preferredLocale); localeIndex = getIndexForLocale(preferredLocale);
} }
sendAppAndLocaleVersions();
update(); update();
} }
private function sendAppAndLocaleVersions():void {
var dispatcher:Dispatcher = new Dispatcher();
var versionEvent:AppVersionEvent = new AppVersionEvent();
versionEvent.configLocaleVersion = false;
dispatcher.dispatchEvent(versionEvent);
}
/** /**
* Defaults to DEFAULT_LANGUAGE when an error is thrown by the ResourceManager * Defaults to DEFAULT_LANGUAGE when an error is thrown by the ResourceManager
* @param event * @param event