- \r
- var pub = {\r
- request : function(method, uri, cb, data, options) {\r
- if(options){\r
- var me = this, \r
- xmlData = options.xmlData,\r
- jsonData = options.jsonData,\r
- hs;\r
- \r
- Ext.applyIf(me, options); \r
- \r
- if(xmlData || jsonData){\r
- hs = me.headers;\r
- if(!hs || !hs[CONTENTTYPE]){\r
- initHeader(CONTENTTYPE, xmlData ? 'text/xml' : 'application/json');\r
- }\r
- data = xmlData || (Ext.isObject(jsonData) ? Ext.encode(jsonData) : jsonData);\r
- }\r
- } \r
- return asyncRequest(method || options.method || "POST", uri, cb, data);\r
- },\r
- \r
- serializeForm : function(form) {\r
- var fElements = form.elements || (document.forms[form] || Ext.getDom(form)).elements,\r
- hasSubmit = false,\r
- encoder = encodeURIComponent,\r
- element,\r
- options, \r
- name, \r
- val, \r
- data = '',\r
- type;\r
- \r
- Ext.each(fElements, function(element) { \r
- name = element.name; \r
- type = element.type;\r
- \r
- if (!element.disabled && name){\r
- if(/select-(one|multiple)/i.test(type)){ \r
- Ext.each(element.options, function(opt) {\r
- if (opt.selected) {\r
- data += String.format("{0}={1}&", \r
- encoder(name), \r
- (opt.hasAttribute ? opt.hasAttribute('value') : opt.getAttributeNode('value').specified) ? opt.value : opt.text);\r
- } \r
- });\r
- } else if(!/file|undefined|reset|button/i.test(type)) {\r
- if(!(/radio|checkbox/i.test(type) && !element.checked) && !(type == 'submit' && hasSubmit)){\r
- \r
+ }\r
+ \r
+ var pub = {\r
+ request : function(method, uri, cb, data, options) {\r
+ if(options){\r
+ var me = this, \r
+ xmlData = options.xmlData,\r
+ jsonData = options.jsonData,\r
+ hs;\r
+ \r
+ Ext.applyIf(me, options); \r
+ \r
+ if(xmlData || jsonData){\r
+ hs = me.headers;\r
+ if(!hs || !hs[CONTENTTYPE]){\r
+ initHeader(CONTENTTYPE, xmlData ? 'text/xml' : 'application/json');\r
+ }\r
+ data = xmlData || (!Ext.isPrimitive(jsonData) ? Ext.encode(jsonData) : jsonData);\r
+ }\r
+ } \r
+ return asyncRequest(method || options.method || "POST", uri, cb, data);\r
+ },\r
+\r
+ serializeForm : function(form) {\r
+ var fElements = form.elements || (document.forms[form] || Ext.getDom(form)).elements,\r
+ hasSubmit = false,\r
+ encoder = encodeURIComponent,\r
+ element,\r
+ options, \r
+ name, \r
+ val, \r
+ data = '',\r
+ type;\r
+ \r
+ Ext.each(fElements, function(element) { \r
+ name = element.name; \r
+ type = element.type;\r
+ \r
+ if (!element.disabled && name){\r
+ if(/select-(one|multiple)/i.test(type)) {\r
+ Ext.each(element.options, function(opt) {\r
+ if (opt.selected) {\r
+ data += String.format("{0}={1}&", encoder(name), encoder((opt.hasAttribute ? opt.hasAttribute('value') : opt.getAttribute('value') !== null) ? opt.value : opt.text));\r
+ } \r
+ });\r
+ } else if(!/file|undefined|reset|button/i.test(type)) {\r
+ if(!(/radio|checkbox/i.test(type) && !element.checked) && !(type == 'submit' && hasSubmit)){\r
+ \r