~crf-team/crf-irp/crf-irp

« back to all changes in this revision

Viewing changes to WebContent/js/extjs-2/docs/output/UpdateManager.jss.html

  • Committer: Thomas
  • Date: 2010-03-10 23:55:46 UTC
  • Revision ID: thomas@daisybox-port-20100310235546-23635dk6x5asb1ca
Upgrade ExtJs 3.1.1
Upgrade Spring 3.0.1 + dependencies
Change Jawr JS post processor : YUI
Upgrade to last build of dwr 3 trunk 69 revision 3019(after build 116), upgrade jawr-dwr plugin 1.4 unofficiale from jose noheda, Jawr 3.2.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
<html><head><title>UpdateManager.js</title><link rel="stylesheet" type="text/css" href="../resources/style.css" media="screen"/></head><body><h1>UpdateManager.js</h1><pre class="highlighted"><code><i>/**
2
 
 * @class Ext.Updater
3
 
 * @extends Ext.util.Observable
4
 
 * Provides AJAX-style update capabilities <b>for</b> Element objects.  Updater can be used to {@link #update} an Element once,
5
 
 * or you can use {@link #startAutoRefresh} to set up an auto-updating Element on a specific interval.&lt;br&gt;&lt;br&gt;
6
 
 * Usage:&lt;br&gt;
7
 
 * &lt;pre&gt;&lt;code&gt;
8
 
 * <i>// Get it from a Ext.Element object</i>
9
 
 * <b>var</b> el = Ext.get(&quot;foo&quot;);
10
 
 * <b>var</b> mgr = el.getUpdater();
11
 
 * mgr.update({
12
 
        url: &quot;http:<i>//myserver.com/index.php&quot;,</i>
13
 
        params: {
14
 
            param1: &quot;foo&quot;,
15
 
            param2: &quot;bar&quot;
16
 
        }
17
 
 * });
18
 
 * ...
19
 
 * mgr.formUpdate(&quot;myFormId&quot;, &quot;http:<i>//myserver.com/index.php&quot;);</i>
20
 
 * &lt;br&gt;
21
 
 * <i>// or directly (returns the same Updater instance)</i>
22
 
 * <b>var</b> mgr = <b>new</b> Ext.Updater(&quot;myElementId&quot;);
23
 
 * mgr.startAutoRefresh(60, &quot;http:<i>//myserver.com/index.php&quot;);</i>
24
 
 * mgr.on(&quot;update&quot;, myFcnNeedsToKnow);
25
 
 * &lt;br&gt;
26
 
 * <i>// short handed call directly from the element object</i>
27
 
 * Ext.get(&quot;foo&quot;).load({
28
 
        url: &quot;bar.php&quot;,
29
 
        scripts: true,
30
 
        params: &quot;param1=foo&amp;amp;param2=bar&quot;,
31
 
        text: &quot;Loading Foo...&quot;
32
 
 * });
33
 
 * &lt;/code&gt;&lt;/pre&gt;
34
 
 * @constructor
35
 
 * Create <b>new</b> Updater directly.
36
 
 * @param {Mixed} el The element to update
37
 
 * @param {Boolean} forceNew (optional) By <b>default</b> the constructor checks to see <b>if</b> the passed element already
38
 
 * has an Updater and <b>if</b> it does it returns the same instance. This will skip that check (useful <b>for</b> extending <b>this</b> class).
39
 
 */</i>
40
 
