Fossil SCM

eliminate some end-of-line spaces

jan.nijtmans 2016-08-23 12:13 trunk
Commit d32155d0642988c4ec14e5e4cdda8c5e89a8d1c0
--- ajax/js/fossil-ajaj.js
+++ ajax/js/fossil-ajaj.js
@@ -7,16 +7,16 @@
77
*/
88
99
/**
1010
Constructor for a new Fossil AJAJ client. ajajOpt may be an optional
1111
object suitable for passing to the WhAjaj.Connector() constructor.
12
-
13
- On returning, this.ajaj is-a WhAjaj.Connector instance which can
14
- be used to send requests to the back-end (though the convenience
15
- functions of this class are the preferred way to do it). Clients
16
- are encouraged to use FossilAjaj.sendCommand() (and friends) instead
17
- of the underlying WhAjaj.Connector API, since this class' API
12
+
13
+ On returning, this.ajaj is-a WhAjaj.Connector instance which can
14
+ be used to send requests to the back-end (though the convenience
15
+ functions of this class are the preferred way to do it). Clients
16
+ are encouraged to use FossilAjaj.sendCommand() (and friends) instead
17
+ of the underlying WhAjaj.Connector API, since this class' API
1818
contains Fossil-specific request-calling handling (e.g. of authentication
1919
info) whereas WhAjaj is more generic.
2020
*/
2121
function FossilAjaj(ajajOpt)
2222
{
@@ -38,11 +38,11 @@
3838
/**
3939
Sends a command to the fossil back-end. Command should be the
4040
path part of the URL, e.g. /json/stat, payload is a request-specific
4141
value type (may often be null/undefined). ajajOpt is an optional object
4242
holding WhAjaj.sendRequest()-compatible options.
43
-
43
+
4444
This function constructs a Fossil/JSON request envelope based
4545
on the given arguments and adds this.auth.authToken and a requestId
4646
to it.
4747
*/
4848
FossilAjaj.prototype.sendCommand = function(command, payload, ajajOpt) {
@@ -63,24 +63,24 @@
6363
};
6464
6565
/**
6666
Sends a login request to the back-end.
6767
68
- ajajOpt is an optional configuration object suitable for passing
68
+ ajajOpt is an optional configuration object suitable for passing
6969
to sendCommand().
7070
7171
After the response returns, this.auth will be
7272
set to the response payload.
73
-
73
+
7474
If name === 'anonymous' (the default if none is passed in) then this
7575
function ignores the pw argument and must make two requests - the first
7676
one gets the captcha code and the second one submits it.
7777
ajajOpt.onResponse() (if set) is only called for the actual login
7878
response (the 2nd one), as opposed to being called for both requests.
7979
However, this.ajaj.callbacks.onResponse() _is_ called for both (because
8080
it happens at a lower level).
81
-
81
+
8282
If this object has an onLogin() function it is called (with
8383
no arguments) before the onResponse() handler of the login is called
8484
(that is the 2nd request for anonymous logins) and any exceptions
8585
it throws are ignored.
8686
@@ -135,13 +135,13 @@
135135
};
136136
137137
/**
138138
Logs out of fossil, invaliding this login token.
139139
140
- ajajOpt is an optional configuration object suitable for passing
140
+ ajajOpt is an optional configuration object suitable for passing
141141
to sendCommand().
142
-
142
+
143143
If this object has an onLogout() function it is called (with
144144
no arguments) before the onResponse() handler is called.
145145
IFF the response succeeds then this.auth is unset.
146146
*/
147147
FossilAjaj.prototype.logout = function(ajajOpt) {
@@ -163,11 +163,11 @@
163163
};
164164
165165
/**
166166
Sends a HAI request to the server. /json/HAI is an alias /json/version.
167167
168
- ajajOpt is an optional configuration object suitable for passing
168
+ ajajOpt is an optional configuration object suitable for passing
169169
to sendCommand().
170170
*/
171171
FossilAjaj.prototype.HAI = function(ajajOpt) {
172172
this.sendCommand('/json/HAI', undefined, ajajOpt);
173173
};
@@ -226,11 +226,11 @@
226226
227227
The interface is otherwise compatible with the "normal"
228228
FossilAjaj.sendCommand() front-end (it is, however, fossil-specific, and
229229
not back-end agnostic like the WhAjaj.sendImpl() interface intends).
230230
231
-
231
+
232232
*/
233233
FossilAjaj.rhinoLocalBinarySendImpl = function(request,args){
234234
var self = this;
235235
request = request || {};
236236
if(!args.fossilBinary){
@@ -240,19 +240,19 @@
240240
if(url.length>1){
241241
// 3x shift(): protocol, host, 'json' part of path
242242
request.command = (url.shift(),url.shift(),url.shift(), url.join('/'));
243243
}
244244
delete args.url;
245
- //print("rhinoLocalBinarySendImpl SENDING: "+WhAjaj.stringify(request));
245
+ //print("rhinoLocalBinarySendImpl SENDING: "+WhAjaj.stringify(request));
246246
var json;
247247
try{
248248
var pargs = [args.fossilBinary, 'json', '--json-input', '-'];
249249
var p = java.lang.Runtime.getRuntime().exec(pargs);
250250
var outs = p.getOutputStream();
251251
var osr = new java.io.OutputStreamWriter(outs);
252252
var osb = new java.io.BufferedWriter(osr);
253
-
253
+
254254
json = JSON.stringify(request);
255255
osb.write(json,0, json.length);
256256
osb.close();
257257
var ins = p.getInputStream();
258258
var isr = new java.io.InputStreamReader(ins);
259259
--- ajax/js/fossil-ajaj.js
+++ ajax/js/fossil-ajaj.js
@@ -7,16 +7,16 @@
7 */
8
9 /**
10 Constructor for a new Fossil AJAJ client. ajajOpt may be an optional
11 object suitable for passing to the WhAjaj.Connector() constructor.
12
13 On returning, this.ajaj is-a WhAjaj.Connector instance which can
14 be used to send requests to the back-end (though the convenience
15 functions of this class are the preferred way to do it). Clients
16 are encouraged to use FossilAjaj.sendCommand() (and friends) instead
17 of the underlying WhAjaj.Connector API, since this class' API
18 contains Fossil-specific request-calling handling (e.g. of authentication
19 info) whereas WhAjaj is more generic.
20 */
21 function FossilAjaj(ajajOpt)
22 {
@@ -38,11 +38,11 @@
38 /**
39 Sends a command to the fossil back-end. Command should be the
40 path part of the URL, e.g. /json/stat, payload is a request-specific
41 value type (may often be null/undefined). ajajOpt is an optional object
42 holding WhAjaj.sendRequest()-compatible options.
43
44 This function constructs a Fossil/JSON request envelope based
45 on the given arguments and adds this.auth.authToken and a requestId
46 to it.
47 */
48 FossilAjaj.prototype.sendCommand = function(command, payload, ajajOpt) {
@@ -63,24 +63,24 @@
63 };
64
65 /**
66 Sends a login request to the back-end.
67
68 ajajOpt is an optional configuration object suitable for passing
69 to sendCommand().
70
71 After the response returns, this.auth will be
72 set to the response payload.
73
74 If name === 'anonymous' (the default if none is passed in) then this
75 function ignores the pw argument and must make two requests - the first
76 one gets the captcha code and the second one submits it.
77 ajajOpt.onResponse() (if set) is only called for the actual login
78 response (the 2nd one), as opposed to being called for both requests.
79 However, this.ajaj.callbacks.onResponse() _is_ called for both (because
80 it happens at a lower level).
81
82 If this object has an onLogin() function it is called (with
83 no arguments) before the onResponse() handler of the login is called
84 (that is the 2nd request for anonymous logins) and any exceptions
85 it throws are ignored.
86
@@ -135,13 +135,13 @@
135 };
136
137 /**
138 Logs out of fossil, invaliding this login token.
139
140 ajajOpt is an optional configuration object suitable for passing
141 to sendCommand().
142
143 If this object has an onLogout() function it is called (with
144 no arguments) before the onResponse() handler is called.
145 IFF the response succeeds then this.auth is unset.
146 */
147 FossilAjaj.prototype.logout = function(ajajOpt) {
@@ -163,11 +163,11 @@
163 };
164
165 /**
166 Sends a HAI request to the server. /json/HAI is an alias /json/version.
167
168 ajajOpt is an optional configuration object suitable for passing
169 to sendCommand().
170 */
171 FossilAjaj.prototype.HAI = function(ajajOpt) {
172 this.sendCommand('/json/HAI', undefined, ajajOpt);
173 };
@@ -226,11 +226,11 @@
226
227 The interface is otherwise compatible with the "normal"
228 FossilAjaj.sendCommand() front-end (it is, however, fossil-specific, and
229 not back-end agnostic like the WhAjaj.sendImpl() interface intends).
230
231
232 */
233 FossilAjaj.rhinoLocalBinarySendImpl = function(request,args){
234 var self = this;
235 request = request || {};
236 if(!args.fossilBinary){
@@ -240,19 +240,19 @@
240 if(url.length>1){
241 // 3x shift(): protocol, host, 'json' part of path
242 request.command = (url.shift(),url.shift(),url.shift(), url.join('/'));
243 }
244 delete args.url;
245 //print("rhinoLocalBinarySendImpl SENDING: "+WhAjaj.stringify(request));
246 var json;
247 try{
248 var pargs = [args.fossilBinary, 'json', '--json-input', '-'];
249 var p = java.lang.Runtime.getRuntime().exec(pargs);
250 var outs = p.getOutputStream();
251 var osr = new java.io.OutputStreamWriter(outs);
252 var osb = new java.io.BufferedWriter(osr);
253
254 json = JSON.stringify(request);
255 osb.write(json,0, json.length);
256 osb.close();
257 var ins = p.getInputStream();
258 var isr = new java.io.InputStreamReader(ins);
259
--- ajax/js/fossil-ajaj.js
+++ ajax/js/fossil-ajaj.js
@@ -7,16 +7,16 @@
7 */
8
9 /**
10 Constructor for a new Fossil AJAJ client. ajajOpt may be an optional
11 object suitable for passing to the WhAjaj.Connector() constructor.
12
13 On returning, this.ajaj is-a WhAjaj.Connector instance which can
14 be used to send requests to the back-end (though the convenience
15 functions of this class are the preferred way to do it). Clients
16 are encouraged to use FossilAjaj.sendCommand() (and friends) instead
17 of the underlying WhAjaj.Connector API, since this class' API
18 contains Fossil-specific request-calling handling (e.g. of authentication
19 info) whereas WhAjaj is more generic.
20 */
21 function FossilAjaj(ajajOpt)
22 {
@@ -38,11 +38,11 @@
38 /**
39 Sends a command to the fossil back-end. Command should be the
40 path part of the URL, e.g. /json/stat, payload is a request-specific
41 value type (may often be null/undefined). ajajOpt is an optional object
42 holding WhAjaj.sendRequest()-compatible options.
43
44 This function constructs a Fossil/JSON request envelope based
45 on the given arguments and adds this.auth.authToken and a requestId
46 to it.
47 */
48 FossilAjaj.prototype.sendCommand = function(command, payload, ajajOpt) {
@@ -63,24 +63,24 @@
63 };
64
65 /**
66 Sends a login request to the back-end.
67
68 ajajOpt is an optional configuration object suitable for passing
69 to sendCommand().
70
71 After the response returns, this.auth will be
72 set to the response payload.
73
74 If name === 'anonymous' (the default if none is passed in) then this
75 function ignores the pw argument and must make two requests - the first
76 one gets the captcha code and the second one submits it.
77 ajajOpt.onResponse() (if set) is only called for the actual login
78 response (the 2nd one), as opposed to being called for both requests.
79 However, this.ajaj.callbacks.onResponse() _is_ called for both (because
80 it happens at a lower level).
81
82 If this object has an onLogin() function it is called (with
83 no arguments) before the onResponse() handler of the login is called
84 (that is the 2nd request for anonymous logins) and any exceptions
85 it throws are ignored.
86
@@ -135,13 +135,13 @@
135 };
136
137 /**
138 Logs out of fossil, invaliding this login token.
139
140 ajajOpt is an optional configuration object suitable for passing
141 to sendCommand().
142
143 If this object has an onLogout() function it is called (with
144 no arguments) before the onResponse() handler is called.
145 IFF the response succeeds then this.auth is unset.
146 */
147 FossilAjaj.prototype.logout = function(ajajOpt) {
@@ -163,11 +163,11 @@
163 };
164
165 /**
166 Sends a HAI request to the server. /json/HAI is an alias /json/version.
167
168 ajajOpt is an optional configuration object suitable for passing
169 to sendCommand().
170 */
171 FossilAjaj.prototype.HAI = function(ajajOpt) {
172 this.sendCommand('/json/HAI', undefined, ajajOpt);
173 };
@@ -226,11 +226,11 @@
226
227 The interface is otherwise compatible with the "normal"
228 FossilAjaj.sendCommand() front-end (it is, however, fossil-specific, and
229 not back-end agnostic like the WhAjaj.sendImpl() interface intends).
230
231
232 */
233 FossilAjaj.rhinoLocalBinarySendImpl = function(request,args){
234 var self = this;
235 request = request || {};
236 if(!args.fossilBinary){
@@ -240,19 +240,19 @@
240 if(url.length>1){
241 // 3x shift(): protocol, host, 'json' part of path
242 request.command = (url.shift(),url.shift(),url.shift(), url.join('/'));
243 }
244 delete args.url;
245 //print("rhinoLocalBinarySendImpl SENDING: "+WhAjaj.stringify(request));
246 var json;
247 try{
248 var pargs = [args.fossilBinary, 'json', '--json-input', '-'];
249 var p = java.lang.Runtime.getRuntime().exec(pargs);
250 var outs = p.getOutputStream();
251 var osr = new java.io.OutputStreamWriter(outs);
252 var osb = new java.io.BufferedWriter(osr);
253
254 json = JSON.stringify(request);
255 osb.write(json,0, json.length);
256 osb.close();
257 var ins = p.getInputStream();
258 var isr = new java.io.InputStreamReader(ins);
259
+246 -246
--- ajax/js/whajaj.js
+++ ajax/js/whajaj.js
@@ -10,22 +10,22 @@
1010
acts as namespace for this framework.
1111
1212
Author: Stephan Beal (http://wanderinghorse.net/home/stephan/)
1313
1414
License: Public Domain
15
-
16
- This framework is directly derived from code originally found in
17
- http://code.google.com/p/jsonmessage, and later in
18
- http://whiki.wanderinghorse.net, where it contained quite a bit
19
- of application-specific logic. It was eventually (the 3rd time i
20
- needed it) split off into its own library to simplify inclusion
15
+
16
+ This framework is directly derived from code originally found in
17
+ http://code.google.com/p/jsonmessage, and later in
18
+ http://whiki.wanderinghorse.net, where it contained quite a bit
19
+ of application-specific logic. It was eventually (the 3rd time i
20
+ needed it) split off into its own library to simplify inclusion
2121
into my many mini-projects.
2222
*/
2323
2424
2525
/**
26
- The WhAjaj function is primarily a namespace, and not intended
26
+ The WhAjaj function is primarily a namespace, and not intended
2727
to called or instantiated via the 'new' operator.
2828
*/
2929
function WhAjaj()
3030
{
3131
}
@@ -36,11 +36,11 @@
3636
return (new Date()).getTime();
3737
};
3838
3939
/** Returns a Unix Epoch timestamp (in seconds) in integer format.
4040
41
- Reminder to self: (1.1 %1.2) evaluates to a floating-point value
41
+ Reminder to self: (1.1 %1.2) evaluates to a floating-point value
4242
in JS, and thus this implementation is less than optimal.
4343
*/
4444
WhAjaj.unixTimestamp = function()
4545
{
4646
var ts = (new Date()).getTime();
@@ -88,22 +88,22 @@
8888
};
8989
9090
/**
9191
Parses window.location.search-style string into an object
9292
containing key/value pairs of URL arguments (already urldecoded).
93
-
94
- If the str argument is not passed (arguments.length==0) then
95
- window.location.search.substring(1) is used by default. If
93
+
94
+ If the str argument is not passed (arguments.length==0) then
95
+ window.location.search.substring(1) is used by default. If
9696
neither str is passed in nor window exists then false is returned.
9797
9898
On success it returns an Object containing the key/value pairs
9999
parsed from the string. Keys which have no value are treated
100100
has having the boolean true value.
101
-
101
+
102102
FIXME: for keys in the form "name[]", build an array of results,
103103
like PHP does.
104
-
104
+
105105
*/
106106
WhAjaj.processUrlArgs = function(str) {
107107
if( 0 === arguments.length ) {
108108
if( ('undefined' === typeof window) ||
109109
!window.location ||
@@ -127,11 +127,11 @@
127127
/**
128128
A simple wrapper around JSON.stringify(), using my own personal
129129
preferred values for the 2nd and 3rd parameters. To globally
130130
set its indentation level, assign WhAjaj.stringify.indent to
131131
an integer value (0 for no intendation).
132
-
132
+
133133
This function is intended only for human-readable output, not
134134
generic over-the-wire JSON output (where JSON.stringify(val) will
135135
produce smaller results).
136136
*/
137137
WhAjaj.stringify = function(val) {
@@ -138,34 +138,34 @@
138138
if( ! arguments.callee.indent ) arguments.callee.indent = 4;
139139
return JSON.stringify(val,0,arguments.callee.indent);
140140
};
141141
142142
/**
143
- Each instance of this class holds state information for making
144
- AJAJ requests to a back-end system. While clients may use one
143
+ Each instance of this class holds state information for making
144
+ AJAJ requests to a back-end system. While clients may use one
145145
"requester" object per connection attempt, for connections to the
146
- same back-end, using an instance configured for that back-end
147
- can simplify usage. This class is designed so that the actual
148
- connection-related details (i.e. _how_ it connects to the
149
- back-end) may be re-implemented to use a client's preferred
146
+ same back-end, using an instance configured for that back-end
147
+ can simplify usage. This class is designed so that the actual
148
+ connection-related details (i.e. _how_ it connects to the
149
+ back-end) may be re-implemented to use a client's preferred
150150
connection mechanism (e.g. jQuery).
151
-
152
- The optional opt paramater may be an object with any (or all) of
153
- the properties documented for WhAjaj.Connector.options.ajax.
154
- Properties set here (or later via modification of the "options"
155
- property of this object) will be used in calls to
151
+
152
+ The optional opt paramater may be an object with any (or all) of
153
+ the properties documented for WhAjaj.Connector.options.ajax.
154
+ Properties set here (or later via modification of the "options"
155
+ property of this object) will be used in calls to
156156
WhAjaj.Connector.sendRequest(), and these override (normally) any
157
- options set in WhAjaj.Connector.options.ajax. Note that
158
- WhAjaj.Connector.sendRequest() _also_ takes an options object,
159
- and ones passed there will override, for purposes of that one
160
- request, any options passed in here or defined in
157
+ options set in WhAjaj.Connector.options.ajax. Note that
158
+ WhAjaj.Connector.sendRequest() _also_ takes an options object,
159
+ and ones passed there will override, for purposes of that one
160
+ request, any options passed in here or defined in
161161
WhAjaj.Connector.options.ajax. See WhAjaj.Connector.options.ajax
162162
and WhAjaj.Connector.prototype.sendRequest() for more details
163163
about the precedence of options.
164
-
164
+
165165
Sample usage:
166
-
166
+
167167
@code
168168
// Set up common connection-level options:
169169
var cgi = new WhAjaj.Connector({
170170
url: '/cgi-bin/my.cgi',
171171
timeout:10000,
@@ -185,25 +185,25 @@
185185
@endcode
186186
187187
For common request types, clients can add functions to this
188188
object which act as wrappers for backend-specific functionality. As
189189
a simple example:
190
-
190
+
191191
@code
192192
cgi.login = function(name,pw,ajajOpt) {
193193
this.sendRequest(
194194
{command:"json/login",
195195
name:name,
196196
password:pw
197197
}, ajajOpt );
198198
};
199199
@endcode
200
-
200
+
201201
TODOs:
202
-
202
+
203203
- Caching of page-load requests, with a configurable lifetime.
204
-
204
+
205205
- Use-cases like the above login() function are a tiny bit
206206
problematic to implement when each request has a different URL
207207
path (i know this from the whiki and fossil implementations).
208208
This is partly a side-effect of design descisions made back in
209209
the very first days of this code's life. i need to go through
@@ -230,42 +230,42 @@
230230
A (meaningless) prefix to apply to WhAjaj.Connector-generated
231231
request IDs.
232232
*/
233233
requestIdPrefix:'WhAjaj.Connector-',
234234
/**
235
- Default options for WhAjaj.Connector.sendRequest() connection
236
- parameters. This object holds only connection-related
237
- options and callbacks (all optional), and not options
238
- related to the required JSON structure of any given request.
239
- i.e. the page name used in a get-page request are not set
235
+ Default options for WhAjaj.Connector.sendRequest() connection
236
+ parameters. This object holds only connection-related
237
+ options and callbacks (all optional), and not options
238
+ related to the required JSON structure of any given request.
239
+ i.e. the page name used in a get-page request are not set
240240
here but are specified as part of the request object.
241241
242
- These connection options are a "normalized form" of options
243
- often found in various AJAX libraries like jQuery,
244
- Prototype, dojo, etc. This approach allows us to swap out
245
- the real connection-related parts by writing a simple proxy
246
- which transforms our "normalized" form to the
247
- backend-specific form. For examples, see the various
242
+ These connection options are a "normalized form" of options
243
+ often found in various AJAX libraries like jQuery,
244
+ Prototype, dojo, etc. This approach allows us to swap out
245
+ the real connection-related parts by writing a simple proxy
246
+ which transforms our "normalized" form to the
247
+ backend-specific form. For examples, see the various
248248
implementations stored in WhAjaj.Connector.sendImpls.
249249
250
- The following callback options are, in practice, almost
250
+ The following callback options are, in practice, almost
251251
always set globally to some app-wide defaults:
252252
253253
- onError() to report errors using a common mechanism.
254254
- beforeSend() to start a visual activity notification
255255
- afterSend() to disable the visual activity notification
256256
257
- However, be aware that if any given WhAjaj.Connector instance is
258
- given its own before/afterSend callback then those will
257
+ However, be aware that if any given WhAjaj.Connector instance is
258
+ given its own before/afterSend callback then those will
259259
override these. Mixing shared/global and per-instance
260260
callbacks can potentially lead to confusing results if, e.g.,
261261
the beforeSend() and afterSend() functions have side-effects
262262
but are not used with their proper before/after partner.
263
-
264
- TODO: rename this to 'ajaj' (the name is historical). The
265
- problem with renaming it is is that the word 'ajax' is
266
- pretty prevelant in the source tree, so i can't globally
263
+
264
+ TODO: rename this to 'ajaj' (the name is historical). The
265
+ problem with renaming it is is that the word 'ajax' is
266
+ pretty prevelant in the source tree, so i can't globally
267267
swap it out.
268268
*/
269269
ajax: {
270270
/**
271271
URL of the back-end server/CGI.
@@ -273,48 +273,48 @@
273273
url: '/some/path',
274274
275275
/**
276276
Connection method. Some connection-related functions might
277277
override any client-defined setting.
278
-
279
- Must be one of 'GET' or 'POST'. For custom connection
280
- implementation, it may optionally be some
278
+
279
+ Must be one of 'GET' or 'POST'. For custom connection
280
+ implementation, it may optionally be some
281281
implementation-specified value.
282282
283283
Normally the API can derive this value automatically - if the
284284
request uses JSON data it is POSTed, else it is GETted.
285285
*/
286286
method:'GET',
287287
288288
/**
289
- A hint whether to run the operation asynchronously or
290
- not. Not all concrete WhAjaj.Connector.sendImpl()
291
- implementations can support this. Interestingly, at
292
- least one popular AJAX toolkit does not document
293
- supporting _synchronous_ AJAX operations. All common
294
- browser-side implementations support async operation, but
289
+ A hint whether to run the operation asynchronously or
290
+ not. Not all concrete WhAjaj.Connector.sendImpl()
291
+ implementations can support this. Interestingly, at
292
+ least one popular AJAX toolkit does not document
293
+ supporting _synchronous_ AJAX operations. All common
294
+ browser-side implementations support async operation, but
295295
non-browser implementations might not.
296296
*/
297297
asynchronous:true,
298298
299299
/**
300
- A HTTP authentication login name for the AJAX
301
- connection. Not all concrete WhAjaj.Connector.sendImpl()
300
+ A HTTP authentication login name for the AJAX
301
+ connection. Not all concrete WhAjaj.Connector.sendImpl()
302302
implementations can support this.
303303
*/
304304
loginName:undefined,
305305
306306
/**
307
- An HTTP authentication login password for the AJAJ
308
- connection. Not all concrete WhAjaj.Connector.sendImpl()
307
+ An HTTP authentication login password for the AJAJ
308
+ connection. Not all concrete WhAjaj.Connector.sendImpl()
309309
implementations can support this.
310310
*/
311311
loginPassword:undefined,
312312
313313
/**
314
- A connection timeout, in milliseconds, for establishing
315
- an AJAJ connection. Not all concrete
314
+ A connection timeout, in milliseconds, for establishing
315
+ an AJAJ connection. Not all concrete
316316
WhAjaj.Connector.sendImpl() implementations can support this.
317317
*/
318318
timeout:10000,
319319
320320
/**
@@ -328,11 +328,11 @@
328328
is the same as the 'this' object for the context of the
329329
callback, but is provided because the instance-level
330330
callbacks (set in (WhAjaj.Connector instance).callbacks,
331331
require it in some cases (because their 'this' is
332332
different!).
333
-
333
+
334334
Note that the response might contain error information
335335
which comes from the back-end. The difference between
336336
this error info and the info passed to the onError()
337337
callback is that this data indicates an
338338
application-level error, whereas onError() is used to
@@ -342,21 +342,21 @@
342342
connection error).
343343
*/
344344
onResponse: function(response, request, opt){},
345345
346346
/**
347
- If an AJAX request fails to establish a connection or it
348
- receives non-JSON data from the back-end, this function
349
- is called (e.g. timeout error or host name not
347
+ If an AJAX request fails to establish a connection or it
348
+ receives non-JSON data from the back-end, this function
349
+ is called (e.g. timeout error or host name not
350350
resolvable). It is passed the originating request and the
351
- "normalized" connection parameters used for that
352
- request. The connectOpt object "should" (or "might")
353
- have an "errorMessage" property which describes the
351
+ "normalized" connection parameters used for that
352
+ request. The connectOpt object "should" (or "might")
353
+ have an "errorMessage" property which describes the
354354
nature of the problem.
355
-
356
- Clients will almost always want to replace the default
357
- implementation with something which integrates into
355
+
356
+ Clients will almost always want to replace the default
357
+ implementation with something which integrates into
358358
their application.
359359
*/
360360
onError: function(request, connectOpt)
361361
{
362362
alert('AJAJ request failed:\n'
@@ -364,60 +364,60 @@
364364
+JSON.stringify(connectOpt,0,4)
365365
);
366366
},
367367
368368
/**
369
- Called before each connection attempt is made. Clients
369
+ Called before each connection attempt is made. Clients
370370
can use this to, e.g., enable a visual "network activity
371
- notification" for the user. It is passed the original
372
- request object and the normalized connection parameters
373
- for the request. If this function changes opt, those
374
- changes _are_ applied to the subsequent request. If this
375
- function throws, neither the onError() nor afterSend()
376
- callbacks are triggered and WhAjaj.Connector.sendImpl()
371
+ notification" for the user. It is passed the original
372
+ request object and the normalized connection parameters
373
+ for the request. If this function changes opt, those
374
+ changes _are_ applied to the subsequent request. If this
375
+ function throws, neither the onError() nor afterSend()
376
+ callbacks are triggered and WhAjaj.Connector.sendImpl()
377377
propagates the exception back to the caller.
378378
*/
379379
beforeSend: function(request,opt){},
380380
381381
/**
382
- Called after an AJAJ connection attempt completes,
383
- regardless of success or failure. Passed the same
384
- parameters as beforeSend() (see that function for
382
+ Called after an AJAJ connection attempt completes,
383
+ regardless of success or failure. Passed the same
384
+ parameters as beforeSend() (see that function for
385385
details).
386
-
387
- Here's an example of setting up a visual notification on
388
- ajax operations using jQuery (but it's also easy to do
386
+
387
+ Here's an example of setting up a visual notification on
388
+ ajax operations using jQuery (but it's also easy to do
389389
without jQuery as well):
390
-
390
+
391391
@code
392392
function startAjaxNotif(req,opt) {
393393
var me = arguments.callee;
394394
var c = ++me.ajaxCount;
395395
me.element.text( c + " pending AJAX operation(s)..." );
396396
if( 1 == c ) me.element.stop().fadeIn();
397397
}
398398
startAjaxNotif.ajaxCount = 0.
399399
startAjaxNotif.element = jQuery('#whikiAjaxNotification');
400
-
400
+
401401
function endAjaxNotif() {
402402
var c = --startAjaxNotif.ajaxCount;
403403
startAjaxNotif.element.text( c+" pending AJAX operation(s)..." );
404404
if( 0 == c ) startAjaxNotif.element.stop().fadeOut();
405405
}
406406
@endcode
407407
408
- Set the beforeSend/afterSend properties to those
409
- functions to enable the notifications by default.
408
+ Set the beforeSend/afterSend properties to those
409
+ functions to enable the notifications by default.
410410
*/
411411
afterSend: function(request,opt){},
412412
413413
/**
414414
If jsonp is a string then the WhAjaj-internal response
415415
handling code ASSUMES that the response contains a JSONP-style
416416
construct and eval()s it after afterSend() but before onResponse().
417417
In this case, onResponse() will get a string value for the response
418
- instead of a response object parsed from JSON.
418
+ instead of a response object parsed from JSON.
419419
*/
420420
jsonp:undefined,
421421
/**
422422
Don't use yet. Planned future option.
423423
*/
@@ -468,25 +468,25 @@
468468
else v = WhAjaj.Connector.options.ajax[key];
469469
return v;
470470
};
471471
472472
/**
473
- Returns a unique string on each call containing a generic
474
- reandom request identifier string. This is not used by the core
475
- API but can be used by client code to generate unique IDs for
473
+ Returns a unique string on each call containing a generic
474
+ reandom request identifier string. This is not used by the core
475
+ API but can be used by client code to generate unique IDs for
476476
each request (if needed).
477477
478478
The exact format is unspecified and may change in the future.
479479
480
- Request IDs can be used by clients to "match up" responses to
481
- specific requests if needed. In practice, however, they are
482
- seldom, if ever, needed. When passing several concurrent
483
- requests through the same response callback, it might be useful
484
- for some clients to be able to distinguish, possibly re-routing
480
+ Request IDs can be used by clients to "match up" responses to
481
+ specific requests if needed. In practice, however, they are
482
+ seldom, if ever, needed. When passing several concurrent
483
+ requests through the same response callback, it might be useful
484
+ for some clients to be able to distinguish, possibly re-routing
485485
them through other handlers based on the originating request type.
486
-
487
- If this.options.requestIdPrefix or
486
+
487
+ If this.options.requestIdPrefix or
488488
WhAjaj.Connector.options.requestIdPrefix is set then that text
489489
is prefixed to the returned string.
490490
*/
491491
WhAjaj.Connector.prototype.generateRequestId = function()
492492
{
@@ -512,39 +512,39 @@
512512
}
513513
return this.options;
514514
};
515515
516516
/**
517
- An internal helper object which holds several functions intended
518
- to simplify the creation of concrete communication channel
517
+ An internal helper object which holds several functions intended
518
+ to simplify the creation of concrete communication channel
519519
implementations for WhAjaj.Connector.sendImpl(). These operations
520520
take care of some of the more error-prone parts of ensuring that
521
- onResponse(), onError(), etc. callbacks are called consistently
521
+ onResponse(), onError(), etc. callbacks are called consistently
522522
using the same rules.
523523
*/
524524
WhAjaj.Connector.sendHelper = {
525525
/**
526
- opt is assumed to be a normalized set of
527
- WhAjaj.Connector.sendRequest() options. This function
528
- creates a url by concatenating opt.url and some form of
526
+ opt is assumed to be a normalized set of
527
+ WhAjaj.Connector.sendRequest() options. This function
528
+ creates a url by concatenating opt.url and some form of
529529
opt.urlParam.
530
-
531
- If opt.urlParam is an object or string then it is appended
532
- to the url. An object is assumed to be a one-dimensional set
533
- of simple (urlencodable) key/value pairs, and not larger
534
- data structures. A string value is assumed to be a
535
- well-formed, urlencoded set of key/value pairs separated by
530
+
531
+ If opt.urlParam is an object or string then it is appended
532
+ to the url. An object is assumed to be a one-dimensional set
533
+ of simple (urlencodable) key/value pairs, and not larger
534
+ data structures. A string value is assumed to be a
535
+ well-formed, urlencoded set of key/value pairs separated by
536536
'&' characters.
537
-
538
- The new/normalized URL is returned (opt is not modified). If
539
- opt.urlParam is not set then opt.url is returned (or an
537
+
538
+ The new/normalized URL is returned (opt is not modified). If
539
+ opt.urlParam is not set then opt.url is returned (or an
540540
empty string if opt.url is itself a false value).
541
-
542
- TODO: if opt is-a Object and any key points to an array,
543
- build up a list of keys in the form "keyname[]". We could
544
- arguably encode sub-objects like "keyname[subkey]=...", but
545
- i don't know if that's conventions-compatible with other
541
+
542
+ TODO: if opt is-a Object and any key points to an array,
543
+ build up a list of keys in the form "keyname[]". We could
544
+ arguably encode sub-objects like "keyname[subkey]=...", but
545
+ i don't know if that's conventions-compatible with other
546546
frameworks.
547547
*/
548548
normalizeURL: function(opt) {
549549
var u = opt.url || '';
550550
if( opt.urlParam ) {
@@ -564,50 +564,50 @@
564564
u = u + (addQ ? '?' : '') + (addA ? '&' : '') + tail;
565565
}
566566
return u;
567567
},
568568
/**
569
- Should be called by WhAjaj.Connector.sendImpl()
570
- implementations after a response has come back. This
571
- function takes care of most of ensuring that framework-level
572
- conventions involving WhAjaj.Connector.options.ajax
569
+ Should be called by WhAjaj.Connector.sendImpl()
570
+ implementations after a response has come back. This
571
+ function takes care of most of ensuring that framework-level
572
+ conventions involving WhAjaj.Connector.options.ajax
573573
properties are followed.
574
-
575
- The request argument must be the original request passed to
574
+
575
+ The request argument must be the original request passed to
576576
the sendImpl() function. It may legally be null for GET requests.
577
-
578
- The opt object should be the normalized AJAX options used
577
+
578
+ The opt object should be the normalized AJAX options used
579579
for the connection.
580
-
581
- The resp argument may be either a plain Object or a string
580
+
581
+ The resp argument may be either a plain Object or a string
582582
(in which case it is assumed to be JSON).
583583
584584
The 'this' object for this call MUST be a WhAjaj.Connector
585585
instance in order for callback processing to work properly.
586
-
586
+
587587
This function takes care of the following:
588
-
588
+
589589
- Calling opt.afterSend()
590
-
590
+
591591
- If resp is a string, de-JSON-izing it to an object.
592
-
592
+
593593
- Calling opt.onResponse()
594
-
595
- - Calling opt.onError() in several common (potential) error
594
+
595
+ - Calling opt.onError() in several common (potential) error
596596
cases.
597597
598598
- If resp is-a String and opt.jsonp then resp is assumed to be
599599
a JSONP-form construct and is eval()d BEFORE opt.onResponse()
600600
is called. It is arguable to eval() it first, but the logic
601601
integrates better with the non-jsonp handler.
602602
603603
The sendImpl() should return immediately after calling this.
604
-
605
- The sendImpl() must call only one of onSendSuccess() or
606
- onSendError(). It must call one of them or it must implement
607
- its own response/error handling, which is not recommended
608
- because getting the documented semantics of the
604
+
605
+ The sendImpl() must call only one of onSendSuccess() or
606
+ onSendError(). It must call one of them or it must implement
607
+ its own response/error handling, which is not recommended
608
+ because getting the documented semantics of the
609609
onError/onResponse/afterSend handling correct can be tedious.
610610
*/
611611
onSendSuccess:function(request,resp,opt) {
612612
var cb = this.callbacks || {};
613613
if( WhAjaj.isFunction(cb.afterSend) ) {
@@ -666,23 +666,23 @@
666666
Should be called by sendImpl() implementations after a response
667667
has failed to connect (e.g. could not resolve host or timeout
668668
reached). This function takes care of most of ensuring that
669669
framework-level conventions involving WhAjaj.Connector.options.ajax
670670
properties are followed.
671
-
672
- The request argument must be the original request passed to
673
- the sendImpl() function. It may legally be null for GET
671
+
672
+ The request argument must be the original request passed to
673
+ the sendImpl() function. It may legally be null for GET
674674
requests.
675675
676676
The 'this' object for this call MUST be a WhAjaj.Connector
677677
instance in order for callback processing to work properly.
678
-
679
- The opt object should be the normalized AJAX options used
680
- for the connection. By convention, the caller of this
681
- function "should" set opt.errorMessage to contain a
678
+
679
+ The opt object should be the normalized AJAX options used
680
+ for the connection. By convention, the caller of this
681
+ function "should" set opt.errorMessage to contain a
682682
human-readable description of the error.
683
-
683
+
684684
The sendImpl() should return immediately after calling this. The
685685
return value from this function is unspecified.
686686
*/
687687
onSendError: function(request,opt) {
688688
var cb = this.callbacks || {};
@@ -704,64 +704,64 @@
704704
}
705705
}
706706
};
707707
708708
/**
709
- WhAjaj.Connector.sendImpls holds several concrete
710
- implementations of WhAjaj.Connector.prototype.sendImpl(). To use
711
- a specific implementation by default assign
709
+ WhAjaj.Connector.sendImpls holds several concrete
710
+ implementations of WhAjaj.Connector.prototype.sendImpl(). To use
711
+ a specific implementation by default assign
712712
WhAjaj.Connector.prototype.sendImpl to one of these functions.
713
-
713
+
714714
The functions defined here require that the 'this' object be-a
715715
WhAjaj.Connector instance.
716
-
716
+
717717
Historical notes:
718718
719
- a) We once had an implementation based on Prototype, but that
720
- library just pisses me off (they change base-most types'
721
- prototypes, introducing side-effects in client code which
722
- doesn't even use Prototype). The Prototype version at the time
723
- had a serious toJSON() bug which caused empty arrays to
724
- serialize as the string "[]", which broke a bunch of my code.
725
- (That has been fixed in the mean time, but i don't use
719
+ a) We once had an implementation based on Prototype, but that
720
+ library just pisses me off (they change base-most types'
721
+ prototypes, introducing side-effects in client code which
722
+ doesn't even use Prototype). The Prototype version at the time
723
+ had a serious toJSON() bug which caused empty arrays to
724
+ serialize as the string "[]", which broke a bunch of my code.
725
+ (That has been fixed in the mean time, but i don't use
726726
Prototype.)
727
-
728
- b) We once had an implementation for the dojo library,
729
-
727
+
728
+ b) We once had an implementation for the dojo library,
729
+
730730
If/when the time comes to add Prototype/dojo support, we simply
731731
need to port:
732
-
732
+
733733
http://code.google.com/p/jsonmessage/source/browse/trunk/lib/JSONMessage/JSONMessage.inc.js
734
-
735
- (search that file for "dojo" and "Prototype") to this tree. That
736
- code is this code's generic grandfather and they are still very
737
- similar, so a port is trivial.
738
-
734
+
735
+ (search that file for "dojo" and "Prototype") to this tree. That
736
+ code is this code's generic grandfather and they are still very
737
+ similar, so a port is trivial.
738
+
739739
*/
740740
WhAjaj.Connector.sendImpls = {
741741
/**
742
- This is a concrete implementation of
743
- WhAjaj.Connector.prototype.sendImpl() which uses the
744
- environment's native XMLHttpRequest class to send whiki
742
+ This is a concrete implementation of
743
+ WhAjaj.Connector.prototype.sendImpl() which uses the
744
+ environment's native XMLHttpRequest class to send whiki
745745
requests and fetch the responses.
746746
747
- The only argument must be a connection properties object, as
747
+ The only argument must be a connection properties object, as
748748
constructed by WhAjaj.Connector.normalizeAjaxParameters().
749749
750
- If window.firebug is set then window.firebug.watchXHR() is
750
+ If window.firebug is set then window.firebug.watchXHR() is
751751
called to enable monitoring of the XMLHttpRequest object.
752752
753
- This implementation honors the loginName and loginPassword
753
+ This implementation honors the loginName and loginPassword
754754
connection parameters.
755755
756756
Returns the XMLHttpRequest object.
757757
758
- This implementation requires that the 'this' object be-a
758
+ This implementation requires that the 'this' object be-a
759759
WhAjaj.Connector.
760
-
761
- This implementation uses setTimeout() to implement the
762
- timeout support, and thus the JS engine must provide that
760
+
761
+ This implementation uses setTimeout() to implement the
762
+ timeout support, and thus the JS engine must provide that
763763
functionality.
764764
*/
765765
XMLHttpRequest: function(request, args)
766766
{
767767
var json = WhAjaj.isObject(request) ? JSON.stringify(request) : request;
@@ -864,30 +864,30 @@
864864
WhAjaj.Connector.sendHelper.onSendError.apply( whself, [request, args] );
865865
return undefined;
866866
}
867867
}/*XMLHttpRequest()*/,
868868
/**
869
- This is a concrete implementation of
870
- WhAjaj.Connector.prototype.sendImpl() which uses the jQuery
869
+ This is a concrete implementation of
870
+ WhAjaj.Connector.prototype.sendImpl() which uses the jQuery
871871
AJAX API to send requests and fetch the responses.
872872
873
- The first argument may be either null/false, an Object
873
+ The first argument may be either null/false, an Object
874874
containing toJSON-able data to post to the back-end, or such an
875875
object in JSON string form.
876876
877
- The second argument must be a connection properties object, as
877
+ The second argument must be a connection properties object, as
878878
constructed by WhAjaj.Connector.normalizeAjaxParameters().
879879
880
- If window.firebug is set then window.firebug.watchXHR() is
880
+ If window.firebug is set then window.firebug.watchXHR() is
881881
called to enable monitoring of the XMLHttpRequest object.
882882
883
- This implementation honors the loginName and loginPassword
883
+ This implementation honors the loginName and loginPassword
884884
connection parameters.
885885
886886
Returns the XMLHttpRequest object.
887887
888
- This implementation requires that the 'this' object be-a
888
+ This implementation requires that the 'this' object be-a
889889
WhAjaj.Connector.
890890
*/
891891
jQuery:function(request,args)
892892
{
893893
var data = request || undefined;
@@ -943,12 +943,12 @@
943943
WhAjaj.Connector.sendHelper.onSendError.apply( whself, [request, args] );
944944
return undefined;
945945
}
946946
}/*jQuery()*/,
947947
/**
948
- This is a concrete implementation of
949
- WhAjaj.Connector.prototype.sendImpl() which uses the rhino
948
+ This is a concrete implementation of
949
+ WhAjaj.Connector.prototype.sendImpl() which uses the rhino
950950
Java API to send requests and fetch the responses.
951951
952952
Limitations vis-a-vis the interface:
953953
954954
- timeouts are not supported.
@@ -1051,28 +1051,28 @@
10511051
WhAjaj.Connector.sendHelper.onSendSuccess.apply( self, [request, json, args] );
10521052
}/*rhino*/
10531053
};
10541054
10551055
/**
1056
- An internal function which takes an object containing properties
1057
- for a WhAjaj.Connector network request. This function creates a new
1056
+ An internal function which takes an object containing properties
1057
+ for a WhAjaj.Connector network request. This function creates a new
10581058
object containing a superset of the properties from:
10591059
10601060
a) opt
10611061
b) this.options
10621062
c) WhAjaj.Connector.options.ajax
10631063
10641064
in that order, using the first one it finds.
10651065
1066
- All non-function properties are _deeply_ copied via JSON cloning
1067
- in order to prevent accidental "cross-request pollenation" (been
1068
- there, done that). Functions cannot be cloned and are simply
1066
+ All non-function properties are _deeply_ copied via JSON cloning
1067
+ in order to prevent accidental "cross-request pollenation" (been
1068
+ there, done that). Functions cannot be cloned and are simply
10691069
copied by reference.
1070
-
1070
+
10711071
This function throws if JSON-copying one of the options fails
10721072
(e.g. due to cyclic data structures).
1073
-
1073
+
10741074
Reminder to self: this function does not "normalize" opt.urlParam
10751075
by encoding it into opt.url, mainly for historical reasons, but
10761076
also because that behaviour was specifically undesirable in this
10771077
code's genetic father.
10781078
*/
@@ -1100,68 +1100,68 @@
11001100
// no, not here: rc.url = WhAjaj.Connector.sendHelper.normalizeURL(rc);
11011101
return rc;
11021102
};
11031103
11041104
/**
1105
- This is the generic interface for making calls to a back-end
1106
- JSON-producing request handler. It is a simple wrapper around
1107
- WhAjaj.Connector.prototype.sendImpl(), which just normalizes the
1108
- connection options for sendImpl() and makes sure that
1105
+ This is the generic interface for making calls to a back-end
1106
+ JSON-producing request handler. It is a simple wrapper around
1107
+ WhAjaj.Connector.prototype.sendImpl(), which just normalizes the
1108
+ connection options for sendImpl() and makes sure that
11091109
opt.beforeSend() is (possibly) called.
1110
-
1111
- The request parameter must either be false/null/empty or a
1112
- fully-populated JSON-able request object (which will be sent as
1113
- unencoded application/json text), depending on the type of
1114
- request being made. It is never semantically legal (in this API)
1115
- for request to be a string/number/true/array value. As a rule,
1116
- only POST requests use the request data. GET requests should
1110
+
1111
+ The request parameter must either be false/null/empty or a
1112
+ fully-populated JSON-able request object (which will be sent as
1113
+ unencoded application/json text), depending on the type of
1114
+ request being made. It is never semantically legal (in this API)
1115
+ for request to be a string/number/true/array value. As a rule,
1116
+ only POST requests use the request data. GET requests should
11171117
encode their data in opt.url or opt.urlParam (see below).
1118
-
1119
- opt must contain the network-related parameters for the request.
1120
- Paramters _not_ set in opt are pulled from this.options or
1121
- WhAjaj.Connector.options.ajax (in that order, using the first
1122
- value it finds). Thus the set of connection-level options used
1118
+
1119
+ opt must contain the network-related parameters for the request.
1120
+ Paramters _not_ set in opt are pulled from this.options or
1121
+ WhAjaj.Connector.options.ajax (in that order, using the first
1122
+ value it finds). Thus the set of connection-level options used
11231123
for the request are a superset of those various sources.
1124
-
1125
- The "normalized" (or "superimposed") opt object's URL may be
1124
+
1125
+ The "normalized" (or "superimposed") opt object's URL may be
11261126
modified before the request is sent, as follows:
11271127
1128
- if opt.urlParam is a string then it is assumed to be properly
1129
- URL-encoded parameters and is appended to the opt.url. If it is
1130
- an Object then it is assumed to be a one-dimensional set of
1131
- key/value pairs with simple values (numbers, strings, booleans,
1132
- null, and NOT objects/arrays). The keys/values are URL-encoded
1128
+ if opt.urlParam is a string then it is assumed to be properly
1129
+ URL-encoded parameters and is appended to the opt.url. If it is
1130
+ an Object then it is assumed to be a one-dimensional set of
1131
+ key/value pairs with simple values (numbers, strings, booleans,
1132
+ null, and NOT objects/arrays). The keys/values are URL-encoded
11331133
and appended to the URL.
11341134
11351135
The beforeSend() callback (see below) can modify the options
11361136
object before the request attempt is made.
1137
-
1137
+
11381138
The callbacks in the normalized opt object will be triggered as
11391139
follows (if they are set to Function values):
1140
-
1141
- - beforeSend(request,opt) will be called before any network
1142
- processing starts. If beforeSend() throws then no other
1143
- callbacks are triggered and this function propagates the
1140
+
1141
+ - beforeSend(request,opt) will be called before any network
1142
+ processing starts. If beforeSend() throws then no other
1143
+ callbacks are triggered and this function propagates the
11441144
exception. This function is passed normalized connection options
11451145
as its second parameter, and changes this function makes to that
11461146
object _will_ be used for the pending connection attempt.
1147
-
1148
- - onError(request,opt) will be called if a connection to the
1149
- back-end cannot be established. It will be passed the original
1150
- request object (which might be null, depending on the request
1151
- type) and the normalized options object. In the error case, the
1152
- opt object passed to onError() "should" have a property called
1147
+
1148
+ - onError(request,opt) will be called if a connection to the
1149
+ back-end cannot be established. It will be passed the original
1150
+ request object (which might be null, depending on the request
1151
+ type) and the normalized options object. In the error case, the
1152
+ opt object passed to onError() "should" have a property called
11531153
"errorMessage" which contains a description of the problem.
1154
-
1155
- - onError(request,opt) will also be called if connection
1154
+
1155
+ - onError(request,opt) will also be called if connection
11561156
succeeds but the response is not JSON data.
1157
-
1158
- - onResponse(response,request) will be called if the response
1159
- returns JSON data. That data might hold an error response code -
1160
- clients need to check for that. It is passed the response object
1157
+
1158
+ - onResponse(response,request) will be called if the response
1159
+ returns JSON data. That data might hold an error response code -
1160
+ clients need to check for that. It is passed the response object
11611161
(a plain object) and the original request object.
1162
-
1162
+
11631163
- afterSend(request,opt) will be called directly after the
11641164
AJAX request is finished, before onError() or onResonse() are
11651165
called. Possible TODO: we explicitly do NOT pass the response to
11661166
this function in order to keep the line between the responsibilities
11671167
of the various callback clear (otherwise this could be used the same
@@ -1179,14 +1179,14 @@
11791179
{
11801180
throw new Error("This object has no sendImpl() member function! I don't know how to send the request!");
11811181
}
11821182
var ex = false;
11831183
var av = Array.prototype.slice.apply( arguments, [0] );
1184
-
1184
+
11851185
/**
1186
- FIXME: how to handle the error, vis-a-vis- the callbacks, if
1187
- normalizeAjaxParameters() throws? It can throw if
1186
+ FIXME: how to handle the error, vis-a-vis- the callbacks, if
1187
+ normalizeAjaxParameters() throws? It can throw if
11881188
(de)JSON-izing fails.
11891189
*/
11901190
var norm = this.normalizeAjaxParameters( WhAjaj.isObject(opt) ? opt : {} );
11911191
norm.url = WhAjaj.Connector.sendHelper.normalizeURL(norm);
11921192
if( ! request ) norm.method = 'GET';
11931193
--- ajax/js/whajaj.js
+++ ajax/js/whajaj.js
@@ -10,22 +10,22 @@
10 acts as namespace for this framework.
11
12 Author: Stephan Beal (http://wanderinghorse.net/home/stephan/)
13
14 License: Public Domain
15
16 This framework is directly derived from code originally found in
17 http://code.google.com/p/jsonmessage, and later in
18 http://whiki.wanderinghorse.net, where it contained quite a bit
19 of application-specific logic. It was eventually (the 3rd time i
20 needed it) split off into its own library to simplify inclusion
21 into my many mini-projects.
22 */
23
24
25 /**
26 The WhAjaj function is primarily a namespace, and not intended
27 to called or instantiated via the 'new' operator.
28 */
29 function WhAjaj()
30 {
31 }
@@ -36,11 +36,11 @@
36 return (new Date()).getTime();
37 };
38
39 /** Returns a Unix Epoch timestamp (in seconds) in integer format.
40
41 Reminder to self: (1.1 %1.2) evaluates to a floating-point value
42 in JS, and thus this implementation is less than optimal.
43 */
44 WhAjaj.unixTimestamp = function()
45 {
46 var ts = (new Date()).getTime();
@@ -88,22 +88,22 @@
88 };
89
90 /**
91 Parses window.location.search-style string into an object
92 containing key/value pairs of URL arguments (already urldecoded).
93
94 If the str argument is not passed (arguments.length==0) then
95 window.location.search.substring(1) is used by default. If
96 neither str is passed in nor window exists then false is returned.
97
98 On success it returns an Object containing the key/value pairs
99 parsed from the string. Keys which have no value are treated
100 has having the boolean true value.
101
102 FIXME: for keys in the form "name[]", build an array of results,
103 like PHP does.
104
105 */
106 WhAjaj.processUrlArgs = function(str) {
107 if( 0 === arguments.length ) {
108 if( ('undefined' === typeof window) ||
109 !window.location ||
@@ -127,11 +127,11 @@
127 /**
128 A simple wrapper around JSON.stringify(), using my own personal
129 preferred values for the 2nd and 3rd parameters. To globally
130 set its indentation level, assign WhAjaj.stringify.indent to
131 an integer value (0 for no intendation).
132
133 This function is intended only for human-readable output, not
134 generic over-the-wire JSON output (where JSON.stringify(val) will
135 produce smaller results).
136 */
137 WhAjaj.stringify = function(val) {
@@ -138,34 +138,34 @@
138 if( ! arguments.callee.indent ) arguments.callee.indent = 4;
139 return JSON.stringify(val,0,arguments.callee.indent);
140 };
141
142 /**
143 Each instance of this class holds state information for making
144 AJAJ requests to a back-end system. While clients may use one
145 "requester" object per connection attempt, for connections to the
146 same back-end, using an instance configured for that back-end
147 can simplify usage. This class is designed so that the actual
148 connection-related details (i.e. _how_ it connects to the
149 back-end) may be re-implemented to use a client's preferred
150 connection mechanism (e.g. jQuery).
151
152 The optional opt paramater may be an object with any (or all) of
153 the properties documented for WhAjaj.Connector.options.ajax.
154 Properties set here (or later via modification of the "options"
155 property of this object) will be used in calls to
156 WhAjaj.Connector.sendRequest(), and these override (normally) any
157 options set in WhAjaj.Connector.options.ajax. Note that
158 WhAjaj.Connector.sendRequest() _also_ takes an options object,
159 and ones passed there will override, for purposes of that one
160 request, any options passed in here or defined in
161 WhAjaj.Connector.options.ajax. See WhAjaj.Connector.options.ajax
162 and WhAjaj.Connector.prototype.sendRequest() for more details
163 about the precedence of options.
164
165 Sample usage:
166
167 @code
168 // Set up common connection-level options:
169 var cgi = new WhAjaj.Connector({
170 url: '/cgi-bin/my.cgi',
171 timeout:10000,
@@ -185,25 +185,25 @@
185 @endcode
186
187 For common request types, clients can add functions to this
188 object which act as wrappers for backend-specific functionality. As
189 a simple example:
190
191 @code
192 cgi.login = function(name,pw,ajajOpt) {
193 this.sendRequest(
194 {command:"json/login",
195 name:name,
196 password:pw
197 }, ajajOpt );
198 };
199 @endcode
200
201 TODOs:
202
203 - Caching of page-load requests, with a configurable lifetime.
204
205 - Use-cases like the above login() function are a tiny bit
206 problematic to implement when each request has a different URL
207 path (i know this from the whiki and fossil implementations).
208 This is partly a side-effect of design descisions made back in
209 the very first days of this code's life. i need to go through
@@ -230,42 +230,42 @@
230 A (meaningless) prefix to apply to WhAjaj.Connector-generated
231 request IDs.
232 */
233 requestIdPrefix:'WhAjaj.Connector-',
234 /**
235 Default options for WhAjaj.Connector.sendRequest() connection
236 parameters. This object holds only connection-related
237 options and callbacks (all optional), and not options
238 related to the required JSON structure of any given request.
239 i.e. the page name used in a get-page request are not set
240 here but are specified as part of the request object.
241
242 These connection options are a "normalized form" of options
243 often found in various AJAX libraries like jQuery,
244 Prototype, dojo, etc. This approach allows us to swap out
245 the real connection-related parts by writing a simple proxy
246 which transforms our "normalized" form to the
247 backend-specific form. For examples, see the various
248 implementations stored in WhAjaj.Connector.sendImpls.
249
250 The following callback options are, in practice, almost
251 always set globally to some app-wide defaults:
252
253 - onError() to report errors using a common mechanism.
254 - beforeSend() to start a visual activity notification
255 - afterSend() to disable the visual activity notification
256
257 However, be aware that if any given WhAjaj.Connector instance is
258 given its own before/afterSend callback then those will
259 override these. Mixing shared/global and per-instance
260 callbacks can potentially lead to confusing results if, e.g.,
261 the beforeSend() and afterSend() functions have side-effects
262 but are not used with their proper before/after partner.
263
264 TODO: rename this to 'ajaj' (the name is historical). The
265 problem with renaming it is is that the word 'ajax' is
266 pretty prevelant in the source tree, so i can't globally
267 swap it out.
268 */
269 ajax: {
270 /**
271 URL of the back-end server/CGI.
@@ -273,48 +273,48 @@
273 url: '/some/path',
274
275 /**
276 Connection method. Some connection-related functions might
277 override any client-defined setting.
278
279 Must be one of 'GET' or 'POST'. For custom connection
280 implementation, it may optionally be some
281 implementation-specified value.
282
283 Normally the API can derive this value automatically - if the
284 request uses JSON data it is POSTed, else it is GETted.
285 */
286 method:'GET',
287
288 /**
289 A hint whether to run the operation asynchronously or
290 not. Not all concrete WhAjaj.Connector.sendImpl()
291 implementations can support this. Interestingly, at
292 least one popular AJAX toolkit does not document
293 supporting _synchronous_ AJAX operations. All common
294 browser-side implementations support async operation, but
295 non-browser implementations might not.
296 */
297 asynchronous:true,
298
299 /**
300 A HTTP authentication login name for the AJAX
301 connection. Not all concrete WhAjaj.Connector.sendImpl()
302 implementations can support this.
303 */
304 loginName:undefined,
305
306 /**
307 An HTTP authentication login password for the AJAJ
308 connection. Not all concrete WhAjaj.Connector.sendImpl()
309 implementations can support this.
310 */
311 loginPassword:undefined,
312
313 /**
314 A connection timeout, in milliseconds, for establishing
315 an AJAJ connection. Not all concrete
316 WhAjaj.Connector.sendImpl() implementations can support this.
317 */
318 timeout:10000,
319
320 /**
@@ -328,11 +328,11 @@
328 is the same as the 'this' object for the context of the
329 callback, but is provided because the instance-level
330 callbacks (set in (WhAjaj.Connector instance).callbacks,
331 require it in some cases (because their 'this' is
332 different!).
333
334 Note that the response might contain error information
335 which comes from the back-end. The difference between
336 this error info and the info passed to the onError()
337 callback is that this data indicates an
338 application-level error, whereas onError() is used to
@@ -342,21 +342,21 @@
342 connection error).
343 */
344 onResponse: function(response, request, opt){},
345
346 /**
347 If an AJAX request fails to establish a connection or it
348 receives non-JSON data from the back-end, this function
349 is called (e.g. timeout error or host name not
350 resolvable). It is passed the originating request and the
351 "normalized" connection parameters used for that
352 request. The connectOpt object "should" (or "might")
353 have an "errorMessage" property which describes the
354 nature of the problem.
355
356 Clients will almost always want to replace the default
357 implementation with something which integrates into
358 their application.
359 */
360 onError: function(request, connectOpt)
361 {
362 alert('AJAJ request failed:\n'
@@ -364,60 +364,60 @@
364 +JSON.stringify(connectOpt,0,4)
365 );
366 },
367
368 /**
369 Called before each connection attempt is made. Clients
370 can use this to, e.g., enable a visual "network activity
371 notification" for the user. It is passed the original
372 request object and the normalized connection parameters
373 for the request. If this function changes opt, those
374 changes _are_ applied to the subsequent request. If this
375 function throws, neither the onError() nor afterSend()
376 callbacks are triggered and WhAjaj.Connector.sendImpl()
377 propagates the exception back to the caller.
378 */
379 beforeSend: function(request,opt){},
380
381 /**
382 Called after an AJAJ connection attempt completes,
383 regardless of success or failure. Passed the same
384 parameters as beforeSend() (see that function for
385 details).
386
387 Here's an example of setting up a visual notification on
388 ajax operations using jQuery (but it's also easy to do
389 without jQuery as well):
390
391 @code
392 function startAjaxNotif(req,opt) {
393 var me = arguments.callee;
394 var c = ++me.ajaxCount;
395 me.element.text( c + " pending AJAX operation(s)..." );
396 if( 1 == c ) me.element.stop().fadeIn();
397 }
398 startAjaxNotif.ajaxCount = 0.
399 startAjaxNotif.element = jQuery('#whikiAjaxNotification');
400
401 function endAjaxNotif() {
402 var c = --startAjaxNotif.ajaxCount;
403 startAjaxNotif.element.text( c+" pending AJAX operation(s)..." );
404 if( 0 == c ) startAjaxNotif.element.stop().fadeOut();
405 }
406 @endcode
407
408 Set the beforeSend/afterSend properties to those
409 functions to enable the notifications by default.
410 */
411 afterSend: function(request,opt){},
412
413 /**
414 If jsonp is a string then the WhAjaj-internal response
415 handling code ASSUMES that the response contains a JSONP-style
416 construct and eval()s it after afterSend() but before onResponse().
417 In this case, onResponse() will get a string value for the response
418 instead of a response object parsed from JSON.
419 */
420 jsonp:undefined,
421 /**
422 Don't use yet. Planned future option.
423 */
@@ -468,25 +468,25 @@
468 else v = WhAjaj.Connector.options.ajax[key];
469 return v;
470 };
471
472 /**
473 Returns a unique string on each call containing a generic
474 reandom request identifier string. This is not used by the core
475 API but can be used by client code to generate unique IDs for
476 each request (if needed).
477
478 The exact format is unspecified and may change in the future.
479
480 Request IDs can be used by clients to "match up" responses to
481 specific requests if needed. In practice, however, they are
482 seldom, if ever, needed. When passing several concurrent
483 requests through the same response callback, it might be useful
484 for some clients to be able to distinguish, possibly re-routing
485 them through other handlers based on the originating request type.
486
487 If this.options.requestIdPrefix or
488 WhAjaj.Connector.options.requestIdPrefix is set then that text
489 is prefixed to the returned string.
490 */
491 WhAjaj.Connector.prototype.generateRequestId = function()
492 {
@@ -512,39 +512,39 @@
512 }
513 return this.options;
514 };
515
516 /**
517 An internal helper object which holds several functions intended
518 to simplify the creation of concrete communication channel
519 implementations for WhAjaj.Connector.sendImpl(). These operations
520 take care of some of the more error-prone parts of ensuring that
521 onResponse(), onError(), etc. callbacks are called consistently
522 using the same rules.
523 */
524 WhAjaj.Connector.sendHelper = {
525 /**
526 opt is assumed to be a normalized set of
527 WhAjaj.Connector.sendRequest() options. This function
528 creates a url by concatenating opt.url and some form of
529 opt.urlParam.
530
531 If opt.urlParam is an object or string then it is appended
532 to the url. An object is assumed to be a one-dimensional set
533 of simple (urlencodable) key/value pairs, and not larger
534 data structures. A string value is assumed to be a
535 well-formed, urlencoded set of key/value pairs separated by
536 '&' characters.
537
538 The new/normalized URL is returned (opt is not modified). If
539 opt.urlParam is not set then opt.url is returned (or an
540 empty string if opt.url is itself a false value).
541
542 TODO: if opt is-a Object and any key points to an array,
543 build up a list of keys in the form "keyname[]". We could
544 arguably encode sub-objects like "keyname[subkey]=...", but
545 i don't know if that's conventions-compatible with other
546 frameworks.
547 */
548 normalizeURL: function(opt) {
549 var u = opt.url || '';
550 if( opt.urlParam ) {
@@ -564,50 +564,50 @@
564 u = u + (addQ ? '?' : '') + (addA ? '&' : '') + tail;
565 }
566 return u;
567 },
568 /**
569 Should be called by WhAjaj.Connector.sendImpl()
570 implementations after a response has come back. This
571 function takes care of most of ensuring that framework-level
572 conventions involving WhAjaj.Connector.options.ajax
573 properties are followed.
574
575 The request argument must be the original request passed to
576 the sendImpl() function. It may legally be null for GET requests.
577
578 The opt object should be the normalized AJAX options used
579 for the connection.
580
581 The resp argument may be either a plain Object or a string
582 (in which case it is assumed to be JSON).
583
584 The 'this' object for this call MUST be a WhAjaj.Connector
585 instance in order for callback processing to work properly.
586
587 This function takes care of the following:
588
589 - Calling opt.afterSend()
590
591 - If resp is a string, de-JSON-izing it to an object.
592
593 - Calling opt.onResponse()
594
595 - Calling opt.onError() in several common (potential) error
596 cases.
597
598 - If resp is-a String and opt.jsonp then resp is assumed to be
599 a JSONP-form construct and is eval()d BEFORE opt.onResponse()
600 is called. It is arguable to eval() it first, but the logic
601 integrates better with the non-jsonp handler.
602
603 The sendImpl() should return immediately after calling this.
604
605 The sendImpl() must call only one of onSendSuccess() or
606 onSendError(). It must call one of them or it must implement
607 its own response/error handling, which is not recommended
608 because getting the documented semantics of the
609 onError/onResponse/afterSend handling correct can be tedious.
610 */
611 onSendSuccess:function(request,resp,opt) {
612 var cb = this.callbacks || {};
613 if( WhAjaj.isFunction(cb.afterSend) ) {
@@ -666,23 +666,23 @@
666 Should be called by sendImpl() implementations after a response
667 has failed to connect (e.g. could not resolve host or timeout
668 reached). This function takes care of most of ensuring that
669 framework-level conventions involving WhAjaj.Connector.options.ajax
670 properties are followed.
671
672 The request argument must be the original request passed to
673 the sendImpl() function. It may legally be null for GET
674 requests.
675
676 The 'this' object for this call MUST be a WhAjaj.Connector
677 instance in order for callback processing to work properly.
678
679 The opt object should be the normalized AJAX options used
680 for the connection. By convention, the caller of this
681 function "should" set opt.errorMessage to contain a
682 human-readable description of the error.
683
684 The sendImpl() should return immediately after calling this. The
685 return value from this function is unspecified.
686 */
687 onSendError: function(request,opt) {
688 var cb = this.callbacks || {};
@@ -704,64 +704,64 @@
704 }
705 }
706 };
707
708 /**
709 WhAjaj.Connector.sendImpls holds several concrete
710 implementations of WhAjaj.Connector.prototype.sendImpl(). To use
711 a specific implementation by default assign
712 WhAjaj.Connector.prototype.sendImpl to one of these functions.
713
714 The functions defined here require that the 'this' object be-a
715 WhAjaj.Connector instance.
716
717 Historical notes:
718
719 a) We once had an implementation based on Prototype, but that
720 library just pisses me off (they change base-most types'
721 prototypes, introducing side-effects in client code which
722 doesn't even use Prototype). The Prototype version at the time
723 had a serious toJSON() bug which caused empty arrays to
724 serialize as the string "[]", which broke a bunch of my code.
725 (That has been fixed in the mean time, but i don't use
726 Prototype.)
727
728 b) We once had an implementation for the dojo library,
729
730 If/when the time comes to add Prototype/dojo support, we simply
731 need to port:
732
733 http://code.google.com/p/jsonmessage/source/browse/trunk/lib/JSONMessage/JSONMessage.inc.js
734
735 (search that file for "dojo" and "Prototype") to this tree. That
736 code is this code's generic grandfather and they are still very
737 similar, so a port is trivial.
738
739 */
740 WhAjaj.Connector.sendImpls = {
741 /**
742 This is a concrete implementation of
743 WhAjaj.Connector.prototype.sendImpl() which uses the
744 environment's native XMLHttpRequest class to send whiki
745 requests and fetch the responses.
746
747 The only argument must be a connection properties object, as
748 constructed by WhAjaj.Connector.normalizeAjaxParameters().
749
750 If window.firebug is set then window.firebug.watchXHR() is
751 called to enable monitoring of the XMLHttpRequest object.
752
753 This implementation honors the loginName and loginPassword
754 connection parameters.
755
756 Returns the XMLHttpRequest object.
757
758 This implementation requires that the 'this' object be-a
759 WhAjaj.Connector.
760
761 This implementation uses setTimeout() to implement the
762 timeout support, and thus the JS engine must provide that
763 functionality.
764 */
765 XMLHttpRequest: function(request, args)
766 {
767 var json = WhAjaj.isObject(request) ? JSON.stringify(request) : request;
@@ -864,30 +864,30 @@
864 WhAjaj.Connector.sendHelper.onSendError.apply( whself, [request, args] );
865 return undefined;
866 }
867 }/*XMLHttpRequest()*/,
868 /**
869 This is a concrete implementation of
870 WhAjaj.Connector.prototype.sendImpl() which uses the jQuery
871 AJAX API to send requests and fetch the responses.
872
873 The first argument may be either null/false, an Object
874 containing toJSON-able data to post to the back-end, or such an
875 object in JSON string form.
876
877 The second argument must be a connection properties object, as
878 constructed by WhAjaj.Connector.normalizeAjaxParameters().
879
880 If window.firebug is set then window.firebug.watchXHR() is
881 called to enable monitoring of the XMLHttpRequest object.
882
883 This implementation honors the loginName and loginPassword
884 connection parameters.
885
886 Returns the XMLHttpRequest object.
887
888 This implementation requires that the 'this' object be-a
889 WhAjaj.Connector.
890 */
891 jQuery:function(request,args)
892 {
893 var data = request || undefined;
@@ -943,12 +943,12 @@
943 WhAjaj.Connector.sendHelper.onSendError.apply( whself, [request, args] );
944 return undefined;
945 }
946 }/*jQuery()*/,
947 /**
948 This is a concrete implementation of
949 WhAjaj.Connector.prototype.sendImpl() which uses the rhino
950 Java API to send requests and fetch the responses.
951
952 Limitations vis-a-vis the interface:
953
954 - timeouts are not supported.
@@ -1051,28 +1051,28 @@
1051 WhAjaj.Connector.sendHelper.onSendSuccess.apply( self, [request, json, args] );
1052 }/*rhino*/
1053 };
1054
1055 /**
1056 An internal function which takes an object containing properties
1057 for a WhAjaj.Connector network request. This function creates a new
1058 object containing a superset of the properties from:
1059
1060 a) opt
1061 b) this.options
1062 c) WhAjaj.Connector.options.ajax
1063
1064 in that order, using the first one it finds.
1065
1066 All non-function properties are _deeply_ copied via JSON cloning
1067 in order to prevent accidental "cross-request pollenation" (been
1068 there, done that). Functions cannot be cloned and are simply
1069 copied by reference.
1070
1071 This function throws if JSON-copying one of the options fails
1072 (e.g. due to cyclic data structures).
1073
1074 Reminder to self: this function does not "normalize" opt.urlParam
1075 by encoding it into opt.url, mainly for historical reasons, but
1076 also because that behaviour was specifically undesirable in this
1077 code's genetic father.
1078 */
@@ -1100,68 +1100,68 @@
1100 // no, not here: rc.url = WhAjaj.Connector.sendHelper.normalizeURL(rc);
1101 return rc;
1102 };
1103
1104 /**
1105 This is the generic interface for making calls to a back-end
1106 JSON-producing request handler. It is a simple wrapper around
1107 WhAjaj.Connector.prototype.sendImpl(), which just normalizes the
1108 connection options for sendImpl() and makes sure that
1109 opt.beforeSend() is (possibly) called.
1110
1111 The request parameter must either be false/null/empty or a
1112 fully-populated JSON-able request object (which will be sent as
1113 unencoded application/json text), depending on the type of
1114 request being made. It is never semantically legal (in this API)
1115 for request to be a string/number/true/array value. As a rule,
1116 only POST requests use the request data. GET requests should
1117 encode their data in opt.url or opt.urlParam (see below).
1118
1119 opt must contain the network-related parameters for the request.
1120 Paramters _not_ set in opt are pulled from this.options or
1121 WhAjaj.Connector.options.ajax (in that order, using the first
1122 value it finds). Thus the set of connection-level options used
1123 for the request are a superset of those various sources.
1124
1125 The "normalized" (or "superimposed") opt object's URL may be
1126 modified before the request is sent, as follows:
1127
1128 if opt.urlParam is a string then it is assumed to be properly
1129 URL-encoded parameters and is appended to the opt.url. If it is
1130 an Object then it is assumed to be a one-dimensional set of
1131 key/value pairs with simple values (numbers, strings, booleans,
1132 null, and NOT objects/arrays). The keys/values are URL-encoded
1133 and appended to the URL.
1134
1135 The beforeSend() callback (see below) can modify the options
1136 object before the request attempt is made.
1137
1138 The callbacks in the normalized opt object will be triggered as
1139 follows (if they are set to Function values):
1140
1141 - beforeSend(request,opt) will be called before any network
1142 processing starts. If beforeSend() throws then no other
1143 callbacks are triggered and this function propagates the
1144 exception. This function is passed normalized connection options
1145 as its second parameter, and changes this function makes to that
1146 object _will_ be used for the pending connection attempt.
1147
1148 - onError(request,opt) will be called if a connection to the
1149 back-end cannot be established. It will be passed the original
1150 request object (which might be null, depending on the request
1151 type) and the normalized options object. In the error case, the
1152 opt object passed to onError() "should" have a property called
1153 "errorMessage" which contains a description of the problem.
1154
1155 - onError(request,opt) will also be called if connection
1156 succeeds but the response is not JSON data.
1157
1158 - onResponse(response,request) will be called if the response
1159 returns JSON data. That data might hold an error response code -
1160 clients need to check for that. It is passed the response object
1161 (a plain object) and the original request object.
1162
1163 - afterSend(request,opt) will be called directly after the
1164 AJAX request is finished, before onError() or onResonse() are
1165 called. Possible TODO: we explicitly do NOT pass the response to
1166 this function in order to keep the line between the responsibilities
1167 of the various callback clear (otherwise this could be used the same
@@ -1179,14 +1179,14 @@
1179 {
1180 throw new Error("This object has no sendImpl() member function! I don't know how to send the request!");
1181 }
1182 var ex = false;
1183 var av = Array.prototype.slice.apply( arguments, [0] );
1184
1185 /**
1186 FIXME: how to handle the error, vis-a-vis- the callbacks, if
1187 normalizeAjaxParameters() throws? It can throw if
1188 (de)JSON-izing fails.
1189 */
1190 var norm = this.normalizeAjaxParameters( WhAjaj.isObject(opt) ? opt : {} );
1191 norm.url = WhAjaj.Connector.sendHelper.normalizeURL(norm);
1192 if( ! request ) norm.method = 'GET';
1193
--- ajax/js/whajaj.js
+++ ajax/js/whajaj.js
@@ -10,22 +10,22 @@
10 acts as namespace for this framework.
11
12 Author: Stephan Beal (http://wanderinghorse.net/home/stephan/)
13
14 License: Public Domain
15
16 This framework is directly derived from code originally found in
17 http://code.google.com/p/jsonmessage, and later in
18 http://whiki.wanderinghorse.net, where it contained quite a bit
19 of application-specific logic. It was eventually (the 3rd time i
20 needed it) split off into its own library to simplify inclusion
21 into my many mini-projects.
22 */
23
24
25 /**
26 The WhAjaj function is primarily a namespace, and not intended
27 to called or instantiated via the 'new' operator.
28 */
29 function WhAjaj()
30 {
31 }
@@ -36,11 +36,11 @@
36 return (new Date()).getTime();
37 };
38
39 /** Returns a Unix Epoch timestamp (in seconds) in integer format.
40
41 Reminder to self: (1.1 %1.2) evaluates to a floating-point value
42 in JS, and thus this implementation is less than optimal.
43 */
44 WhAjaj.unixTimestamp = function()
45 {
46 var ts = (new Date()).getTime();
@@ -88,22 +88,22 @@
88 };
89
90 /**
91 Parses window.location.search-style string into an object
92 containing key/value pairs of URL arguments (already urldecoded).
93
94 If the str argument is not passed (arguments.length==0) then
95 window.location.search.substring(1) is used by default. If
96 neither str is passed in nor window exists then false is returned.
97
98 On success it returns an Object containing the key/value pairs
99 parsed from the string. Keys which have no value are treated
100 has having the boolean true value.
101
102 FIXME: for keys in the form "name[]", build an array of results,
103 like PHP does.
104
105 */
106 WhAjaj.processUrlArgs = function(str) {
107 if( 0 === arguments.length ) {
108 if( ('undefined' === typeof window) ||
109 !window.location ||
@@ -127,11 +127,11 @@
127 /**
128 A simple wrapper around JSON.stringify(), using my own personal
129 preferred values for the 2nd and 3rd parameters. To globally
130 set its indentation level, assign WhAjaj.stringify.indent to
131 an integer value (0 for no intendation).
132
133 This function is intended only for human-readable output, not
134 generic over-the-wire JSON output (where JSON.stringify(val) will
135 produce smaller results).
136 */
137 WhAjaj.stringify = function(val) {
@@ -138,34 +138,34 @@
138 if( ! arguments.callee.indent ) arguments.callee.indent = 4;
139 return JSON.stringify(val,0,arguments.callee.indent);
140 };
141
142 /**
143 Each instance of this class holds state information for making
144 AJAJ requests to a back-end system. While clients may use one
145 "requester" object per connection attempt, for connections to the
146 same back-end, using an instance configured for that back-end
147 can simplify usage. This class is designed so that the actual
148 connection-related details (i.e. _how_ it connects to the
149 back-end) may be re-implemented to use a client's preferred
150 connection mechanism (e.g. jQuery).
151
152 The optional opt paramater may be an object with any (or all) of
153 the properties documented for WhAjaj.Connector.options.ajax.
154 Properties set here (or later via modification of the "options"
155 property of this object) will be used in calls to
156 WhAjaj.Connector.sendRequest(), and these override (normally) any
157 options set in WhAjaj.Connector.options.ajax. Note that
158 WhAjaj.Connector.sendRequest() _also_ takes an options object,
159 and ones passed there will override, for purposes of that one
160 request, any options passed in here or defined in
161 WhAjaj.Connector.options.ajax. See WhAjaj.Connector.options.ajax
162 and WhAjaj.Connector.prototype.sendRequest() for more details
163 about the precedence of options.
164
165 Sample usage:
166
167 @code
168 // Set up common connection-level options:
169 var cgi = new WhAjaj.Connector({
170 url: '/cgi-bin/my.cgi',
171 timeout:10000,
@@ -185,25 +185,25 @@
185 @endcode
186
187 For common request types, clients can add functions to this
188 object which act as wrappers for backend-specific functionality. As
189 a simple example:
190
191 @code
192 cgi.login = function(name,pw,ajajOpt) {
193 this.sendRequest(
194 {command:"json/login",
195 name:name,
196 password:pw
197 }, ajajOpt );
198 };
199 @endcode
200
201 TODOs:
202
203 - Caching of page-load requests, with a configurable lifetime.
204
205 - Use-cases like the above login() function are a tiny bit
206 problematic to implement when each request has a different URL
207 path (i know this from the whiki and fossil implementations).
208 This is partly a side-effect of design descisions made back in
209 the very first days of this code's life. i need to go through
@@ -230,42 +230,42 @@
230 A (meaningless) prefix to apply to WhAjaj.Connector-generated
231 request IDs.
232 */
233 requestIdPrefix:'WhAjaj.Connector-',
234 /**
235 Default options for WhAjaj.Connector.sendRequest() connection
236 parameters. This object holds only connection-related
237 options and callbacks (all optional), and not options
238 related to the required JSON structure of any given request.
239 i.e. the page name used in a get-page request are not set
240 here but are specified as part of the request object.
241
242 These connection options are a "normalized form" of options
243 often found in various AJAX libraries like jQuery,
244 Prototype, dojo, etc. This approach allows us to swap out
245 the real connection-related parts by writing a simple proxy
246 which transforms our "normalized" form to the
247 backend-specific form. For examples, see the various
248 implementations stored in WhAjaj.Connector.sendImpls.
249
250 The following callback options are, in practice, almost
251 always set globally to some app-wide defaults:
252
253 - onError() to report errors using a common mechanism.
254 - beforeSend() to start a visual activity notification
255 - afterSend() to disable the visual activity notification
256
257 However, be aware that if any given WhAjaj.Connector instance is
258 given its own before/afterSend callback then those will
259 override these. Mixing shared/global and per-instance
260 callbacks can potentially lead to confusing results if, e.g.,
261 the beforeSend() and afterSend() functions have side-effects
262 but are not used with their proper before/after partner.
263
264 TODO: rename this to 'ajaj' (the name is historical). The
265 problem with renaming it is is that the word 'ajax' is
266 pretty prevelant in the source tree, so i can't globally
267 swap it out.
268 */
269 ajax: {
270 /**
271 URL of the back-end server/CGI.
@@ -273,48 +273,48 @@
273 url: '/some/path',
274
275 /**
276 Connection method. Some connection-related functions might
277 override any client-defined setting.
278
279 Must be one of 'GET' or 'POST'. For custom connection
280 implementation, it may optionally be some
281 implementation-specified value.
282
283 Normally the API can derive this value automatically - if the
284 request uses JSON data it is POSTed, else it is GETted.
285 */
286 method:'GET',
287
288 /**
289 A hint whether to run the operation asynchronously or
290 not. Not all concrete WhAjaj.Connector.sendImpl()
291 implementations can support this. Interestingly, at
292 least one popular AJAX toolkit does not document
293 supporting _synchronous_ AJAX operations. All common
294 browser-side implementations support async operation, but
295 non-browser implementations might not.
296 */
297 asynchronous:true,
298
299 /**
300 A HTTP authentication login name for the AJAX
301 connection. Not all concrete WhAjaj.Connector.sendImpl()
302 implementations can support this.
303 */
304 loginName:undefined,
305
306 /**
307 An HTTP authentication login password for the AJAJ
308 connection. Not all concrete WhAjaj.Connector.sendImpl()
309 implementations can support this.
310 */
311 loginPassword:undefined,
312
313 /**
314 A connection timeout, in milliseconds, for establishing
315 an AJAJ connection. Not all concrete
316 WhAjaj.Connector.sendImpl() implementations can support this.
317 */
318 timeout:10000,
319
320 /**
@@ -328,11 +328,11 @@
328 is the same as the 'this' object for the context of the
329 callback, but is provided because the instance-level
330 callbacks (set in (WhAjaj.Connector instance).callbacks,
331 require it in some cases (because their 'this' is
332 different!).
333
334 Note that the response might contain error information
335 which comes from the back-end. The difference between
336 this error info and the info passed to the onError()
337 callback is that this data indicates an
338 application-level error, whereas onError() is used to
@@ -342,21 +342,21 @@
342 connection error).
343 */
344 onResponse: function(response, request, opt){},
345
346 /**
347 If an AJAX request fails to establish a connection or it
348 receives non-JSON data from the back-end, this function
349 is called (e.g. timeout error or host name not
350 resolvable). It is passed the originating request and the
351 "normalized" connection parameters used for that
352 request. The connectOpt object "should" (or "might")
353 have an "errorMessage" property which describes the
354 nature of the problem.
355
356 Clients will almost always want to replace the default
357 implementation with something which integrates into
358 their application.
359 */
360 onError: function(request, connectOpt)
361 {
362 alert('AJAJ request failed:\n'
@@ -364,60 +364,60 @@
364 +JSON.stringify(connectOpt,0,4)
365 );
366 },
367
368 /**
369 Called before each connection attempt is made. Clients
370 can use this to, e.g., enable a visual "network activity
371 notification" for the user. It is passed the original
372 request object and the normalized connection parameters
373 for the request. If this function changes opt, those
374 changes _are_ applied to the subsequent request. If this
375 function throws, neither the onError() nor afterSend()
376 callbacks are triggered and WhAjaj.Connector.sendImpl()
377 propagates the exception back to the caller.
378 */
379 beforeSend: function(request,opt){},
380
381 /**
382 Called after an AJAJ connection attempt completes,
383 regardless of success or failure. Passed the same
384 parameters as beforeSend() (see that function for
385 details).
386
387 Here's an example of setting up a visual notification on
388 ajax operations using jQuery (but it's also easy to do
389 without jQuery as well):
390
391 @code
392 function startAjaxNotif(req,opt) {
393 var me = arguments.callee;
394 var c = ++me.ajaxCount;
395 me.element.text( c + " pending AJAX operation(s)..." );
396 if( 1 == c ) me.element.stop().fadeIn();
397 }
398 startAjaxNotif.ajaxCount = 0.
399 startAjaxNotif.element = jQuery('#whikiAjaxNotification');
400
401 function endAjaxNotif() {
402 var c = --startAjaxNotif.ajaxCount;
403 startAjaxNotif.element.text( c+" pending AJAX operation(s)..." );
404 if( 0 == c ) startAjaxNotif.element.stop().fadeOut();
405 }
406 @endcode
407
408 Set the beforeSend/afterSend properties to those
409 functions to enable the notifications by default.
410 */
411 afterSend: function(request,opt){},
412
413 /**
414 If jsonp is a string then the WhAjaj-internal response
415 handling code ASSUMES that the response contains a JSONP-style
416 construct and eval()s it after afterSend() but before onResponse().
417 In this case, onResponse() will get a string value for the response
418 instead of a response object parsed from JSON.
419 */
420 jsonp:undefined,
421 /**
422 Don't use yet. Planned future option.
423 */
@@ -468,25 +468,25 @@
468 else v = WhAjaj.Connector.options.ajax[key];
469 return v;
470 };
471
472 /**
473 Returns a unique string on each call containing a generic
474 reandom request identifier string. This is not used by the core
475 API but can be used by client code to generate unique IDs for
476 each request (if needed).
477
478 The exact format is unspecified and may change in the future.
479
480 Request IDs can be used by clients to "match up" responses to
481 specific requests if needed. In practice, however, they are
482 seldom, if ever, needed. When passing several concurrent
483 requests through the same response callback, it might be useful
484 for some clients to be able to distinguish, possibly re-routing
485 them through other handlers based on the originating request type.
486
487 If this.options.requestIdPrefix or
488 WhAjaj.Connector.options.requestIdPrefix is set then that text
489 is prefixed to the returned string.
490 */
491 WhAjaj.Connector.prototype.generateRequestId = function()
492 {
@@ -512,39 +512,39 @@
512 }
513 return this.options;
514 };
515
516 /**
517 An internal helper object which holds several functions intended
518 to simplify the creation of concrete communication channel
519 implementations for WhAjaj.Connector.sendImpl(). These operations
520 take care of some of the more error-prone parts of ensuring that
521 onResponse(), onError(), etc. callbacks are called consistently
522 using the same rules.
523 */
524 WhAjaj.Connector.sendHelper = {
525 /**
526 opt is assumed to be a normalized set of
527 WhAjaj.Connector.sendRequest() options. This function
528 creates a url by concatenating opt.url and some form of
529 opt.urlParam.
530
531 If opt.urlParam is an object or string then it is appended
532 to the url. An object is assumed to be a one-dimensional set
533 of simple (urlencodable) key/value pairs, and not larger
534 data structures. A string value is assumed to be a
535 well-formed, urlencoded set of key/value pairs separated by
536 '&' characters.
537
538 The new/normalized URL is returned (opt is not modified). If
539 opt.urlParam is not set then opt.url is returned (or an
540 empty string if opt.url is itself a false value).
541
542 TODO: if opt is-a Object and any key points to an array,
543 build up a list of keys in the form "keyname[]". We could
544 arguably encode sub-objects like "keyname[subkey]=...", but
545 i don't know if that's conventions-compatible with other
546 frameworks.
547 */
548 normalizeURL: function(opt) {
549 var u = opt.url || '';
550 if( opt.urlParam ) {
@@ -564,50 +564,50 @@
564 u = u + (addQ ? '?' : '') + (addA ? '&' : '') + tail;
565 }
566 return u;
567 },
568 /**
569 Should be called by WhAjaj.Connector.sendImpl()
570 implementations after a response has come back. This
571 function takes care of most of ensuring that framework-level
572 conventions involving WhAjaj.Connector.options.ajax
573 properties are followed.
574
575 The request argument must be the original request passed to
576 the sendImpl() function. It may legally be null for GET requests.
577
578 The opt object should be the normalized AJAX options used
579 for the connection.
580
581 The resp argument may be either a plain Object or a string
582 (in which case it is assumed to be JSON).
583
584 The 'this' object for this call MUST be a WhAjaj.Connector
585 instance in order for callback processing to work properly.
586
587 This function takes care of the following:
588
589 - Calling opt.afterSend()
590
591 - If resp is a string, de-JSON-izing it to an object.
592
593 - Calling opt.onResponse()
594
595 - Calling opt.onError() in several common (potential) error
596 cases.
597
598 - If resp is-a String and opt.jsonp then resp is assumed to be
599 a JSONP-form construct and is eval()d BEFORE opt.onResponse()
600 is called. It is arguable to eval() it first, but the logic
601 integrates better with the non-jsonp handler.
602
603 The sendImpl() should return immediately after calling this.
604
605 The sendImpl() must call only one of onSendSuccess() or
606 onSendError(). It must call one of them or it must implement
607 its own response/error handling, which is not recommended
608 because getting the documented semantics of the
609 onError/onResponse/afterSend handling correct can be tedious.
610 */
611 onSendSuccess:function(request,resp,opt) {
612 var cb = this.callbacks || {};
613 if( WhAjaj.isFunction(cb.afterSend) ) {
@@ -666,23 +666,23 @@
666 Should be called by sendImpl() implementations after a response
667 has failed to connect (e.g. could not resolve host or timeout
668 reached). This function takes care of most of ensuring that
669 framework-level conventions involving WhAjaj.Connector.options.ajax
670 properties are followed.
671
672 The request argument must be the original request passed to
673 the sendImpl() function. It may legally be null for GET
674 requests.
675
676 The 'this' object for this call MUST be a WhAjaj.Connector
677 instance in order for callback processing to work properly.
678
679 The opt object should be the normalized AJAX options used
680 for the connection. By convention, the caller of this
681 function "should" set opt.errorMessage to contain a
682 human-readable description of the error.
683
684 The sendImpl() should return immediately after calling this. The
685 return value from this function is unspecified.
686 */
687 onSendError: function(request,opt) {
688 var cb = this.callbacks || {};
@@ -704,64 +704,64 @@
704 }
705 }
706 };
707
708 /**
709 WhAjaj.Connector.sendImpls holds several concrete
710 implementations of WhAjaj.Connector.prototype.sendImpl(). To use
711 a specific implementation by default assign
712 WhAjaj.Connector.prototype.sendImpl to one of these functions.
713
714 The functions defined here require that the 'this' object be-a
715 WhAjaj.Connector instance.
716
717 Historical notes:
718
719 a) We once had an implementation based on Prototype, but that
720 library just pisses me off (they change base-most types'
721 prototypes, introducing side-effects in client code which
722 doesn't even use Prototype). The Prototype version at the time
723 had a serious toJSON() bug which caused empty arrays to
724 serialize as the string "[]", which broke a bunch of my code.
725 (That has been fixed in the mean time, but i don't use
726 Prototype.)
727
728 b) We once had an implementation for the dojo library,
729
730 If/when the time comes to add Prototype/dojo support, we simply
731 need to port:
732
733 http://code.google.com/p/jsonmessage/source/browse/trunk/lib/JSONMessage/JSONMessage.inc.js
734
735 (search that file for "dojo" and "Prototype") to this tree. That
736 code is this code's generic grandfather and they are still very
737 similar, so a port is trivial.
738
739 */
740 WhAjaj.Connector.sendImpls = {
741 /**
742 This is a concrete implementation of
743 WhAjaj.Connector.prototype.sendImpl() which uses the
744 environment's native XMLHttpRequest class to send whiki
745 requests and fetch the responses.
746
747 The only argument must be a connection properties object, as
748 constructed by WhAjaj.Connector.normalizeAjaxParameters().
749
750 If window.firebug is set then window.firebug.watchXHR() is
751 called to enable monitoring of the XMLHttpRequest object.
752
753 This implementation honors the loginName and loginPassword
754 connection parameters.
755
756 Returns the XMLHttpRequest object.
757
758 This implementation requires that the 'this' object be-a
759 WhAjaj.Connector.
760
761 This implementation uses setTimeout() to implement the
762 timeout support, and thus the JS engine must provide that
763 functionality.
764 */
765 XMLHttpRequest: function(request, args)
766 {
767 var json = WhAjaj.isObject(request) ? JSON.stringify(request) : request;
@@ -864,30 +864,30 @@
864 WhAjaj.Connector.sendHelper.onSendError.apply( whself, [request, args] );
865 return undefined;
866 }
867 }/*XMLHttpRequest()*/,
868 /**
869 This is a concrete implementation of
870 WhAjaj.Connector.prototype.sendImpl() which uses the jQuery
871 AJAX API to send requests and fetch the responses.
872
873 The first argument may be either null/false, an Object
874 containing toJSON-able data to post to the back-end, or such an
875 object in JSON string form.
876
877 The second argument must be a connection properties object, as
878 constructed by WhAjaj.Connector.normalizeAjaxParameters().
879
880 If window.firebug is set then window.firebug.watchXHR() is
881 called to enable monitoring of the XMLHttpRequest object.
882
883 This implementation honors the loginName and loginPassword
884 connection parameters.
885
886 Returns the XMLHttpRequest object.
887
888 This implementation requires that the 'this' object be-a
889 WhAjaj.Connector.
890 */
891 jQuery:function(request,args)
892 {
893 var data = request || undefined;
@@ -943,12 +943,12 @@
943 WhAjaj.Connector.sendHelper.onSendError.apply( whself, [request, args] );
944 return undefined;
945 }
946 }/*jQuery()*/,
947 /**
948 This is a concrete implementation of
949 WhAjaj.Connector.prototype.sendImpl() which uses the rhino
950 Java API to send requests and fetch the responses.
951
952 Limitations vis-a-vis the interface:
953
954 - timeouts are not supported.
@@ -1051,28 +1051,28 @@
1051 WhAjaj.Connector.sendHelper.onSendSuccess.apply( self, [request, json, args] );
1052 }/*rhino*/
1053 };
1054
1055 /**
1056 An internal function which takes an object containing properties
1057 for a WhAjaj.Connector network request. This function creates a new
1058 object containing a superset of the properties from:
1059
1060 a) opt
1061 b) this.options
1062 c) WhAjaj.Connector.options.ajax
1063
1064 in that order, using the first one it finds.
1065
1066 All non-function properties are _deeply_ copied via JSON cloning
1067 in order to prevent accidental "cross-request pollenation" (been
1068 there, done that). Functions cannot be cloned and are simply
1069 copied by reference.
1070
1071 This function throws if JSON-copying one of the options fails
1072 (e.g. due to cyclic data structures).
1073
1074 Reminder to self: this function does not "normalize" opt.urlParam
1075 by encoding it into opt.url, mainly for historical reasons, but
1076 also because that behaviour was specifically undesirable in this
1077 code's genetic father.
1078 */
@@ -1100,68 +1100,68 @@
1100 // no, not here: rc.url = WhAjaj.Connector.sendHelper.normalizeURL(rc);
1101 return rc;
1102 };
1103
1104 /**
1105 This is the generic interface for making calls to a back-end
1106 JSON-producing request handler. It is a simple wrapper around
1107 WhAjaj.Connector.prototype.sendImpl(), which just normalizes the
1108 connection options for sendImpl() and makes sure that
1109 opt.beforeSend() is (possibly) called.
1110
1111 The request parameter must either be false/null/empty or a
1112 fully-populated JSON-able request object (which will be sent as
1113 unencoded application/json text), depending on the type of
1114 request being made. It is never semantically legal (in this API)
1115 for request to be a string/number/true/array value. As a rule,
1116 only POST requests use the request data. GET requests should
1117 encode their data in opt.url or opt.urlParam (see below).
1118
1119 opt must contain the network-related parameters for the request.
1120 Paramters _not_ set in opt are pulled from this.options or
1121 WhAjaj.Connector.options.ajax (in that order, using the first
1122 value it finds). Thus the set of connection-level options used
1123 for the request are a superset of those various sources.
1124
1125 The "normalized" (or "superimposed") opt object's URL may be
1126 modified before the request is sent, as follows:
1127
1128 if opt.urlParam is a string then it is assumed to be properly
1129 URL-encoded parameters and is appended to the opt.url. If it is
1130 an Object then it is assumed to be a one-dimensional set of
1131 key/value pairs with simple values (numbers, strings, booleans,
1132 null, and NOT objects/arrays). The keys/values are URL-encoded
1133 and appended to the URL.
1134
1135 The beforeSend() callback (see below) can modify the options
1136 object before the request attempt is made.
1137
1138 The callbacks in the normalized opt object will be triggered as
1139 follows (if they are set to Function values):
1140
1141 - beforeSend(request,opt) will be called before any network
1142 processing starts. If beforeSend() throws then no other
1143 callbacks are triggered and this function propagates the
1144 exception. This function is passed normalized connection options
1145 as its second parameter, and changes this function makes to that
1146 object _will_ be used for the pending connection attempt.
1147
1148 - onError(request,opt) will be called if a connection to the
1149 back-end cannot be established. It will be passed the original
1150 request object (which might be null, depending on the request
1151 type) and the normalized options object. In the error case, the
1152 opt object passed to onError() "should" have a property called
1153 "errorMessage" which contains a description of the problem.
1154
1155 - onError(request,opt) will also be called if connection
1156 succeeds but the response is not JSON data.
1157
1158 - onResponse(response,request) will be called if the response
1159 returns JSON data. That data might hold an error response code -
1160 clients need to check for that. It is passed the response object
1161 (a plain object) and the original request object.
1162
1163 - afterSend(request,opt) will be called directly after the
1164 AJAX request is finished, before onError() or onResonse() are
1165 called. Possible TODO: we explicitly do NOT pass the response to
1166 this function in order to keep the line between the responsibilities
1167 of the various callback clear (otherwise this could be used the same
@@ -1179,14 +1179,14 @@
1179 {
1180 throw new Error("This object has no sendImpl() member function! I don't know how to send the request!");
1181 }
1182 var ex = false;
1183 var av = Array.prototype.slice.apply( arguments, [0] );
1184
1185 /**
1186 FIXME: how to handle the error, vis-a-vis- the callbacks, if
1187 normalizeAjaxParameters() throws? It can throw if
1188 (de)JSON-izing fails.
1189 */
1190 var norm = this.normalizeAjaxParameters( WhAjaj.isObject(opt) ? opt : {} );
1191 norm.url = WhAjaj.Connector.sendHelper.normalizeURL(norm);
1192 if( ! request ) norm.method = 'GET';
1193
--- ajax/wiki-editor.html
+++ ajax/wiki-editor.html
@@ -277,11 +277,11 @@
277277
if(resp.resultCode) return;
278278
delete p.isNew;
279279
p.timestamp = resp.payload.timestamp;
280280
}
281281
});
282
-
282
+
283283
};
284284
285285
TheApp.createNewPage = function(){
286286
var name = prompt("New page name?");
287287
if(!name) return;
288288
--- ajax/wiki-editor.html
+++ ajax/wiki-editor.html
@@ -277,11 +277,11 @@
277 if(resp.resultCode) return;
278 delete p.isNew;
279 p.timestamp = resp.payload.timestamp;
280 }
281 });
282
283 };
284
285 TheApp.createNewPage = function(){
286 var name = prompt("New page name?");
287 if(!name) return;
288
--- ajax/wiki-editor.html
+++ ajax/wiki-editor.html
@@ -277,11 +277,11 @@
277 if(resp.resultCode) return;
278 delete p.isNew;
279 p.timestamp = resp.payload.timestamp;
280 }
281 });
282
283 };
284
285 TheApp.createNewPage = function(){
286 var name = prompt("New page name?");
287 if(!name) return;
288
+2 -2
--- src/fshell.c
+++ src/fshell.c
@@ -90,11 +90,11 @@
9090
for(i=1; i<nArg; i++){
9191
fossil_print("argv[%d] = [%s]\n", i, azArg[i]);
9292
}
9393
}
9494
95
- /* Special cases */
95
+ /* Special cases */
9696
if( nArg<2 ) continue;
9797
if( fossil_strcmp(azArg[1],"exit")==0 ) break;
9898
9999
/* Fork a process to handle the command */
100100
childPid = fork();
@@ -112,7 +112,7 @@
112112
/* The parent process */
113113
int status;
114114
waitpid(childPid, &status, 0);
115115
}
116116
}
117
-#endif
117
+#endif
118118
}
119119
--- src/fshell.c
+++ src/fshell.c
@@ -90,11 +90,11 @@
90 for(i=1; i<nArg; i++){
91 fossil_print("argv[%d] = [%s]\n", i, azArg[i]);
92 }
93 }
94
95 /* Special cases */
96 if( nArg<2 ) continue;
97 if( fossil_strcmp(azArg[1],"exit")==0 ) break;
98
99 /* Fork a process to handle the command */
100 childPid = fork();
@@ -112,7 +112,7 @@
112 /* The parent process */
113 int status;
114 waitpid(childPid, &status, 0);
115 }
116 }
117 #endif
118 }
119
--- src/fshell.c
+++ src/fshell.c
@@ -90,11 +90,11 @@
90 for(i=1; i<nArg; i++){
91 fossil_print("argv[%d] = [%s]\n", i, azArg[i]);
92 }
93 }
94
95 /* Special cases */
96 if( nArg<2 ) continue;
97 if( fossil_strcmp(azArg[1],"exit")==0 ) break;
98
99 /* Fork a process to handle the command */
100 childPid = fork();
@@ -112,7 +112,7 @@
112 /* The parent process */
113 int status;
114 waitpid(childPid, &status, 0);
115 }
116 }
117 #endif
118 }
119
+2 -2
--- src/shun.c
+++ src/shun.c
@@ -493,15 +493,15 @@
493493
db_multi_exec(
494494
"DELETE FROM unversioned WHERE rcvid=%d", rcvid
495495
);
496496
}
497497
db_finalize(&q);
498
- db_prepare(&q,
498
+ db_prepare(&q,
499499
"SELECT name, hash, sz\n"
500500
" FROM unversioned "
501501
" WHERE rcvid=%d", rcvid
502
-
503502
);
503
+ );
504504
while( db_step(&q)==SQLITE_ROW ){
505505
const char *zName = db_column_text(&q,0);
506506
const char *zHash = db_column_text(&q,1);
507507
int size = db_column_int(&q,2);
508508
int isDeleted = zHash==0;
509509
--- src/shun.c
+++ src/shun.c
@@ -493,15 +493,15 @@
493 db_multi_exec(
494 "DELETE FROM unversioned WHERE rcvid=%d", rcvid
495 );
496 }
497 db_finalize(&q);
498 db_prepare(&q,
499 "SELECT name, hash, sz\n"
500 " FROM unversioned "
501 " WHERE rcvid=%d", rcvid
502
503 );
 
