// exponent Javascript Support Systems EXPONENT = {}; // for back-compat eXp = EXPONENT; // map certian php CONSTANTS to JS vars EXPONENT.LANG = "English - US"; EXPONENT.PATH_RELATIVE = "/"; EXPONENT.URL_FULL = "http://www.jet-stream.it/"; EXPONENT.BASE = "/var/www/vhosts/jet-stream.it/httpdocs/"; EXPONENT.THEME_RELATIVE = "/themes/coolwatertheme/"; EXPONENT.ICON_RELATIVE = "/framework/core/assets/images/"; EXPONENT.JS_FULL = 'http://www.jet-stream.it/framework/core/js/'; EXPONENT.YUI2_PATH = '/external/lissa/2.9.0/build/'; EXPONENT.YUI3_PATH = '/external/lissa/3.3.0/build/'; EXPONENT.YUI2_URL = 'http://www.jet-stream.it/external/lissa/2.9.0/build/'; EXPONENT.YUI3_URL = 'http://www.jet-stream.it/external/lissa/3.3.0/build/'; EXPONENT.YUI3_CONFIG = {}; // YUI 2 ajax helper method. This is much easier in YUI 3. Should also migrate. EXPONENT.AjaxEvent = function() { var obj; var data = ""; var gatherURLInfo = function (obj){ json = obj.json ? "&json=1" : ""; if (obj.form){ data = YAHOO.util.Connect.setForm(obj.form); //slap a date in there so IE doesn't cache var dt = new Date().valueOf(); var sUri = EXPONENT.URL_FULL + "index.php?ajax_action=1" + json + "&yaetime=" + dt; return sUri; } else if (!obj.action || (!obj.controller && !obj.module)) { alert("If you don't pass the ID of a form, you need to specify both a module/controller AND and a cresponding action."); } else { //slap a date in there so IE doesn't cache var dt = new Date().valueOf(); var modcontrol = (obj.controller) ? "&controller="+obj.controller : "&module="+obj.module; var sUri = EXPONENT.URL_FULL + "index.php?ajax_action=1" + modcontrol + "&action=" + obj.action + json + "&yaetime=" + dt + obj.params; return sUri; } } return { json:0, subscribe: function(fn, oScope) { if (!this.oEvent) { this.oEvent = new YAHOO.util.CustomEvent("ajaxevent", this, false, YAHOO.util.CustomEvent.FLAT); } if (oScope) { this.oEvent.subscribe(fn, oScope, true); } else { this.oEvent.subscribe(fn); } }, fetch: function(obj) { if (typeof obj == "undefined" || !obj){ alert('EXPONENT.ajax requires a single object parameter.'); return false; } else { if (typeof(obj.json)!=="undefined"){ this.json = obj.json; } else { this.json = false; } var sUri = gatherURLInfo(obj); //console.debug(sUri); YAHOO.util.Connect.asyncRequest("POST", sUri, { success: function (o) { //if we're just sending a request and not needing to do //anything on the completion, we can skip firing the custtom event if (typeof(this.oEvent)!=="undefined") { //otherwise, we check if we've got SJON coming back to parse if (this.json!==false) { //if so, parse it var oParse = YAHOO.lang.JSON.parse(o.responseText); } else { //if not, it's probably HTML we're going to update a view with var oParse = o.responseText; } //fire off the custom event to do some more stuff with this.oEvent.fire(oParse); } }, scope: this },obj.data); } } } } // Form helper functions. We should migrate this. EXPONENT.forms = { getSelectedRadio: function (formId, inputId){ var oForm = this.grabForm(formId); for (var i=0; i