Ext.Updater = Ext.extend(Ext.util.Observable, {
41
 
    constructor: <b>function</b>(el, forceNew){
42
 
        el = Ext.get(el);
43
 
        <b>if</b>(!forceNew &amp;&amp; el.updateManager){
44
 
            <b>return</b> el.updateManager;
45
 
        }
46
 
        <i>/**
47
 
         * The Element object
48
 
         * @type Ext.Element
49
 
         */</i>
50
 
        <b>this</b>.el = el;
51
 
        <i>/**
52
 
         * Cached url to use <b>for</b> refreshes. Overwritten every time update() is called unless &quot;discardUrl&quot; param is set to true.
53
 
         * @type String
54
 
         */</i>
55
 
        <b>this</b>.defaultUrl = null;
56
 
 
57
 
        <b>this</b>.addEvents(
58
 
            <i>/**
59
 
             * @event beforeupdate
60
 
             * Fired before an update is made, <b>return</b> false from your handler and the update is cancelled.
61
 
             * @param {Ext.Element} el
62
 
             * @param {String/Object/Function} url
63
 
             * @param {String/Object} params
64
 
             */</i>
65
 
            &quot;beforeupdate&quot;,
66
 
            <i>/**
67
 
             * @event update
68
 
             * Fired after successful update is made.
69
 
             * @param {Ext.Element} el
70
 
             * @param {Object} oResponseObject The response Object
71
 
             */</i>
72
 
            &quot;update&quot;,
73
 
            <i>/**
74
 
             * @event failure
75
 
             * Fired on update failure.
76
 
             * @param {Ext.Element} el
77
 
             * @param {Object} oResponseObject The response Object
78
 
             */</i>
79
 
            &quot;failure&quot;
80
 
        );
81
 
        <b>var</b> d = Ext.Updater.defaults;
82
 
        <i>/**
83
 
         * Blank page URL to use <b>with</b> SSL file uploads (defaults to {@link Ext.Updater.defaults#sslBlankUrl}).
84
 
         * @type String
85
 
         */</i>
86
 
        <b>this</b>.sslBlankUrl = d.sslBlankUrl;
87
 
        <i>/**
88
 
         * Whether to append unique parameter on get request to disable caching (defaults to {@link Ext.Updater.defaults#disableCaching}).
89
 
         * @type Boolean
90
 
         */</i>
91
 
        <b>this</b>.disableCaching = d.disableCaching;
92
 
        <i>/**
93
 
         * Text <b>for</b> loading indicator (defaults to {@link Ext.Updater.defaults#indicatorText}).
94
 
         * @type String
95
 
         */</i>
96
 
        <b>this</b>.indicatorText = d.indicatorText;
97
 
        <i>/**
98
 
         * Whether to show indicatorText when loading (defaults to {@link Ext.Updater.defaults#showLoadIndicator}).
99
 
         * @type String
100
 
         */</i>
101
 
        <b>this</b>.showLoadIndicator = d.showLoadIndicator;
102
 
        <i>/**
103
 
         * Timeout <b>for</b> requests or form posts <b>in</b> seconds (defaults to {@link Ext.Updater.defaults#timeout}).
104
 
         * @type Number
105
 
         */</i>
106
 
        <b>this</b>.timeout = d.timeout;
107
 
        <i>/**
108
 
         * True to process scripts <b>in</b> the output (defaults to {@link Ext.Updater.defaults#loadScripts}).
109
 
         * @type Boolean
110
 
         */</i>
111
 
        <b>this</b>.loadScripts = d.loadScripts;
112
 
        <i>/**
113
 
         * Transaction object of the current executing transaction, or null <b>if</b> there is no active transaction.
114
 
         */</i>
115
 
        <b>this</b>.transaction = null;
116
 
        <i>/**
117
 
         * Delegate <b>for</b> refresh() prebound to &quot;<b>this</b>&quot;, use myUpdater.refreshDelegate.createCallback(arg1, arg2) to bind arguments
118
 
         * @type Function
119
 
         */</i>
120
 
        <b>this</b>.refreshDelegate = <b>this</b>.refresh.createDelegate(<b>this</b>);
121
 
        <i>/**
122
 
         * Delegate <b>for</b> update() prebound to &quot;<b>this</b>&quot;, use myUpdater.updateDelegate.createCallback(arg1, arg2) to bind arguments
123
 
         * @type Function
124
 
         */</i>
125
 
        <b>this</b>.updateDelegate = <b>this</b>.update.createDelegate(<b>this</b>);
126
 
        <i>/**
127
 
         * Delegate <b>for</b> formUpdate() prebound to &quot;<b>this</b>&quot;, use myUpdater.formUpdateDelegate.createCallback(arg1, arg2) to bind arguments
128
 
         * @type Function
129
 
         */</i>
130
 
        <b>this</b>.formUpdateDelegate = <b>this</b>.formUpdate.createDelegate(<b>this</b>);
131
 
 
132
 
        <b>if</b>(!<b>this</b>.renderer){
133
 
         <i>/**
134
 
          * The renderer <b>for</b> this Updater (defaults to {@link Ext.Updater.BasicRenderer}).
135
 
          */</i>
136
 
        <b>this</b>.renderer = <b>this</b>.getDefaultRenderer();
137
 
        }
138
 
        Ext.Updater.superclass.constructor.call(<b>this</b>);
139
 
    },
140
 
    <i>/**
141
 
     * This is an overrideable method which returns a reference to a <b>default</b>
142
 
     * renderer class <b>if</b> none is specified when creating the Ext.Updater.
143
 
     * Defaults to {@link Ext.Updater.BasicRenderer}
144
 
     */</i>
145
 
    getDefaultRenderer: <b>function</b>() {
146
 
        <b>return</b> new Ext.Updater.BasicRenderer();
147
 
    },
148
 
    <i>/**
149
 
     * Get the Element <b>this</b> Updater is bound to
150
 
     * @<b>return</b> {Ext.Element} The element
151
 
     */</i>
152
 
    getEl : <b>function</b>(){
153
 
        <b>return</b> this.el;
154
 
    },
155
 
 
156
 
    <i>/**
157
 
     * Performs an &lt;b&gt;asynchronous&lt;/b&gt; request, updating <b>this</b> element <b>with</b> the response.
158
 
     * If params are specified it uses POST, otherwise it uses GET.&lt;br&gt;&lt;br&gt;
159
 
     * &lt;b&gt;Note:&lt;/b&gt; Due to the asynchronous nature of remote server requests, the Element
160
 
     * will not have been fully updated when the <b>function</b> returns. To post-process the returned
161
 
     * data, use the callback option, or an &lt;b&gt;&lt;tt&gt;update&lt;/tt&gt;&lt;/b&gt; event handler.
162
 
     * @param {Object} options A config object containing any of the following options:&lt;ul&gt;
163
 
     * &lt;li&gt;url : &lt;b&gt;String/Function&lt;/b&gt;&lt;p class=&quot;sub-desc&quot;&gt;The URL to request or a <b>function</b> which
164
 
     * &lt;i&gt;returns&lt;/i&gt; the URL (defaults to the value of {@link Ext.Ajax#url} <b>if</b> not specified).&lt;/p&gt;&lt;/li&gt;
165
 
     * &lt;li&gt;method : &lt;b&gt;String&lt;/b&gt;&lt;p class=&quot;sub-desc&quot;&gt;The HTTP method to
166
 
     * use. Defaults to POST <b>if</b> the &lt;tt&gt;params&lt;/tt&gt; argument is present, otherwise GET.&lt;/p&gt;&lt;/li&gt;
167
 
     * &lt;li&gt;params : &lt;b&gt;String/Object/Function&lt;/b&gt;&lt;p class=&quot;sub-desc&quot;&gt;The
168
 
     * parameters to pass to the server (defaults to none). These may be specified as a url-encoded
169
 
     * string, or as an object containing properties which represent parameters,
170
 
     * or as a <b>function</b>, which returns such an object.&lt;/p&gt;&lt;/li&gt;
171
 
     * &lt;li&gt;scripts : &lt;b&gt;Boolean&lt;/b&gt;&lt;p class=&quot;sub-desc&quot;&gt;If &lt;tt&gt;true&lt;/tt&gt;
172
 
     * any &amp;lt;script&amp;gt; tags embedded <b>in</b> the response text will be extracted
173
 
     * and executed (defaults to {@link Ext.Updater.defaults#loadScripts}). If <b>this</b> option is specified,
174
 
     * the callback will be called &lt;i&gt;after&lt;/i&gt; the execution of the scripts.&lt;/p&gt;&lt;/li&gt;
175
 
     * &lt;li&gt;callback : &lt;b&gt;Function&lt;/b&gt;&lt;p class=&quot;sub-desc&quot;&gt;A <b>function</b> to
176
 
     * be called when the response from the server arrives. The following
177
 
     * parameters are passed:&lt;ul&gt;
178
 
     * &lt;li&gt;&lt;b&gt;el&lt;/b&gt; : Ext.Element&lt;p class=&quot;sub-desc&quot;&gt;The Element being updated.&lt;/p&gt;&lt;/li&gt;
179
 
     * &lt;li&gt;&lt;b&gt;success&lt;/b&gt; : Boolean&lt;p class=&quot;sub-desc&quot;&gt;True <b>for</b> success, false <b>for</b> failure.&lt;/p&gt;&lt;/li&gt;
180
 
     * &lt;li&gt;&lt;b&gt;response&lt;/b&gt; : XMLHttpRequest&lt;p class=&quot;sub-desc&quot;&gt;The XMLHttpRequest which processed the update.&lt;/p&gt;&lt;/li&gt;
181
 
     * &lt;li&gt;&lt;b&gt;options&lt;/b&gt; : Object&lt;p class=&quot;sub-desc&quot;&gt;The config object passed to the update call.&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;
182
 
     * &lt;/p&gt;&lt;/li&gt;
183
 
     * &lt;li&gt;scope : &lt;b&gt;Object&lt;/b&gt;&lt;p class=&quot;sub-desc&quot;&gt;The scope <b>in</b> which
184
 
     * to execute the callback (The callback's &lt;tt&gt;<b>this</b>&lt;/tt&gt; reference.) If the
185
 
     * &lt;tt&gt;params&lt;/tt&gt; argument is a <b>function</b>, <b>this</b> scope is used <b>for</b> that <b>function</b> also.&lt;/p&gt;&lt;/li&gt;
186
 
     * &lt;li&gt;discardUrl : &lt;b&gt;Boolean&lt;/b&gt;&lt;p class=&quot;sub-desc&quot;&gt;By <b>default</b>, the URL of <b>this</b> request becomes
187
 
     * the <b>default</b> URL <b>for</b> this Updater object, and will be subsequently used <b>in</b> {@link #refresh}
188
 
     * calls.  To bypass <b>this</b> behavior, pass &lt;tt&gt;discardUrl:true&lt;/tt&gt; (defaults to false).&lt;/p&gt;&lt;/li&gt;
189
 
     * &lt;li&gt;timeout : &lt;b&gt;Number&lt;/b&gt;&lt;p class=&quot;sub-desc&quot;&gt;The number of seconds to wait <b>for</b> a response before
190
 
     * timing out (defaults to {@link Ext.Updater.defaults#timeout}).&lt;/p&gt;&lt;/li&gt;
191
 
     * &lt;li&gt;text : &lt;b&gt;String&lt;/b&gt;&lt;p class=&quot;sub-desc&quot;&gt;The text to use as the innerHTML of the
192
 
     * {@link Ext.Updater.defaults#indicatorText} div (defaults to <em>'Loading...'</em>).  To replace the entire div, not
193
 
     * just the text, override {@link Ext.Updater.defaults#indicatorText} directly.&lt;/p&gt;&lt;/li&gt;
194
 
     * &lt;li&gt;nocache : &lt;b&gt;Boolean&lt;/b&gt;&lt;p class=&quot;sub-desc&quot;&gt;Only needed <b>for</b> GET
195
 
     * requests, <b>this</b> option causes an extra, auto-generated parameter to be appended to the request
196
 
     * to defeat caching (defaults to {@link Ext.Updater.defaults#disableCaching}).&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;
197
 
     * &lt;p&gt;
198
 
     * For example:
199
 
&lt;pre&gt;&lt;code&gt;
200
 
um.update({
201
 
    url: &quot;your-url.php&quot;,
202
 
    params: {param1: &quot;foo&quot;, param2: &quot;bar&quot;}, <i>// or a URL encoded string</i>
203
 
    callback: yourFunction,
204
 
    scope: yourObject, <i>//(optional scope)</i>
205
 
    discardUrl: true,
206
 
    nocache: true,
207
 
    text: &quot;Loading...&quot;,
208
 
    timeout: 60,
209
 
    scripts: false <i>// Save time by avoiding RegExp execution.</i>
210
 
});
211
 
&lt;/code&gt;&lt;/pre&gt;
212
 
     */</i>
213
 
    update : <b>function</b>(url, params, callback, discardUrl){
214
 
        <b>if</b>(this.fireEvent(&quot;beforeupdate&quot;, <b>this</b>.el, url, params) !== false){
215
 
            <b>var</b> cfg, callerScope;
216
 
            <b>if</b>(typeof url == &quot;object&quot;){ <i>// must be config object</i>
217
 
                cfg = url;
218
 
                url = cfg.url;
219
 
                params = params || cfg.params;
220
 
                callback = callback || cfg.callback;
221
 
                discardUrl = discardUrl || cfg.discardUrl;
222
 
                callerScope = cfg.scope;
223
 
                <b>if</b>(typeof cfg.nocache != &quot;undefined&quot;){<b>this</b>.disableCaching = cfg.nocache;};
224
 
                <b>if</b>(typeof cfg.text != &quot;undefined&quot;){<b>this</b>.indicatorText = <em>'&lt;div class=&quot;loading-indicator&quot;&gt;'</em>+cfg.text+&quot;&lt;/div&gt;&quot;;};
225
 
                <b>if</b>(typeof cfg.scripts != &quot;undefined&quot;){<b>this</b>.loadScripts = cfg.scripts;};
226
 
                <b>if</b>(typeof cfg.timeout != &quot;undefined&quot;){<b>this</b>.timeout = cfg.timeout;};
227
 
            }
228
 
            <b>this</b>.showLoading();
229
 
 
230
 
            <b>if</b>(!discardUrl){
231
 
                <b>this</b>.defaultUrl = url;
232
 
            }
233
 
            <b>if</b>(typeof url == &quot;<b>function</b>&quot;){
234
 
                url = url.call(<b>this</b>);
235
 
            }
236
 
 
237
 
            <b>var</b> o = Ext.apply({}, {
238
 
                url : url,
239
 
                params: (<b>typeof</b> params == &quot;<b>function</b>&quot; &amp;&amp; callerScope) ? params.createDelegate(callerScope) : params,
240
 
                success: <b>this</b>.processSuccess,
241
 
                failure: <b>this</b>.processFailure,
242
 
                scope: <b>this</b>,
243
 
                callback: undefined,
244
 
                timeout: (<b>this</b>.timeout*1000),
245
 
                disableCaching: <b>this</b>.disableCaching,
246
 
                argument: {
247
 
                    &quot;options&quot;: cfg,
248
 
                    &quot;url&quot;: url,
249
 
                    &quot;form&quot;: null,
250
 
                    &quot;callback&quot;: callback,
251
 
                    &quot;scope&quot;: callerScope || window,
252
 
                    &quot;params&quot;: params
253
 
                }
254
 
            }, cfg);
255
 
 
256
 
            <b>this</b>.transaction = Ext.Ajax.request(o);
257
 
        }
258
 
    },
259
 
 
260
 
    <i>/**
261
 
     * &lt;p&gt;Performs an async form post, updating <b>this</b> element <b>with</b> the response. If the form has the attribute
262
 
     * enctype=&quot;&lt;a href=&quot;http:<i>//www.faqs.org/rfcs/rfc2388.html&quot;&gt;multipart/form-data&lt;/a&gt;&quot;, it assumes it's a file upload.</i>
263
 
     * Uses <b>this</b>.sslBlankUrl <b>for</b> SSL file uploads to prevent IE security warning.&lt;/p&gt;
264
 
     * &lt;p&gt;File uploads are not performed using normal &quot;Ajax&quot; techniques, that is they are &lt;b&gt;not&lt;/b&gt;
265
 
     * performed using XMLHttpRequests. Instead the form is submitted <b>in</b> the standard manner <b>with</b> the
266
 
     * DOM &lt;tt&gt;&amp;lt;form&gt;&lt;/tt&gt; element temporarily modified to have its
267
 
     * &lt;a href=&quot;http:<i>//www.w3.org/TR/REC-html40/present/frames.html#adef-target&quot;&gt;target&lt;/a&gt; set to refer</i>
268
 
     * to a dynamically generated, hidden &lt;tt&gt;&amp;lt;iframe&gt;&lt;/tt&gt; which is inserted into the document
269
 
     * but removed after the <b>return</b> data has been gathered.&lt;/p&gt;
270
 
     * &lt;p&gt;Be aware that file upload packets, sent <b>with</b> the content type &lt;a href=&quot;http:<i>//www.faqs.org/rfcs/rfc2388.html&quot;&gt;multipart/form-data&lt;/a&gt;</i>
271
 
     * and some server technologies (notably JEE) may require some custom processing <b>in</b> order to
272
 
     * retrieve parameter names and parameter values from the packet content.&lt;/p&gt;
273
 
     * @param {String/HTMLElement} form The form Id or form element
274
 
     * @param {String} url (optional) The url to pass the form to. If omitted the action attribute on the form will be used.
275
 
     * @param {Boolean} reset (optional) Whether to try to reset the form after the update
276
 
     * @param {Function} callback (optional) Callback when transaction is complete. The following
277
 
     * parameters are passed:&lt;ul&gt;
278
 
     * &lt;li&gt;&lt;b&gt;el&lt;/b&gt; : Ext.Element&lt;p class=&quot;sub-desc&quot;&gt;The Element being updated.&lt;/p&gt;&lt;/li&gt;
279
 
     * &lt;li&gt;&lt;b&gt;success&lt;/b&gt; : Boolean&lt;p class=&quot;sub-desc&quot;&gt;True <b>for</b> success, false <b>for</b> failure.&lt;/p&gt;&lt;/li&gt;
280
 
     * &lt;li&gt;&lt;b&gt;response&lt;/b&gt; : XMLHttpRequest&lt;p class=&quot;sub-desc&quot;&gt;The XMLHttpRequest which processed the update.&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;
281
 
     */</i>
282
 
    formUpdate : <b>function</b>(form, url, reset, callback){
283
 
        <b>if</b>(this.fireEvent(&quot;beforeupdate&quot;, <b>this</b>.el, form, url) !== false){
284
 
            <b>if</b>(typeof url == &quot;<b>function</b>&quot;){
285
 
                url = url.call(<b>this</b>);
286
 
            }
287
 
            form = Ext.getDom(form)
288
 
            <b>this</b>.transaction = Ext.Ajax.request({
289
 
                form: form,
290
 
                url:url,
291
 
                success: <b>this</b>.processSuccess,
292
 
                failure: <b>this</b>.processFailure,
293
 
                scope: <b>this</b>,
294
 
                timeout: (<b>this</b>.timeout*1000),
295
 
                argument: {
296
 
                    &quot;url&quot;: url,
297
 
                    &quot;form&quot;: form,
298
 
                    &quot;callback&quot;: callback,
299
 
                    &quot;reset&quot;: reset
300
 
                }
301
 
            });
302
 
            <b>this</b>.showLoading.defer(1, <b>this</b>);
303
 
        }
304
 
    },
305
 
 
306
 
    <i>/**
307
 
     * Refresh the element <b>with</b> the last used url or defaultUrl. If there is no url, it returns immediately
308
 
     * @param {Function} callback (optional) Callback when transaction is complete - called <b>with</b> signature (oElement, bSuccess)
309
 
     */</i>
310
 
    refresh : <b>function</b>(callback){
311
 
        <b>if</b>(this.defaultUrl == null){
312
 
            <b>return</b>;
313
 
        }
314
 
        <b>this</b>.update(<b>this</b>.defaultUrl, null, callback, true);
315
 
    },
316
 
 
317
 
    <i>/**
318
 
     * Set <b>this</b> element to auto refresh.  Can be canceled by calling {@link #stopAutoRefresh}.
319
 
     * @param {Number} interval How often to update (<b>in</b> seconds).
320
 
     * @param {String/Object/Function} url (optional) The url <b>for</b> this request, a config object <b>in</b> the same format
321
 
     * supported by {@link #load}, or a <b>function</b> to call to get the url (defaults to the last used url).  Note that <b>while</b>
322
 
     * the url used <b>in</b> a load call can be reused by <b>this</b> method, other load config options will not be reused and must be
323
 
     * sepcified as part of a config object passed as <b>this</b> paramter <b>if</b> needed.
324
 
     * @param {String/Object} params (optional) The parameters to pass as either a url encoded string
325
 
     * &quot;&amp;param1=1&amp;param2=2&quot; or as an object {param1: 1, param2: 2}
326
 
     * @param {Function} callback (optional) Callback when transaction is complete - called <b>with</b> signature (oElement, bSuccess)
327
 
     * @param {Boolean} refreshNow (optional) Whether to execute the refresh now, or wait the interval
328
 
     */</i>
329
 
    startAutoRefresh : <b>function</b>(interval, url, params, callback, refreshNow){
330
 
        <b>if</b>(refreshNow){
331
 
            <b>this</b>.update(url || <b>this</b>.defaultUrl, params, callback, true);
332
 
        }
333
 
        <b>if</b>(this.autoRefreshProcId){
334
 
            clearInterval(<b>this</b>.autoRefreshProcId);
335
 
        }
336
 
        <b>this</b>.autoRefreshProcId = setInterval(<b>this</b>.update.createDelegate(<b>this</b>, [url || <b>this</b>.defaultUrl, params, callback, true]), interval*1000);
337
 
    },
338
 
 
339
 
    <i>/**
340
 
     * Stop auto refresh on <b>this</b> element.
341
 
     */</i>
342
 
     stopAutoRefresh : <b>function</b>(){
343
 
        <b>if</b>(this.autoRefreshProcId){
344
 
            clearInterval(<b>this</b>.autoRefreshProcId);
345
 
            <b>delete</b> this.autoRefreshProcId;
346
 
        }
347
 
    },
348
 
 
349
 
    <i>/**
350
 
     * Returns true <b>if</b> the Updater is currently set to auto refresh its content (see {@link #startAutoRefresh}), otherwise false.
351
 
     */</i>
352
 
    isAutoRefreshing : <b>function</b>(){
353
 
       <b>return</b> this.autoRefreshProcId ? true : false;
354
 
    },
355
 
 
356
 
    <i>/**
357
 
     * Display the element's &quot;loading&quot; state. By <b>default</b>, the element is updated <b>with</b> {@link #indicatorText}. This
358
 
     * method may be overridden to perform a custom action <b>while</b> this Updater is actively updating its contents.
359
 
     */</i>
360
 
    showLoading : <b>function</b>(){
361
 
        <b>if</b>(this.showLoadIndicator){
362
 
            <b>this</b>.el.update(<b>this</b>.indicatorText);
363
 
        }
364
 
    },
365
 
 
366
 
    <i>// private</i>
367
 
    processSuccess : <b>function</b>(response){
368
 
        <b>this</b>.transaction = null;
369
 
        <b>if</b>(response.argument.form &amp;&amp; response.argument.reset){
370
 
            try{ <i>// put <b>in</b> try/catch since some older FF releases had problems <b>with</b> this</i>
371
 
                response.argument.form.reset();
372
 
            }catch(e){}
373
 
        }
374
 
        <b>if</b>(this.loadScripts){
375
 
            <b>this</b>.renderer.render(<b>this</b>.el, response, <b>this</b>,
376
 
                <b>this</b>.updateComplete.createDelegate(<b>this</b>, [response]));
377
 
        }<b>else</b>{
378
 
            <b>this</b>.renderer.render(<b>this</b>.el, response, <b>this</b>);
379
 
            <b>this</b>.updateComplete(response);
380
 
        }
381
 
    },
382
 
 
383
 
    <i>// private</i>
384
 
    updateComplete : <b>function</b>(response){
385
 
        <b>this</b>.fireEvent(&quot;update&quot;, <b>this</b>.el, response);
386
 
        <b>if</b>(typeof response.argument.callback == &quot;<b>function</b>&quot;){
387
 
            response.argument.callback.call(response.argument.scope, <b>this</b>.el, true, response, response.argument.options);
388
 
        }
389
 
    },
390
 
 
391
 
    <i>// private</i>
392
 
    processFailure : <b>function</b>(response){
393
 
        <b>this</b>.transaction = null;
394
 
        <b>this</b>.fireEvent(&quot;failure&quot;, <b>this</b>.el, response);
395
 
        <b>if</b>(typeof response.argument.callback == &quot;<b>function</b>&quot;){
396
 
            response.argument.callback.call(response.argument.scope, <b>this</b>.el, false, response, response.argument.options);
397
 
        }
398
 
    },
399
 
 
400
 
    <i>/**
401
 
     * Sets the content renderer <b>for</b> this Updater. See {@link Ext.Updater.BasicRenderer#render} <b>for</b> more details.
402
 
     * @param {Object} renderer The object implementing the render() method
403
 
     */</i>
404
 
    setRenderer : <b>function</b>(renderer){
405
 
        <b>this</b>.renderer = renderer;
406
 
    },
407
 
 
408
 
    <i>/**
409
 
     * Returns the content renderer <b>for</b> this Updater. See {@link Ext.Updater.BasicRenderer#render} <b>for</b> more details.
410
 
     * @<b>return</b> {Object}
411
 
     */</i>
412
 
    getRenderer : <b>function</b>(){
413
 
       <b>return</b> this.renderer;
414
 
    },
415
 
 
416
 
    <i>/**
417
 
     * Sets the <b>default</b> URL used <b>for</b> updates.
418
 
     * @param {String/Function} defaultUrl The url or a <b>function</b> to call to get the url
419
 
     */</i>
420
 
    setDefaultUrl : <b>function</b>(defaultUrl){
421
 
        <b>this</b>.defaultUrl = defaultUrl;
422
 
    },
423
 
 
424
 
    <i>/**
425
 
     * Aborts the currently executing transaction, <b>if</b> any.
426
 
     */</i>
427
 
    abort : <b>function</b>(){
428
 
        <b>if</b>(this.transaction){
429
 
            Ext.Ajax.abort(<b>this</b>.transaction);
430
 
        }
431
 
    },
432
 
 
433
 
    <i>/**
434
 
     * Returns true <b>if</b> an update is <b>in</b> progress, otherwise false.
435
 
     * @<b>return</b> {Boolean}
436
 
     */</i>
437
 
    isUpdating : <b>function</b>(){
438
 
        <b>if</b>(this.transaction){
439
 
            <b>return</b> Ext.Ajax.isLoading(<b>this</b>.transaction);
440
 
        }
441
 
        <b>return</b> false;
442
 
    }
443
 
});
444
 
 
445
 