504 while( db_step(&q)==SQLITE_ROW ){
505 const char *zName = db_column_text(&q,0);
506 const char *zHash = db_column_text(&q,1);
507 int size = db_column_int(&q,2);
508 int isDeleted = zHash==0;
509
--- src/shun.c
+++ src/shun.c
@@ -493,15 +493,15 @@
493 db_multi_exec(
494 "DELETE FROM unversioned WHERE rcvid=%d", rcvid
495 );
496 }
497 db_finalize(&q);
498 db_prepare(&q,
499 "SELECT name, hash, sz\n"
500 " FROM unversioned "
501 " WHERE rcvid=%d", rcvid
 
502 );
503 );
504 while( db_step(&q)==SQLITE_ROW ){
505 const char *zName = db_column_text(&q,0);
506 const char *zHash = db_column_text(&q,1);
507 int size = db_column_int(&q,2);
508 int isDeleted = zHash==0;
509
+1 -1
--- src/timeline.c
+++ src/timeline.c
@@ -2046,11 +2046,11 @@
20462046
** after
20472047
** descendants | children
20482048
** ancestors | parents
20492049
**
20502050
** The CHECKIN can be any unique prefix of 4 characters or more. You
2051
-** can also say "current" for the current version.
2051
+** can also say "current" for the current version.
20522052
**
20532053
** DATETIME may be "now" or "YYYY-MM-DDTHH:MM:SS.SSS". If in
20542054
** year-month-day form, it may be truncated, the "T" may be replaced by
20552055
** a space, and it may also name a timezone offset from UTC as "-HH:MM"
20562056
** (westward) or "+HH:MM" (eastward). Either no timezone suffix or "Z"
20572057
--- src/timeline.c
+++ src/timeline.c
@@ -2046,11 +2046,11 @@
2046 ** after
2047 ** descendants | children
2048 ** ancestors | parents
2049 **
2050 ** The CHECKIN can be any unique prefix of 4 characters or more. You
2051 ** can also say "current" for the current version.
2052 **
2053 ** DATETIME may be "now" or "YYYY-MM-DDTHH:MM:SS.SSS". If in
2054 ** year-month-day form, it may be truncated, the "T" may be replaced by
2055 ** a space, and it may also name a timezone offset from UTC as "-HH:MM"
2056 ** (westward) or "+HH:MM" (eastward). Either no timezone suffix or "Z"
2057
--- src/timeline.c
+++ src/timeline.c
@@ -2046,11 +2046,11 @@
2046 ** after
2047 ** descendants | children
2048 ** ancestors | parents
2049 **
2050 ** The CHECKIN can be any unique prefix of 4 characters or more. You
2051 ** can also say "current" for the current version.
2052 **
2053 ** DATETIME may be "now" or "YYYY-MM-DDTHH:MM:SS.SSS". If in
2054 ** year-month-day form, it may be truncated, the "T" may be replaced by
2055 ** a space, and it may also name a timezone offset from UTC as "-HH:MM"
2056 ** (westward) or "+HH:MM" (eastward). Either no timezone suffix or "Z"
2057
--- src/unversioned.c
+++ src/unversioned.c
@@ -34,11 +34,11 @@
3434
static const char zUnversionedInit[] =
3535
@ CREATE TABLE IF NOT EXISTS repository.unversioned(
3636
@ name TEXT PRIMARY KEY, -- Name of the uv file
3737
@ rcvid INTEGER, -- Where received from
3838
@ mtime DATETIME, -- timestamp. Seconds since 1970.
39
-@ hash TEXT, -- Content hash. NULL if a delete marker
39
+@ hash TEXT, -- Content hash. NULL if a delete marker
4040
@ sz INTEGER, -- size of content after decompression
4141
@ encoding INT, -- 0: plaintext. 1: zlib compressed
4242
@ content BLOB -- content of the file. NULL if oversized
4343
@ ) WITHOUT ROWID;
4444
;
4545
--- src/unversioned.c
+++ src/unversioned.c
@@ -34,11 +34,11 @@
34 static const char zUnversionedInit[] =
35 @ CREATE TABLE IF NOT EXISTS repository.unversioned(
36 @ name TEXT PRIMARY KEY, -- Name of the uv file
37 @ rcvid INTEGER, -- Where received from
38 @ mtime DATETIME, -- timestamp. Seconds since 1970.
39 @ hash TEXT, -- Content hash. NULL if a delete marker
40 @ sz INTEGER, -- size of content after decompression
41 @ encoding INT, -- 0: plaintext. 1: zlib compressed
42 @ content BLOB -- content of the file. NULL if oversized
43 @ ) WITHOUT ROWID;
44 ;
45
--- src/unversioned.c
+++ src/unversioned.c
@@ -34,11 +34,11 @@
34 static const char zUnversionedInit[] =
35 @ CREATE TABLE IF NOT EXISTS repository.unversioned(
36 @ name TEXT PRIMARY KEY, -- Name of the uv file
37 @ rcvid INTEGER, -- Where received from
38 @ mtime DATETIME, -- timestamp. Seconds since 1970.
39 @ hash TEXT, -- Content hash. NULL if a delete marker
40 @ sz INTEGER, -- size of content after decompression
41 @ encoding INT, -- 0: plaintext. 1: zlib compressed
42 @ content BLOB -- content of the file. NULL if oversized
43 @ ) WITHOUT ROWID;
44 ;
45
+4 -4
--- src/xfer.c
+++ src/xfer.c
@@ -293,11 +293,11 @@
293293
** The file line is in one of the following two forms:
294294
**
295295
** uvfile NAME MTIME HASH SIZE FLAGS
296296
** uvfile NAME MTIME HASH SIZE FLAGS \n CONTENT
297297
**
298
-** If the 0x0001 bit of FLAGS is set, that means the file has been
298
+** If the 0x0001 bit of FLAGS is set, that means the file has been
299299
** deleted, SIZE is zero, the HASH is "-", and the "\n CONTENT" is omitted.
300300
**
301301
** SIZE is the number of bytes of CONTENT. The CONTENT is uncompressed.
302302
** HASH is the SHA1 hash of CONTENT.
303303
**
@@ -351,16 +351,16 @@
351351
/* Make sure we have a valid g.rcvid marker */
352352
content_rcvid_init();
353353
354354
/* Check to see if current content really should be overwritten. Ideally,
355355
** a uvfile card should never have been sent unless the overwrite should
356
- ** occur. But do not trust the sender. Double-check.
356
+ ** occur. But do not trust the sender. Double-check.
357357
*/
358358
iStatus = unversioned_status(blob_str(&pXfer->aToken[1]), mtime,
359359
blob_str(pHash));
360360
if( iStatus>=3 ) goto end_accept_unversioned_file;
361
-
361
+
362362
/* Store the content */
363363
isDelete = blob_eq(pHash, "-");
364364
if( isDelete ){
365365
db_prepare(&q,
366366
"UPDATE unversioned"
@@ -1038,11 +1038,11 @@
10381038
sqlite3_int64 mtime = db_column_int64(&uvq,1);
10391039
const char *zHash = db_column_text(&uvq,2);
10401040
int sz = db_column_int(&uvq,3);
10411041
nUvIgot++;
10421042
if( zHash==0 ){ sz = 0; zHash = "-"; }
1043
- blob_appendf(pXfer->pOut, "uvigot %s %lld %s %d\n",
1043
+ blob_appendf(pXfer->pOut, "uvigot %s %lld %s %d\n",
10441044
zName, mtime, zHash, sz);
10451045
}
10461046
db_finalize(&uvq);
10471047
}
10481048
}
10491049
--- src/xfer.c
+++ src/xfer.c
@@ -293,11 +293,11 @@
293 ** The file line is in one of the following two forms:
294 **
295 ** uvfile NAME MTIME HASH SIZE FLAGS
296 ** uvfile NAME MTIME HASH SIZE FLAGS \n CONTENT
297 **
298 ** If the 0x0001 bit of FLAGS is set, that means the file has been
299 ** deleted, SIZE is zero, the HASH is "-", and the "\n CONTENT" is omitted.
300 **
301 ** SIZE is the number of bytes of CONTENT. The CONTENT is uncompressed.
302 ** HASH is the SHA1 hash of CONTENT.
303 **
@@ -351,16 +351,16 @@
351 /* Make sure we have a valid g.rcvid marker */
352 content_rcvid_init();
353
354 /* Check to see if current content really should be overwritten. Ideally,
355 ** a uvfile card should never have been sent unless the overwrite should
356 ** occur. But do not trust the sender. Double-check.
357 */
358 iStatus = unversioned_status(blob_str(&pXfer->aToken[1]), mtime,
359 blob_str(pHash));
360 if( iStatus>=3 ) goto end_accept_unversioned_file;
361
362 /* Store the content */
363 isDelete = blob_eq(pHash, "-");
364 if( isDelete ){
365 db_prepare(&q,
366 "UPDATE unversioned"
@@ -1038,11 +1038,11 @@
1038 sqlite3_int64 mtime = db_column_int64(&uvq,1);
1039 const char *zHash = db_column_text(&uvq,2);
1040 int sz = db_column_int(&uvq,3);
1041 nUvIgot++;
1042 if( zHash==0 ){ sz = 0; zHash = "-"; }
1043 blob_appendf(pXfer->pOut, "uvigot %s %lld %s %d\n",
1044 zName, mtime, zHash, sz);
1045 }
1046 db_finalize(&uvq);
1047 }
1048 }
1049
--- src/xfer.c
+++ src/xfer.c
@@ -293,11 +293,11 @@
293 ** The file line is in one of the following two forms:
294 **
295 ** uvfile NAME MTIME HASH SIZE FLAGS
296 ** uvfile NAME MTIME HASH SIZE FLAGS \n CONTENT
297 **
298 ** If the 0x0001 bit of FLAGS is set, that means the file has been
299 ** deleted, SIZE is zero, the HASH is "-", and the "\n CONTENT" is omitted.
300 **
301 ** SIZE is the number of bytes of CONTENT. The CONTENT is uncompressed.
302 ** HASH is the SHA1 hash of CONTENT.
303 **
@@ -351,16 +351,16 @@
351 /* Make sure we have a valid g.rcvid marker */
352 content_rcvid_init();
353
354 /* Check to see if current content really should be overwritten. Ideally,
355 ** a uvfile card should never have been sent unless the overwrite should
356 ** occur. But do not trust the sender. Double-check.
357 */
358 iStatus = unversioned_status(blob_str(&pXfer->aToken[1]), mtime,
359 blob_str(pHash));
360 if( iStatus>=3 ) goto end_accept_unversioned_file;
361
362 /* Store the content */
363 isDelete = blob_eq(pHash, "-");
364 if( isDelete ){
365 db_prepare(&q,
366 "UPDATE unversioned"
@@ -1038,11 +1038,11 @@
1038 sqlite3_int64 mtime = db_column_int64(&uvq,1);
1039 const char *zHash = db_column_text(&uvq,2);
1040 int sz = db_column_int(&uvq,3);
1041 nUvIgot++;
1042 if( zHash==0 ){ sz = 0; zHash = "-"; }
1043 blob_appendf(pXfer->pOut, "uvigot %s %lld %s %d\n",
1044 zName, mtime, zHash, sz);
1045 }
1046 db_finalize(&uvq);
1047 }
1048 }
1049
+1 -1
--- test/amend.test
+++ test/amend.test
@@ -304,11 +304,11 @@
304304
set cancels {}
305305
set t1exp ""
306306
set t2exp "*"
307307
set t3exp "*"
308308
set t5exp "*"
309
- foreach tag $tagt {
309
+ foreach tag $tagt {
310310
lappend tags -tag $tag
311311
lappend cancels -cancel $tag
312312
}
313313
foreach res $result {
314314
append t1exp ", $res"
315315
--- test/amend.test
+++ test/amend.test
@@ -304,11 +304,11 @@
304 set cancels {}
305 set t1exp ""
306 set t2exp "*"
307 set t3exp "*"
308 set t5exp "*"
309 foreach tag $tagt {
310 lappend tags -tag $tag
311 lappend cancels -cancel $tag
312 }
313 foreach res $result {
314 append t1exp ", $res"
315
--- test/amend.test
+++ test/amend.test
@@ -304,11 +304,11 @@
304 set cancels {}
305 set t1exp ""
306 set t2exp "*"
307 set t3exp "*"
308 set t5exp "*"
309 foreach tag $tagt {
310 lappend tags -tag $tag
311 lappend cancels -cancel $tag
312 }
313 foreach res $result {
314 append t1exp ", $res"
315
--- test/revert.test
+++ test/revert.test
@@ -25,25 +25,25 @@
2525
# on the file system. 'fossil undo' is called after each test
2626
#
2727
proc revert-test {testid revertArgs expectedRevertOutput args} {
2828
global RESULT
2929
set passed 1
30
-
30
+
3131
set args [dict merge {
3232
-changes {} -addremove {} -exists {} -notexists {}
3333
} $args]
34
-
34
+
3535
set result [fossil revert {*}$revertArgs]
3636
test_status_list revert-$testid $result $expectedRevertOutput
37
-
37
+
3838
set statusListTests [list -changes changes -addremove {addremove -n}]
3939
foreach {key fossilArgs} $statusListTests {
4040
set expected [dict get $args $key]
41
- set result [fossil {*}$fossilArgs]
41
+ set result [fossil {*}$fossilArgs]
4242
test_status_list revert-$testid$key $result $expected
4343
}
44
-
44
+
4545
set fileExistsTests [list -exists 1 does -notexists 0 should]
4646
foreach {key expected verb} $fileExistsTests {
4747
foreach path [dict get $args $key] {
4848
if {[file exists $path] != $expected} {
4949
set passed 0
@@ -50,11 +50,11 @@
5050
protOut " Failure: File $verb not exist: $path"
5151
}
5252
}
5353
test revert-$testid$key $passed
5454
}
55
-
55
+
5656
fossil undo
5757
}
5858
5959
require_no_open_checkout
6060
test_setup
6161
--- test/revert.test
+++ test/revert.test
@@ -25,25 +25,25 @@
25 # on the file system. 'fossil undo' is called after each test
26 #
27 proc revert-test {testid revertArgs expectedRevertOutput args} {
28 global RESULT
29 set passed 1
30
31 set args [dict merge {
32 -changes {} -addremove {} -exists {} -notexists {}
33 } $args]
34
35 set result [fossil revert {*}$revertArgs]
36 test_status_list revert-$testid $result $expectedRevertOutput
37
38 set statusListTests [list -changes changes -addremove {addremove -n}]
39 foreach {key fossilArgs} $statusListTests {
40 set expected [dict get $args $key]
41 set result [fossil {*}$fossilArgs]
42 test_status_list revert-$testid$key $result $expected
43 }
44
45 set fileExistsTests [list -exists 1 does -notexists 0 should]
46 foreach {key expected verb} $fileExistsTests {
47 foreach path [dict get $args $key] {
48 if {[file exists $path] != $expected} {
49 set passed 0
@@ -50,11 +50,11 @@
50 protOut " Failure: File $verb not exist: $path"
51 }
52 }
53 test revert-$testid$key $passed
54 }
55
56 fossil undo
57 }
58
59 require_no_open_checkout
60 test_setup
61
--- test/revert.test
+++ test/revert.test
@@ -25,25 +25,25 @@
25 # on the file system. 'fossil undo' is called after each test
26 #
27 proc revert-test {testid revertArgs expectedRevertOutput args} {
28 global RESULT
29 set passed 1
30
31 set args [dict merge {
32 -changes {} -addremove {} -exists {} -notexists {}
33 } $args]
34
35 set result [fossil revert {*}$revertArgs]
36 test_status_list revert-$testid $result $expectedRevertOutput
37
38 set statusListTests [list -changes changes -addremove {addremove -n}]
39 foreach {key fossilArgs} $statusListTests {
40 set expected [dict get $args $key]
41 set result [fossil {*}$fossilArgs]
42 test_status_list revert-$testid$key $result $expected
43 }
44
45 set fileExistsTests [list -exists 1 does -notexists 0 should]
46 foreach {key expected verb} $fileExistsTests {
47 foreach path [dict get $args $key] {
48 if {[file exists $path] != $expected} {
49 set passed 0
@@ -50,11 +50,11 @@
50 protOut " Failure: File $verb not exist: $path"
51 }
52 }
53 test revert-$testid$key $passed
54 }
55
56 fossil undo
57 }
58
59 require_no_open_checkout
60 test_setup
61
+11 -11
--- test/stash.test
+++ test/stash.test
@@ -15,11 +15,11 @@
1515
#
1616
############################################################################
1717
#
1818
#
1919
# Tests for 'fossil stash'
20
-#
20
+#
2121
#
2222
2323
proc knownBug {t tests} {
2424
return [expr {$t in $tests ? "knownBug" : ""}]
2525
}
@@ -43,11 +43,11 @@
4343
# Also, if the exit status of fossil stash does not match
4444
# expectations, the rest of the areas are not tested.
4545
proc test_result_state {testid cmdArgs expectedOutput args} {
4646
global RESULT
4747
set passed 1
48
-
48
+
4949
set args [dict merge {
5050
-changes {} -addremove {} -exists {} -notexists {} -knownbugs {}
5151
} $args]
5252
5353
set knownbugs [dict get $args "-knownbugs"]
@@ -63,18 +63,18 @@
6363
if {$code} {
6464
return
6565
}
6666
}
6767
test_status_list $testid $result $expectedOutput [knownBug "-result" $knownbugs]
68
-
68
+
6969
set statusListTests [list -changes changes -addremove {addremove -n}]
7070
foreach {key fossilArgs} $statusListTests {
7171
set expected [dict get $args $key]
72
- set result [fossil {*}$fossilArgs]
72
+ set result [fossil {*}$fossilArgs]
7373
test_status_list $testid$key $result $expected [knownBug $key $knownbugs]
7474
}
75
-
75
+
7676
set fileExistsTests [list -exists 1 does -notexists 0 should]
7777
foreach {key expected verb} $fileExistsTests {
7878
foreach path [dict get $args $key] {
7979
if {[file exists $path] != $expected} {
8080
set passed 0
@@ -81,17 +81,17 @@
8181
protOut " Failure: File $verb not exist: $path"
8282
}
8383
}
8484
test $testid$key $passed [knownBug $key $knownbugs]
8585
}
86
-
86
+
8787
#fossil undo
8888
}
8989
9090
proc stash-test {testid stashArgs expectedStashOutput args} {
9191
fossil stash {*}$stashArgs
92
- return [test_result_state stash-$testid "stash $stashArgs" $expectedStashOutput {*}$args]
92
+ return [test_result_state stash-$testid "stash $stashArgs" $expectedStashOutput {*}$args]
9393
}
9494
9595
require_no_open_checkout
9696
test_setup
9797
@@ -243,15 +243,15 @@
243243
DELETE f1n
244244
} -exists {f1} -notexists {f1n} -knownbugs {-code -result}
245245
# TODO: add tests that verify the saved stash is sensible. Possibly
246246
# by applying it and checking results. But until the MISSING file
247247
# error is fixed, there is nothing stashed to test.
248
-
248
+
249249
250250
# Test stashing a newly added (but never committed) file. As with
251
-# fossil revert, fossil stash save unmanages the new file, but
252
-# leaves the copy present on disk. This is undocumented, but
251
+# fossil revert, fossil stash save unmanages the new file, but
252
+# leaves the copy present on disk. This is undocumented, but
253253
# probably sensible.
254254
test_setup
255255
write_file f1 "f1"
256256
write_file f2 "f2"
257257
fossil add f1 f2
@@ -282,11 +282,11 @@
282282
fossil status
283283
284284
285285
# Test stashing a rename of one file with at least one file
286286
# unchanged. This should stash (and revert) just the rename
287
-# operation. Instead it also stores and touches the unchanged file.
287
+# operation. Instead it also stores and touches the unchanged file.
288288
test_setup
289289
write_file f1 "f1"
290290
write_file f2 "f2"
291291
fossil add f1 f2
292292
fossil commit -m "baseline"
293293
--- test/stash.test
+++ test/stash.test
@@ -15,11 +15,11 @@
15 #
16 ############################################################################
17 #
18 #
19 # Tests for 'fossil stash'
20 #
21 #
22
23 proc knownBug {t tests} {
24 return [expr {$t in $tests ? "knownBug" : ""}]
25 }
@@ -43,11 +43,11 @@
43 # Also, if the exit status of fossil stash does not match
44 # expectations, the rest of the areas are not tested.
45 proc test_result_state {testid cmdArgs expectedOutput args} {
46 global RESULT
47 set passed 1
48
49 set args [dict merge {
50 -changes {} -addremove {} -exists {} -notexists {} -knownbugs {}
51 } $args]
52
53 set knownbugs [dict get $args "-knownbugs"]
@@ -63,18 +63,18 @@
63 if {$code} {
64 return
65 }
66 }
67 test_status_list $testid $result $expectedOutput [knownBug "-result" $knownbugs]
68
69 set statusListTests [list -changes changes -addremove {addremove -n}]
70 foreach {key fossilArgs} $statusListTests {
71 set expected [dict get $args $key]
72 set result [fossil {*}$fossilArgs]
73 test_status_list $testid$key $result $expected [knownBug $key $knownbugs]
74 }
75
76 set fileExistsTests [list -exists 1 does -notexists 0 should]
77 foreach {key expected verb} $fileExistsTests {
78 foreach path [dict get $args $key] {
79 if {[file exists $path] != $expected} {
80 set passed 0
@@ -81,17 +81,17 @@
81 protOut " Failure: File $verb not exist: $path"
82 }
83 }
84 test $testid$key $passed [knownBug $key $knownbugs]
85 }
86
87 #fossil undo
88 }
89
90 proc stash-test {testid stashArgs expectedStashOutput args} {
91 fossil stash {*}$stashArgs
92 return [test_result_state stash-$testid "stash $stashArgs" $expectedStashOutput {*}$args]
93 }
94
95 require_no_open_checkout
96 test_setup
97
@@ -243,15 +243,15 @@
243 DELETE f1n
244 } -exists {f1} -notexists {f1n} -knownbugs {-code -result}
245 # TODO: add tests that verify the saved stash is sensible. Possibly
246 # by applying it and checking results. But until the MISSING file
247 # error is fixed, there is nothing stashed to test.
248
249
250 # Test stashing a newly added (but never committed) file. As with
251 # fossil revert, fossil stash save unmanages the new file, but
252 # leaves the copy present on disk. This is undocumented, but
253 # probably sensible.
254 test_setup
255 write_file f1 "f1"
256 write_file f2 "f2"
257 fossil add f1 f2
@@ -282,11 +282,11 @@
282 fossil status
283
284
285 # Test stashing a rename of one file with at least one file
286 # unchanged. This should stash (and revert) just the rename
287 # operation. Instead it also stores and touches the unchanged file.
288 test_setup
289 write_file f1 "f1"
290 write_file f2 "f2"
291 fossil add f1 f2
292 fossil commit -m "baseline"
293
--- test/stash.test
+++ test/stash.test
@@ -15,11 +15,11 @@
15 #
16 ############################################################################
17 #
18 #
19 # Tests for 'fossil stash'
20 #
21 #
22
23 proc knownBug {t tests} {
24 return [expr {$t in $tests ? "knownBug" : ""}]
25 }
@@ -43,11 +43,11 @@
43 # Also, if the exit status of fossil stash does not match
44 # expectations, the rest of the areas are not tested.
45 proc test_result_state {testid cmdArgs expectedOutput args} {
46 global RESULT
47 set passed 1
48
49 set args [dict merge {
50 -changes {} -addremove {} -exists {} -notexists {} -knownbugs {}
51 } $args]
52
53 set knownbugs [dict get $args "-knownbugs"]
@@ -63,18 +63,18 @@
63 if {$code} {
64 return
65 }
66 }
67 test_status_list $testid $result $expectedOutput [knownBug "-result" $knownbugs]
68
69 set statusListTests [list -changes changes -addremove {addremove -n}]
70 foreach {key fossilArgs} $statusListTests {
71 set expected [dict get $args $key]
72 set result [fossil {*}$fossilArgs]
73 test_status_list $testid$key $result $expected [knownBug $key $knownbugs]
74 }
75
76 set fileExistsTests [list -exists 1 does -notexists 0 should]
77 foreach {key expected verb} $fileExistsTests {
78 foreach path [dict get $args $key] {
79 if {[file exists $path] != $expected} {
80 set passed 0
@@ -81,17 +81,17 @@
81 protOut " Failure: File $verb not exist: $path"
82 }
83 }
84 test $testid$key $passed [knownBug $key $knownbugs]
85 }
86
87 #fossil undo
88 }
89
90 proc stash-test {testid stashArgs expectedStashOutput args} {
91 fossil stash {*}$stashArgs
92 return [test_result_state stash-$testid "stash $stashArgs" $expectedStashOutput {*}$args]
93 }
94
95 require_no_open_checkout
96 test_setup
97
@@ -243,15 +243,15 @@
243 DELETE f1n
244 } -exists {f1} -notexists {f1n} -knownbugs {-code -result}
245 # TODO: add tests that verify the saved stash is sensible. Possibly
246 # by applying it and checking results. But until the MISSING file
247 # error is fixed, there is nothing stashed to test.
248
249
250 # Test stashing a newly added (but never committed) file. As with
251 # fossil revert, fossil stash save unmanages the new file, but
252 # leaves the copy present on disk. This is undocumented, but
253 # probably sensible.
254 test_setup
255 write_file f1 "f1"
256 write_file f2 "f2"
257 fossil add f1 f2
@@ -282,11 +282,11 @@
282 fossil status
283
284
285 # Test stashing a rename of one file with at least one file
286 # unchanged. This should stash (and revert) just the rename
287 # operation. Instead it also stores and touches the unchanged file.
288 test_setup
289 write_file f1 "f1"
290 write_file f2 "f2"
291 fossil add f1 f2
292 fossil commit -m "baseline"
293
+14 -14
--- test/wiki.test
+++ test/wiki.test
@@ -124,11 +124,11 @@
124124
# Trying to add a technote with the same timestamp should succeed and create a
125125
# second tech note
126126
fossil wiki create 2ndnote f3 -technote {2016-01-01 12:34}
127127
test wiki-13 {$CODE == 0}
128128
fossil wiki list --technote
129
-set technotelist [split $RESULT "\n"]
129
+set technotelist [split $RESULT "\n"]
130130
test wiki-13.1 {[llength $technotelist] == 2}
131131
132132
###############################################################################
133133
# commiting a change to an existing technote should replace the page on export
134134
# (this should update the tech note from wiki-13 as that the most recently
@@ -147,11 +147,11 @@
147147
# But we shouldn't be able to update non-existant pages
148148
fossil wiki commit doesntexist f1 -expectError
149149
test wiki-16 {$CODE != 0}
150150
151151
###############################################################################
152
-# Check specifying tags for a technote is OK
152
+# Check specifying tags for a technote is OK
153153
write_file f5 "technote with tags"
154154
fossil wiki create {tagged technote} f5 --technote {2016-01-02 12:34} --technote-tags {A B}
155155
test wiki-17 {$CODE == 0}
156156
write_file f5.1 "editted and tagged technote"
157157
fossil wiki commit {tagged technote} f5 --technote {2016-01-02 12:34} --technote-tags {C D}
@@ -208,16 +208,16 @@
208208
fossil timeline
209209
test wiki-30 {[string match *Unique*technote* $RESULT]}
210210
211211
###############################################################################
212212
# Check for a collision between an attachment and a note, this was a
213
-# bug that resulted from some code treating the attachment entry as if it
214
-# were a technote when it isn't really.
213
+# bug that resulted from some code treating the attachment entry as if it
214
+# were a technote when it isn't really.
215215
#
216216
# First, wait for the top of the next second so the attachment
217217
# happens at a known time, then add an attachment to an existing note
218
-# and a new note immediately after.
218
+# and a new note immediately after.
219219
220220
set t0 [clock seconds]
221221
while {$t0 == [clock seconds]} {
222222
after 100
223223
}
@@ -242,29 +242,29 @@
242242
write_file f10 "Even unstampted notes are delivered.\nStamped $t2"
243243
fossil wiki create "Unstamped Note" f10 --technote -expectError
244244
test wiki-33 {$CODE != 0}
245245
fossil wiki create "Unstamped Note" f10 --technote now
246246
test wiki-34 {$CODE == 0}
247
-fossil wiki list -t
247
+fossil wiki list -t
248248
test wiki-35 {[string match "*$t2*" $RESULT]}
249249
250250
###############################################################################
251
-# Check an attachment to it in the same second works.
251
+# Check an attachment to it in the same second works.
252252
write_file f11 "Time Stamp was $t2"
253253
fossil attachment add f11 --technote $t2
254254
test wiki-36 {$CODE == 0}
255255
fossil timeline
256256
test wiki-36-1 {$CODE == 0}
257257
fossil wiki list -t
258258
test wiki-36-2 {$CODE == 0}
259259
260260
###############################################################################
261
-# Check that we have the expected number of tech notes on the list (and not
262
-# extra ones from other events (such as the attachments) - 8 tech notes
263
-# expected created by tests 9, 13, 17, 19, 29, 31, 32 and 34
261
+# Check that we have the expected number of tech notes on the list (and not
262
+# extra ones from other events (such as the attachments) - 8 tech notes
263
+# expected created by tests 9, 13, 17, 19, 29, 31, 32 and 34
264264
fossil wiki list --technote
265
-set technotelist [split $RESULT "\n"]
265
+set technotelist [split $RESULT "\n"]
266266
test wiki-37 {[llength $technotelist] == 8}
267267
268268
###############################################################################
269269
# Check that using the show-technote-ids shows the same tech notes in the same
270270
# order (with the technote id as the first word of the line)
@@ -289,11 +289,11 @@
289289
test wiki-40 {[similar_file f12 a12]}
290290
291291
###############################################################################
292292
# Also check that we can specify a prefix of the tech note id (note: with
293293
# 9 items in the tech note at this point there is a chance of a collision.
294
-# However with a 20 character prefix the chance of the collision is
294
+# However with a 20 character prefix the chance of the collision is
295295
# approximately 1 in 10^22 so this test ignores that possibility.)
296296
fossil wiki export a12.1 --technote [string range $anoldtechnoteid 0 20]
297297
test wiki-41 {[similar_file f12 a12.1]}
298298
299299
###############################################################################
@@ -308,11 +308,11 @@
308308
set fullid [lindex $technotelist $i]
309309
set id [string range $fullid 0 3]
310310
dict incr idcounts $id
311311
if {[dict get $idcounts $id] > $maxcount} {
312312
set maxid $id
313
- incr maxcount
313
+ incr maxcount
314314
}
315315
}
316316
# get i so that, as a julian date, it is in the 1800s, i.e., older than
317317
# any other tech note, but after 1 AD
318318
set i 2400000
@@ -326,11 +326,11 @@
326326
set oldesttechnoteid [lindex [split [lindex $technotelist [llength $technotelist]-1]] 0]
327327
set id [string range $oldesttechnoteid 0 3]
328328
dict incr idcounts $id
329329
if {[dict get $idcounts $id] > $maxcount} {
330330
set maxid $id
331
- incr maxcount
331
+ incr maxcount
332332
}
333333
}
334334
# Save the duplicate id for this and later tests
335335
set duplicateid $maxid
336336
fossil wiki export a13 --technote $duplicateid -expectError
337337
--- test/wiki.test
+++ test/wiki.test
@@ -124,11 +124,11 @@
124 # Trying to add a technote with the same timestamp should succeed and create a
125 # second tech note
126 fossil wiki create 2ndnote f3 -technote {2016-01-01 12:34}
127 test wiki-13 {$CODE == 0}
128 fossil wiki list --technote
129 set technotelist [split $RESULT "\n"]
130 test wiki-13.1 {[llength $technotelist] == 2}
131
132 ###############################################################################
133 # commiting a change to an existing technote should replace the page on export
134 # (this should update the tech note from wiki-13 as that the most recently
@@ -147,11 +147,11 @@
147 # But we shouldn't be able to update non-existant pages
148 fossil wiki commit doesntexist f1 -expectError
149 test wiki-16 {$CODE != 0}
150
151 ###############################################################################
152 # Check specifying tags for a technote is OK
153 write_file f5 "technote with tags"
154 fossil wiki create {tagged technote} f5 --technote {2016-01-02 12:34} --technote-tags {A B}
155 test wiki-17 {$CODE == 0}
156 write_file f5.1 "editted and tagged technote"
157 fossil wiki commit {tagged technote} f5 --technote {2016-01-02 12:34} --technote-tags {C D}
@@ -208,16 +208,16 @@
208 fossil timeline
209 test wiki-30 {[string match *Unique*technote* $RESULT]}
210
211 ###############################################################################
212 # Check for a collision between an attachment and a note, this was a
213 # bug that resulted from some code treating the attachment entry as if it
214 # were a technote when it isn't really.
215 #
216 # First, wait for the top of the next second so the attachment
217 # happens at a known time, then add an attachment to an existing note
218 # and a new note immediately after.
219
220 set t0 [clock seconds]
221 while {$t0 == [clock seconds]} {
222 after 100
223 }
@@ -242,29 +242,29 @@
242 write_file f10 "Even unstampted notes are delivered.\nStamped $t2"
243 fossil wiki create "Unstamped Note" f10 --technote -expectError
244 test wiki-33 {$CODE != 0}
245 fossil wiki create "Unstamped Note" f10 --technote now
246 test wiki-34 {$CODE == 0}
247 fossil wiki list -t
248 test wiki-35 {[string match "*$t2*" $RESULT]}
249
250 ###############################################################################
251 # Check an attachment to it in the same second works.
252 write_file f11 "Time Stamp was $t2"
253 fossil attachment add f11 --technote $t2
254 test wiki-36 {$CODE == 0}
255 fossil timeline
256 test wiki-36-1 {$CODE == 0}
257 fossil wiki list -t
258 test wiki-36-2 {$CODE == 0}
259
260 ###############################################################################
261 # Check that we have the expected number of tech notes on the list (and not
262 # extra ones from other events (such as the attachments) - 8 tech notes
263 # expected created by tests 9, 13, 17, 19, 29, 31, 32 and 34
264 fossil wiki list --technote
265 set technotelist [split $RESULT "\n"]
266 test wiki-37 {[llength $technotelist] == 8}
267
268 ###############################################################################
269 # Check that using the show-technote-ids shows the same tech notes in the same
270 # order (with the technote id as the first word of the line)
@@ -289,11 +289,11 @@
289 test wiki-40 {[similar_file f12 a12]}
290
291 ###############################################################################
292 # Also check that we can specify a prefix of the tech note id (note: with
293 # 9 items in the tech note at this point there is a chance of a collision.
294 # However with a 20 character prefix the chance of the collision is
295 # approximately 1 in 10^22 so this test ignores that possibility.)
296 fossil wiki export a12.1 --technote [string range $anoldtechnoteid 0 20]
297 test wiki-41 {[similar_file f12 a12.1]}
298
299 ###############################################################################
@@ -308,11 +308,11 @@
308 set fullid [lindex $technotelist $i]
309 set id [string range $fullid 0 3]
310 dict incr idcounts $id
311 if {[dict get $idcounts $id] > $maxcount} {
312 set maxid $id
313 incr maxcount
314 }
315 }
316 # get i so that, as a julian date, it is in the 1800s, i.e., older than
317 # any other tech note, but after 1 AD
318 set i 2400000
@@ -326,11 +326,11 @@
326 set oldesttechnoteid [lindex [split [lindex $technotelist [llength $technotelist]-1]] 0]
327 set id [string range $oldesttechnoteid 0 3]
328 dict incr idcounts $id
329 if {[dict get $idcounts $id] > $maxcount} {
330 set maxid $id
331 incr maxcount
332 }
333 }
334 # Save the duplicate id for this and later tests
335 set duplicateid $maxid
336 fossil wiki export a13 --technote $duplicateid -expectError
337
--- test/wiki.test
+++ test/wiki.test
@@ -124,11 +124,11 @@
124 # Trying to add a technote with the same timestamp should succeed and create a
125 # second tech note
126 fossil wiki create 2ndnote f3 -technote {2016-01-01 12:34}
127 test wiki-13 {$CODE == 0}
128 fossil wiki list --technote
129 set technotelist [split $RESULT "\n"]
130 test wiki-13.1 {[llength $technotelist] == 2}
131
132 ###############################################################################
133 # commiting a change to an existing technote should replace the page on export
134 # (this should update the tech note from wiki-13 as that the most recently
@@ -147,11 +147,11 @@
147 # But we shouldn't be able to update non-existant pages
148 fossil wiki commit doesntexist f1 -expectError
149 test wiki-16 {$CODE != 0}
150
151 ###############################################################################
152 # Check specifying tags for a technote is OK
153 write_file f5 "technote with tags"
154 fossil wiki create {tagged technote} f5 --technote {2016-01-02 12:34} --technote-tags {A B}
155 test wiki-17 {$CODE == 0}
156 write_file f5.1 "editted and tagged technote"
157 fossil wiki commit {tagged technote} f5 --technote {2016-01-02 12:34} --technote-tags {C D}
@@ -208,16 +208,16 @@
208 fossil timeline
209 test wiki-30 {[string match *Unique*technote* $RESULT]}
210
211 ###############################################################################
212 # Check for a collision between an attachment and a note, this was a
213 # bug that resulted from some code treating the attachment entry as if it
214 # were a technote when it isn't really.
215 #
216 # First, wait for the top of the next second so the attachment
217 # happens at a known time, then add an attachment to an existing note
218 # and a new note immediately after.
219
220 set t0 [clock seconds]
221 while {$t0 == [clock seconds]} {
222 after 100
223 }
@@ -242,29 +242,29 @@
242 write_file f10 "Even unstampted notes are delivered.\nStamped $t2"
243 fossil wiki create "Unstamped Note" f10 --technote -expectError
244 test wiki-33 {$CODE != 0}
245 fossil wiki create "Unstamped Note" f10 --technote now
246 test wiki-34 {$CODE == 0}
247 fossil wiki list -t
248 test wiki-35 {[string match "*$t2*" $RESULT]}
249
250 ###############################################################################
251 # Check an attachment to it in the same second works.
252 write_file f11 "Time Stamp was $t2"
253 fossil attachment add f11 --technote $t2
254 test wiki-36 {$CODE == 0}
255 fossil timeline
256 test wiki-36-1 {$CODE == 0}
257 fossil wiki list -t
258 test wiki-36-2 {$CODE == 0}
259
260 ###############################################################################
261 # Check that we have the expected number of tech notes on the list (and not
262 # extra ones from other events (such as the attachments) - 8 tech notes
263 # expected created by tests 9, 13, 17, 19, 29, 31, 32 and 34
264 fossil wiki list --technote
265 set technotelist [split $RESULT "\n"]
266 test wiki-37 {[llength $technotelist] == 8}
267
268 ###############################################################################
269 # Check that using the show-technote-ids shows the same tech notes in the same
270 # order (with the technote id as the first word of the line)
@@ -289,11 +289,11 @@
289 test wiki-40 {[similar_file f12 a12]}
290
291 ###############################################################################
292 # Also check that we can specify a prefix of the tech note id (note: with
293 # 9 items in the tech note at this point there is a chance of a collision.
294 # However with a 20 character prefix the chance of the collision is
295 # approximately 1 in 10^22 so this test ignores that possibility.)
296 fossil wiki export a12.1 --technote [string range $anoldtechnoteid 0 20]
297 test wiki-41 {[similar_file f12 a12.1]}
298
299 ###############################################################################
@@ -308,11 +308,11 @@
308 set fullid [lindex $technotelist $i]
309 set id [string range $fullid 0 3]
310 dict incr idcounts $id
311 if {[dict get $idcounts $id] > $maxcount} {
312 set maxid $id
313 incr maxcount
314 }
315 }
316 # get i so that, as a julian date, it is in the 1800s, i.e., older than
317 # any other tech note, but after 1 AD
318 set i 2400000
@@ -326,11 +326,11 @@
326 set oldesttechnoteid [lindex [split [lindex $technotelist [llength $technotelist]-1]] 0]
327 set id [string range $oldesttechnoteid 0 3]
328 dict incr idcounts $id
329 if {[dict get $idcounts $id] > $maxcount} {
330 set maxid $id
331 incr maxcount
332 }
333 }
334 # Save the duplicate id for this and later tests
335 set duplicateid $maxid
336 fossil wiki export a13 --technote $duplicateid -expectError
337
+1 -1
--- www/mkindex.tcl
+++ www/mkindex.tcl
@@ -1,11 +1,11 @@
11
#!/bin/sh
22
#
33
# Run this TCL script to generate a WIKI page that contains a
44
# permuted index of the various documentation files.
55
#
6
-# tclsh mkindex.tcl
6
+# tclsh mkindex.tcl
77
#
88
99
set doclist {
1010
aboutcgi.wiki {How CGI Works In Fossil}
1111
adding_code.wiki {Adding New Features To Fossil}
1212
--- www/mkindex.tcl
+++ www/mkindex.tcl
@@ -1,11 +1,11 @@
1 #!/bin/sh
2 #
3 # Run this TCL script to generate a WIKI page that contains a
4 # permuted index of the various documentation files.
5 #
6 # tclsh mkindex.tcl
7 #
8
9 set doclist {
10 aboutcgi.wiki {How CGI Works In Fossil}
11 adding_code.wiki {Adding New Features To Fossil}
12
--- www/mkindex.tcl
+++ www/mkindex.tcl
@@ -1,11 +1,11 @@
1 #!/bin/sh
2 #
3 # Run this TCL script to generate a WIKI page that contains a
4 # permuted index of the various documentation files.
5 #
6 # tclsh mkindex.tcl
7 #
8
9 set doclist {
10 aboutcgi.wiki {How CGI Works In Fossil}
11 adding_code.wiki {Adding New Features To Fossil}
12
+3 -3
--- www/unvers.wiki
+++ www/unvers.wiki
@@ -46,26 +46,26 @@
4646
commands will synchronize unversioned content if and only if the
4747
"-u" (or "--unversioned") command-line option is supplied. The
4848
[/help?cmd=unversioned|fossil unversioned sync] command will synchronize the
4949
unversioned content without synchronizing anything else.
5050
51
-Notice that the "-u" option does not work on
51
+Notice that the "-u" option does not work on
5252
[/help?cmd=push|fossil push] or [/help?cmd=pull|fossil pull].
5353
The "-u" option is only available on "sync" and "clone".
5454
5555
A rough equivalent of an unversioned pull would be the
56
-[/help?cmd=unversioned|fossil unversioned revert] command. The
56
+[/help?cmd=unversioned|fossil unversioned revert] command. The
5757
"unversioned revert"
5858
command causes the unversioned content on the local repository to overwritten
5959
by the unversioned content found on the remote repository.
6060
6161
<h2>Implementation Details</h2>
6262
6363
<i>(This section outlines the current implementation of unversioned
6464
files. This is not an interface spec and hence subject to change.)</i>
6565
66
-Unversioned content is stored in the repository in the
66
+Unversioned content is stored in the repository in the
6767
"unversioned" table:
6868
6969
<blockquote><pre>
7070
CREATE TABLE unversioned(
7171
name TEXT PRIMARY KEY, -- Name of the file
7272
--- www/unvers.wiki
+++ www/unvers.wiki
@@ -46,26 +46,26 @@
46 commands will synchronize unversioned content if and only if the
47 "-u" (or "--unversioned") command-line option is supplied. The
48 [/help?cmd=unversioned|fossil unversioned sync] command will synchronize the
49 unversioned content without synchronizing anything else.
50
51 Notice that the "-u" option does not work on
52 [/help?cmd=push|fossil push] or [/help?cmd=pull|fossil pull].
53 The "-u" option is only available on "sync" and "clone".
54
55 A rough equivalent of an unversioned pull would be the
56 [/help?cmd=unversioned|fossil unversioned revert] command. The
57 "unversioned revert"
58 command causes the unversioned content on the local repository to overwritten
59 by the unversioned content found on the remote repository.
60
61 <h2>Implementation Details</h2>
62
63 <i>(This section outlines the current implementation of unversioned
64 files. This is not an interface spec and hence subject to change.)</i>
65
66 Unversioned content is stored in the repository in the
67 "unversioned" table:
68
69 <blockquote><pre>
70 CREATE TABLE unversioned(
71 name TEXT PRIMARY KEY, -- Name of the file
72
--- www/unvers.wiki
+++ www/unvers.wiki
@@ -46,26 +46,26 @@
46 commands will synchronize unversioned content if and only if the
47 "-u" (or "--unversioned") command-line option is supplied. The
48 [/help?cmd=unversioned|fossil unversioned sync] command will synchronize the
49 unversioned content without synchronizing anything else.
50
51 Notice that the "-u" option does not work on
52 [/help?cmd=push|fossil push] or [/help?cmd=pull|fossil pull].
53 The "-u" option is only available on "sync" and "clone".
54
55 A rough equivalent of an unversioned pull would be the
56 [/help?cmd=unversioned|fossil unversioned revert] command. The
57 "unversioned revert"
58 command causes the unversioned content on the local repository to overwritten
59 by the unversioned content found on the remote repository.
60
61 <h2>Implementation Details</h2>
62
63 <i>(This section outlines the current implementation of unversioned
64 files. This is not an interface spec and hence subject to change.)</i>
65
66 Unversioned content is stored in the repository in the
67 "unversioned" table:
68
69 <blockquote><pre>
70 CREATE TABLE unversioned(
71 name TEXT PRIMARY KEY, -- Name of the file
72
+4 -4
--- www/webui.wiki
+++ www/webui.wiki
@@ -19,11 +19,11 @@
1919
* Move check-ins between branches
2020
* Revise check-in comments
2121
* Manage user credentials and access permissions
2222
* And so forth... (some [./webpage-ex.md|examples])
2323
24
-You get all of this, and more, for free when you use Fossil.
24
+You get all of this, and more, for free when you use Fossil.
2525
There are no extra programs to install or setup.
2626
Everything you need is already pre-configured and built into the
2727
self-contained, stand-alone Fossil executable.
2828
2929
As an example of how useful this web interface can be,
@@ -53,11 +53,11 @@
5353
5454
<b>fossil ui existing-repository.fossil</b>
5555
5656
Substitute the name of your repository, of course.
5757
The "ui" command will start a webserver running (it figures out an
58
-available TCP port to use on its own) and then automatically launches
58
+available TCP port to use on its own) and then automatically launches
5959
your web browser to point at that server. If you run the "ui" command
6060
from within an open check-out, you can omit the repository name:
6161
6262
<b>fossil ui</b>
6363
@@ -151,11 +151,11 @@
151151
</verbatim>
152152
153153
Adjust the script above so that the paths are correct for your system,
154154
of course, and also make sure the Fossil binary is installed on the server.
155155
But that is <u>all</u> you have to do. You now have everything you need to host
156
-a distributed software development project in less than five minutes using a
156
+a distributed software development project in less than five minutes using a
157157
two-line CGI script.
158158
159159
Instructions for setting up an SCGI server are
160160
[./scgi.wiki | available separately].
161161
@@ -165,11 +165,11 @@
165165
xinetd. An inetd configuration line sufficient to launch the Fossil
166166
web interface looks like this:
167167
168168
<verbatim>
169169
80 stream tcp nowait.1000 root /usr/local/bin/fossil \
170
- /usr/local/bin/fossil http /home/www/sample-project.fossil
170
+ /usr/local/bin/fossil http /home/www/sample-project.fossil
171171
</verbatim>
172172
173173
As always, you'll want to adjust the pathnames to whatever is appropriate
174174
for your system. The xinetd setup uses a different syntax but follows
175175
the same idea.
176176
--- www/webui.wiki
+++ www/webui.wiki
@@ -19,11 +19,11 @@
19 * Move check-ins between branches
20 * Revise check-in comments
21 * Manage user credentials and access permissions
22 * And so forth... (some [./webpage-ex.md|examples])
23
24 You get all of this, and more, for free when you use Fossil.
25 There are no extra programs to install or setup.
26 Everything you need is already pre-configured and built into the
27 self-contained, stand-alone Fossil executable.
28
29 As an example of how useful this web interface can be,
@@ -53,11 +53,11 @@
53
54 <b>fossil ui existing-repository.fossil</b>
55
56 Substitute the name of your repository, of course.
57 The "ui" command will start a webserver running (it figures out an
58 available TCP port to use on its own) and then automatically launches
59 your web browser to point at that server. If you run the "ui" command
60 from within an open check-out, you can omit the repository name:
61
62 <b>fossil ui</b>
63
@@ -151,11 +151,11 @@
151 </verbatim>
152
153 Adjust the script above so that the paths are correct for your system,
154 of course, and also make sure the Fossil binary is installed on the server.
155 But that is <u>all</u> you have to do. You now have everything you need to host
156 a distributed software development project in less than five minutes using a
157 two-line CGI script.
158
159 Instructions for setting up an SCGI server are
160 [./scgi.wiki | available separately].
161
@@ -165,11 +165,11 @@
165 xinetd. An inetd configuration line sufficient to launch the Fossil
166 web interface looks like this:
167
168 <verbatim>
169 80 stream tcp nowait.1000 root /usr/local/bin/fossil \
170 /usr/local/bin/fossil http /home/www/sample-project.fossil
171 </verbatim>
172
173 As always, you'll want to adjust the pathnames to whatever is appropriate
174 for your system. The xinetd setup uses a different syntax but follows
175 the same idea.
176
--- www/webui.wiki
+++ www/webui.wiki
@@ -19,11 +19,11 @@
19 * Move check-ins between branches
20 * Revise check-in comments
21 * Manage user credentials and access permissions
22 * And so forth... (some [./webpage-ex.md|examples])
23
24 You get all of this, and more, for free when you use Fossil.
25 There are no extra programs to install or setup.
26 Everything you need is already pre-configured and built into the
27 self-contained, stand-alone Fossil executable.
28
29 As an example of how useful this web interface can be,
@@ -53,11 +53,11 @@
53
54 <b>fossil ui existing-repository.fossil</b>
55
56 Substitute the name of your repository, of course.
57 The "ui" command will start a webserver running (it figures out an
58 available TCP port to use on its own) and then automatically launches
59 your web browser to point at that server. If you run the "ui" command
60 from within an open check-out, you can omit the repository name:
61
62 <b>fossil ui</b>
63
@@ -151,11 +151,11 @@
151 </verbatim>
152
153 Adjust the script above so that the paths are correct for your system,
154 of course, and also make sure the Fossil binary is installed on the server.
155 But that is <u>all</u> you have to do. You now have everything you need to host
156 a distributed software development project in less than five minutes using a
157 two-line CGI script.
158
159 Instructions for setting up an SCGI server are
160 [./scgi.wiki | available separately].
161
@@ -165,11 +165,11 @@
165 xinetd. An inetd configuration line sufficient to launch the Fossil
166 web interface looks like this:
167
168 <verbatim>
169 80 stream tcp nowait.1000 root /usr/local/bin/fossil \
170 /usr/local/bin/fossil http /home/www/sample-project.fossil
171 </verbatim>
172
173 As always, you'll want to adjust the pathnames to whatever is appropriate
174 for your system. The xinetd setup uses a different syntax but follows
175 the same idea.
176

Keyboard Shortcuts

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