Fossil SCM
fixed a url-updating problem caused by recent refactoring.
Commit
4b70853483fbecd79008e6027035a0cd5e4a8b7d
Parent
afb3c89fe6beee6…
2 files changed
+3
-3
+9
-5
+3
-3
| --- ajax/index.html | ||
| +++ ajax/index.html | ||
| @@ -155,11 +155,11 @@ | ||
| 155 | 155 | ajcb.afterSend = function(req,opt) { |
| 156 | 156 | TheApp.timer.end(); |
| 157 | 157 | TheApp.endAjaxNotif(); |
| 158 | 158 | TheApp.jqe.timer.text( "(Round-trip time (incl. JS overhead): "+TheApp.timer.duration+'ms)' ); |
| 159 | 159 | }; |
| 160 | - ajcb.onResponse = function(resp,req) { | |
| 160 | + ajcb.onResponse = function(resp,req, opt) { | |
| 161 | 161 | var val; |
| 162 | 162 | if(this.jsonp) return /*was already handled*/; |
| 163 | 163 | try { |
| 164 | 164 | val = WhAjaj.stringify(resp); |
| 165 | 165 | } |
| @@ -167,11 +167,11 @@ | ||
| 167 | 167 | val = WhAjaj.stringify(e) |
| 168 | 168 | } |
| 169 | 169 | //alert("onResponse this:"+WhAjaj.stringify(this)); |
| 170 | 170 | //alert("val="+val); |
| 171 | 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,'')); | |
| 172 | + if( opt.url ) TheApp.jqe.textPath.val(opt.url.replace(WhAjaj.Connector.options.ajax.url,'')); | |
| 173 | 173 | TheApp.jqe.taResponse.val( val ); |
| 174 | 174 | }; |
| 175 | 175 | ajcb.onError = function(req,opt) { |
| 176 | 176 | TheApp.jqe.taResponse.val( "ERROR SENDING REQUEST:\n"+WhAjaj.stringify(opt) ); |
| 177 | 177 | }; |
| @@ -217,11 +217,11 @@ | ||
| 217 | 217 | <strong>Quick-posts:</strong><br/> |
| 218 | 218 | <input type='button' value='HAI' onclick='TheApp.cgi.HAI()' /> |
| 219 | 219 | <input type='button' value='HAI JSONP' onclick='TheApp.cgi.sendCommand("/json/HAI",undefined,{jsonp:"myJsonPCallback"});' /> |
| 220 | 220 | |
| 221 | 221 | <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")' /> | |
| 223 | 223 | <input type='button' value='whoami' onclick='TheApp.cgi.sendCommand("/json/whoami")' /> |
| 224 | 224 | <input type='button' value='cap' onclick='TheApp.cgi.sendCommand("/json/cap")' /> |
| 225 | 225 | <input type='button' value='branch/list' onclick='TheApp.cgi.sendCommand("/json/branch/list")' /> |
| 226 | 226 | <input type='button' value='timeline/ci' onclick='TheApp.cgi.sendCommand("/json/timeline/ci?files=true")' /> |
| 227 | 227 | <input type='button' value='timeline/wiki' onclick='TheApp.cgi.sendCommand("/json/timeline/wiki")' /> |
| 228 | 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) { |
| 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 |
+9
-5
| --- ajax/js/whajaj.js | ||
| +++ ajax/js/whajaj.js | ||
| @@ -315,21 +315,25 @@ | ||
| 315 | 315 | If an AJAJ request receives JSON data from the back-end, that |
| 316 | 316 | data is passed as a plain Object as the response parameter |
| 317 | 317 | (exception: in jsonp mode it is passed a string). The initiating |
| 318 | 318 | request object is passed as the second parameter, but clients |
| 319 | 319 | 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!). | |
| 321 | 325 | |
| 322 | 326 | Note that the response might contain error information which |
| 323 | 327 | comes from the back-end. The difference between this error info |
| 324 | 328 | and the info passed to the onError() callback is that this data |
| 325 | 329 | indicates an application-level error, whereas onError() is used |
| 326 | 330 | to report connection-level problems or when the backend produces |
| 327 | 331 | non-JSON data (which, when not in jsonp mode, is unexpected and |
| 328 | 332 | is as fatal to the request as a connection error). |
| 329 | 333 | */ |
| 330 | - onResponse: function(response, request){}, | |
| 334 | + onResponse: function(response, request, opt){}, | |
| 331 | 335 | |
| 332 | 336 | /** |
| 333 | 337 | If an AJAX request fails to establish a connection or it |
| 334 | 338 | receives non-JSON data from the back-end, this function |
| 335 | 339 | is called (e.g. timeout error or host name not |
| @@ -570,11 +574,11 @@ | ||
| 570 | 574 | |
| 571 | 575 | - Calling opt.afterSend() |
| 572 | 576 | |
| 573 | 577 | - If resp is a string, de-JSON-izing it to an object. |
| 574 | 578 | |
| 575 | - - Calling opt.onSuccess() | |
| 579 | + - Calling opt.onResponse() | |
| 576 | 580 | |
| 577 | 581 | - Calling opt.onError() in several common (potential) error |
| 578 | 582 | cases. |
| 579 | 583 | |
| 580 | 584 | - If resp is-a String and opt.jsonp then resp is assumed to be |
| @@ -625,14 +629,14 @@ | ||
| 625 | 629 | return; |
| 626 | 630 | } |
| 627 | 631 | } |
| 628 | 632 | try { |
| 629 | 633 | if( WhAjaj.isFunction( cb.onResponse ) ) { |
| 630 | - cb.onResponse( resp, request ); | |
| 634 | + cb.onResponse( resp, request, opt ); | |
| 631 | 635 | } |
| 632 | 636 | if( WhAjaj.isFunction( opt.onResponse ) ) { |
| 633 | - opt.onResponse( resp, request ); | |
| 637 | + opt.onResponse( resp, request, opt ); | |
| 634 | 638 | } |
| 635 | 639 | return true; |
| 636 | 640 | } |
| 637 | 641 | catch(e) { |
| 638 | 642 | opt.errorMessage = "Exception while handling inbound JSON response:\n" |
| 639 | 643 |
| --- 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 |