<i>/**
446
 
 * @class Ext.Updater.defaults
447
 
 * The defaults collection enables customizing the <b>default</b> properties of Updater
448
 
 */</i>
449
 
   Ext.Updater.defaults = {
450
 
       <i>/**
451
 
         * Timeout <b>for</b> requests or form posts <b>in</b> seconds (defaults to 30 seconds).
452
 
         * @type Number
453
 
         */</i>
454
 
         timeout : 30,
455
 
         <i>/**
456
 
         * True to process scripts by <b>default</b> (defaults to false).
457
 
         * @type Boolean
458
 
         */</i>
459
 
        loadScripts : false,
460
 
        <i>/**
461
 
        * Blank page URL to use <b>with</b> SSL file uploads (defaults to {@link Ext#SSL_SECURE_URL} <b>if</b> set, or &quot;javascript:false&quot;).
462
 
        * @type String
463
 
        */</i>
464
 
        sslBlankUrl : (Ext.SSL_SECURE_URL || &quot;javascript:false&quot;),
465
 
        <i>/**
466
 
         * True to append a unique parameter to GET requests to disable caching (defaults to false).
467
 
         * @type Boolean
468
 
         */</i>
469
 
        disableCaching : false,
470
 
        <i>/**
471
 
         * Whether or not to show {@link #indicatorText} during loading (defaults to true).
472
 
         * @type Boolean
473
 
         */</i>
474
 
        showLoadIndicator : true,
475
 
        <i>/**
476
 
         * Text <b>for</b> loading indicator (defaults to <em>'&amp;lt;div class=&quot;loading-indicator&quot;&amp;gt;Loading...&amp;lt;/div&amp;gt;'</em>).
477
 
         * @type String
478
 
         */</i>
479
 
        indicatorText : <em>'&lt;div class=&quot;loading-indicator&quot;&gt;Loading...&lt;/div&gt;'</em>
480
 
   };
