Fossil SCM

fixed a url-updating problem caused by recent refactoring.

stephan 2011-10-05 07:01 UTC json-multitag-test
Commit 4b70853483fbecd79008e6027035a0cd5e4a8b7d
2 files changed +3 -3 +9 -5
+3 -3
--- ajax/index.html
+++ ajax/index.html
@@ -155,11 +155,11 @@
155155
ajcb.afterSend = function(req,opt) {
156156
TheApp.timer.end();
157157
TheApp.endAjaxNotif();
158158
TheApp.jqe.timer.text( "(Round-trip time (incl. JS overhead): "+TheApp.timer.duration+'ms)' );
159159
};
160
- ajcb.onResponse = function(resp,req) {
160
+ ajcb.onResponse = function(resp,req, opt) {
161161
var val;
162162
if(this.jsonp) return /*was already handled*/;
163163
try {
164164
val = WhAjaj.stringify(resp);
165165
}
@@ -167,11 +167,11 @@
167167
val = WhAjaj.stringify(e)
168168
}
169169
//alert("onResponse this:"+WhAjaj.stringify(this));
170170
//alert("val="+val);
171171
// FIXME: this.url is hosed for login because of how i overload onResponse()
172
- if( this.url ) TheApp.jqe.textPath.val(this.url.replace(WhAjaj.Connector.options.ajax.url,''));
172
+ if( opt.url ) TheApp.jqe.textPath.val(opt.url.replace(WhAjaj.Connector.options.ajax.url,''));
173173
TheApp.jqe.taResponse.val( val );
174174
};
175175
ajcb.onError = function(req,opt) {
176176
TheApp.jqe.taResponse.val( "ERROR SENDING REQUEST:\n"+WhAjaj.stringify(opt) );
177177
};
@@ -217,11 +217,11 @@
217217
<strong>Quick-posts:</strong><br/>
218218
<input type='button' value='HAI' onclick='TheApp.cgi.HAI()' />
219219
<input type='button' value='HAI JSONP' onclick='TheApp.cgi.sendCommand("/json/HAI",undefined,{jsonp:"myJsonPCallback"});' />
220220
221221
<input type='button' value='version' onclick='TheApp.cgi.sendCommand("/json/version")' />
222
-<input type='button' value='stat' onclick='TheApp.cgi.sendCommand("/json/stat")' />
222
+<input type='button' value='stat' onclick='TheApp.cgi.sendCommand("/json/stat?full=0")' />
223223
<input type='button' value='whoami' onclick='TheApp.cgi.sendCommand("/json/whoami")' />
224224
<input type='button' value='cap' onclick='TheApp.cgi.sendCommand("/json/cap")' />
225225
<input type='button' value='branch/list' onclick='TheApp.cgi.sendCommand("/json/branch/list")' />
226226
<input type='button' value='timeline/ci' onclick='TheApp.cgi.sendCommand("/json/timeline/ci?files=true")' />
227227
<input type='button' value='timeline/wiki' onclick='TheApp.cgi.sendCommand("/json/timeline/wiki")' />
228228
--- ajax/index.html
+++ ajax/index.html
@@ -155,11 +155,11 @@
155 ajcb.afterSend = function(req,opt) {
156 TheApp.timer.end();
157 TheApp.endAjaxNotif();
158 TheApp.jqe.timer.text( "(Round-trip time (incl. JS overhead): "+TheApp.timer.duration+'ms)' );
159 };
160 ajcb.onResponse = function(resp,req) {
161 var val;
162 if(this.jsonp) return /*was already handled*/;
163 try {
164 val = WhAjaj.stringify(resp);
165 }
@@ -167,11 +167,11 @@
167 val = WhAjaj.stringify(e)
168 }
169 //alert("onResponse this:"+WhAjaj.stringify(this));
170 //alert("val="+val);
171 // FIXME: this.url is hosed for login because of how i overload onResponse()
172 if( this.url ) TheApp.jqe.textPath.val(this.url.replace(WhAjaj.Connector.options.ajax.url,''));
173 TheApp.jqe.taResponse.val( val );
174 };
175 ajcb.onError = function(req,opt) {
176 TheApp.jqe.taResponse.val( "ERROR SENDING REQUEST:\n"+WhAjaj.stringify(opt) );
177 };
@@ -217,11 +217,11 @@
217 <strong>Quick-posts:</strong><br/>
218 <input type='button' value='HAI' onclick='TheApp.cgi.HAI()' />
219 <input type='button' value='HAI JSONP' onclick='TheApp.cgi.sendCommand("/json/HAI",undefined,{jsonp:"myJsonPCallback"});' />
220
221 <input type='button' value='version' onclick='TheApp.cgi.sendCommand("/json/version")' />
222 <input type='button' value='stat' onclick='TheApp.cgi.sendCommand("/json/stat")' />
223 <input type='button' value='whoami' onclick='TheApp.cgi.sendCommand("/json/whoami")' />
224 <input type='button' value='cap' onclick='TheApp.cgi.sendCommand("/json/cap")' />
225 <input type='button' value='branch/list' onclick='TheApp.cgi.sendCommand("/json/branch/list")' />
226 <input type='button' value='timeline/ci' onclick='TheApp.cgi.sendCommand("/json/timeline/ci?files=true")' />
227 <input type='button' value='timeline/wiki' onclick='TheApp.cgi.sendCommand("/json/timeline/wiki")' />
228
--- ajax/index.html
+++ ajax/index.html
@@ -155,11 +155,11 @@
155 ajcb.afterSend = function(req,opt) {
156 TheApp.timer.end();
157 TheApp.endAjaxNotif();
158 TheApp.jqe.timer.text( "(Round-trip time (incl. JS overhead): "+TheApp.timer.duration+'ms)' );
159 };
160 ajcb.onResponse = function(resp,req, opt) {
161 var val;
162 if(this.jsonp) return /*was already handled*/;
163 try {
164 val = WhAjaj.stringify(resp);
165 }
@@ -167,11 +167,11 @@
167 val = WhAjaj.stringify(e)
168 }
169 //alert("onResponse this:"+WhAjaj.stringify(this));
170 //alert("val="+val);
171 // FIXME: this.url is hosed for login because of how i overload onResponse()
172 if( opt.url ) TheApp.jqe.textPath.val(opt.url.replace(WhAjaj.Connector.options.ajax.url,''));
173 TheApp.jqe.taResponse.val( val );
174 };
175 ajcb.onError = function(req,opt) {
176 TheApp.jqe.taResponse.val( "ERROR SENDING REQUEST:\n"+WhAjaj.stringify(opt) );
177 };
@@ -217,11 +217,11 @@
217 <strong>Quick-posts:</strong><br/>
218 <input type='button' value='HAI' onclick='TheApp.cgi.HAI()' />
219 <input type='button' value='HAI JSONP' onclick='TheApp.cgi.sendCommand("/json/HAI",undefined,{jsonp:"myJsonPCallback"});' />
220
221 <input type='button' value='version' onclick='TheApp.cgi.sendCommand("/json/version")' />
222 <input type='button' value='stat' onclick='TheApp.cgi.sendCommand("/json/stat?full=0")' />
223 <input type='button' value='whoami' onclick='TheApp.cgi.sendCommand("/json/whoami")' />
224 <input type='button' value='cap' onclick='TheApp.cgi.sendCommand("/json/cap")' />
225 <input type='button' value='branch/list' onclick='TheApp.cgi.sendCommand("/json/branch/list")' />
226 <input type='button' value='timeline/ci' onclick='TheApp.cgi.sendCommand("/json/timeline/ci?files=true")' />
227 <input type='button' value='timeline/wiki' onclick='TheApp.cgi.sendCommand("/json/timeline/wiki")' />
228
--- ajax/js/whajaj.js
+++ ajax/js/whajaj.js
@@ -315,21 +315,25 @@
315315
If an AJAJ request receives JSON data from the back-end, that
316316
data is passed as a plain Object as the response parameter
317317
(exception: in jsonp mode it is passed a string). The initiating
318318
request object is passed as the second parameter, but clients
319319
can normally ignore it (only those which need a way to map
320
- specific requests to responses will need it).
320
+ specific requests to responses will need it). The 3rd parameter
321
+ is the same as the 'this' object for the context of the callback,
322
+ but is provided because the instance-level callbacks (set in
323
+ (WhAjaj.Connector instance).callbacks, require it in some
324
+ cases (because their 'this' is different!).
321325
322326
Note that the response might contain error information which
323327
comes from the back-end. The difference between this error info
324328
and the info passed to the onError() callback is that this data
325329
indicates an application-level error, whereas onError() is used
326330
to report connection-level problems or when the backend produces
327331
non-JSON data (which, when not in jsonp mode, is unexpected and
328332
is as fatal to the request as a connection error).
329333
*/
330
- onResponse: function(response, request){},
334
+ onResponse: function(response, request, opt){},
331335
332336
/**
333337
If an AJAX request fails to establish a connection or it
334338
receives non-JSON data from the back-end, this function
335339
is called (e.g. timeout error or host name not
@@ -570,11 +574,11 @@
570574
571575
- Calling opt.afterSend()
572576
573577
- If resp is a string, de-JSON-izing it to an object.
574578
575
- - Calling opt.onSuccess()
579
+ - Calling opt.onResponse()
576580
577581
- Calling opt.onError() in several common (potential) error
578582
cases.
579583
580584
- If resp is-a String and opt.jsonp then resp is assumed to be
@@ -625,14 +629,14 @@
625629
return;
626630
}
627631
}
628632
try {
629633
if( WhAjaj.isFunction( cb.onResponse ) ) {
630
- cb.onResponse( resp, request );
634
+ cb.onResponse( resp, request, opt );
631635
}
632636
if( WhAjaj.isFunction( opt.onResponse ) ) {
633
- opt.onResponse( resp, request );
637
+ opt.onResponse( resp, request, opt );
634638
}
635639
return true;
636640
}
637641
catch(e) {
638642
opt.errorMessage = "Exception while handling inbound JSON response:\n"
639643
--- ajax/js/whajaj.js
+++ ajax/js/whajaj.js
@@ -315,21 +315,25 @@
315 If an AJAJ request receives JSON data from the back-end, that
316 data is passed as a plain Object as the response parameter
317 (exception: in jsonp mode it is passed a string). The initiating
318 request object is passed as the second parameter, but clients
319 can normally ignore it (only those which need a way to map
320 specific requests to responses will need it).
 
 
 
 
321
322 Note that the response might contain error information which
323 comes from the back-end. The difference between this error info
324 and the info passed to the onError() callback is that this data
325 indicates an application-level error, whereas onError() is used
326 to report connection-level problems or when the backend produces
327 non-JSON data (which, when not in jsonp mode, is unexpected and
328 is as fatal to the request as a connection error).
329 */
330 onResponse: function(response, request){},
331
332 /**
333 If an AJAX request fails to establish a connection or it
334 receives non-JSON data from the back-end, this function
335 is called (e.g. timeout error or host name not
@@ -570,11 +574,11 @@
570
571 - Calling opt.afterSend()
572
573 - If resp is a string, de-JSON-izing it to an object.
574
575 - Calling opt.onSuccess()
576
577 - Calling opt.onError() in several common (potential) error
578 cases.
579
580 - If resp is-a String and opt.jsonp then resp is assumed to be
@@ -625,14 +629,14 @@
625 return;
626 }
627 }
628 try {
629 if( WhAjaj.isFunction( cb.onResponse ) ) {
630 cb.onResponse( resp, request );
631 }
632 if( WhAjaj.isFunction( opt.onResponse ) ) {
633 opt.onResponse( resp, request );
634 }
635 return true;
636 }
637 catch(e) {
638 opt.errorMessage = "Exception while handling inbound JSON response:\n"
639
--- ajax/js/whajaj.js
+++ ajax/js/whajaj.js
@@ -315,21 +315,25 @@
315 If an AJAJ request receives JSON data from the back-end, that
316 data is passed as a plain Object as the response parameter
317 (exception: in jsonp mode it is passed a string). The initiating
318 request object is passed as the second parameter, but clients
319 can normally ignore it (only those which need a way to map
320 specific requests to responses will need it). The 3rd parameter
321 is the same as the 'this' object for the context of the callback,
322 but is provided because the instance-level callbacks (set in
323 (WhAjaj.Connector instance).callbacks, require it in some
324 cases (because their 'this' is different!).
325
326 Note that the response might contain error information which
327 comes from the back-end. The difference between this error info
328 and the info passed to the onError() callback is that this data
329 indicates an application-level error, whereas onError() is used
330 to report connection-level problems or when the backend produces
331 non-JSON data (which, when not in jsonp mode, is unexpected and
332 is as fatal to the request as a connection error).
333 */
334 onResponse: function(response, request, opt){},
335
336 /**
337 If an AJAX request fails to establish a connection or it
338 receives non-JSON data from the back-end, this function
339 is called (e.g. timeout error or host name not
@@ -570,11 +574,11 @@
574
575 - Calling opt.afterSend()
576
577 - If resp is a string, de-JSON-izing it to an object.
578
579 - Calling opt.onResponse()
580
581 - Calling opt.onError() in several common (potential) error
582 cases.
583
584 - If resp is-a String and opt.jsonp then resp is assumed to be
@@ -625,14 +629,14 @@
629 return;
630 }
631 }
632 try {
633 if( WhAjaj.isFunction( cb.onResponse ) ) {
634 cb.onResponse( resp, request, opt );
635 }
636 if( WhAjaj.isFunction( opt.onResponse ) ) {
637 opt.onResponse( resp, request, opt );
638 }
639 return true;
640 }
641 catch(e) {
642 opt.errorMessage = "Exception while handling inbound JSON response:\n"
643

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button