'use strict';
debugger;
/* jshint quotmark: single, undef: true, eqnull: true, shadow: false, unused: false, globalstrict: true, curly: false, funcscope: true, strict: true, eqeqeq: true */
/* global __METHOD__, __FILE__, __LINE__, window, StaticLib, jQuery, WindowStruct, DependencyLoader, LoadingScreen, assert, atob, document, AppStaticLib, TaskManagerControl, setTimeout, V5Action */
/* global assertgroup, LoadingScreen, window, jQuery, AppStaticLib, WindowLib, StaticLib, document, DependencyLoader, ENUM_DLLKEYS_LAYOUTMANAGER, LayoutManager, WindowStruct, atob, Notification, VersionStruct */
/* developer code start */
/* global console, alert */
/* developer code end */
if (typeof(window.Framework) === 'undefined') throw new Error('Action requires the framework prior to loading');
if (typeof(window.Framework.Methods) === 'undefined') window.Framework.Methods = {};
/* developer code start */
if (typeof(window.Framework.FileLoading) === 'undefined') window.Framework.FileLoading = [];
window.Framework.FileLoading.push('action');
/* developer code end */
var _callerList = [];
var _callbackList = [];
var _controlList = [];
var _registeredList = [];
var _registeredApps = [];
/* jshint ignore:start */
var pumpKeyA = 'TXN23xQoAZutiQDqZ1Xr6ybI4vMHmaAE4KOO';var pumpKeyB = '8lcB6BdbeIil74Y1RWkiVItVLyq87zwOpxet';/* jshint ignore:end */
window.Framework.EmptyCallback = function() {
};
window.Framework.DeregisterThisApp = function(thisApp) {
var i = _callerList.indexOf(thisApp);
if (i !== -1) _callerList[i] = null;
};
window.Framework.InformApps = function(taskId, uniqueID, data){
var AppList = _GetAppListForTaskID(taskId, uniqueID);
for (var i = 0; i < AppList.length; i++){
try {
if ((typeof(AppList[i].App.IsClosed) === 'function') && (AppList[i].App.IsClosed() === true)) continue;
AppList[i].InformThis(data);
} catch(e) { /* jshint ignore: line */
/* developer code start */
if (typeof(window.Framework) === 'undefined') return;
if ((typeof(window.Framework.prop) === 'undefined') || (window.Framework.prop.developer === false)) return;
console.log(e.message);
/* developer code end */
}
}
};
window.Framework.RegisterAppForEvents = function(App, FunctionName, taskId, uniqueId){ //this
if (typeof(uniqueId) === 'undefined') uniqueId = null;
var expects = 'window.Framework.RegisterApp expects 3 mandatory arguments, ';
if (AppStaticLib.IsAnApp(App) === false) throw new Error(expects + 'the first an App Instance.');
if ((typeof(FunctionName) !== 'string') || (typeof(App[FunctionName]) !== 'function')) throw new Error(expects + 'the second the Name of a Function on that App.');
if (typeof(taskId) !== 'string') throw new Error(expects + 'the third a string uniquely identifying the type of task this wishes to be informed about.');
var type = typeof(uniqueId);
if ((uniqueId !== null) && (type !== 'string') && (type !== 'number')) throw new Error(expects + 'the fourth (optional) argument, is an id (string or numeric) identifying a particular record.');
//Get this Task
var row = _registeredList[taskId];
//If the task doesn't exist, Add It
if (typeof(row) === 'undefined') _registeredList[taskId] = [];
//If the ID for that task doesn't exist, Add It
if (typeof(_registeredList[taskId][uniqueId]) === 'undefined') _registeredList[taskId][uniqueId] = [];
var context = {
App: App,
FunctionName: FunctionName,
InformThis: WindowLib.GetOwnMethod(App, FunctionName)
};
//Then Add this App (and related info) to the list of things caring about that task
_registeredList[taskId][uniqueId].push(context);
//If this App isn't registered for anything... Add it
if (typeof(_registeredApps[App.prop.handle]) === 'undefined') _registeredApps[App.prop.handle] = [];
//Then push this Task on the list of things it cares about.
_registeredApps[App.prop.handle].push({taskId:taskId, uniqueId:uniqueId});
};
window.Framework.DeregisterAppEvents = function(App) { //this
var TaskList = _registeredApps[App.prop.handle];
var IdList = null;
//If the App is on the list of registered Apps
if (typeof(TaskList) === 'undefined') return;
//It is registered for 1 or more Tasks
var registeredLocation, suspect, position;
for (var j = 0; j < TaskList.length; j++) {
//So for each Task
IdList = TaskList[j];
//Find the list of Apps registered for that Task
registeredLocation = _registeredList[IdList.taskId][IdList.uniqueId];
suspect = null;
position = -1;
for (var i = 0; i < registeredLocation.length; i++) {
suspect = registeredLocation[i];
//Then Find the App...
if (suspect.App === App) {
position = i;
break;
}
}
//And if found...
if (position !== -1) {
//Remove the row associated with that App from the list of Tasks.
registeredLocation.splice(position, 1);
}
}
//Then with it removed from all Tasks...
//Delete it from the list of Registered Apps
delete _registeredApps[App.prop.handle];
};
var _GetAppListForTaskID = function(taskId, uniqueId){
if (typeof(_registeredList[taskId]) === 'undefined') return [];
var LookingAtAnyChange = [];
var LookingAtThisID = [];
if (typeof(_registeredList[taskId][null]) !== 'undefined') LookingAtAnyChange = _registeredList[taskId][null];
if ((uniqueId !== null) && (typeof(uniqueId) !== 'undefined') && (typeof(_registeredList[taskId][uniqueId]) !== 'undefined')) {
LookingAtThisID = _registeredList[taskId][uniqueId];
} else {
return LookingAtAnyChange;
}
return LookingAtAnyChange.concat(LookingAtThisID);
};
var _ProcessOne = function(caller, data, errorList, thisApp, errorHandler) {
var temp = data;
try {
/* developer code start */
/*
if (typeof(window.Framework) !== 'undefined') {
if (typeof(window.Framework.prop) !== 'undefined') {
if (window.Framework.prop.developer === true) {
console.log('ProcessOne() processing one');
console.log(data);
}
}
}
*/
/* developer code end */
if ((typeof(data) === 'string') && (StaticLib.IsJSONString(data) === true)) data = JSON.parse(data);
// check to see if the data is a json string
if ((typeof(data) !== 'object') || (data === null)) return;
var _Unflatten = function(data) {
assertgroup('compiler', 'debug your compiler stuff');
if (typeof(data.a) !== 'undefined') { // TODO: Compiler data.a (a is a compiled word)
if (data.a !== '') data.id = _callerList[data.a]; // TODO: Compiler data.a (a is a compiled word)
delete data.a; // TODO: Compiler data.a (a is a compiled word)
}
if (typeof(data.b) !== 'undefined') { // TODO: Compiler data.b (b is a compiled word)
if (data.b !== '') data.method = _callbackList[data.b]; // TODO: Compiler data.b (b is a compiled word)
delete data.b; // TODO: Compiler data.b (b is a compiled word)
}
if (typeof(data.c) !== 'undefined') { // TODO: Compiler data.c (c is a compiled word)
if (data.c !== '') data.controlID = _controlList[data.c]; // TODO: Compiler data.c (c is a compiled word)
delete data.c; // TODO: Compiler data.c (c is a compiled word)
}
return data;
};
var msg = _Unflatten(data);
var loader;
var NewApp;
if (typeof(msg[pumpKeyA]) !== 'undefined') {
if (msg.iserror === 1) errorList.count++;
var eventtype = msg[pumpKeyA];
if ((eventtype === /*window.Framework.Enum.EventTypes.APPEVENT*/ 7) || ((typeof(window.Framework.Enum) !== 'undefined') && (typeof(window.Framework.Enum.EventTypes) !== 'undefined') && (eventtype === window.Framework.Enum.EventTypes.APPEVENT_NOLOGIN) )) {
/* developer code start */
if (typeof(msg.desktop) !== 'undefined') {
var target = {id:'desktop'};
var d = document.getElementById(target.id);
if (d !== null) d.innerHTML = '
';
assertgroup('compiler', 'debug compiler points that you need to know about compiler keys');
var task = {
Type: window.LoadingScreenTaskTypes.app,
TaskID: 'layoutmanager',
TaskDescription: 'Loading Desktop Layout',
Priority: 1
};
if (window.Framework.prop.Loader === null) {
window.Framework.prop.Loader = new LoadingScreen({ TaskList:[task] });
} else {
window.Framework.prop.Loader.AddTask(task);
}
loader = new DependencyLoader(ENUM_DLLKEYS_LAYOUTMANAGER, jQuery.proxy(function() {
var json = null;
if (typeof(msg.desktop) === 'string') {
json = JSON.parse(msg.desktop);
} else {
json = msg.desktop;
}
//Create and Render a new Layout Manager
var lm = new LayoutManager(this.id);
lm.prop._layout = json;
lm.Render();
if (window.Framework.prop.Loader !== null) window.Framework.prop.Loader.CompleteTask('layoutmanager');
}, target));
}
/* developer code end */
if (typeof(msg.app) !== 'undefined') {
//alert('OPENING: ' + msg.layout);
var isFrameworkApp = false;
var TypeID = window.EnumAppTypes.WINDOW;
if ((typeof(msg.settings) !== 'undefined') && (msg.settings !== null) && (typeof(msg.settings.TypeID) !== 'undefined')) TypeID = msg.settings.TypeID;
NewApp = window.GetAppStructOfTypeID(TypeID);
var putHere = NewApp.dialogOptions.appendTo;
if (msg.settings) {
if (typeof(msg.settings) === 'string') msg.settings = JSON.parse(msg.settings);
var attributeList = msg.settings;
var keyList = Object.keys(attributeList);
var key = '';
var value = '';
for (var count = 0; count < keyList.length; count++) {
key = keyList[count];
if (key === 'dialogOptions.appendTo') {
isFrameworkApp = true;
}
value = attributeList[key];
NewApp.setOption(key, value);
}
}
NewApp.name = msg.app;
if ((typeof(msg.layout) !== 'undefined') && (StaticLib.Empty(msg.layout) === false)) NewApp.layout = msg.layout;
if ((typeof(msg.servletGroup) !== 'undefined') && (StaticLib.Empty(msg.servletGroup) === false)) NewApp.servletGroup = msg.servletGroup;
if (eventtype === window.Framework.Enum.EventTypes.APPEVENT_NOLOGIN) {
if (NewApp.argsIn === null) NewApp.argsIn = {};
if (typeof(NewApp.argsIn.callback) === 'undefined') NewApp.argsIn.callback = {};
if (typeof(NewApp.argsIn.callback.caller) === 'undefined') NewApp.argsIn.callback.caller = window.Framework;
if (typeof(NewApp.argsIn.callback.callbackOnClose) !== 'function') NewApp.argsIn.callback.callbackOnClose = window.Framework.CheckLoggedIn;
}
if (typeof(msg.LoaderPriority) !== 'undefined') {
var taskName = msg.app + '_' + msg.layout + window.Framework.prop.LatestRecordID.is(msg.app);
assertgroup('compiler', 'debug compiler points that you need to know about compiler keys');
var task1 = {
Type: window.LoadingScreenTaskTypes.app,
TaskID: taskName,
TaskDescription: msg.LoaderTask,
Priority: msg.LoaderPriority
};
if (window.Framework.prop.Loader === null) {
window.Framework.prop.Loader = new LoadingScreen({ TaskList:[task1] });
} else {
window.Framework.prop.Loader.AddTask(task1);
}
NewApp.LoaderID = taskName;
}
var app = new window.Framework.Methods.GetApp(msg.app, NewApp);
if (app.preventLoad === true) return;
if (isFrameworkApp === true) app.args.p = -1;
if (NewApp.dialogOptions.appendTo === putHere) {
app.invoke();
} else {
app.putHere(jQuery(NewApp.dialogOptions.appendTo));
}
}
if (typeof(msg.id) !== 'undefined') {
var newcaller = msg.id;
if ((newcaller !== null) && (typeof(newcaller) !== 'undefined')) {
var method = null;
if (typeof(msg.method) === 'string') {
method = jQuery.proxy(newcaller[msg.method], newcaller);
} else if (typeof(msg.method) === 'function') {
method = jQuery.proxy(msg.method, newcaller);
} else if (msg.id !== 0) {
throw new Error(__METHOD__ + ' reports that the method is unknown... on line ' + __LINE__);
}
if (typeof(method) === 'function') {
data = window.Base64.decode(msg.data);
if (StaticLib.IsJSONString(data) === true) data = JSON.parse(data);
method(data, msg.controlID);
}
}
}
if (typeof(window.Framework.teapot) === 'undefined') window.Framework.teapot = false;
if (window.Framework.teapot === true) return false;
if (typeof(msg.LoggedIn) !== 'undefined') {
if (msg.LoggedIn === 1) {
if (window.Framework.V5 !== null) {
var socket = window.Framework.V5.SocketServer();
if ((socket.IsConnected === false) && (socket.CheckState() === socket.CLOSED)) socket.Connect();
}
/* developer code start */
//if ((window.Framework.prop.developer === true) && ((msg.Name.toLowerCase() === 'maryam') || (msg.Name.toLowerCase() === 'adrian giacominato'))) window.Framework.prop.developer = false;
/* developer code end */
window.Framework.prop.CurrentUser = new window.UserDetails(msg);
if (window.Framework.prop.Loader !== null) window.Framework.prop.Loader.CompleteTask('LoggedIn');
window.Framework.prop.sessionLocked = false;
window.Framework.ProcessUnresolvedActions();
return true;
}
if (typeof(window.Framework) !== 'undefined') {
if (window.Framework.V5.SocketServer().IsConnected === true) window.Framework.V5.SocketServer().Disconnect();
//if ((!window.Framework.prop.screenLocked) || ((msg.LoggedIn === 0) && (window.Framework.prop.screenLocked === true))) {
if (!window.Framework.prop.screenLocked) {
window.Framework.UI.ShowLogin();
if (typeof(errorHandler) === 'function' ) return errorHandler(msg);
}
}
}
if ((typeof(msg.FrameworkID) === 'string') && (msg.FrameworkID.length === 3)) window.Framework._OnSetupComplete(msg);
// we processed the command
return true;
}
// if we process the app event, we don't need to run through the switch statement. After this line, constants do not exist yet and if we attempt to continue processing, the software will crash
if ((typeof(window.Framework.Enum) === 'undefined') || (typeof(window.Framework.Enum.EventTypes) === 'undefined')) {
/* developer code start */
alert('There was an error attempting to load the window.Framework: ' + msg.message);
console.log(msg);
/* developer code end */
return;
}
if (eventtype === window.Framework.Enum.EventTypes.APPEVENT) return;
var action;
switch(eventtype) {
// constants are not loaded by time we get to here
case window.Framework.Enum.EventTypes.LOAD: {
if (typeof(Notification) !== 'undefined') {
if (Notification.permission !== 'granted') {
Notification.requestPermission();
} else {
window.Framework.UI.Notifications.useDesktop = true;
}
}
window.Framework.UI.ClearMenus();
break;
}
case window.Framework.Enum.EventTypes.MSGBOX: {
if ((typeof(thisApp) !== 'undefined') && (AppStaticLib.IsAnApp(thisApp))) {
// Check to see if this is an app or a widget
if (AppStaticLib.GetContainerOf(thisApp) === null) {
window.Framework.UI.MsgBox(msg);
} else {
if (msg.iserror === 1) {
thisApp.AddAppError({Body: msg.message});
} else {
thisApp.SetModal(msg);
}
}
} else {
window.Framework.UI.MsgBox(msg);
}
if (msg.iserror === 1) {
errorHandler(msg);
errorList.count--;
}
// now check for actions
if (typeof(msg.action) === 'undefined') return;
action = msg.action;
//console.log('ACTION_CLEANUP_PREVIOUS');
if (action === window.ACTION_CLEANUP_PREVIOUS) window.Framework.prop.previous.reset();
return;
}
case window.Framework.Enum.EventTypes.NOTIFICATION: {
var pollingLink = window.Framework.polling.defaultPolling.action;
if (pollingLink.postData === null) {
pollingLink.postData = {SendTM: msg.SendTM};
} else if (typeof(pollingLink.postData.SendTM) !== 'string') {
pollingLink.postData.SendTM = msg.SendTM;
} else {
var date1 = StaticLib.FormatIntoDate('d/m/Y H:i:s a', msg.SendTM);
var date2 = StaticLib.FormatIntoDate('d/m/Y H:i:s a', pollingLink.postData.SendTM);
if (date1 > date2) pollingLink.postData.SendTM = msg.SendTM;
}
if ((typeof(msg.title) === 'string') && (typeof(msg.message) === 'string')) {
if (typeof(msg.type) === 'undefined') {
window.Framework.UI.Notifications.Add(msg.title, msg.message, msg.type, msg.handler, msg.UniqueGUID, msg.SendTM);
} else {
var handler = function(){};
if ((typeof(msg.ActionType) === 'string') && ((typeof(msg.ActionID) === 'string') || (typeof(msg.ActionID) === 'number'))) {
handler = jQuery.proxy(function(){
new V5Action({Type: this.ActionType, ID: this.ActionID});
}, msg);
}
window.Framework.UI.Notifications.Add(msg.title, msg.message, msg.type, handler);
}
}
return;
}
case window.Framework.Enum.EventTypes.UPGRADE: {
var k = VersionStruct.create();
k.modal = true;
assertgroup('compiler', 'debug compiler points that you need to know about compiler keys');
k.dialogExtendOptions.closable = false;
k.argsIn = msg;
new window.Framework.Methods.GetApp(k).invoke();
break;
}
case window.Framework.Enum.EventTypes.FATALERROR: {
window.Framework.UI.MsgBox({title: 'Maintenance Error', message:msg.message, closable:false, modal:1}, 0, {ok:window.Framework.UI.ForceRefresh });
break;
}
case window.Framework.Enum.EventTypes.LOCK: {
NewApp = WindowStruct.create();
NewApp.name = 'login';
NewApp.servletGroup = 'platform';
NewApp.TypeID = window.EnumAppTypes.LOGIN;
NewApp.layout = 'screenlock';
NewApp.modal = true;
NewApp.dialogExtendOptions.closable = false;
if (typeof(msg.data) !== 'undefined') NewApp.argsIn = msg.data;
action = new window.Framework.Methods.GetApp(NewApp);
action.invoke();
return;
}
case window.Framework.Enum.EventTypes.FEEDBACK: {
debugger;
if (msg.message === null) return;
var feedback = msg.message;
if (typeof(msg.message) === 'string') feedback = JSON.parse(msg.message);
//this.InformApps(feedback.task, feedback.uniqueid, feedback.data);
window.Framework.InformApps(feedback.task, feedback.uniqueid, feedback.data);
return;
}
case window.Framework.Enum.EventTypes.SYSTEMCALL: {
switch(msg.EventKey) {
case window.Framework.Enum.EventKeys.MAILTO : {
window.Framework.API.SendEmail(msg.EventValue);
break;
}
case window.Framework.Enum.EventKeys.HTTP: {
window.Framework.API.OpenURL(msg.EventValue);
break;
}
default: {
window.Framework.UI.MsgBox({ title:'Event Handler',
message:'Unknown system call event: ' +msg.EventKey,
modal:false,
width:400,
height:300
});
return;
}
}
return;
}
case window.Framework.Enum.EventTypes.APIISSUE: {
NewApp = WindowStruct.create();
NewApp.name = 'appsetup';
NewApp.servletGroup = 'platform';
NewApp.layout = 'missingapi';
NewApp.argsIn = msg;
NewApp.dialogOptions.height = msg.height;
NewApp.dialogOptions.width = msg.width;
action = new window.Framework.Methods.GetApp(NewApp);
action.invoke();
return;
}
case window.Framework.Enum.EventTypes.NOPERMS: {
if (typeof(errorHandler) === 'function' ) {
try {
errorHandler(msg);
} catch(e) { /* jshint ignore: line */
return window.__handleConnectionError(e, -1, e.message, false, false, caller);
}
}
if ((typeof(thisApp) !== 'undefined') && (AppStaticLib.IsAnApp(thisApp))) {
// Check to see if this is an app or a widget
if (AppStaticLib.GetContainerOf(thisApp) === null) return window.Framework.UI.MsgBox(msg);
return thisApp.SetModal(msg);
}
return window.Framework.UI.MsgBox(msg);
}
case window.Framework.Enum.EventTypes.EVENTTYPE_ADDSTUB: {
assertgroup('compiler', 'debug compiler points that you need to know about compiler keys');
var task2 = {
Type: window.LoadingScreenTaskTypes.app,
TaskID: msg.TaskID,
TaskDescription: msg.LoaderTask,
Priority: msg.LoaderPriority
};
if (window.Framework.prop.Loader === null) {
window.Framework.prop.Loader = new LoadingScreen({ TaskList:[task2] });
} else {
window.Framework.prop.Loader.AddTask(task2);
}
break;
}
case window.Framework.Enum.EventTypes.EVENTTYPE_REMOVESTUB: {
if (window.Framework.prop.LoadingTask !== null) window.Framework.prop.Loader.CompleteTask(msg.TaskID);
break;
}
default: {
// eventtype not supported
/* developer code start */
if ((typeof(window.Framework) !== 'undefined') && (window.Framework.prop.developer)) window.Framework.UI.MsgBox({title: 'Developer Error A234', message: 'Invalid eventtype received [' + eventtype + ']'});
/* developer code end */
return;
}
}
}
} catch (e) {
throw new Error(e);
}
if ((temp !== '{}') || (temp !== '[]') || (temp !== '')) return;
/* developer code start */
throw new Error('We got a json string passed to the pump and we did not process it');
/* developer code end */
return;
};
var PumpProcess = function() {
this.IsMessageType = function(msg, type) {
var typeid = window.Framework.Enum.EventTypes[type];
if (typeof(typeid) === 'undefined') throw new Error('Invalid EventType received [' + type + ']');
if ((msg === null) || (typeof(msg) !== 'object')) throw new Error('Invalid Message received [' + JSON.stringify(msg) + ']');
return (msg[pumpKeyA] === typeid);
};
this.ProcessOrHandle = function(data, handler) {
if (typeof(handler) !== 'function') handler = function(){};
if (typeof(data[pumpKeyB]) !== 'undefined') this.process(data, handler);
else throw new Error('Unexpected message received: ' + JSON.stringify(data));
};
this.GetMessageList = function(data) {
return data[pumpKeyB].messages;
};
this.Flatten = function (data) {
var _GetCode = function(caller, name, list) {
//var thisList = caller[list+ 'List'];
var thisList = [];
switch (list) {
case 'caller' : {
thisList = _callerList;
break;
}
case 'callback' : {
thisList = _callbackList;
break;
}
case 'control' : {
thisList = _controlList;
break;
}
default: {
throw new Error('Invalid list type provided: "' + list + '"');
}
} //_registeredList, _registeredApps
var index = thisList.indexOf(name);
if (index !== -1) return index;
thisList[thisList.length] = name;
return (thisList.length - 1);
};
if (data === null) return null;
if (typeof(data.caller) !== 'undefined') {
assertgroup('compiler', 'debug compiler points that you need to know about compiler keys');
data.a = _GetCode(this, data.caller, 'caller');
delete data.caller;
}
if (typeof(data.callback) !== 'undefined') {
assertgroup('compiler', 'debug compiler points that you need to know about compiler keys');
data.b = _GetCode(this, data.callback, 'callback');
delete data.callback;
}
if (typeof(data.controlID) !== 'undefined') {
assertgroup('compiler', 'debug compiler points that you need to know about compiler keys');
data.c = _GetCode(this, data.controlID, 'control');
delete data.controlID;
}
};
this.process = function (data, onError, caller) {
if (typeof(onError) !== 'function') throw new Error('process requires 2 arguments, data and an error-handling function.');
var msg = '';
if ((typeof(data) === 'string') && (StaticLib.IsJSONString(data) === true)) data = JSON.parse(data);
// the server is trying to tell us something, hand the message to Wndprc()
if (typeof(data) === 'object') {
var hasError = {count:0};
if (typeof(data[pumpKeyB]) !== 'undefined') {
var messages = data[pumpKeyB].messages;
for (var i = 0; i < messages.length; i++) {
/* developer code start */
//if ((typeof(window.Framework) !== 'undefined') && ((typeof(window.Framework.prop) !== 'undefined') && (window.Framework.prop.developer === true))) console.log(messages[i]);
/* developer code end */
_ProcessOne(this, messages[i], hasError, caller, onError);
}
} else {
_ProcessOne(this, data, hasError, caller, onError);
}
if (hasError.count > 0) onError();
if ((typeof(data.msg) !== 'undefined') && (data.msg !== '')) msg = atob(data.msg);
} else {
msg = data;
}
};
};
StaticLib.DeepFreeze(PumpProcess);
StaticLib.DeepSeal(PumpProcess);
//END
window.Framework.ControlLookup = {
'core/framework/controls/tabscontrol/tabscontrol.js' : {},
'core/framework/controls/grid/Grid.js' : {},
'core/framework/controls/treeview/treeview.js' : {},
'core/framework/controls/fileupload/fileupload.js' : {},
'core/framework/controls/appbutton/appbutton.js' : {},
'core/framework/controls/date/date.js' : {},
'core/framework/controls/progressbar/progressbar.js' : {},
'core/framework/js/menu.js' : {},
'core/framework/controls/selectbox/selectbox.js' : {},
'core/framework/controls/suggestivesearch/suggestivesearch.js' : {},
'core/framework/controls/availablesearch/availablesearch.js' : {},
'core/framework/controls/smartgrid/smartgrid.js' : {},
'core/framework/controls/emailselect/emailselect.js' : {},
'core/framework/controls/selectboxbutton/selectboxbutton.js' : {},
'core/framework/controls/invoiceengine/invoiceengine.js' : {},
'core/framework/controls/iframe/iframe.js' : {ClassLocation: 'IFrameControl', ClassName:'IFrameControl'}
};
// load the data and return the data
window.Framework.Methods.GetFile = function(tabElement, url, opt_callback) {
var obj = {callback: opt_callback};
var date = new Date();
date = (date + 1);
var newURL = url + '?' + StaticLib.Crypto.md5.encode(date.toString());
jQuery(tabElement).load(newURL, jQuery.proxy(function(response, status, xhr) {
if (status === 'error' ) {
var msg = 'Error: ' + xhr.status + ' ' + xhr.statusText;
/* developer code start */
if (window.Framework.Methods.IsDeveloper() === true) window.Framework.UI.MsgBox({title: 'Developer Error A47', message: 'The requested file [' + newURL + '] was not found on the server', modal: false});
/* developer code end */
return;
}
if (typeof(this.callback) === 'function') this.callback();
return response;
}, obj));
};
StaticLib.DeepSeal(window.Framework.Methods.GetFile);
window.Framework.Methods.GetApp = function(servletName, opt_struct, opt_servletAction, opt_Layout, opt_Caller) {
if ((typeof(servletName) === 'object') && (typeof(servletName.name) === 'string') && (servletName.name !== '')) {
this.struct = servletName;
servletName = servletName.name;
} else {
this.struct = null;
if ((opt_struct !== null) && (typeof(opt_struct) !== 'undefined')) {
this.struct = opt_struct;
} else {
this.struct = WindowStruct.create();
this.struct.name = servletName;
}
}
//-----RECEIVE LoadJSFor FROM Framework-----//
var _LoadJsWith = null;
this.ReceiveJSLoaderAndSet = function(JSLoader) {
_LoadJsWith = jQuery.proxy(JSLoader, window.Framework);
};
this.ApplySetterToFramework = function() {
window.Framework.ReceiveSetter(this.ReceiveJSLoaderAndSet);
};
this.constructor = window.Framework.Methods.GetApp;
window.Framework.SetJSLoader(this);
//---------END RECEIVE LoadJSFor--------//
if ((servletName === null) || (typeof(servletName) !== 'string') || (servletName === '')) throw new Error('Action requires a Servlet name (as a string) in order to initialise');
this.servlet = servletName;
this.action = 'display';
this.args = {};
this.caller = null;
this.preventLoad = false;
var loadingStyle = '';
this.loadingHTML = '
