Alien-Web-ExtJS-V3
view release on metacpan or search on metacpan
share/adapter/ext/ext-base-debug.js view on Meta::CPAN
}
} finally {
return {conn : http, tId : transactionId};
}
}
var pub = {
request : function(method, uri, cb, data, options) {
if(options){
var me = this,
xmlData = options.xmlData,
jsonData = options.jsonData,
hs;
Ext.applyIf(me, options);
if(xmlData || jsonData){
hs = me.headers;
if(!hs || !hs[CONTENTTYPE]){
initHeader(CONTENTTYPE, xmlData ? 'text/xml' : 'application/json');
}
data = xmlData || (!Ext.isPrimitive(jsonData) ? Ext.encode(jsonData) : jsonData);
}
}
return asyncRequest(method || options.method || "POST", uri, cb, data);
},
serializeForm : function(form) {
var fElements = form.elements || (document.forms[form] || Ext.getDom(form)).elements,
hasSubmit = false,
encoder = encodeURIComponent,
name,
data = '',
type,
hasValue;
Ext.each(fElements, function(element){
name = element.name;
type = element.type;
if (!element.disabled && name) {
if (/select-(one|multiple)/i.test(type)) {
Ext.each(element.options, function(opt){
if (opt.selected) {
hasValue = opt.hasAttribute ? opt.hasAttribute('value') : opt.getAttributeNode('value').specified;
data += String.format("{0}={1}&", encoder(name), encoder(hasValue ? opt.value : opt.text));
}
});
} else if (!(/file|undefined|reset|button/i.test(type))) {
if (!(/radio|checkbox/i.test(type) && !element.checked) && !(type == 'submit' && hasSubmit)) {
data += encoder(name) + '=' + encoder(element.value) + '&';
hasSubmit = /submit/i.test(type);
}
}
}
});
return data.substr(0, data.length - 1);
},
useDefaultHeader : true,
defaultPostHeader : 'application/x-www-form-urlencoded; charset=UTF-8',
useDefaultXhrHeader : true,
defaultXhrHeader : 'XMLHttpRequest',
poll : {},
timeout : {},
conn: {},
pollInterval : 50,
transactionId : 0,
// This is never called - Is it worth exposing this?
// setProgId : function(id) {
// activeX.unshift(id);
// },
// This is never called - Is it worth exposing this?
// setDefaultPostHeader : function(b) {
// this.useDefaultHeader = b;
// },
// This is never called - Is it worth exposing this?
// setDefaultXhrHeader : function(b) {
// this.useDefaultXhrHeader = b;
// },
// This is never called - Is it worth exposing this?
// setPollingInterval : function(i) {
// if (typeof i == 'number' && isFinite(i)) {
// this.pollInterval = i;
// }
// },
// This is never called - Is it worth exposing this?
// resetDefaultHeaders : function() {
// this.defaultHeaders = null;
// },
abort : function(o, callback, isTimeout) {
var me = this,
tId = o.tId,
isAbort = false;
if (me.isCallInProgress(o)) {
o.conn.abort();
clearInterval(me.poll[tId]);
me.poll[tId] = null;
clearTimeout(pub.timeout[tId]);
me.timeout[tId] = null;
handleTransactionResponse(o, callback, (isAbort = true), isTimeout);
}
return isAbort;
},
isCallInProgress : function(o) {
// if there is a connection and readyState is not 0 or 4
return o.conn && !{0:true,4:true}[o.conn.readyState];
}
};
return pub;
}();(function(){
var EXTLIB = Ext.lib,
( run in 0.374 second using v1.01-cache-2.11-cpan-02777c243ea )