481
 
 
482
 
<i>/**
483
 
 * Static convenience method. &lt;b&gt;This method is deprecated <b>in</b> favor of el.load({url:<em>'foo.php'</em>, ...})&lt;/b&gt;.
484
 
 * Usage:
485
 
 * &lt;pre&gt;&lt;code&gt;Ext.Updater.updateElement(&quot;my-div&quot;, &quot;stuff.php&quot;);&lt;/code&gt;&lt;/pre&gt;
486
 
 * @param {Mixed} el The element to update
487
 
 * @param {String} url The url
488
 
 * @param {String/Object} params (optional) Url encoded param string or an object of name/value pairs
489
 
 * @param {Object} options (optional) A config object <b>with</b> any of the Updater properties you want to set - <b>for</b>
490
 
 * example: {disableCaching:true, indicatorText: &quot;Loading data...&quot;}
491
 
 * @static
492
 
 * @deprecated
493
 
 * @member Ext.Updater
494
 
 */</i>
495
 
Ext.Updater.updateElement = <b>function</b>(el, url, params, options){
496
 
    <b>var</b> um = Ext.get(el).getUpdater();
497
 
    Ext.apply(um, options);
498
 
    um.update(url, params, options ? options.callback : null);
499
 
};
500
 
<i>/**
501
 
 * @class Ext.Updater.BasicRenderer
502
 
 * Default Content renderer. Updates the elements innerHTML <b>with</b> the responseText.
503
 
 */</i>
