'use strict'; /* 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, pumpKeyA: true, pumpKeyB: true, assertgroup, LoadingScreen, window, AppStaticLib, WindowLib, StaticLib, document, DependencyLoader, ENUM_DLLKEYS_LAYOUTMANAGER, LayoutManager, WindowStruct, atob, Notification, VersionStruct */ if(typeof(window.Framework)==='undefined')throw new Error('Action requires the framework prior to loading');if(typeof(window.Framework.Methods)==='undefined')window.Framework.Methods={};var _callerList=[];var _callbackList=[];var _controlList=[];var _registeredList=[];var _registeredApps=[]; /* jshint ignore:start */ var pumpKeyA = 'B4BI4YYH4OImw5sLMappkNzHPDgUrTq7p6W0';var pumpKeyB = 'lYxBfk9p6IG2z6RmZJA1BsSElMR8uLu1JkVR';/* 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;i0)&&(typeof(outerWindow[0].Popup)!=='undefined')){popupController=outerWindow[0].Popup;}var handle=dummyWindow.attr('id')||'';var isLoginWindow=/^(DIALOG|MODAL)_login(?:_|$)/.test(handle);if((popupController!==null)&&(popupController.prop!==null)&&(typeof(popupController.prop)==='object')){isLoginWindow=isLoginWindow||(popupController.prop.name==='login')||(popupController.prop.type==='login');}if(isLoginWindow)return;try{if(popupController!==null){if((popupController.prop!==null)&&(typeof(popupController.prop)==='object')&&(popupController.prop.dialogOptions!==null)&&(typeof(popupController.prop.dialogOptions)==='object')){popupController.prop.dialogOptions.close=null;}overlay=popupController.ModalOverlay;minimisedContainer=popupController.MinimisedPopupContainer;popupController.Close();}}catch(e){ /* jshint ignore: line */ }finally{if(overlay!==null)overlay.remove();if(minimisedContainer!==null)minimisedContainer.remove();outerWindow.remove();dummyWindow.remove();}});};function Msgbox(options){options=options||{};var title=options.title||'Message';var message=options.message||'';var buttons=options.buttons||['OK'];var callback=options.callback||function(){};var overlay=document.getElementById('MessageBoxOverlay');var titleDiv=document.getElementById('MessageBoxTitle');var messageDiv=document.getElementById('MessageBoxText');var buttonsDiv=document.getElementById('MessageBoxButtons');titleDiv.textContent=title;messageDiv.innerHTML=message;buttonsDiv.innerHTML='';buttons.forEach(function(buttonText){var button=document.createElement('button');button.type='button';button.className='btn btn-default ms-2';button.textContent=buttonText;button.addEventListener('click',function(){overlay.style.display='none';callback(buttonText);});buttonsDiv.appendChild(button);});overlay.style.display='block';}var _ProcessOne=function(caller,data,errorList,thisApp,errorHandler){var temp=data;try{if((typeof(data)==='string')&&(StaticLib.IsJSONString(data)===true))data=JSON.parse(data);if((typeof(data)!=='object')||(data===null))return;var _Unflatten=function(data){assertgroup('compiler','debug your compiler stuff');if(typeof(data.a)!=='undefined'){if(data.a!=='')data.id=_callerList[data.a];delete data.a;}if(typeof(data.b)!=='undefined'){if(data.b!=='')data.method=_callbackList[data.b];delete data.b;}if(typeof(data.c)!=='undefined'){if(data.c!=='')data.controlID=_controlList[data.c];delete data.c;}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===7)||((typeof(window.Framework.Enum)!=='undefined')&&(typeof(window.Framework.Enum.EventTypes)!=='undefined')&&(eventtype===window.Framework.Enum.EventTypes.APPEVENT_NOLOGIN))){if(typeof(msg.app)!=='undefined'){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;countdate2)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(){};var appTarget=msg.AppTarget;if(typeof(appTarget)==='string'){try{appTarget=JSON.parse(appTarget);}catch(ignoreAppTarget){}}if(appTarget&&typeof(appTarget)==='object'){handler=function(){window.Framework.UI.Notifications.OpenAppFromNotification(appTarget);};handler.NotificationTarget=appTarget;}if((typeof(msg.ActionType)==='string')&&((typeof(msg.ActionID)==='string')||(typeof(msg.ActionID)==='number'))){if(!(appTarget&&typeof(appTarget)==='object')){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:{if(msg.message===null)return;var feedback=msg.message;if(typeof(msg.message)==='string')feedback=JSON.parse(msg.message);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))){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:{return;}}}}catch(e){throw new Error(e);}if((temp!=='{}')||(temp!=='[]')||(temp!==''))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=[];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+'"');}}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);if(typeof(data)==='object'){var hasError={count:0};if(typeof(data[pumpKeyB])!=='undefined'){var messages=data[pumpKeyB].messages;for(var i=0;i0)onError();if((typeof(data.msg)!=='undefined')&&(data.msg!==''))msg=atob(data.msg);}else{msg=data;}};};StaticLib.DeepFreeze(PumpProcess);StaticLib.DeepSeal(PumpProcess);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'}};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;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;}}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);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='
'+loadingStyle+'Logo
';this.CurrentRecord=window.Framework.prop.LatestRecordID.is(this.struct.name);this.struct.CurrentRecord=this.CurrentRecord;if(((this.struct.uniqueType!=='')&&(this.struct.uniqueTypeId!==''))||((opt_Caller!==null)&&(typeof(opt_Caller)!=='undefined'))){this.caller=this;if((opt_Caller!==null)&&(typeof(opt_Caller)!=='undefined'))this.caller=opt_Caller;this.prop={handle:'__loader'};if((this.struct.uniqueType!=='')&&(this.struct.uniqueTypeId!=='')){if(typeof(window.Framework.prop.UniqueWindowCollection[this.struct.uniqueType])!=='undefined'){if(typeof(window.Framework.prop.UniqueWindowCollection[this.struct.uniqueType][this.struct.uniqueTypeId])!=='undefined'){this.preventLoad=true;if(this.struct.LoaderID!=='')window.Framework.prop.Loader.CompleteTask(this.struct.LoaderID);return false;}}else{window.Framework.prop.UniqueWindowCollection[this.struct.uniqueType]={};}window.Framework.prop.UniqueWindowCollection[this.struct.uniqueType][this.struct.uniqueTypeId]=this.prop;}var temp=jQuery.proxy(function(newWindow){if((this.caller!==this)&&(typeof(this.caller.__actionLoader)!=='undefined')&&(this.caller.__actionLoader!==null))this.caller.__actionLoader.CompleteTask(this.servlet+'-'+this.struct.layout);if((this.struct.uniqueType!=='')&&(this.struct.uniqueTypeId!=='')){if(typeof(window.Framework.prop.UniqueWindowCollection[this.struct.uniqueType])==='undefined')window.Framework.prop.UniqueWindowCollection[this.struct.uniqueType]={};window.Framework.prop.UniqueWindowCollection[this.struct.uniqueType][this.struct.uniqueTypeId]=newWindow.prop.handle;}},this);if((this.struct.argsIn===null)||(typeof(this.struct.argsIn)==='undefined')){this.struct.argsIn={callback:{caller:this}};}else if((this.struct.argsIn.callback===null)||(typeof(this.struct.argsIn.callback)==='undefined')){this.struct.argsIn.callback={caller:this};}if(((this.struct.argsIn.callback.callbackOnLoad===null)||(typeof(this.struct.argsIn.callback.callbackOnLoad)==='undefined'))===false){var temp2={first:temp,second:this.struct.argsIn.callback.callbackOnLoad};temp=jQuery.proxy(function(arg1){this.first(arg1);this.second(arg1);},temp2);}this.struct.argsIn.callback.callbackOnLoad=temp;}if((typeof(opt_Layout)!=='undefined')&&(opt_Layout!==null)){this.args.layout=opt_Layout;this.struct.layout=opt_Layout;}if((opt_servletAction!==null)&&(typeof(opt_servletAction)!=='undefined'))this.action=opt_servletAction;this.createWindow=null;this.opt_BeforeInvoke=null;this.repeatCall=null;this.isComplete=false;this.waitForLoginCallback=false;this.onLoginRequired=null;this.LastCalledURL='';var _Callback_OnSuccess=jQuery.proxy(function(data,status,connection){var msg='';var dependencies=true;if(typeof(connection)==='undefined')throw new Error('Unknown connection');var ct=connection.getResponseHeader('content-type')||'';if(ct.indexOf('html')>-1){if(StaticLib.IsJSONString(data)){data=JSON.parse(data);}else{var AddError=jQuery.proxy(function(msg){this.errors.push(msg.message);},this.struct);data=StaticLib.StripJS(data,AddError);}}else if(ct.indexOf('json')>-1){if(StaticLib.IsJSONString(data)===true){data=JSON.parse(data);}else{throw new Error('Not a valid JSON string ['+data+']');}}else{throw new Error('Unknown content type');}var _handler=jQuery.proxy(function(msg){if((typeof(msg)!=='undefined')&&(msg!==null)){if(this.struct.handle!==null){var temp=jQuery('#'+this.struct.handle);var provisionalWindow=temp.parents('.ui-dialog').first();var popupController=null;var provisionalOverlay=jQuery();var provisionalMinimisedContainer=jQuery();try{if((temp.length>0)&&(typeof(temp[0].Popup)!=='undefined')){popupController=temp[0].Popup;if(temp.hasClass('DummyWindow'))popupController.prop.dialogOptions.close=null;provisionalOverlay=popupController.ModalOverlay;provisionalMinimisedContainer=popupController.MinimisedPopupContainer;popupController.Close();}}catch(e){ /* jshint ignore: line */ }finally{if(provisionalOverlay!==null)provisionalOverlay.remove();if(provisionalMinimisedContainer!==null)provisionalMinimisedContainer.remove();provisionalWindow.remove();temp.remove();}}if((msg[pumpKeyA]===window.Framework.Enum.EventTypes.NOPERMS)||(msg[pumpKeyA]===window.Framework.Enum.EventTypes.MSGBOX))return window.Framework.UI.MsgBox(msg);if((msg.LoggedIn===0)&&(this.action!=='CheckLoggedIn')){if((this.waitForLoginCallback===true)&&(typeof(this.onLoginRequired)==='function')){this.onLoginRequired(this);}else if(this.waitForLoginCallback!==true){window.Framework.UnresolvedActions.push(this);}}}},this);if(typeof(this.struct.onError)==='function')_handler=StaticLib.combineFunctions(_handler,this.struct.onError);if(typeof(data)==='object'){if(typeof(data[pumpKeyB])!=='undefined'){var outputter=new PumpProcess();outputter.process(data,_handler,this);}if(data.load){if(typeof(this.postData)==='undefined'){this.postData={};}else{if(typeof(this.postData.try)==='undefined'){this.postData.try=2;}else{this.postData.try++;}}if(Array.isArray(data.load)){var loadThese=[];data.load.sort(function(obj1,obj2){return obj1.priority-obj2.priority;});for(var i=0;iallowedTries){assert(function(){return(this.postData.try<=allowedTries);});return;}}}else{this.postData={};}if((this.caller!==null)&&(typeof(this.caller)==='object')){if(this.postData===null)this.postData={};var pos=(this.caller.prop.handle.startsWith('#')===true)?1:0;var callerID=this.caller.prop.handle.slice(pos,this.caller.prop.handle.length).trim();this.args.caller=callerID;}var _link=_createURL();if(typeof(this.opt_BeforeInvoke)==='function')this.opt_BeforeInvoke(this);if(AppStaticLib.IsAnApp(this.caller)===true){if((typeof(this.caller.__actionLoader)==='undefined')||(this.caller.__actionLoader===null)){var overlay=document.createElement('div');overlay.setAttribute('class','ui-widget-overlay ui-front');overlay.setAttribute('style','position: absolute;');jQuery(this.caller.prop.handle).append(overlay);var debug=true;if(debug===true){this.progressbar=new window.Framework.Controls.ProgressBar('','rectangle','append','',this.caller);this.progressbar.vars.div.setAttribute('style','position: absolute; top: 0px;');this.progressbar.load();}this.caller.__actionLoader=new TaskManagerControl({ParentObject:this.caller,TaskList:[this.servlet+'-'+this.struct.layout],WhenDone:jQuery.proxy(function(){jQuery(this.caller.prop.handle).find('.ui-widget-overlay').first().remove();delete this.progressbar;this.caller.__actionLoader=null;},this)});}else{if(typeof(this.postData.try)==='undefined')this.caller.__actionLoader.AddTask(this.servlet+'-'+this.struct.layout);}}if(window.Online===false)return window.Framework.UI.MsgBox({title:'Error',message:'Not online',height:200,width:300,modal:false});jQuery.ajax({url:_link,method:'POST',data:this.postData,dataType:'text',context:this,error:_Callback_OnError,complete:_Callback_OnComplete,success:_Callback_OnSuccess}).ActionObj=this;if((typeof(opt_resetTimer)!=='undefined')&&(opt_resetTimer===false))return;if((typeof(window.Framework.prop)!=='undefined')&&(typeof(window.Framework.prop.SessionTimer)!=='undefined')&&(window.Framework.prop.SessionTimer!==null))window.Framework.prop.SessionTimer.resetTimer();};this.FillSectionAndWrap=function(NewApp,data){var id=0;if((window.Framework)&&(window.Framework!==null)&&(window.Framework.prop)&&(window.Framework.prop!==null)&&(window.Framework.prop.LatestRecordID)&&(window.Framework.prop.LatestRecordID!==null))id=window.Framework.prop.LatestRecordID.is(this.name);var newID='ContainedApp_'+id;var newLocation=jQuery('
');jQuery(this.putHere).append(newLocation);this.putHere=newLocation;jQuery.proxy(this.context.callback_FillSectionWithWidget,this)(NewApp,data);};this.putHere=function(putHere,opt_resetTimer,opt_CallbackAfterComplete){var context={putHere:putHere,opt_resetTimer:opt_resetTimer,opt_CallbackAfterComplete:opt_CallbackAfterComplete,func:this.putHere,context:this};this.createWindow=jQuery.proxy(this.FillSectionAndWrap,context);this.repeatCall=jQuery.proxy(function(){return jQuery.proxy(this.func,this.context)(this.putHere,this.opt_resetTimer,this.opt_CallbackAfterComplete);},context);if(typeof(opt_CallbackAfterComplete)!=='undefined')this.onComplete=opt_CallbackAfterComplete;if(jQuery(putHere)[0].id!=='')this.struct.handle=jQuery(putHere)[0].id;this.contactServer(opt_resetTimer);};this.callback_FillSectionWithWidget=function(NewApp,data){var putHere=jQuery(this.putHere);var thisApp=null;var container=document.createElement('DIV');var jContainer=jQuery(container);var handle_Modal=NewApp.servletGroup+NewApp.name+NewApp.layout+'_'+NewApp.CurrentRecord;container.setAttribute('id',handle_Modal);container.setAttribute('class','containedapp');container.innerHTML=data;putHere.html(container);if(AppStaticLib.GetThisApp(container)===null){jContainer.hover(jQuery.proxy(function(){jQuery(this).addClass('ui-front');},putHere),jQuery.proxy(function(){jQuery(this).removeClass('ui-front');},putHere));}if(NewApp.hasScript){var JSurl=NewApp.JSLink();_LoadJsWith(JSurl,jContainer,NewApp);var parentApp=null;if(NewApp.type!=='FrameworkComponent'){try{if(jQuery.contains(document,putHere[0]))parentApp=AppStaticLib.GetThisApp(putHere);}catch(e){ /* jshint ignore: line */ }}}if((NewApp.LoaderID!=='')&&(window.Framework.prop.Loader!==null))window.Framework.prop.Loader.CompleteTask(NewApp.LoaderID);};return this;};StaticLib.DeepSeal(window.Framework.Methods.GetApp);StaticLib.DeepFreeze(window.Framework.Methods.GetApp);window.APIV2Struct={create:function(obj){var struct={servlet:'',view:'',servletGroup:'',api:'',proxy:false,proxyServlet:'',proxyServletGroup:'',proxyView:'default',controlID:'',caller:null,from:null,callback:null,postData:null,oneVal:true,showLoading:true,isControl:false,LoadingTask:null};if((obj!==null)&&(typeof(obj)!=='undefined')){if((obj.api==='')||(typeof(obj.api)!=='string'))throw new Error('APIV2Struct expects an \'api\' argument that is a function name');if((obj.LoadingTask!==null)&&(typeof(obj.LoadingTask)!=='undefined'))obj.LoadingTask=new window.LoadingTaskSTRUCT(obj.LoadingTask);if((obj.caller===null)||(typeof(obj.caller)==='undefined')){if((obj.from!==null)&&(typeof(obj.from)==='object')){if(obj.isControl!==true)obj.caller=obj.from;}else{throw new Error('APIV2Struct expects a \'caller\' argument');}}if((obj.from===null)||(typeof(obj.from)!=='object')){if((obj.caller!==null)&&(typeof(obj.caller)==='object')){obj.from=obj.caller;}else{throw new Error('APIV2Struct expects a \'caller\' argument');}}if(AppStaticLib.IsAnApp(obj.from)){obj.servlet=obj.from.AppDetails.servlet;obj.view=obj.from.AppDetails.view;obj.servletGroup=obj.from.AppDetails.servletGroup;}else if(obj.from===window.Framework){obj.servlet=obj.proxyServlet;obj.view=obj.proxyView;obj.servletGroup=obj.proxyServletGroup;}else{throw new Error('APIV2Struct expects a \'caller\' argument (or the \'from\' argument when providing BOTH \'caller\' & \'from\') to be an instance of an App');}if(obj.isControl!==true){if((!AppStaticLib.IsAnApp(obj.caller))&&(obj.from!==window.Framework)){throw new Error('APIV2Struct expects the \'caller\' argument to be an instance of an App, unless the \'isControl\' argument is provided');}if(obj.from===window.Framework){if(typeof(obj.from[obj.callback])!=='function')throw new Error('APIV2Struct expects a \'callback\' argument that is a string name of a function available on the \'window.Framework\'');}else{if((typeof(obj.callback)!=='string')||(typeof(obj.caller[obj.callback])!=='function'))throw new Error('APIV2Struct expects a \'callback\' argument that is a string name of a function available on the \'caller\'');obj.servlet=obj.from.AppDetails.servlet;obj.view=obj.from.AppDetails.view;obj.servletGroup=obj.from.AppDetails.servletGroup;}}if((obj.proxyServlet!=='')&&(typeof(obj.proxyServlet)==='string')&&(obj.proxyServletGroup!=='')&&(typeof(obj.proxyServletGroup)==='string')){if((obj.proxyView==='')||(typeof(obj.proxyView)!=='string'))obj.proxyView='default';if((obj.servletGroup!==obj.proxyServletGroup)||(obj.servlet!==obj.proxyServlet)||(obj.view!==obj.proxyView))obj.proxy=true;}else{if(((obj.proxyServlet!=='')&&(typeof(obj.proxyServlet)==='string'))||(obj.proxy===true))throw new Error('When \'proxy\' is set to true or proxyServlet is provided, APIV2Struct expects the \'proxyServletGroup\' & \'proxyServlet\' arguments');}}if((typeof(obj)!=='undefined')&&(obj!==null))StaticLib.SetProps(struct,obj);return struct;}};StaticLib.DeepSeal(window.APIV2Struct);StaticLib.DeepFreeze(window.APIV2Struct);window.Framework.Methods.GetAPIV2=function(o){this.prop=window.APIV2Struct.create(o);var keys=Object.keys(this.prop);keys.forEach(jQuery.proxy(function(key){Object.defineProperty(this,key,{get:function(){return this.prop[key];},set:function(value){this.prop[key]=value;},enumerable:false,writeable:true,configurable:true});},this));Object.defineProperty(this,'callbackName',{get:function(){return this.prop.callback;},set:function(value){this.prop.callback=value;},enumerable:false,writeable:true,configurable:true});if((this.prop.servlet===null)||(typeof(this.prop.servlet)!=='string'))throw new Error('Action requires a Servlet name (as a string) in order to initialise');this.showLoading=true;var callObj=null;this.opt_BeforeInvoke=null;this.opt_SuccessCallback=null;this.opt_CompleteCallback=null;this.opt_ErrorCallback=null;this.args={};this.onError=null;this.onComplete=null;this.opt_BeforeProcess=null;this.LastCalledURL='';this.Frame={Level:0,Start:null,Method:null,URL:'',ServletGroup:'',Servlet:'',View:'',IsProxyCall:false,ProxyServletGroup:'',ProxyServlet:'',ProxyView:'',Duration:function(){var end=window.performance.now();var ms=parseInt((end-this.Start).toString().split('.'[0]));var time=(end-this.Start);var label='milliseconds';if(ms>1000){time=(ms/1000);label='seconds';}return time+' '+label;}};if(typeof(this.prop.callback)!=='undefined'){if((!this.prop.isControl)&&((this.prop.callback===null)||(typeof(this.prop.callback)!=='string')))throw new Error('The appCallback argument that Action was passed was not a string as required');this.callbackName=this.prop.callback;}if((this.prop.postData!==null)&&(typeof(this.prop.postData)!=='undefined'))this.postData=this.prop.postData;var _Callback_OnSuccess=jQuery.proxy(function(data,status,connection){if(typeof(connection)==='undefined')throw new Error('connection is unknown');if(typeof(this.opt_BeforeProcess)==='function')this.opt_BeforeProcess(data);var msg='';var ct=connection.getResponseHeader('content-type')||'';if(ct.indexOf('html')>-1){if(StaticLib.IsJSONString(data)===true){var caller=null;if((connection.ActionObj!==null)&&(connection.ActionObj.caller!==null))caller=connection.ActionObj.caller;msg=__METHOD__+' reports that the data returned is not JSON but instead HTML, please specify your content-type header before returning your data';if(caller===null)throw new Error(msg);if(typeof(this.onError)==='function')this.onError(data);try{throw new Error(msg);}catch(e){return window.__handleConnectionError(e,-1,msg,false,false,caller);}}else{window.Framework.UI.MsgBox({title:'Error',message:data});}}else if(ct.indexOf('json')>-1){if(StaticLib.IsJSONString(data)===false){if(typeof(this.onError)==='function')handler=this.onError(data);throw new Error('Not a valid JSON string');}data=JSON.parse(data);}else{throw new Error('Unknown content type');}if((typeof(data.CallStack)!=='undefined')&&((typeof(connection.ActionObj)!=='undefined')&&(AppStaticLib.IsAnApp(connection.ActionObj.prop.caller)===true)))connection.ActionObj.prop.caller.AddAppCall(data.CallStack);var handler=jQuery.proxy(function(){if(msg.LoggedIn===0)window.Framework.UnresolvedActions.push(this);},this);if(typeof(this.onError)==='function')handler=this.onError;if(typeof(data)==='object'){if(Array.isArray(data.NewKey)===true){pumpKeyA=data.NewKey[0];pumpKeyB=data.NewKey[1];}if(typeof(data[pumpKeyB])!=='undefined'){var outputter=new PumpProcess();outputter.process(data,handler);}if((typeof(data.msg)!=='undefined')&&(data.msg!==''))msg=atob(data.msg);}if(typeof(this.opt_SuccessCallback)==='function')this.opt_SuccessCallback(data);},this);var _Callback_OnComplete=jQuery.proxy(function(data,status,connection){var caller=this.caller;if(AppStaticLib.IsAnApp(this.prop.proxyCaller))caller=this.prop.proxyCaller;if(AppStaticLib.IsAnApp(caller)){var index=caller.currentAPICalls.indexOf(this);if(index!==-1){caller.currentAPICalls.splice(index,1);}}if((this.showLoading)&&(typeof(caller)!=='undefined')&&(caller!==null)&&(typeof(caller.__actionLoader)!=='undefined')&&(caller.__actionLoader!==null))caller.__actionLoader.CompleteTask(this.servlet+'-'+this.action);if((typeof(this.onComplete)!=='undefined')&&(this.onComplete!==null)){try{this.onComplete(data);}catch(e){ /* jshint ignore: line */ if(AppStaticLib.IsAnApp(caller)!==true){if(AppStaticLib.IsAnApp(caller.vars.ParentObject))caller=caller.vars.ParentObject;else if(AppStaticLib.IsAnApp(caller.prop.ParentObject))caller=caller.vars.ParentObject;else if((typeof(caller.prop.ParentObject)==='object')&&(typeof(caller.prop.ParentObject.GetValue)==='function')){if(AppStaticLib.IsAnApp(caller.prop.ParentObject))caller=caller.vars.ParentObject;}}if(AppStaticLib.IsAnApp(caller)===false)window.ErrorHandler(caller.prop.struct,e,_createURL(),true,caller);}}if(this.prop.LoadingTask!==null)window.Framework.prop.Loader.CompleteTask(this.prop.LoadingTask.TaskID);},this);var _Callback_OnError=jQuery.proxy(function(connection,status,errorText){if(typeof(connection)==='undefined')return;window.__handleConnectionError(connection,connection.status,errorText,true);var caller=this.caller;if(typeof(this.opt_BeforeProcess)==='function')this.opt_BeforeProcess(null);if(AppStaticLib.IsAnApp(this.prop.proxyCaller)===true)caller=this.prop.proxyCaller;if((this.showLoading)&&(typeof(caller)!=='undefined')&&(caller!==null)&&(typeof(caller.__actionLoader)!=='undefined')&&(caller.__actionLoader!==null))caller.__actionLoader.CompleteTask(this.servlet+'-'+this.action);if(typeof(this.onError)==='function')this.onError();if(StaticLib.IsJSONString(connection.responseText)===true){var outputter=new PumpProcess();outputter.process(connection.responseText,function(){},caller);return;}},this);this.ReturnDataLocation=function(DataSourceObj){if((DataSourceObj instanceof DatasourceArray)!==true)return;DataSourceObj.ReceiveURL(_createURL());};var _createURL=jQuery.proxy(function(){var layout='';var group='';if((typeof(this.prop.caller)!=='undefined')&&(this.prop.caller!==null)){if(this.args===null)this.args={};this.args.caller=this.prop.caller;}else{throw new Error('You can\'t _createURL for an API that doesn\'t have a caller');}if((this.prop.from===null)&&(typeof(this.prop.from)!=='object'))throw new Error('You can\'t _createURL for an API that doesn\'t have a \'from\' source');if(this.prop.from!==window.Framework)this.args.w=this.prop.from.prop.struct.CurrentRecord;if(this.prop.callback!==null)this.args.callback=this.prop.callback;if(this.controlID!==null)this.args.controlID=this.prop.controlID;if(this.prop.proxy===true){this.args.proxy=1;if(this.postData===null)this.postData={};}var outputter=new PumpProcess();outputter.Flatten(this.args);var extraArgs='';if(this.action!=='display'){if(this.args!==null){jQuery.each(this.args,function(index,value){if(value===null)return;if(typeof(value)==='undefined')return;extraArgs=extraArgs+'&'+index+'='+encodeURI(value);});}}var servletGroup=this.prop.servletGroup;var servlet=this.prop.servlet;var view=this.prop.view;if(this.prop.from!==window.Framework){servletGroup=this.prop.from.AppDetails.servletGroup;servlet=this.prop.from.AppDetails.servlet;view=this.prop.from.AppDetails.view;}if(StaticLib.Empty(servletGroup)===true)throw new Error('ServletGroup is empty');if(StaticLib.Empty(servlet)===true)throw new Error('Servlet is empty');if(StaticLib.Empty(view)===true)throw new Error('View is empty');var frameworkID=window.FrameworkID;if((typeof(window.Framework.V5)==='object')&&(window.Framework.V5!==null)&&(typeof(window.Framework.V5.RunningFrameworkID)==='string'))frameworkID=window.Framework.V5.RunningFrameworkID;this.LastCalledURL=servletGroup+'/'+servlet+'/'+view+'/'+this.prop.api+'/?'+'f='+frameworkID+extraArgs;return this.LastCalledURL;},this);this._createURL=function(){return _createURL();};this.PreviewContent=function(IFrameName){if(typeof(this.postData)!=='object')throw new Error('GetAPI.PreviewContent should only be called with PostForm Data');var url=_createURL();var params=this.postData;var newWindow=true;if(this.prop.oneVal)params={POSTDATA:this.postData};var addParam=function(paramName,paramValue){var input=jQuery('');if(typeof(paramValue)==='object'){if(typeof(StaticLib)!=='undefined')paramValue=StaticLib.JsonEncode(paramValue);else paramValue=JSON.stringify(paramValue);}input.attr({'id':paramName,'name':paramName,'value':paramValue});form.append(input);};var form=jQuery('
');form.attr('action',url);form.attr('method','POST');var targetName='_blank';if((typeof(IFrameName)!=='undefined')&&(IFrameName!==null)&&(IFrameName!==''))targetName=IFrameName;if(newWindow===true)form.attr('target',targetName);for(var key in params)addParam(key,params[key]);assertgroup('compiler','debug compiler points that you need to know about compiler keys');form.appendTo(document.body);form.submit();form.remove();};var _ProxyPost=jQuery.proxy(function(){if(this.postData===null)return null;var temp=this.postData;var tempVal=this.postData;if(this.oneVal===true){if(this.postData!==null){if(typeof(StaticLib)!=='undefined')temp=StaticLib.JsonEncode(this.postData);else temp=JSON.stringify(this.postData);}temp={'POSTDATA':temp};}else{temp=JSON.parse(StaticLib.JsonEncode(this.postData));}if(this.prop.proxy===true)temp.proxy={servlet:this.prop.proxyServlet,view:this.prop.proxyView,proxyServletGroup:this.prop.proxyServletGroup};return temp;},this);this.invoke=function(opt_resetTimer){if(window.Online===false)return window.Framework.UI.MsgBox({title:'Error',message:'Not online',height:200,width:300,modal:false});var _link=_createURL();var temp='';if(this.postData!==null){if(typeof(StaticLib)!=='undefined')temp=StaticLib.JsonEncode(this.postData);else temp=JSON.stringify(this.postData);}if(typeof(this.opt_BeforeInvoke)==='function')this.opt_BeforeInvoke(this);var caller=this.caller;if(AppStaticLib.IsAnApp(this.prop.proxyCaller)===true)caller=this.prop.proxyCaller;if((this.showLoading===true)&&(AppStaticLib.IsAnApp(caller)===true)&&(caller.prop.struct.hasScript===true)&&(jQuery(caller.prop.handle).hasClass('loading')===false)){if((typeof(caller.__actionLoader)==='undefined')||(caller.__actionLoader===null)){var debugoverlay=false;if(debugoverlay===true){var overlay=document.createElement('div');overlay.setAttribute('class','ui-widget-overlay ui-front');overlay.setAttribute('style','position: absolute; top: 0px;');jQuery(caller.prop.handle).append(overlay);}var message='';if(typeof(this.prop.LoaderMessage)==='string')message=this.prop.LoaderMessage;var canAbort=false;if(this.prop.cancellable===true)canAbort=true;var debug=false;if(debug===true){this.progressbar=new window.Framework.Controls.ProgressBar('','rectangle','append',message,caller,canAbort);this.progressbar.vars.div.setAttribute('style','position: absolute; top: 0px;');this.progressbar.load();}var context={GetAPI:this,overlay:overlay,caller:caller};caller.__actionLoader=new TaskManagerControl({ParentObject:caller,TaskList:[this.servlet+'-'+this.action],WhenDone:jQuery.proxy(function(){jQuery(this.overlay).remove();delete this.GetAPI.progressbar;this.caller.__actionLoader=null;},context)});}else{caller.__actionLoader.AddTask(this.servlet+'-'+this.action);}}if(this.prop.LoadingTask!==null){if(window.Framework.prop.Loader===null){window.Framework.prop.Loader=new LoadingScreen({TaskList:[this.prop.LoadingTask]});}else{window.Framework.prop.Loader.AddTask(this.prop.LoadingTask);}}temp=_ProxyPost();if(window.Online===false)return window.Framework.UI.MsgBox({title:'Error',message:'Not online',height:200,width:300,modal:false});callObj=jQuery.ajax({url:_link,method:'POST',data:temp,dataType:'text',context:this,error:_Callback_OnError,complete:_Callback_OnComplete,success:_Callback_OnSuccess,startTime:window.performance.now()});callObj.ActionObj=this;if(AppStaticLib.IsAnApp(caller)===true){caller.currentAPICalls.push(this);}if(canAbort===true){if(this.progressbar!==null){jQuery(this.progressbar.vars.closeBtn).click(jQuery.proxy(function(){this.abort();},this));}else{jQuery.proxy(function(){this.abort();},this);}}if((typeof(opt_resetTimer)!=='undefined')&&(opt_resetTimer===false))return;if((typeof(window.Framework.prop)!=='undefined')&&(typeof(window.Framework.prop.SessionTimer)!=='undefined')&&(window.Framework.prop.SessionTimer!==null))window.Framework.prop.SessionTimer.resetTimer();};this.abort=function(){callObj.abort();};this.clone=function(){var temp=new window.Framework.Methods.GetAPIV2(this.prop);temp.postData=_ProxyPost();return temp;};return this;};StaticLib.DeepSeal(window.Framework.Methods.GetAPIV2);StaticLib.DeepFreeze(window.Framework.Methods.GetAPIV2);window.Framework.Methods.GetAPIV1=function(servletName,servletAction,opt_CallerApp,opt_appCallback,opt_postData,opt_controlID){var o=window.APIV2Struct.create();o.servlet=servletName;if(opt_CallerApp!==null){var parentApp=opt_CallerApp;if(((typeof(parentApp.OuterParentObject)==='object')&&(parentApp.OuterParentObject!==null))||((typeof(parentApp.prop)!=='undefined')&&(typeof(parentApp.prop.ParentObject)==='object')&&(parentApp.prop.ParentObject!==null))){while(parentApp.OuterParentObject)parentApp=parentApp.OuterParentObject;parentApp=parentApp.prop.ParentObject;if(typeof(parentApp.GetValue)==='function')parentApp=parentApp.GetValue();}if(AppStaticLib.IsAnApp(parentApp)===true)o.view=parentApp.AppDetails.view;}o.api=servletAction;if((typeof(opt_CallerApp)!=='undefined')&&(opt_CallerApp!==null))o.caller=opt_CallerApp;if((typeof(opt_appCallback)==='undefined')&&(opt_appCallback===null)){opt_appCallback='_devnull';}else{o.callback=opt_appCallback;}if((typeof(opt_postData)!=='undefined')&&(opt_postData!==null))o.postData=opt_postData;if((typeof(opt_controlID)!=='undefined')&&(opt_controlID!==null))o.controlID=opt_controlID;return new window.Framework.Methods.GetAPIV2(o);};StaticLib.DeepSeal(window.Framework.Methods.GetAPIV1);window.Framework.Methods.IsDeveloper=function(){if(typeof(window.Framework.prop)==='undefined')return false;return(window.Framework.prop.developer===true);};StaticLib.DeepSeal(window.Framework.Methods.IsDeveloper);window.Framework.Methods.GetAPI=function(servletName,servletAction,opt_CallerApp,opt_appCallback,opt_postData,opt_controlID){if(typeof(opt_CallerApp)==='undefined')opt_CallerApp=null;if(typeof(opt_appCallback)==='undefined')opt_appCallback=null;if(typeof(opt_postData)==='undefined')opt_postData=null;if(typeof(opt_controlID)==='undefined')opt_controlID=null;if((opt_CallerApp!==null)&&(AppStaticLib.IsAnApp(opt_CallerApp)===true)){if((opt_appCallback!==null)&&(typeof(opt_appCallback)!=='string'))throw new Error('The appCallback argument that Action was passed was not a string as required');}this.prop=window.APIV2Struct.create();if((servletName===null)||(typeof(servletName)!=='string'))throw new Error('Action requires a Servlet name (as a string) in order to initialise');this.servlet=servletName;this.action='display';this.controlID=(typeof(opt_controlID)!=='undefined')?opt_controlID:null;this.oneVal=false;this.args={};if((servletAction!==null)&&(typeof(servletAction)!=='undefined'))this.action=servletAction;if((opt_CallerApp!==null)&&(typeof(opt_CallerApp)==='object'))this.caller=opt_CallerApp;this.servletGroup='';this.showLoading=true;this.callbackName=null;this.opt_BeforeInvoke=null;this.opt_SuccessCallback=null;this.opt_CompleteCallback=null;this.opt_ErrorCallback=null;this.postData=null;this.onError=null;this.LastCalledURL='';this.callbackName=opt_appCallback;if((opt_postData!==null)&&(typeof(opt_postData)!=='undefined'))this.postData=opt_postData;var _Callback_OnSuccess=jQuery.proxy(function(data,status,connection){if((this.showLoading===true)&&(typeof(this.caller)!=='undefined')&&(this.caller!==null)&&(typeof(this.caller.__actionLoader)!=='undefined')&&(this.caller.__actionLoader!==null))this.caller.__actionLoader.CompleteTask(this.servlet+'-'+this.action);var msg='';var ct=connection.getResponseHeader('content-type')||'';if(ct.indexOf('html')>-1){if(StaticLib.IsJSONString(data)===true)throw new Error(__METHOD__+' reports that the data returned is not JSON but instead HTML, please specify your content-type header before returning your data');throw new Error('html content type not yet handled ('+data)+')';}else if(ct.indexOf('json')>-1){if(StaticLib.IsJSONString(data)){data=JSON.parse(data);}else{throw new Error('Not a valid JSON string');}}else{throw new Error('Unknown content type');}if(typeof(connection.ActionObj)!=='undefined'){if((connection.ActionObj.servletGroup==='platform')&&(connection.ActionObj.servlet==='system')&&(connection.ActionObj.action==='CheckServerMessages')&&(data.length===0))return;}var handler=jQuery.proxy(function(msg){if((typeof(msg)!=='undefined')&&(msg.LoggedIn===0)&&(this.action!=='CheckLoggedIn'))window.Framework.UnresolvedActions.push(this);},this);if(typeof(this.onError)==='function')handler=this.onError;if(typeof(data)==='object'){if(Array.isArray(data.NewKey)===true){pumpKeyA=data.NewKey[0];pumpKeyB=data.NewKey[1];}if(typeof(data[pumpKeyB])!=='undefined'){var outputter=new PumpProcess();outputter.process(data,handler);}if(typeof(data.msg)!=='undefined')if(data.msg!=='')msg=atob(data.msg);}else{msg=data;}if(typeof(this.opt_SuccessCallback)==='function')this.opt_SuccessCallback(data);},this);var _Callback_OnComplete=jQuery.proxy(function(data,status,connection){if((typeof(this.onComplete)!=='undefined')&&(this.onComplete!==null))this.onComplete(data);},this);var _Callback_OnError=jQuery.proxy(function(connection,status,errorText){if(typeof(connection)==='undefined')return;window.__handleConnectionError(connection,connection.status,errorText,true);if((this.showLoading===true)&&(typeof(this.caller)!=='undefined')&&(this.caller!==null)&&(typeof(this.caller.__actionLoader)!=='undefined')&&(this.caller.__actionLoader!==null))this.caller.__actionLoader.CompleteTask(this.servlet+'-'+this.action);if(typeof(this.onError)==='function')this.onError();if(StaticLib.IsJSONString(connection.responseText)===true){var outputter=new PumpProcess();outputter.process(connection.responseText,function(){});return;}},this);var _createURL=jQuery.proxy(function(){var layout='';var group='';if((typeof(this.caller)!=='undefined')&&(this.caller!==null)){if(this.args===null)this.args={};this.args.caller=this.caller;}if(this.callbackName!==null){if(this.args===null)this.args={};this.args.callback=this.callbackName;}if(this.controlID!==null){if(this.args===null)this.args={};this.args.controlID=this.controlID;}if(this.prop.proxy){if(this.args===null)this.args={};this.args.proxy=1;if(this.postData===null)this.postData={};this.postData.proxy={servlet:this.prop.servlet,view:this.prop.view};}if(typeof(this.caller)!=='undefined'){var parentApp=this.caller;if(((typeof(parentApp.OuterParentObject)==='object')&&(parentApp.OuterParentObject!==null))||((typeof(parentApp.prop)!=='undefined')&&(typeof(parentApp.prop.ParentObject)==='object')&&(parentApp.prop.ParentObject!==null))){while(parentApp.OuterParentObject)parentApp=parentApp.OuterParentObject;parentApp=parentApp.prop.ParentObject;if(typeof(parentApp.GetValue)==='function')parentApp=parentApp.GetValue();}if(AppStaticLib.IsAnApp(parentApp)){if(this.args===null)this.args={};this.args.r=parentApp.prop.struct.CurrentRecord;layout=parentApp.AppDetails.view;group=this.caller.AppDetails.servletGroup;}}var outputter=new PumpProcess();outputter.Flatten(this.args);var extraArgs='';if((this.action!=='display')&&(this.args!==null))jQuery.each(this.args,function(index,value){if(value!==null)extraArgs=extraArgs+'&'+index+'='+encodeURI(value);});if(this.servletGroup!=='')group=this.servletGroup;if((group===''))throw new Error('Group was not set');if(layout==='')layout='default';var frameworkID=window.FrameworkID;if((typeof(window.Framework.V5)==='object')&&(window.Framework.V5!==null)&&(typeof(window.Framework.V5.RunningFrameworkID)==='string'))frameworkID=window.Framework.V5.RunningFrameworkID;this.LastCalledURL=group+'/'+this.servlet+'/'+layout+'/'+this.action+'/?'+'f='+frameworkID+extraArgs;return this.LastCalledURL;},this);this.PreviewContent=function(IFrameName){if(typeof(this.postData)!=='object')throw new Error(__METHOD__+' reports that should only be called with PreviewContent Data on line '+__LINE__);var url=_createURL();var params=this.postData;var newWindow=true;var addParam=function(paramName,paramValue){var input=jQuery('');if(typeof(paramValue)==='object')paramValue=JSON.stringify(paramValue);input.attr({'id':paramName,'name':paramName,'value':paramValue});form.append(input);};var form=jQuery('');form.attr('action',url);form.attr('method','POST');var targetName='_blank';if((typeof(IFrameName)!=='undefined')&&(IFrameName!==null)&&(IFrameName!==''))targetName=IFrameName;if(newWindow===true)form.attr('target',targetName);for(var key in params)addParam(key,params[key]);assertgroup('compiler','debug compiler points that you need to know about compiler keys');form.appendTo(document.body);form.submit();form.remove();};this.invoke=function(opt_resetTimer){var _link=_createURL();var tempVal=null;var temp='';if(typeof(this.opt_BeforeInvoke)==='function')this.opt_BeforeInvoke(this);if((this.showLoading)&&(AppStaticLib.IsAnApp(this.caller))&&(!jQuery(this.caller.prop.handle).hasClass('loading'))){if((typeof(this.caller.__actionLoader)==='undefined')||(this.caller.__actionLoader===null)){var overlay=document.createElement('div');overlay.setAttribute('class','ui-widget-overlay ui-front');overlay.setAttribute('style','position: absolute;');jQuery(this.caller.prop.handle).append(overlay);var debug=false;if(debug===true){this.progressbar=new window.Framework.Controls.ProgressBar('','rectangle','append','',this.caller);this.progressbar.vars.div.setAttribute('style','position: absolute; top: 0px;');this.progressbar.load();}var context={GetAPI:this,overlay:overlay};this.caller.__actionLoader=new TaskManagerControl({ParentObject:this.caller,TaskList:[this.servlet+'-'+this.action],WhenDone:jQuery.proxy(function(){jQuery(this.overlay).remove();delete this.GetAPI.progressbar;this.GetAPI.caller.__actionLoader=null;},context)});}else{this.caller.__actionLoader.AddTask(this.servlet+'-'+this.action);}}temp=this.postData;tempVal=this.postData;if(this.oneVal===true){if(((tempVal!==null)&&(typeof(tempVal)==='object'))&&(typeof(tempVal.Serialize)==='function'))tempVal=tempVal.Serialize();temp={POSTDATA:JSON.stringify(tempVal)};}var method='POST';if(this.action==='CheckServerMessages')method='GET';jQuery.ajax({url:_link,method:method,data:temp,dataType:'text',context:this,error:_Callback_OnError,complete:_Callback_OnComplete,success:_Callback_OnSuccess}).ActionObj=this;if((typeof(opt_resetTimer)!=='undefined')&&(opt_resetTimer===false))return;if((typeof(window.Framework.prop)!=='undefined')&&(typeof(window.Framework.prop.SessionTimer)!=='undefined')&&(window.Framework.prop.SessionTimer!==null))window.Framework.prop.SessionTimer.resetTimer();};this.clone=function(){return new window.Framework.Methods.GetAPI(this.servlet,this.action,this.caller,(this.callbackName)?this.callbackName:undefined,this.postData,this.controlID);};return this;};StaticLib.DeepSeal(window.Framework.Methods.GetAPI);StaticLib.DeepFreeze(window.Framework.Methods.GetAPI);function DatasourceArray(o){this.OrderBy='';this.UniqueID='';this.Prefetch=false;this.DatasourcePostdataArgs=[];this.callback='';this.caller=null;this.onComplete=null;this.opt_BeforeInvoke=null;this.IDlookup={};this.callCache={};this.Cache=[];this.DataLocation='';this.AllDataFetched=false;this.API=new window.Framework.Methods.GetAPIV2(o);if(typeof(o.OrderBy)==='string')this.OrderBy=o.OrderBy;if(typeof(o.UniqueID)==='string')this.UniqueID=o.UniqueID;if(o.Prefetch===true)this.Prefetch=true;if((this.OrderBy==='')||(this.UniqueID===''))throw new Error('Datasource expects and \'OrderBy\' and \'UniqueID\' string attribute in it\'s argument');if((typeof(o.DatasourcePostdataArgs)==='object')&&(typeof(o.DatasourcePostdataArgs.length)==='number'))this.DatasourcePostdataArgs=o.DatasourcePostdataArgs;this.ReceivedURL=false;Object.defineProperty(this,'ReceiveURL',{value:jQuery.proxy(function(url){if(this.ReceivedURL===true)return;this.DataLocation=url;this.ReceivedURL=true;},this)});this.caller=this.API.from;this.API.caller=this;this.API.ReturnDataLocation(this);this.LastCalledURL=this.DataLocation;var index=this.DataLocation.indexOf('?');if(index!==-1)this.DataLocation=this.DataLocation.substring(0,index);if(this.API.proxy===true)this.DataLocation=this.DataLocation+this.API.proxyServletGroup+'/'+this.API.proxyServlet+'/'+this.API.proxyView+'/';if(this.DatasourcePostdataArgs.length>0){for(var count=0;counttempIndex)return false;if(foundIndex<=-1)return false;return true;},this);var DB=window.Framework.DataStores[this.DataLocation].Cache;for(var count=0;count=start){subset.push(DB[count]);}else{matched++;}if((limit>-1)&&(subset.length>=limit))break;}}this.caller[this.callbackName](subset);if(typeof(this.onComplete)==='function')this.onComplete(subset);};var status=window.Framework.DataStores[this.DataLocation];if((status.Prefetch===true)&(status.HasPrefetched===false)){status.HasPrefetched=true;var initialData={};if(typeof(this.API.prop.postData.Limit)==='number')initialData.Limit=this.API.prop.postData.Limit;this.API.prop.postData.Limit=null;if(typeof(this.API.prop.postData.Start)==='number'){initialData.Start=this.API.prop.postData.Start;this.API.prop.postData.Start=0;}if(typeof(this.API.prop.postData.SearchVal)==='undefined'){initialData.SearchVal=this.API.prop.postData.SearchVal;this.API.prop.postData.SearchVal='%';this.API.prop.postData.OrderBy=this.OrderBy;}this.invoke();StaticLib.SetProps(this.API.prop.postData,initialData);}}StaticLib.DeepSeal(DatasourceArray);StaticLib.DeepFreeze(DatasourceArray);