- 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;
public class AppVersionEvent extends Event
{
public class AppVersionEvent extends Event {
public static const APP_VERSION_EVENT:String = "APP VERSION EVENT";
public var appVersion:String;
public var localVersion:String;
public var suppressLocaleWarning:Boolean;
public var localeVersion:String;
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()
{

View File

@ -24,8 +24,6 @@ package org.bigbluebutton.main.model
import flash.net.URLLoader;
import flash.net.URLRequest;
import flash.utils.Dictionary;
import org.bigbluebutton.main.events.AppVersionEvent;
import org.bigbluebutton.main.model.modules.ModuleDescriptor;
public class ConfigParameters {
@ -53,9 +51,7 @@ package org.bigbluebutton.main.model
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.loadedListener = loadedListener;
_urlLoader = new URLLoader();

View File

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

View File

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

View File

@ -19,6 +19,7 @@
package org.bigbluebutton.util.i18n
{
import com.adobe.utils.StringUtil;
import com.asfusion.mate.events.Dispatcher;
import flash.events.Event;
import flash.events.EventDispatcher;
@ -37,6 +38,7 @@ package org.bigbluebutton.util.i18n
import org.bigbluebutton.common.LogUtil;
import org.bigbluebutton.common.events.LocaleChangeEvent;
import org.bigbluebutton.main.events.AppVersionEvent;
public class ResourceUtil extends EventDispatcher {
private static var instance:ResourceUtil = null;
@ -179,10 +181,17 @@ package org.bigbluebutton.util.i18n
preferredLocale = MASTER_LOCALE;
localeIndex = getIndexForLocale(preferredLocale);
}
sendAppAndLocaleVersions();
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
* @param event