504
 
Ext.Updater.BasicRenderer = <b>function</b>(){};
505
 
 
506
 
Ext.Updater.BasicRenderer.prototype = {
507
 
    <i>/**
508
 
     * This is called when the transaction is completed and it's time to update the element - The BasicRenderer
509
 
     * updates the elements innerHTML <b>with</b> the responseText - To perform a custom render (i.e. XML or JSON processing),
510
 
     * create an object <b>with</b> a &quot;render(el, response)&quot; method and pass it to setRenderer on the Updater.
511
 
     * @param {Ext.Element} el The element being rendered
512
 
     * @param {Object} response The XMLHttpRequest object
513
 
     * @param {Updater} updateManager The calling update manager
514
 
     * @param {Function} callback A callback that will need to be called <b>if</b> loadScripts is true on the Updater
515
 
     */</i>
516
 
     render : <b>function</b>(el, response, updateManager, callback){
517
 
        el.update(response.responseText, updateManager.loadScripts, callback);
518
 
    }
519
 
};
520
 
 
521
 
Ext.UpdateManager = Ext.Updater;
522
 
</code></pre><hr><div style="font-size:10px;text-align:center;color:gray;">Ext - Copyright &copy; 2006-2007 Ext JS, LLC<br />All rights reserved.</div>
523
 
    </body></html>
 
 
b'\\ No newline at end of file'