var redf={}; redf["loadExternalScript"]=function(url, callback, customAttr1, customAttr1Value) { // Adding the script tag to the head as suggested before var head = document.head; var script = document.createElement('script'); script.type = 'text/javascript'; script.src = url; script.async = false; script[customAttr1]=customAttr1Value; // Then bind the event to the callback function. // There are several events for cross browser compatibility. script.onreadystatechange = callback; script.onload = callback; // Fire the loading head.appendChild(script); }; redf["loadScript"]=function(url, callback, customAttr1, customAttr1Value) { redf.loadExternalScript('https://snowbound.firstlightnetwork.co.uk/SNOW/'+'/'+url,callback, customAttr1, customAttr1Value); }; redf["addHTMLToHead"]=function(HTML) { document.head.append(HTML); }; redf["construct"]=function() { /* Add in standard css */ { var link = document.createElement("link"); link["href"]='https://snowbound.firstlightnetwork.co.uk/SNOW/style/redf.css?v=1.0.19d'; link["rel"]='stylesheet'; link["type"]='text/css'; document.head.appendChild(link); } redf["getLocalDateFormat"]=function() { var now=new Date(2023,11,31); var str=now.toLocaleDateString(); str=str.replace("31","dd"); str=str.replace("12","MM"); str=str.replace("2023","yyyy"); return str; }; var callBackVenusIsloaded= function() { var addedHTML=""; addedHTML=addedHTML.replace(new RegExp("",'g'),""); var processScriptHTML=function(strHTML,strTag) { var arrScripts=strHTML.split(new RegExp("<"+strTag+"(.*?)>")); for(var i=0;i") continue; var s0 = document.createElement(strTag); var arrKeyValuePairs=scriptParams.split(new RegExp(" ")); for(var j=0;j1) { var key=arrKeyValue.shift(); var value=arrKeyValue.join("=");//just in case nested equals s0[key]=value.replace(new RegExp("'",'g'),""); } } document.head.appendChild(s0); } } processScriptHTML(addedHTML.replace(new RegExp("",'g'),""),"script"); processScriptHTML(addedHTML.replace(new RegExp("",'g'),""),"link"); dojo["_loadModule"] = dojo["require"] = function(/*String*/moduleName, /*Boolean?*/omitModuleCheck) { omitModuleCheck = dojo._global_omit_module_check || omitModuleCheck; //Check if it is already loaded. var module = dojo._loadedModules[moduleName]; if(module){ return module; } // convert periods to slashes var relpath = dojo._getModuleSymbols(moduleName).join("/") + '.js?v=1.0.19d'; var modArg = !omitModuleCheck ? moduleName : null; var ok = dojo._loadPath(relpath, modArg); if(!ok && !omitModuleCheck){ throw new Error("Could not load '" + moduleName + "'; last tried '" + relpath + "'"); } // check that the symbol was defined // Don't bother if we're doing xdomain (asynchronous) loading. if(!omitModuleCheck && !dojo._isXDomain){ // pass in false so we can give better error module = dojo._loadedModules[moduleName]; if(!module){ throw new Error("symbol '" + moduleName + "' is not defined after loading '" + relpath + "'"); } } return module; }; //override dojo.body function so that it gets REDF_body dojo.body = function(){ return document.getElementById("REDF_body"); // Node } //mixin dojo functions to redf redf.mixin=dojo.mixin; redf.map=dojo.map; redf.disconnect=dojo.disconnect; redf.connect=dojo.connect; redf.isString=dojo.isString, redf.fromJson=dojo.fromJson; redf.toJson=dojo.toJson; redf.byId=dojo.byId; redf.hasClass=dojo.hasClass; redf.body=dojo.body; redf.destroy=dojo.destroy; redf.require=dojo.require; redf.rawXhrPost=dojo.rawXhrPost; redf.marginBox=dojo.marginBox; //load in primary module redf.require("venus.layers.core",true);//strVersion defined in constants if(dojo.date!=null)//not sure why this had a problem when deployed to google server redf.dateToISOString=dojo.date.stamp.toISOString; //override to allow for body offset dijit.placeOnScreenAroundNode = function( /* DomNode */ node, /* DomNode */ aroundNode, /* Object */ aroundCorners, /* Function? */ layoutNode){ // get coordinates of aroundNode aroundNode = dojo.byId(aroundNode); var oldDisplay = aroundNode.style.display; aroundNode.style.display=""; // #3172: use the slightly tighter border box instead of marginBox var aroundNodePos = dojo.position(aroundNode, false); //GJ - added to account for not being at 0,0 if(dojo.byId("REDF_body")!=null) { var offset=dojo.position(dojo.byId("REDF_body"),false); aroundNodePos.x=20+aroundNodePos.x-(offset.x); aroundNodePos.y=6+aroundNodePos.y-(offset.y-aroundNodePos.h); } //GJ end aroundNode.style.display=oldDisplay; // place the node around the calculated rectangle return dijit._placeOnScreenAroundRect(node, aroundNodePos.x, aroundNodePos.y, aroundNodePos.w, aroundNodePos.h, // rectangle aroundCorners, layoutNode); }; dijit.placementRegistry.unregister("node"); dijit.placementRegistry.register("node", function(n, x){ return typeof x == "object" && typeof x.offsetWidth != "undefined" && typeof x.offsetHeight != "undefined"; }, dijit.placeOnScreenAroundNode); /*S080814*/ if(location.hash.startsWith("#F0=") && location.hash.indexOf("&P=")==-1) { redf.loadForm(location.hash.substring(4),dojo.byId("REDF_body")); } else if(location.hash.startsWith("#F2=") && location.hash.indexOf("&P=")==-1) { redf.loadForm(location.hash.substring(4),dojo.byId("REDF_body"),2); } else /*E080814*/ { redf.loadForm("WSNOW01Av1_GuestStartConfirm",dojo.byId("REDF_body")); } } var callBackJQueryIsloaded= function() { redf.loadScript('js/venus.js?v=1.0.19d',callBackVenusIsloaded); } var callBackDojoIsloaded= function() { if(!window.jQuery) { redf.loadScript('js/jquery-1.9.1.min.js',callBackJQueryIsloaded); } else { callBackJQueryIsloaded(); } } if(location.hostname!='www.snowboundtransfers.co.uk') { setTimeout(function() { document.getElementById("REDF_body").innerHTML='Invalid use. Please contact an adminsitrator. Should be :www.snowboundtransfers.co.uk: but is :'+location.hostname; }, 500); } else { //load Dojo redf.loadScript('js/dojo/dojo.js',callBackDojoIsloaded,'djConfig','parseOnLoad: true, locale:"en-gb"'); } } redf["Environment"] = { //mobile or desktop compatible event name, to be used with '.on' function TOUCH_DOWN_EVENT_NAME: 'mousedown touchstart', TOUCH_UP_EVENT_NAME: 'mouseup touchend', TOUCH_MOVE_EVENT_NAME: 'mousemove touchmove', TOUCH_DOUBLE_TAB_EVENT_NAME: 'dblclick dbltap', isAndroid: function() { return navigator.userAgent.match(/Android/i); }, isBlackBerry: function() { return navigator.userAgent.match(/BlackBerry/i); }, isIOS: function() { return navigator.userAgent.match(/iPhone|iPad|iPod/i); }, isOpera: function() { return navigator.userAgent.match(/Opera Mini/i); }, isWindowsMobile: function() { return navigator.userAgent.match(/IEMobile/i); }, isMobile: function() { //S130814 - disabled for now return (redf.Environment.isAndroid() || redf.Environment.isBlackBerry() || redf.Environment.isIOS() || redf.Environment.isOpera() || redf.Environment.isWindowsMobile()); //return false; //E130814 }, isFireFox:function() { return (navigator.userAgent.toLowerCase().indexOf('firefox') > -1); }, isIE:function() { return (navigator.userAgent.toLowerCase().indexOf('msie') > -1); } }; redf["getAppName"]=function() { return "SNOW"; }; redf["getLoginEnvID"]=function() { return 1; }; redf["isSecure"]=function() { //THIS NEEDS SWITCHING IN LIVE return true; }; redf["keep_alive"]=function() { http_request = new XMLHttpRequest(); http_request.open('GET', "REDF_version.jsp"); http_request.send(null); }; setInterval(redf.keep_alive,600000); redf["logout"]=function(){window.location = "https://snowbound.firstlightnetwork.co.uk/SNOW/?logout=true";}; redf["goHome"]=function(){window.location = "https://snowbound.firstlightnetwork.co.uk/SNOW/";}; redf["isUpdater"]=function() { return false;/* TODO should be which module screen is in */ }; redf["isSysAdmin"]=function() { return false;/* TODO should be which module screen is in */ }; redf["isAdmin"]=function() { return false;/* TODO should be which module screen is in */ }; /*S070814*/ redf["isGuest"]=function() { return false; }; /*E070814*/ redf["getCurrentTaskID"]=function(){return 0;}; redf["getUserName"]=function(){return "snow3";}; redf["getUserContactID"]=function(){return "1024";}; redf["m_objLoader"]=null; redf["getLoader"]=function (){return redf.m_objLoader;}; redf["setLoader"]=function (loader){ redf.m_objLoader=loader;}; //var m_objLoader=null; //function getLoader(){return m_objLoader;} redf["loadForm"]=function(p_strForm,p_strDivNameOrDiv,p_iOptionalMode) { if(p_strForm==null || p_strForm.length==0) { alert("Your user profile does not appear to be associated with any modules. Please contact an administrator."); logout(); return; } if(p_strDivNameOrDiv) { var loaderDiv=document.createElement("div"); if(p_strDivNameOrDiv.appendChild) p_strDivNameOrDiv.appendChild(loaderDiv); else document.getElementById(p_strDivNameOrDiv).appendChild(loaderDiv); var jsonProps={}; jsonProps["formName"]=p_strForm; jsonProps["sessionid"]="CFC3C9BF6D3C835B41DD9D029C1E74E1"; jsonProps["homeURL"]="https://snowbound.firstlightnetwork.co.uk/SNOW/"; jsonProps["_allowRecording"]=false; jsonProps["formParams"]=null; //S090113 - note no longer used - done by javascript test //Could probably do the below just with javascript test whether mobile //jsonProps["mobile"]=false; //E090113 /*S020814*/ if(p_iOptionalMode!=null) jsonProps["_formMode"]=p_iOptionalMode; /*E020814*/ //m_objLoader =new venus.form.Loader(jsonProps, loaderDiv); redf.setLoader(new venus.form.Loader(jsonProps, loaderDiv)); //m_objLoader =new redf.form.Loader(jsonProps, loaderDiv); dojo.addOnWindowUnload(function() { redf.getLoader().destroyRecursive(); //m_objLoader=null; redf.setLoader(null); }); } }; redf["redf_log"]=[]; redf["redf_log_interval"]=0; redf["redf_log_start"]=0; redf["log"]=function(strMessage) { var dt=new Date(); redf.redf_log.push(""+(dt.getTime()-redf.redf_log_start)+":"+(dt.getTime()-redf.redf_log_interval)+":"+strMessage +"
"); redf.redf_log_interval=dt.getTime(); }; redf["getLog"]=function(strMessage) { return redf.redf_log.join(""); }; redf["resetLog"]=function(strMessage) { redf.redf_log=[]; var dt=new Date(); redf.redf_log_start=dt.getTime(); redf.redf_log_interval=dt.getTime(); }; redf["printReport"]=function(p_URL) { var strOptions ="scrollbars=yes,menubar=no,status=yes,resizable=yes"; var scrSplit=p_URL.split("?"); if(scrSplit.length>1)//sessionid needs to come before paramters p_URL=scrSplit[0]+";jsessionid=CFC3C9BF6D3C835B41DD9D029C1E74E1"+"?"+scrSplit[1]; else p_URL=p_URL+";jsessionid=CFC3C9BF6D3C835B41DD9D029C1E74E1" //var newWin = window.open(p_URL+";jsessionid=CFC3C9BF6D3C835B41DD9D029C1E74E1","newWin",strOptions); //to open in same window each time //var newWin = window.open(p_URL,"newWin",strOptions); //to open a new window each time: var newWin = window.open(p_URL,"_blank",strOptions); setTimeout(function(){newWin.focus();},500); //if(newWin!=null) // newWin.document.focus(); }; redf['hashIsChanging']=function(hashEvent) { redf.getLoader().hashIsChanging(hashEvent); }; if (!('onhashchange' in window) || window.attachEvent) { var prevURL = window.location.href; setInterval(function() { var nextURL = window.location.href; if (prevURL === nextURL) return; console.debug("prevURL:"+prevURL); console.debug("newURL:"+nextURL); console.debug("LoaderChangingHash:"+redf.getLoader().m_bLoaderIsChangingHash); redf.hashIsChanging.call(window, { type: 'hashchange', newURL: nextURL, oldURL: prevURL }); prevURL = nextURL; }, 100); } else if (window.addEventListener) { window.addEventListener('hashchange', redf.hashIsChanging, false); } redf.construct();