/* Copyright (c) 2011, Accounting enhancements, Inc and Lee Lofgren. Available via Academic Free License >= 2.1 OR the modified BSD license. see: http://dojotoolkit.org/license for details */ if (typeof accountingenhancements == "undefined"){ dojo.provide("accountingenhancements"); dojo.provide("accountingenhancements.accountingenhancements"); (function(){ accountingenhancements = { config: { isDebug: false, debugAtAllCosts: false }, _hasResource: {} }; var aei = accountingenhancements; var rev = "$Rev: 0 $".match(/\d+/) //The SVN rev from which accountingenhancements was pulled aei.version = { major: 1, //type: Integer. If total version is "1.2.0beta1", will be 1 minor: 0, //type: Integer. If total version is "1.2.0beta1", will be 2 patch: 0, //type: Integer. If total version is "1.2.0beta1", will be 0 flag: "", //type: String. If total version is "1.2.0beta1", will be "beta1" revision: rev ? +rev[0] : NaN, //The SVN rev from which accountingenhancements was pulled toString: function(){ with(aei.version){ return major + "." + minor + "." + patch + flag + " (" + revision + ")"; // String } } } if (typeof window != 'undefined'){ (function(){ var index; var in_dojo_modulePrefixes = false; if (typeof dojo != "undefined" && typeof dojo._modulePrefixes != "undefined"){ for (index in dojo._modulePrefixes){ if (index){ if (dojo._modulePrefixes[index].name == "accountingenhancements"){ aei.config.baseUrl = dojo._modulePrefixes[index].value; in_dojo_modulePrefixes = true; } } } } if(document && document.getElementsByTagName){ var scripts = document.getElementsByTagName("script"); var rePkg = /accountingenhancements(\.xd)?\.js(\W|$)/i; for(index = 0; index < scripts.length; index++){ var src = scripts[index].getAttribute("src"); if(!src){ continue; } var m = src.match(rePkg); if(m){ // find out where we came from if(!aei.config.baseUrl){ aei.config.baseUrl = src.substring(0, m.index); } // and find out if we need to modify our behavior var cfg = scripts[index].getAttribute("accountingenhancementsConfig"); if(cfg){ var cfgo = eval("({ "+cfg+" })"); for(var x in cfgo){ aei.config[x] = cfgo[x]; } } break; // "first AccountingEnhancements wins" } } } aei.baseUrl = aei.config.baseUrl; })(); aei._hasResource["accountingenhancements._securityCheckIn"]=true; aei._securityCheckIn = function(data, returnFunction){ var result = null; if (data && data.evalString)result = dojo.toJson(eval(data.evalString)); var xhrArgs = new Object(); xhrArgs.url = window.accountingenhancements.config.baseUrl+"/SecurityCheckIn.php"; xhrArgs.handleAs = "json"; xhrArgs.content = new Object(); xhrArgs.content.REQUEST = data.evalString; xhrArgs.content.RESULT = result; xhrArgs.load = dojo.hitch(this, this._securityCheckIn_callback,returnFunction); xhrArgs.error = dojo.hitch(this, this._securityCheckIn_errorCallback,returnFunction); dojo.xhrPost(xhrArgs); } aei._securityCheckIn_callback = function(returnFunction, data, xhrArgs){ var result = false; if (data.VALIDATED==true)result=true; returnFunction(result, data); } aei._securityCheckIn_errorCallback = function(returnFunction, data, xhrArgs){ returnFunction(false); //Failed } aei.nextId=0; aei.getNextId = function(){ var nextId = accountingenhancements.nextId++; return nextId; } } })(); }