//ActionScript 3.0
// package com
// package sdp
// package app
// class AppContext
package com.sdp.app
{
import com.sdp.*;
import com.sdp.assets.*;
import com.sdp.config.*;
import com.sdp.config.dataset.*;
import com.sdp.config.language.*;
import com.sdp.controls.alert.*;
import com.sdp.data.*;
import com.sdp.data.converter.*;
import com.sdp.forms.*;
import com.sdp.http.*;
import com.sdp.http.events.*;
import com.sdp.message.*;
import com.sdp.module.version.*;
import com.sdp.shortcuts.*;
import com.sdp.utils.*;
import com.sdp.version.*;
import flash.display.*;
import flash.events.*;
import flash.external.*;
import flash.net.*;
import flash.system.*;
import flash.utils.*;
import mx.collections.*;
import mx.controls.*;
import mx.core.*;
import mx.events.*;
import mx.managers.*;
import mx.utils.*;
public class AppContext extends flash.events.EventDispatcher
{
public function AppContext()
{
formLoaders = new com.sdp.utils.HashMap();
globalVariantMap = new com.sdp.utils.HashMap();
sessionMap = new com.sdp.utils.HashMap();
_processArray = new mx.collections.ArrayCollection();
_shortcutsArray = new com.sdp.utils.HashMap();
_configArray = new com.sdp.utils.HashMap();
_iobjectList = new com.sdp.utils.HashMap();
super();
if (_instance != null)
{
throw new Error("AppContext is Singleton!");
}
return;
}
public function addFormLoader(arg1:String, arg2:String, arg3:com.sdp.forms.FormLoader):void
{
var loc2:*=null;
var loc3:*=null;
var loc1:*=formLoaders.getValue(arg1) as Array;
if (loc1 == null)
{
loc1 = new Array();
loc3 = new Object();
loc3.url = arg2;
loc3.loader = arg3;
loc1.push(loc3);
formLoaders.put(arg1, loc1);
}
else
{
loc2 = new Object();
loc2.url = arg2;
loc2.loader = arg3;
loc1.push(loc2);
}
return;
}
private function stopLockTimer():void
{
if (_lockTimer != null)
{
_lockTimer.reset();
_lockTimer = null;
}
return;
}
public function refreshApplication():void
{
var loc1:*=new XML("<script>\r\n\t\t\t\t\t<![CDATA[\r\n\t\t\t\t\t\t\t\tfunction(myFoo){\r\n\t\t\t\t\t\t\t\t\tfunction reload(){\r\n\t\t\t\t\t\t\t\t\t\tdocument.location.reload();\r\n\t\t\t\t\t\t\t\t\t}; \r\n\t\t\t\t\t\t\t\t\treload();\r\n\t\t\t\t\t\t\t\t} \r\n\t\t\t\t\t\t\t]]> \r\n\t\t\t\t</script>");
flash.external.ExternalInterface.call(loc1);
return;
}
private static function initLanguage():void
{
var langList:XMLList;
var lang:XMLList;
var loc1:*;
langList = null;
lang = null;
if (allowInitLoadLanguages)
{
if (com.sdp.utils.ToolsUtil.isNullOrEmpty(browserLanguage))
{
if (com.sdp.utils.ToolsUtil.isNullOrEmpty(defaultLanguage))
{
language = com.sdp.utils.ToolsUtil.isNullOrEmpty(language) ? "zh-CN" : language;
}
else
{
language = defaultLanguage;
}
}
else
{
langList = _instance.languageLibrary.getAllLanguageByCache();
if (langList == null || langList.length() == 0)
{
_instance.languageLibrary.getAllLanguageToLocal(initLanguage);
return;
}
var loc3:*=0;
var loc4:*=langList;
var loc2:*=new XMLList("");
for each (var loc5:* in loc4)
{
var loc6:*;
with (loc6 = loc5)
{
if (language == browserLanguage)
{
loc2[loc3] = loc5;
}
}
}
lang = loc2;
if (!(lang == null) && lang.length() > 0)
{
language = browserLanguage;
}
else
{
language = defaultLanguage;
}
}
if (com.sdp.utils.ToolsUtil.isNullOrEmpty(com.sdp.app.AppContext.language))
{
com.sdp.app.AppContext.language = "zh-CN";
}
_instance.languageLibrary.addEventListener(com.sdp.config.language.LanguageLibraryConfig.ON_INITIAL_COMPLETE, afterLanguageInit);
_instance.languageLibrary.getAllSystemLanguages();
}
else
{
afterLanguageInit(null);
}
return;
}
public static function getInstance():com.sdp.app.AppContext
{
if (_instance == null)
{
_instance = new AppContext();
}
return _instance;
}
public static function init():void
{
var loc1:*=null;
var loc2:*=null;
var loc3:*=null;
com.sdp.app.AppContext.getInstance();
com.sdp.app.AppContext.getInstance().libraryVersions = getVersionInfo(new com.sdp.version.LibraryVersion());
if (com.sdp.utils.ToolsUtil.isNullOrEmpty(com.sdp.app.AppContext.browserLanguage))
{
loc1 = mx.core.Application.application.parameters.language;
if (com.sdp.utils.ToolsUtil.isNullOrEmpty(loc1) == false)
{
loc2 = new RegExp("-", "g");
loc3 = loc1.split(loc2);
if (loc3.length != 1)
{
if (loc3.length != 2)
{
com.sdp.app.AppContext.browserLanguage = "";
}
else
{
com.sdp.app.AppContext.browserLanguage = loc3[0] + "-" + (loc3[1] as String).toUpperCase();
}
}
else
{
com.sdp.app.AppContext.browserLanguage = loc1;
}
}
}
setPropertiesByConfig();
if (com.sdp.app.AppContext.contextPath == "")
{
initContextPath();
}
if (com.sdp.app.AppContext.servicePath == "")
{
com.sdp.app.AppContext.servicePath = com.sdp.app.AppContext.contextPath;
}
_moduleVersion = com.sdp.module.version.ModuleVersionManager.getInstance();
_moduleVersion.addEventListener(flash.events.Event.COMPLETE, VersionConfigInitHandle);
_moduleVersion.enabledVersionControl = allowVersionControl;
_moduleVersion.loadCurrentVesionsFromDB = moduleVersionFromDB;
_moduleVe