Web UI for ARGUS server
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

593 lines
28 KiB

6 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. <html>
  2. <head>
  3. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  4. <title>The source code</title>
  5. <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
  6. <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
  7. </head>
  8. <body onload="prettyPrint();">
  9. <pre class="prettyprint lang-js">/*!
  10. * Ext JS Library 3.3.1
  11. * Copyright(c) 2006-2010 Sencha Inc.
  12. * licensing@sencha.com
  13. * http://www.sencha.com/license
  14. */
  15. (function(){
  16. var BEFOREREQUEST = "beforerequest",
  17. REQUESTCOMPLETE = "requestcomplete",
  18. REQUESTEXCEPTION = "requestexception",
  19. UNDEFINED = undefined,
  20. LOAD = 'load',
  21. POST = 'POST',
  22. GET = 'GET',
  23. WINDOW = window;
  24. <div id="cls-Ext.data.Connection"></div>/**
  25. * @class Ext.data.Connection
  26. * @extends Ext.util.Observable
  27. * <p>The class encapsulates a connection to the page's originating domain, allowing requests to be made
  28. * either to a configured URL, or to a URL specified at request time.</p>
  29. * <p>Requests made by this class are asynchronous, and will return immediately. No data from
  30. * the server will be available to the statement immediately following the {@link #request} call.
  31. * To process returned data, use a
  32. * <a href="#request-option-success" ext:member="request-option-success" ext:cls="Ext.data.Connection">success callback</a>
  33. * in the request options object,
  34. * or an {@link #requestcomplete event listener}.</p>
  35. * <p><h3>File Uploads</h3><a href="#request-option-isUpload" ext:member="request-option-isUpload" ext:cls="Ext.data.Connection">File uploads</a> are not performed using normal "Ajax" techniques, that
  36. * is they are <b>not</b> performed using XMLHttpRequests. Instead the form is submitted in the standard
  37. * manner with the DOM <tt>&lt;form></tt> element temporarily modified to have its
  38. * <a href="http://www.w3.org/TR/REC-html40/present/frames.html#adef-target">target</a> set to refer
  39. * to a dynamically generated, hidden <tt>&lt;iframe></tt> which is inserted into the document
  40. * but removed after the return data has been gathered.</p>
  41. * <p>The server response is parsed by the browser to create the document for the IFRAME. If the
  42. * server is using JSON to send the return object, then the
  43. * <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.17">Content-Type</a> header
  44. * must be set to "text/html" in order to tell the browser to insert the text unchanged into the document body.</p>
  45. * <p>Characters which are significant to an HTML parser must be sent as HTML entities, so encode
  46. * "&lt;" as "&amp;lt;", "&amp;" as "&amp;amp;" etc.</p>
  47. * <p>The response text is retrieved from the document, and a fake XMLHttpRequest object
  48. * is created containing a <tt>responseText</tt> property in order to conform to the
  49. * requirements of event handlers and callbacks.</p>
  50. * <p>Be aware that file upload packets are sent with the content type <a href="http://www.faqs.org/rfcs/rfc2388.html">multipart/form</a>
  51. * and some server technologies (notably JEE) may require some custom processing in order to
  52. * retrieve parameter names and parameter values from the packet content.</p>
  53. * <p>Also note that it's not possible to check the response code of the hidden iframe, so the success handler will ALWAYS fire.</p>
  54. * @constructor
  55. * @param {Object} config a configuration object.
  56. */
  57. Ext.data.Connection = function(config){
  58. Ext.apply(this, config);
  59. this.addEvents(
  60. <div id="event-Ext.data.Connection-beforerequest"></div>/**
  61. * @event beforerequest
  62. * Fires before a network request is made to retrieve a data object.
  63. * @param {Connection} conn This Connection object.
  64. * @param {Object} options The options config object passed to the {@link #request} method.
  65. */
  66. BEFOREREQUEST,
  67. <div id="event-Ext.data.Connection-requestcomplete"></div>/**
  68. * @event requestcomplete
  69. * Fires if the request was successfully completed.
  70. * @param {Connection} conn This Connection object.
  71. * @param {Object} response The XHR object containing the response data.
  72. * See <a href="http://www.w3.org/TR/XMLHttpRequest/">The XMLHttpRequest Object</a>
  73. * for details.
  74. * @param {Object} options The options config object passed to the {@link #request} method.
  75. */
  76. REQUESTCOMPLETE,
  77. <div id="event-Ext.data.Connection-requestexception"></div>/**
  78. * @event requestexception
  79. * Fires if an error HTTP status was returned from the server.
  80. * See <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html">HTTP Status Code Definitions</a>
  81. * for details of HTTP status codes.
  82. * @param {Connection} conn This Connection object.
  83. * @param {Object} response The XHR object containing the response data.
  84. * See <a href="http://www.w3.org/TR/XMLHttpRequest/">The XMLHttpRequest Object</a>
  85. * for details.
  86. * @param {Object} options The options config object passed to the {@link #request} method.
  87. */
  88. REQUESTEXCEPTION
  89. );
  90. Ext.data.Connection.superclass.constructor.call(this);
  91. };
  92. Ext.extend(Ext.data.Connection, Ext.util.Observable, {
  93. <div id="cfg-Ext.data.Connection-url"></div>/**
  94. * @cfg {String} url (Optional) <p>The default URL to be used for requests to the server. Defaults to undefined.</p>
  95. * <p>The <code>url</code> config may be a function which <i>returns</i> the URL to use for the Ajax request. The scope
  96. * (<code><b>this</b></code> reference) of the function is the <code>scope</code> option passed to the {@link #request} method.</p>
  97. */
  98. <div id="cfg-Ext.data.Connection-extraParams"></div>/**
  99. * @cfg {Object} extraParams (Optional) An object containing properties which are used as
  100. * extra parameters to each request made by this object. (defaults to undefined)
  101. */
  102. <div id="cfg-Ext.data.Connection-defaultHeaders"></div>/**
  103. * @cfg {Object} defaultHeaders (Optional) An object containing request headers which are added
  104. * to each request made by this object. (defaults to undefined)
  105. */
  106. <div id="cfg-Ext.data.Connection-method"></div>/**
  107. * @cfg {String} method (Optional) The default HTTP method to be used for requests.
  108. * (defaults to undefined; if not set, but {@link #request} params are present, POST will be used;
  109. * otherwise, GET will be used.)
  110. */
  111. <div id="cfg-Ext.data.Connection-timeout"></div>/**
  112. * @cfg {Number} timeout (Optional) The timeout in milliseconds to be used for requests. (defaults to 30000)
  113. */
  114. timeout : 30000,
  115. <div id="cfg-Ext.data.Connection-autoAbort"></div>/**
  116. * @cfg {Boolean} autoAbort (Optional) Whether this request should abort any pending requests. (defaults to false)
  117. * @type Boolean
  118. */
  119. autoAbort:false,
  120. <div id="cfg-Ext.data.Connection-disableCaching"></div>/**
  121. * @cfg {Boolean} disableCaching (Optional) True to add a unique cache-buster param to GET requests. (defaults to true)
  122. * @type Boolean
  123. */
  124. disableCaching: true,
  125. <div id="cfg-Ext.data.Connection-disableCachingParam"></div>/**
  126. * @cfg {String} disableCachingParam (Optional) Change the parameter which is sent went disabling caching
  127. * through a cache buster. Defaults to '_dc'
  128. * @type String
  129. */
  130. disableCachingParam: '_dc',
  131. <div id="method-Ext.data.Connection-request"></div>/**
  132. * <p>Sends an HTTP request to a remote server.</p>
  133. * <p><b>Important:</b> Ajax server requests are asynchronous, and this call will
  134. * return before the response has been received. Process any returned data
  135. * in a callback function.</p>
  136. * <pre><code>
  137. Ext.Ajax.request({
  138. url: 'ajax_demo/sample.json',
  139. success: function(response, opts) {
  140. var obj = Ext.decode(response.responseText);
  141. console.dir(obj);
  142. },
  143. failure: function(response, opts) {
  144. console.log('server-side failure with status code ' + response.status);
  145. }
  146. });
  147. * </code></pre>
  148. * <p>To execute a callback function in the correct scope, use the <tt>scope</tt> option.</p>
  149. * @param {Object} options An object which may contain the following properties:<ul>
  150. * <li><b>url</b> : String/Function (Optional)<div class="sub-desc">The URL to
  151. * which to send the request, or a function to call which returns a URL string. The scope of the
  152. * function is specified by the <tt>scope</tt> option. Defaults to the configured
  153. * <tt>{@link #url}</tt>.</div></li>
  154. * <li><b>params</b> : Object/String/Function (Optional)<div class="sub-desc">
  155. * An object containing properties which are used as parameters to the
  156. * request, a url encoded string or a function to call to get either. The scope of the function
  157. * is specified by the <tt>scope</tt> option.</div></li>
  158. * <li><b>method</b> : String (Optional)<div class="sub-desc">The HTTP method to use
  159. * for the request. Defaults to the configured method, or if no method was configured,
  160. * "GET" if no parameters are being sent, and "POST" if parameters are being sent. Note that
  161. * the method name is case-sensitive and should be all caps.</div></li>
  162. * <li><b>callback</b> : Function (Optional)<div class="sub-desc">The
  163. * function to be called upon receipt of the HTTP response. The callback is
  164. * called regardless of success or failure and is passed the following
  165. * parameters:<ul>
  166. * <li><b>options</b> : Object<div class="sub-desc">The parameter to the request call.</div></li>
  167. * <li><b>success</b> : Boolean<div class="sub-desc">True if the request succeeded.</div></li>
  168. * <li><b>response</b> : Object<div class="sub-desc">The XMLHttpRequest object containing the response data.
  169. * See <a href="http://www.w3.org/TR/XMLHttpRequest/">http://www.w3.org/TR/XMLHttpRequest/</a> for details about
  170. * accessing elements of the response.</div></li>
  171. * </ul></div></li>
  172. * <li><a id="request-option-success"></a><b>success</b> : Function (Optional)<div class="sub-desc">The function
  173. * to be called upon success of the request. The callback is passed the following
  174. * parameters:<ul>
  175. * <li><b>response</b> : Object<div class="sub-desc">The XMLHttpRequest object containing the response data.</div></li>
  176. * <li><b>options</b> : Object<div class="sub-desc">The parameter to the request call.</div></li>
  177. * </ul></div></li>
  178. * <li><b>failure</b> : Function (Optional)<div class="sub-desc">The function
  179. * to be called upon failure of the request. The callback is passed the
  180. * following parameters:<ul>
  181. * <li><b>response</b> : Object<div class="sub-desc">The XMLHttpRequest object containing the response data.</div></li>
  182. * <li><b>options</b> : Object<div class="sub-desc">The parameter to the request call.</div></li>
  183. * </ul></div></li>
  184. * <li><b>scope</b> : Object (Optional)<div class="sub-desc">The scope in
  185. * which to execute the callbacks: The "this" object for the callback function. If the <tt>url</tt>, or <tt>params</tt> options were
  186. * specified as functions from which to draw values, then this also serves as the scope for those function calls.
  187. * Defaults to the browser window.</div></li>
  188. * <li><b>timeout</b> : Number (Optional)<div class="sub-desc">The timeout in milliseconds to be used for this request. Defaults to 30 seconds.</div></li>
  189. * <li><b>form</b> : Element/HTMLElement/String (Optional)<div class="sub-desc">The <tt>&lt;form&gt;</tt>
  190. * Element or the id of the <tt>&lt;form&gt;</tt> to pull parameters from.</div></li>
  191. * <li><a id="request-option-isUpload"></a><b>isUpload</b> : Boolean (Optional)<div class="sub-desc"><b>Only meaningful when used
  192. * with the <tt>form</tt> option</b>.
  193. * <p>True if the form object is a file upload (will be set automatically if the form was
  194. * configured with <b><tt>enctype</tt></b> "multipart/form-data").</p>
  195. * <p>File uploads are not performed using normal "Ajax" techniques, that is they are <b>not</b>
  196. * performed using XMLHttpRequests. Instead the form is submitted in the standard manner with the
  197. * DOM <tt>&lt;form></tt> element temporarily modified to have its
  198. * <a href="http://www.w3.org/TR/REC-html40/present/frames.html#adef-target">target</a> set to refer
  199. * to a dynamically generated, hidden <tt>&lt;iframe></tt> which is inserted into the document
  200. * but removed after the return data has been gathered.</p>
  201. * <p>The server response is parsed by the browser to create the document for the IFRAME. If the
  202. * server is using JSON to send the return object, then the
  203. * <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.17">Content-Type</a> header
  204. * must be set to "text/html" in order to tell the browser to insert the text unchanged into the document body.</p>
  205. * <p>The response text is retrieved from the document, and a fake XMLHttpRequest object
  206. * is created containing a <tt>responseText</tt> property in order to conform to the
  207. * requirements of event handlers and callbacks.</p>
  208. * <p>Be aware that file upload packets are sent with the content type <a href="http://www.faqs.org/rfcs/rfc2388.html">multipart/form</a>
  209. * and some server technologies (notably JEE) may require some custom processing in order to
  210. * retrieve parameter names and parameter values from the packet content.</p>
  211. * </div></li>
  212. * <li><b>headers</b> : Object (Optional)<div class="sub-desc">Request
  213. * headers to set for the request.</div></li>
  214. * <li><b>xmlData</b> : Object (Optional)<div class="sub-desc">XML document
  215. * to use for the post. Note: This will be used instead of params for the post
  216. * data. Any params will be appended to the URL.</div></li>
  217. * <li><b>jsonData</b> : Object/String (Optional)<div class="sub-desc">JSON
  218. * data to use as the post. Note: This will be used instead of params for the post
  219. * data. Any params will be appended to the URL.</div></li>
  220. * <li><b>disableCaching</b> : Boolean (Optional)<div class="sub-desc">True
  221. * to add a unique cache-buster param to GET requests.</div></li>
  222. * </ul></p>
  223. * <p>The options object may also contain any other property which might be needed to perform
  224. * postprocessing in a callback because it is passed to callback functions.</p>
  225. * @return {Number} transactionId The id of the server transaction. This may be used
  226. * to cancel the request.
  227. */
  228. request : function(o){
  229. var me = this;
  230. if(me.fireEvent(BEFOREREQUEST, me, o)){
  231. if (o.el) {
  232. if(!Ext.isEmpty(o.indicatorText)){
  233. me.indicatorText = '<div class="loading-indicator">'+o.indicatorText+"</div>";
  234. }
  235. if(me.indicatorText) {
  236. Ext.getDom(o.el).innerHTML = me.indicatorText;
  237. }
  238. o.success = (Ext.isFunction(o.success) ? o.success : function(){}).createInterceptor(function(response) {
  239. Ext.getDom(o.el).innerHTML = response.responseText;
  240. });
  241. }
  242. var p = o.params,
  243. url = o.url || me.url,
  244. method,
  245. cb = {success: me.handleResponse,
  246. failure: me.handleFailure,
  247. scope: me,
  248. argument: {options: o},
  249. timeout : Ext.num(o.timeout, me.timeout)
  250. },
  251. form,
  252. serForm;
  253. if (Ext.isFunction(p)) {
  254. p = p.call(o.scope||WINDOW, o);
  255. }
  256. p = Ext.urlEncode(me.extraParams, Ext.isObject(p) ? Ext.urlEncode(p) : p);
  257. if (Ext.isFunction(url)) {
  258. url = url.call(o.scope || WINDOW, o);
  259. }
  260. if((form = Ext.getDom(o.form))){
  261. url = url || form.action;
  262. if(o.isUpload || (/multipart\/form-data/i.test(form.getAttribute("enctype")))) {
  263. return me.doFormUpload.call(me, o, p, url);
  264. }
  265. serForm = Ext.lib.Ajax.serializeForm(form);
  266. p = p ? (p + '&' + serForm) : serForm;
  267. }
  268. method = o.method || me.method || ((p || o.xmlData || o.jsonData) ? POST : GET);
  269. if(method === GET && (me.disableCaching && o.disableCaching !== false) || o.disableCaching === true){
  270. var dcp = o.disableCachingParam || me.disableCachingParam;
  271. url = Ext.urlAppend(url, dcp + '=' + (new Date().getTime()));
  272. }
  273. o.headers = Ext.apply(o.headers || {}, me.defaultHeaders || {});
  274. if(o.autoAbort === true || me.autoAbort) {
  275. me.abort();
  276. }
  277. if((method == GET || o.xmlData || o.jsonData) && p){
  278. url = Ext.urlAppend(url, p);
  279. p = '';
  280. }
  281. return (me.transId = Ext.lib.Ajax.request(method, url, cb, p, o));
  282. }else{
  283. return o.callback ? o.callback.apply(o.scope, [o,UNDEFINED,UNDEFINED]) : null;
  284. }
  285. },
  286. <div id="method-Ext.data.Connection-isLoading"></div>/**
  287. * Determine whether this object has a request outstanding.
  288. * @param {Number} transactionId (Optional) defaults to the last transaction
  289. * @return {Boolean} True if there is an outstanding request.
  290. */
  291. isLoading : function(transId){
  292. return transId ? Ext.lib.Ajax.isCallInProgress(transId) : !! this.transId;
  293. },
  294. <div id="method-Ext.data.Connection-abort"></div>/**
  295. * Aborts any outstanding request.
  296. * @param {Number} transactionId (Optional) defaults to the last transaction
  297. */
  298. abort : function(transId){
  299. if(transId || this.isLoading()){
  300. Ext.lib.Ajax.abort(transId || this.transId);
  301. }
  302. },
  303. // private
  304. handleResponse : function(response){
  305. this.transId = false;
  306. var options = response.argument.options;
  307. response.argument = options ? options.argument : null;
  308. this.fireEvent(REQUESTCOMPLETE, this, response, options);
  309. if(options.success){
  310. options.success.call(options.scope, response, options);
  311. }
  312. if(options.callback){
  313. options.callback.call(options.scope, options, true, response);
  314. }
  315. },
  316. // private
  317. handleFailure : function(response, e){
  318. this.transId = false;
  319. var options = response.argument.options;
  320. response.argument = options ? options.argument : null;
  321. this.fireEvent(REQUESTEXCEPTION, this, response, options, e);
  322. if(options.failure){
  323. options.failure.call(options.scope, response, options);
  324. }
  325. if(options.callback){
  326. options.callback.call(options.scope, options, false, response);
  327. }
  328. },
  329. // private
  330. doFormUpload : function(o, ps, url){
  331. var id = Ext.id(),
  332. doc = document,
  333. frame = doc.createElement('iframe'),
  334. form = Ext.getDom(o.form),
  335. hiddens = [],
  336. hd,
  337. encoding = 'multipart/form-data',
  338. buf = {
  339. target: form.target,
  340. method: form.method,
  341. encoding: form.encoding,
  342. enctype: form.enctype,
  343. action: form.action
  344. };
  345. /*
  346. * Originally this behaviour was modified for Opera 10 to apply the secure URL after
  347. * the frame had been added to the document. It seems this has since been corrected in
  348. * Opera so the behaviour has been reverted, the URL will be set before being added.
  349. */
  350. Ext.fly(frame).set({
  351. id: id,
  352. name: id,
  353. cls: 'x-hidden',
  354. src: Ext.SSL_SECURE_URL
  355. });
  356. doc.body.appendChild(frame);
  357. // This is required so that IE doesn't pop the response up in a new window.
  358. if(Ext.isIE){
  359. document.frames[id].name = id;
  360. }
  361. Ext.fly(form).set({
  362. target: id,
  363. method: POST,
  364. enctype: encoding,
  365. encoding: encoding,
  366. action: url || buf.action
  367. });
  368. // add dynamic params
  369. Ext.iterate(Ext.urlDecode(ps, false), function(k, v){
  370. hd = doc.createElement('input');
  371. Ext.fly(hd).set({
  372. type: 'hidden',
  373. value: v,
  374. name: k
  375. });
  376. form.appendChild(hd);
  377. hiddens.push(hd);
  378. });
  379. function cb(){
  380. var me = this,
  381. // bogus response object
  382. r = {responseText : '',
  383. responseXML : null,
  384. argument : o.argument},
  385. doc,
  386. firstChild;
  387. try{
  388. doc = frame.contentWindow.document || frame.contentDocument || WINDOW.frames[id].document;
  389. if(doc){
  390. if(doc.body){
  391. if(/textarea/i.test((firstChild = doc.body.firstChild || {}).tagName)){ // json response wrapped in textarea
  392. r.responseText = firstChild.value;
  393. }else{
  394. r.responseText = doc.body.innerHTML;
  395. }
  396. }
  397. //in IE the document may still have a body even if returns XML.
  398. r.responseXML = doc.XMLDocument || doc;
  399. }
  400. }
  401. catch(e) {}
  402. Ext.EventManager.removeListener(frame, LOAD, cb, me);
  403. me.fireEvent(REQUESTCOMPLETE, me, r, o);
  404. function runCallback(fn, scope, args){
  405. if(Ext.isFunction(fn)){
  406. fn.apply(scope, args);
  407. }
  408. }
  409. runCallback(o.success, o.scope, [r, o]);
  410. runCallback(o.callback, o.scope, [o, true, r]);
  411. if(!me.debugUploads){
  412. setTimeout(function(){Ext.removeNode(frame);}, 100);
  413. }
  414. }
  415. Ext.EventManager.on(frame, LOAD, cb, this);
  416. form.submit();
  417. Ext.fly(form).set(buf);
  418. Ext.each(hiddens, function(h) {
  419. Ext.removeNode(h);
  420. });
  421. }
  422. });
  423. })();
  424. <div id="cls-Ext.Ajax"></div>/**
  425. * @class Ext.Ajax
  426. * @extends Ext.data.Connection
  427. * <p>The global Ajax request class that provides a simple way to make Ajax requests
  428. * with maximum flexibility.</p>
  429. * <p>Since Ext.Ajax is a singleton, you can set common properties/events for it once
  430. * and override them at the request function level only if necessary.</p>
  431. * <p>Common <b>Properties</b> you may want to set are:<div class="mdetail-params"><ul>
  432. * <li><b><tt>{@link #method}</tt></b><p class="sub-desc"></p></li>
  433. * <li><b><tt>{@link #extraParams}</tt></b><p class="sub-desc"></p></li>
  434. * <li><b><tt>{@link #url}</tt></b><p class="sub-desc"></p></li>
  435. * </ul></div>
  436. * <pre><code>
  437. // Default headers to pass in every request
  438. Ext.Ajax.defaultHeaders = {
  439. 'Powered-By': 'Ext'
  440. };
  441. * </code></pre>
  442. * </p>
  443. * <p>Common <b>Events</b> you may want to set are:<div class="mdetail-params"><ul>
  444. * <li><b><tt>{@link Ext.data.Connection#beforerequest beforerequest}</tt></b><p class="sub-desc"></p></li>
  445. * <li><b><tt>{@link Ext.data.Connection#requestcomplete requestcomplete}</tt></b><p class="sub-desc"></p></li>
  446. * <li><b><tt>{@link Ext.data.Connection#requestexception requestexception}</tt></b><p class="sub-desc"></p></li>
  447. * </ul></div>
  448. * <pre><code>
  449. // Example: show a spinner during all Ajax requests
  450. Ext.Ajax.on('beforerequest', this.showSpinner, this);
  451. Ext.Ajax.on('requestcomplete', this.hideSpinner, this);
  452. Ext.Ajax.on('requestexception', this.hideSpinner, this);
  453. * </code></pre>
  454. * </p>
  455. * <p>An example request:</p>
  456. * <pre><code>
  457. // Basic request
  458. Ext.Ajax.{@link Ext.data.Connection#request request}({
  459. url: 'foo.php',
  460. success: someFn,
  461. failure: otherFn,
  462. headers: {
  463. 'my-header': 'foo'
  464. },
  465. params: { foo: 'bar' }
  466. });
  467. // Simple ajax form submission
  468. Ext.Ajax.{@link Ext.data.Connection#request request}({
  469. form: 'some-form',
  470. params: 'foo=bar'
  471. });
  472. * </code></pre>
  473. * </p>
  474. * @singleton
  475. */
  476. Ext.Ajax = new Ext.data.Connection({
  477. <div id="cfg-Ext.Ajax-url"></div>/**
  478. * @cfg {String} url @hide
  479. */
  480. <div id="cfg-Ext.Ajax-extraParams"></div>/**
  481. * @cfg {Object} extraParams @hide
  482. */
  483. <div id="cfg-Ext.Ajax-defaultHeaders"></div>/**
  484. * @cfg {Object} defaultHeaders @hide
  485. */
  486. <div id="cfg-Ext.Ajax-method"></div>/**
  487. * @cfg {String} method (Optional) @hide
  488. */
  489. <div id="cfg-Ext.Ajax-timeout"></div>/**
  490. * @cfg {Number} timeout (Optional) @hide
  491. */
  492. <div id="cfg-Ext.Ajax-autoAbort"></div>/**
  493. * @cfg {Boolean} autoAbort (Optional) @hide
  494. */
  495. <div id="cfg-Ext.Ajax-disableCaching"></div>/**
  496. * @cfg {Boolean} disableCaching (Optional) @hide
  497. */
  498. <div id="prop-Ext.Ajax-disableCaching"></div>/**
  499. * @property disableCaching
  500. * True to add a unique cache-buster param to GET requests. (defaults to true)
  501. * @type Boolean
  502. */
  503. <div id="prop-Ext.Ajax-url"></div>/**
  504. * @property url
  505. * The default URL to be used for requests to the server. (defaults to undefined)
  506. * If the server receives all requests through one URL, setting this once is easier than
  507. * entering it on every request.
  508. * @type String
  509. */
  510. <div id="prop-Ext.Ajax-extraParams"></div>/**
  511. * @property extraParams
  512. * An object containing properties which are used as extra parameters to each request made
  513. * by this object (defaults to undefined). Session information and other data that you need
  514. * to pass with each request are commonly put here.
  515. * @type Object
  516. */
  517. <div id="prop-Ext.Ajax-defaultHeaders"></div>/**
  518. * @property defaultHeaders
  519. * An object containing request headers which are added to each request made by this object
  520. * (defaults to undefined).
  521. * @type Object
  522. */
  523. <div id="prop-Ext.Ajax-method"></div>/**
  524. * @property method
  525. * The default HTTP method to be used for requests. Note that this is case-sensitive and
  526. * should be all caps (defaults to undefined; if not set but params are present will use
  527. * <tt>"POST"</tt>, otherwise will use <tt>"GET"</tt>.)
  528. * @type String
  529. */
  530. <div id="prop-Ext.Ajax-timeout"></div>/**
  531. * @property timeout
  532. * The timeout in milliseconds to be used for requests. (defaults to 30000)
  533. * @type Number
  534. */
  535. <div id="prop-Ext.Ajax-autoAbort"></div>/**
  536. * @property autoAbort
  537. * Whether a new request should abort any pending requests. (defaults to false)
  538. * @type Boolean
  539. */
  540. autoAbort : false,
  541. <div id="method-Ext.Ajax-serializeForm"></div>/**
  542. * Serialize the passed form into a url encoded string
  543. * @param {String/HTMLElement} form
  544. * @return {String}
  545. */
  546. serializeForm : function(form){
  547. return Ext.lib.Ajax.serializeForm(form);
  548. }
  549. });
  550. </pre>
  551. </body>
  552. </html>