X-Git-Url: http://git.roojs.org/?a=blobdiff_plain;f=roojs-debug.js;h=fb819f7e82e83289aeba4c51f40cee1c61b11d26;hb=960d50c92006ef3fcd1c47eb3e521591ed9319e1;hp=c44698cda55f21a8136068a1a3ffd37fb433b1cd;hpb=bbea05ba2ddfd77b500f7065e9081f94e407e4d9;p=roojs1 diff --git a/roojs-debug.js b/roojs-debug.js index c44698cda5..fb819f7e82 100644 --- a/roojs-debug.js +++ b/roojs-debug.js @@ -1015,8 +1015,34 @@ Roo.applyIf(Array.prototype, { } return res; + }, + /** + * equals + * @param {Array} o The array to compare to + * @returns {Boolean} true if the same + */ + equals : function(b) + { + // https://stackoverflow.com/questions/3115982/how-to-check-if-two-arrays-are-equal-with-javascript + if (this === b) { + return true; + } + if (b == null) { + return false; + } + if (this.length !== b.length) { + return false; + } + + // sort?? a.sort().equals(b.sort()); + + for (var i = 0; i < this.length; ++i) { + if (this[i] !== b[i]) { + return false; + } + } + return true; } - }); @@ -4652,6 +4678,12 @@ Roo.Template = function(cfg){ }; Roo.Template.prototype = { + /** + * @cfg {Function} onLoad Called after the template has been loaded and complied (usually from a remove source) + */ + onLoad : false, + + /** * @cfg {String} url The Url to load the template from. beware if you are loading from a url, the data may not be ready if you use it instantly.. * it should be fixed so that template is observable... @@ -4667,6 +4699,7 @@ Roo.Template.prototype = { * @return {String} The HTML fragment */ applyTemplate : function(values){ + //Roo.log(["applyTemplate", values]); try { if(this.compiled){ @@ -4728,6 +4761,9 @@ Roo.Template.prototype = { _t.html = response.responseText; _t.url = false; _t.compile(); + if (_t.onLoad) { + _t.onLoad(); + } }, failure : function(response) { Roo.log("Template failed to load from " + _t.url); @@ -6073,10 +6109,10 @@ Roo.util.Observable.releaseCapture = function(o){ var ls = this.listeners, scope, len = ls.length; if(len > 0){ this.firing = true; - var args = Array.prototype.slice.call(arguments, 0); + var args = Array.prototype.slice.call(arguments, 0); for(var i = 0; i < len; i++){ - var l = ls[i]; - if(l.fireFn.apply(l.scope||this.obj||window, arguments) === false){ + var l = ls[i]; + if(l.fireFn.apply(l.scope||this.obj||window, args) === false){ this.firing = false; return false; } @@ -7126,12 +7162,14 @@ if(opt.anim.isAnimated()){ El.prototype = { /** - * The element's default display mode (defaults to "") + * The element's default display mode (defaults to "") * @type String */ originalDisplay : "", - visibilityMode : 1, + + // note this is overridden in BS version.. + visibilityMode : 1, /** * The default unit to append to CSS values where a unit isn't provided (defaults to px). * @type String @@ -8559,7 +8597,8 @@ if(opt.anim.isAnimated()){ * @param {Array} offsets (optional) Offset the positioning by [x, y] * @return {Array} [x, y] */ - getAlignToXY : function(el, p, o){ + getAlignToXY : function(el, p, o) + { el = Roo.get(el); var d = this.dom; if(!el.dom){ @@ -8600,7 +8639,7 @@ if(opt.anim.isAnimated()){ //otherwise swap the aligned el to the opposite border of the target. var p1y = p1.charAt(0), p1x = p1.charAt(p1.length-1); var p2y = p2.charAt(0), p2x = p2.charAt(p2.length-1); - var swapY = ((p1y=="t" && p2y=="b") || (p1y=="b" && p2y=="t")); + var swapY = ((p1y=="t" && p2y=="b") || (p1y=="b" && p2y=="t") ); var swapX = ((p1x=="r" && p2x=="l") || (p1x=="l" && p2x=="r")); var doc = document; @@ -11615,7 +11654,7 @@ Roo.extend(Roo.data.Connection, Roo.util.Observable, { var enctype = form.getAttribute("enctype"); if (o.formData) { - return this.doFormDataUpload(o,p,url); + return this.doFormDataUpload(o, url); } if(o.isUpload || (enctype && enctype.toLowerCase() == 'multipart/form-data')){ @@ -11624,6 +11663,16 @@ Roo.extend(Roo.data.Connection, Roo.util.Observable, { var f = Roo.lib.Ajax.serializeForm(form); p = p ? (p + '&' + f) : f; } + + if (!o.form && o.formData) { + o.formData = o.formData === true ? new FormData() : o.formData; + for (var k in o.params) { + o.formData.append(k,o.params[k]); + } + + return this.doFormDataUpload(o, url); + } + var hs = o.headers; if(this.defaultHeaders){ @@ -11659,7 +11708,9 @@ Roo.extend(Roo.data.Connection, Roo.util.Observable, { url += (url.indexOf('?') != -1 ? '&' : '?') + p; p = ''; } + Roo.lib.Ajax.useDefaultHeader = typeof(o.headers) == 'undefined' || typeof(o.headers['Content-Type']) == 'undefined'; this.transId = Roo.lib.Ajax.request(method, url, cb, p, o); + Roo.lib.Ajax.useDefaultHeader == true; return this.transId; }else{ Roo.callback(o.callback, o.scope, [o, null, null]); @@ -11799,11 +11850,17 @@ Roo.extend(Roo.data.Connection, Roo.util.Observable, { // this is a 'formdata version???' - doFormDataUpload : function(o, ps, url) + doFormDataUpload : function(o, url) { - var form = Roo.getDom(o.form); - form.enctype = form.encoding = 'multipart/form-data'; - var formData = o.formData === true ? new FormData(form) : o.formData; + var formData; + if (o.form) { + var form = Roo.getDom(o.form); + form.enctype = form.encoding = 'multipart/form-data'; + formData = o.formData === true ? new FormData(form) : o.formData; + } else { + formData = o.formData === true ? new FormData() : o.formData; + } + var cb = { success: this.handleResponse, @@ -11823,7 +11880,7 @@ Roo.extend(Roo.data.Connection, Roo.util.Observable, { //Roo.lib.Ajax.defaultPostHeader = null; Roo.lib.Ajax.useDefaultHeader = false; - this.transId = Roo.lib.Ajax.request( "POST", url, cb, o.formData, o); + this.transId = Roo.lib.Ajax.request( "POST", url, cb, formData, o); Roo.lib.Ajax.useDefaultHeader = true; @@ -13299,6 +13356,9 @@ mc.add(otherEl); * @return {Object} The item associated with the passed key. */ item : function(key){ + if (key === 'length') { + return null; + } var item = typeof this.map[key] != "undefined" ? this.map[key] : this.items[key]; return typeof item != 'function' || this.allowFunctions ? item : null; // for prototype! }, @@ -15433,7 +15493,7 @@ Roo.extend(Roo.Component, Roo.util.Observable, { /** * @cfg {String} actionMode * which property holds the element that used for hide() / show() / disable() / enable() - * default is 'el' + * default is 'el' for forms you probably want to set this to fieldEl */ actionMode : "el", @@ -15998,6 +16058,463 @@ Roo.extend(Roo.BoxComponent, Roo.Component, { return {x : x, y: y}; } });/* + * Based on: + * Ext JS Library 1.1.1 + * Copyright(c) 2006-2007, Ext JS, LLC. + * + * Originally Released Under LGPL - original licence link has changed is not relivant. + * + * Fork - LGPL + *