Fossil SCM

Replaced the /fileedit_AJAX_ROUTE calls with /fileedit?ajax=ROUTE_NAME to eliminate the dispatch-time and help-system bloat.

stephan 2020-05-11 13:03 fileedit-ajaxify
Commit 9f26fd1eeeddac74ff782d3eb03234c64046513580c888240daaee9c95da1245
+28 -12
--- src/fileedit.c
+++ src/fileedit.c
@@ -1162,11 +1162,11 @@
11621162
}
11631163
return 1;
11641164
}
11651165
11661166
/*
1167
-** WEBPAGE: fileedit_content
1167
+** AJAX route /fileedit?ajax=content
11681168
**
11691169
** Query parameters:
11701170
**
11711171
** filename=FILENAME
11721172
** checkin=CHECKIN_NAME
@@ -1174,11 +1174,11 @@
11741174
** User must have Write access to use this page.
11751175
**
11761176
** Responds with the raw content of the given page. On error it
11771177
** produces a JSON response as documented for fileedit_ajax_error().
11781178
*/
1179
-void fileedit_ajax_content(void){
1179
+static void fileedit_ajax_content(void){
11801180
const char * zFilename = 0;
11811181
const char * zRev = 0;
11821182
int vid, frid;
11831183
Blob content = empty_blob;
11841184
const char * zMime;
@@ -1201,11 +1201,11 @@
12011201
cgi_set_content_type(zMime);
12021202
cgi_set_content(&content);
12031203
}
12041204
12051205
/*
1206
-** WEBPAGE: fileedit_preview
1206
+** AJAX route /fileedit?ajax=preview
12071207
**
12081208
** Required query parameters:
12091209
**
12101210
** filename=FILENAME
12111211
** content=text
@@ -1223,11 +1223,11 @@
12231223
** User must have Write access to use this page.
12241224
**
12251225
** Responds with the HTML content of the preview. On error it produces
12261226
** a JSON response as documented for fileedit_ajax_error().
12271227
*/
1228
-void fileedit_ajax_preview(void){
1228
+static void fileedit_ajax_preview(void){
12291229
const char * zFilename = 0;
12301230
const char * zContent = P("content");
12311231
int renderMode = atoi(PD("render_mode","0"));
12321232
int ln = atoi(PD("ln","0"));
12331233
int iframeHeight = atoi(PD("iframe_height","40"));
@@ -1244,11 +1244,11 @@
12441244
ln ? FE_PREVIEW_LINE_NUMBERS : 0,
12451245
renderMode, iframeHeight);
12461246
}
12471247
12481248
/*
1249
-** WEBPAGE: fileedit_diff
1249
+** AJAX route /fileedit?ajax=diff
12501250
**
12511251
** Required query parameters:
12521252
**
12531253
** filename=FILENAME
12541254
** content=text
@@ -1261,11 +1261,11 @@
12611261
** User must have Write access to use this page.
12621262
**
12631263
** Responds with the HTML content of the diff. On error it produces a
12641264
** JSON response as documented for fileedit_ajax_error().
12651265
*/
1266
-void fileedit_ajax_diff(void){
1266
+static void fileedit_ajax_diff(void){
12671267
/*
12681268
** Reminder: we only need the filename to perform valdiation
12691269
** against fileedit_is_editable(), else this route could be
12701270
** abused to get diffs against content disallowed by the
12711271
** whitelist.
@@ -1418,11 +1418,11 @@
14181418
fossil_free(zFileUuid);
14191419
return rc ? rc : 500;
14201420
}
14211421
14221422
/*
1423
-** WEBPAGE: fileedit_filelist
1423
+** AJAX route /fileedit?ajax=filelist
14241424
**
14251425
** Fetches a JSON-format list of leaves and/or filenames for use in
14261426
** creating a file selection list in /fileedit. It has different modes
14271427
** of operation depending on its arguments:
14281428
**
@@ -1444,11 +1444,11 @@
14441444
** }
14451445
**
14461446
** On error it produces a JSON response as documented for
14471447
** fileedit_ajax_error().
14481448
*/
1449
-void fileedit_ajax_filelist(void){
1449
+static void fileedit_ajax_filelist(void){
14501450
const char * zCi = PD("checkin",P("ci"));
14511451
Blob sql = empty_blob;
14521452
Stmt q = empty_Stmt;
14531453
int i = 0;
14541454
@@ -1506,11 +1506,11 @@
15061506
fileedit_ajax_error(500, "Unhandled URL argument.");
15071507
}
15081508
}
15091509
15101510
/*
1511
-** WEBPAGE: fileedit_commit
1511
+** AJAX route /fileedit?ajax=commit
15121512
**
15131513
** Required query parameters:
15141514
**
15151515
** filename=FILENAME
15161516
** checkin=Parent checkin UUID
@@ -1534,20 +1534,20 @@
15341534
** }
15351535
**
15361536
** On error it produces a JSON response as documented for
15371537
** fileedit_ajax_error().
15381538
*/
1539
-void fileedit_ajax_commit(void){
1539
+static void fileedit_ajax_commit(void){
15401540
Blob err = empty_blob; /* Error messages */
15411541
Blob manifest = empty_blob; /* raw new manifest */
15421542
CheckinMiniInfo cimi; /* checkin state */
15431543
int rc; /* generic result code */
15441544
int newVid = 0; /* new version's RID */
15451545
char * zNewUuid = 0; /* newVid's UUID */
15461546
15471547
if(!fileedit_ajax_boostrap()){
1548
- goto end_cleanup;
1548
+ return;
15491549
}
15501550
db_begin_transaction();
15511551
CheckinMiniInfo_init(&cimi);
15521552
rc = fileedit_setup_cimi_from_p(&cimi, &err);
15531553
if(0!=rc){
@@ -1613,19 +1613,35 @@
16131613
combined into a single JS
16141614
function call, thus each
16151615
entry must end with a
16161616
semicolon. */
16171617
Stmt stmt = empty_Stmt;
1618
+ const char *zAjax = P("ajax");
16181619
1620
+ if(0!=zAjax){
1621
+ if(0==strcmp("content",zAjax)){
1622
+ fileedit_ajax_content();
1623
+ }else if(0==strcmp("preview",zAjax)){
1624
+ fileedit_ajax_preview();
1625
+ }else if(0==strcmp("filelist",zAjax)){
1626
+ fileedit_ajax_filelist();
1627
+ }else if(0==strcmp("diff",zAjax)){
1628
+ fileedit_ajax_diff();
1629
+ }else if(0==strcmp("commit",zAjax)){
1630
+ fileedit_ajax_commit();
1631
+ }else{
1632
+ fileedit_ajax_error(500, "Unhandled 'ajax' value.");
1633
+ }
1634
+ return;
1635
+ }
16191636
login_check_credentials();
16201637
if( !g.perm.Write ){
16211638
login_needed(g.anon.Write);
16221639
return;
16231640
}
16241641
db_begin_transaction();
16251642
CheckinMiniInfo_init(&cimi);
1626
-
16271643
style_header("File Editor");
16281644
/* As of this point, don't use return or fossil_fatal(). Write any
16291645
** error in (&err) and goto end_footer instead so that we can be
16301646
** sure to do any cleanup and end the transaction cleanly.
16311647
*/
16321648
--- src/fileedit.c
+++ src/fileedit.c
@@ -1162,11 +1162,11 @@
1162 }
1163 return 1;
1164 }
1165
1166 /*
1167 ** WEBPAGE: fileedit_content
1168 **
1169 ** Query parameters:
1170 **
1171 ** filename=FILENAME
1172 ** checkin=CHECKIN_NAME
@@ -1174,11 +1174,11 @@
1174 ** User must have Write access to use this page.
1175 **
1176 ** Responds with the raw content of the given page. On error it
1177 ** produces a JSON response as documented for fileedit_ajax_error().
1178 */
1179 void fileedit_ajax_content(void){
1180 const char * zFilename = 0;
1181 const char * zRev = 0;
1182 int vid, frid;
1183 Blob content = empty_blob;
1184 const char * zMime;
@@ -1201,11 +1201,11 @@
1201 cgi_set_content_type(zMime);
1202 cgi_set_content(&content);
1203 }
1204
1205 /*
1206 ** WEBPAGE: fileedit_preview
1207 **
1208 ** Required query parameters:
1209 **
1210 ** filename=FILENAME
1211 ** content=text
@@ -1223,11 +1223,11 @@
1223 ** User must have Write access to use this page.
1224 **
1225 ** Responds with the HTML content of the preview. On error it produces
1226 ** a JSON response as documented for fileedit_ajax_error().
1227 */
1228 void fileedit_ajax_preview(void){
1229 const char * zFilename = 0;
1230 const char * zContent = P("content");
1231 int renderMode = atoi(PD("render_mode","0"));
1232 int ln = atoi(PD("ln","0"));
1233 int iframeHeight = atoi(PD("iframe_height","40"));
@@ -1244,11 +1244,11 @@
1244 ln ? FE_PREVIEW_LINE_NUMBERS : 0,
1245 renderMode, iframeHeight);
1246 }
1247
1248 /*
1249 ** WEBPAGE: fileedit_diff
1250 **
1251 ** Required query parameters:
1252 **
1253 ** filename=FILENAME
1254 ** content=text
@@ -1261,11 +1261,11 @@
1261 ** User must have Write access to use this page.
1262 **
1263 ** Responds with the HTML content of the diff. On error it produces a
1264 ** JSON response as documented for fileedit_ajax_error().
1265 */
1266 void fileedit_ajax_diff(void){
1267 /*
1268 ** Reminder: we only need the filename to perform valdiation
1269 ** against fileedit_is_editable(), else this route could be
1270 ** abused to get diffs against content disallowed by the
1271 ** whitelist.
@@ -1418,11 +1418,11 @@
1418 fossil_free(zFileUuid);
1419 return rc ? rc : 500;
1420 }
1421
1422 /*
1423 ** WEBPAGE: fileedit_filelist
1424 **
1425 ** Fetches a JSON-format list of leaves and/or filenames for use in
1426 ** creating a file selection list in /fileedit. It has different modes
1427 ** of operation depending on its arguments:
1428 **
@@ -1444,11 +1444,11 @@
1444 ** }
1445 **
1446 ** On error it produces a JSON response as documented for
1447 ** fileedit_ajax_error().
1448 */
1449 void fileedit_ajax_filelist(void){
1450 const char * zCi = PD("checkin",P("ci"));
1451 Blob sql = empty_blob;
1452 Stmt q = empty_Stmt;
1453 int i = 0;
1454
@@ -1506,11 +1506,11 @@
1506 fileedit_ajax_error(500, "Unhandled URL argument.");
1507 }
1508 }
1509
1510 /*
1511 ** WEBPAGE: fileedit_commit
1512 **
1513 ** Required query parameters:
1514 **
1515 ** filename=FILENAME
1516 ** checkin=Parent checkin UUID
@@ -1534,20 +1534,20 @@
1534 ** }
1535 **
1536 ** On error it produces a JSON response as documented for
1537 ** fileedit_ajax_error().
1538 */
1539 void fileedit_ajax_commit(void){
1540 Blob err = empty_blob; /* Error messages */
1541 Blob manifest = empty_blob; /* raw new manifest */
1542 CheckinMiniInfo cimi; /* checkin state */
1543 int rc; /* generic result code */
1544 int newVid = 0; /* new version's RID */
1545 char * zNewUuid = 0; /* newVid's UUID */
1546
1547 if(!fileedit_ajax_boostrap()){
1548 goto end_cleanup;
1549 }
1550 db_begin_transaction();
1551 CheckinMiniInfo_init(&cimi);
1552 rc = fileedit_setup_cimi_from_p(&cimi, &err);
1553 if(0!=rc){
@@ -1613,19 +1613,35 @@
1613 combined into a single JS
1614 function call, thus each
1615 entry must end with a
1616 semicolon. */
1617 Stmt stmt = empty_Stmt;
 
1618
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1619 login_check_credentials();
1620 if( !g.perm.Write ){
1621 login_needed(g.anon.Write);
1622 return;
1623 }
1624 db_begin_transaction();
1625 CheckinMiniInfo_init(&cimi);
1626
1627 style_header("File Editor");
1628 /* As of this point, don't use return or fossil_fatal(). Write any
1629 ** error in (&err) and goto end_footer instead so that we can be
1630 ** sure to do any cleanup and end the transaction cleanly.
1631 */
1632
--- src/fileedit.c
+++ src/fileedit.c
@@ -1162,11 +1162,11 @@
1162 }
1163 return 1;
1164 }
1165
1166 /*
1167 ** AJAX route /fileedit?ajax=content
1168 **
1169 ** Query parameters:
1170 **
1171 ** filename=FILENAME
1172 ** checkin=CHECKIN_NAME
@@ -1174,11 +1174,11 @@
1174 ** User must have Write access to use this page.
1175 **
1176 ** Responds with the raw content of the given page. On error it
1177 ** produces a JSON response as documented for fileedit_ajax_error().
1178 */
1179 static void fileedit_ajax_content(void){
1180 const char * zFilename = 0;
1181 const char * zRev = 0;
1182 int vid, frid;
1183 Blob content = empty_blob;
1184 const char * zMime;
@@ -1201,11 +1201,11 @@
1201 cgi_set_content_type(zMime);
1202 cgi_set_content(&content);
1203 }
1204
1205 /*
1206 ** AJAX route /fileedit?ajax=preview
1207 **
1208 ** Required query parameters:
1209 **
1210 ** filename=FILENAME
1211 ** content=text
@@ -1223,11 +1223,11 @@
1223 ** User must have Write access to use this page.
1224 **
1225 ** Responds with the HTML content of the preview. On error it produces
1226 ** a JSON response as documented for fileedit_ajax_error().
1227 */
1228 static void fileedit_ajax_preview(void){
1229 const char * zFilename = 0;
1230 const char * zContent = P("content");
1231 int renderMode = atoi(PD("render_mode","0"));
1232 int ln = atoi(PD("ln","0"));
1233 int iframeHeight = atoi(PD("iframe_height","40"));
@@ -1244,11 +1244,11 @@
1244 ln ? FE_PREVIEW_LINE_NUMBERS : 0,
1245 renderMode, iframeHeight);
1246 }
1247
1248 /*
1249 ** AJAX route /fileedit?ajax=diff
1250 **
1251 ** Required query parameters:
1252 **
1253 ** filename=FILENAME
1254 ** content=text
@@ -1261,11 +1261,11 @@
1261 ** User must have Write access to use this page.
1262 **
1263 ** Responds with the HTML content of the diff. On error it produces a
1264 ** JSON response as documented for fileedit_ajax_error().
1265 */
1266 static void fileedit_ajax_diff(void){
1267 /*
1268 ** Reminder: we only need the filename to perform valdiation
1269 ** against fileedit_is_editable(), else this route could be
1270 ** abused to get diffs against content disallowed by the
1271 ** whitelist.
@@ -1418,11 +1418,11 @@
1418 fossil_free(zFileUuid);
1419 return rc ? rc : 500;
1420 }
1421
1422 /*
1423 ** AJAX route /fileedit?ajax=filelist
1424 **
1425 ** Fetches a JSON-format list of leaves and/or filenames for use in
1426 ** creating a file selection list in /fileedit. It has different modes
1427 ** of operation depending on its arguments:
1428 **
@@ -1444,11 +1444,11 @@
1444 ** }
1445 **
1446 ** On error it produces a JSON response as documented for
1447 ** fileedit_ajax_error().
1448 */
1449 static void fileedit_ajax_filelist(void){
1450 const char * zCi = PD("checkin",P("ci"));
1451 Blob sql = empty_blob;
1452 Stmt q = empty_Stmt;
1453 int i = 0;
1454
@@ -1506,11 +1506,11 @@
1506 fileedit_ajax_error(500, "Unhandled URL argument.");
1507 }
1508 }
1509
1510 /*
1511 ** AJAX route /fileedit?ajax=commit
1512 **
1513 ** Required query parameters:
1514 **
1515 ** filename=FILENAME
1516 ** checkin=Parent checkin UUID
@@ -1534,20 +1534,20 @@
1534 ** }
1535 **
1536 ** On error it produces a JSON response as documented for
1537 ** fileedit_ajax_error().
1538 */
1539 static void fileedit_ajax_commit(void){
1540 Blob err = empty_blob; /* Error messages */
1541 Blob manifest = empty_blob; /* raw new manifest */
1542 CheckinMiniInfo cimi; /* checkin state */
1543 int rc; /* generic result code */
1544 int newVid = 0; /* new version's RID */
1545 char * zNewUuid = 0; /* newVid's UUID */
1546
1547 if(!fileedit_ajax_boostrap()){
1548 return;
1549 }
1550 db_begin_transaction();
1551 CheckinMiniInfo_init(&cimi);
1552 rc = fileedit_setup_cimi_from_p(&cimi, &err);
1553 if(0!=rc){
@@ -1613,19 +1613,35 @@
1613 combined into a single JS
1614 function call, thus each
1615 entry must end with a
1616 semicolon. */
1617 Stmt stmt = empty_Stmt;
1618 const char *zAjax = P("ajax");
1619
1620 if(0!=zAjax){
1621 if(0==strcmp("content",zAjax)){
1622 fileedit_ajax_content();
1623 }else if(0==strcmp("preview",zAjax)){
1624 fileedit_ajax_preview();
1625 }else if(0==strcmp("filelist",zAjax)){
1626 fileedit_ajax_filelist();
1627 }else if(0==strcmp("diff",zAjax)){
1628 fileedit_ajax_diff();
1629 }else if(0==strcmp("commit",zAjax)){
1630 fileedit_ajax_commit();
1631 }else{
1632 fileedit_ajax_error(500, "Unhandled 'ajax' value.");
1633 }
1634 return;
1635 }
1636 login_check_credentials();
1637 if( !g.perm.Write ){
1638 login_needed(g.anon.Write);
1639 return;
1640 }
1641 db_begin_transaction();
1642 CheckinMiniInfo_init(&cimi);
 
1643 style_header("File Editor");
1644 /* As of this point, don't use return or fossil_fatal(). Write any
1645 ** error in (&err) and goto end_footer instead so that we can be
1646 ** sure to do any cleanup and end the transaction cleanly.
1647 */
1648
--- src/fossil.page.fileedit.js
+++ src/fossil.page.fileedit.js
@@ -22,12 +22,12 @@
2222
},
2323
loadLeaves: function(){
2424
D.append(D.clearElement(this.e.ciListLabel),"Loading leaves...");
2525
D.disable(this.e.btnLoadFile, this.e.selectFiles, this.e.selectCi);
2626
const self = this;
27
- F.fetch('fileedit_filelist',{
28
- urlParams:'leaves',
27
+ F.fetch('fileedit',{
28
+ urlParams:'ajax=filelist&leaves',
2929
responseType: 'json',
3030
onload: function(list){
3131
D.append(D.clearElement(self.e.ciListLabel),"Open leaves:");
3232
self.cache.checkins = list;
3333
D.clearElement(D.enable(self.e.selectCi));
@@ -72,12 +72,12 @@
7272
}
7373
D.disable(selFiles,this.e.btnLoadFile);
7474
D.clearElement(selFiles);
7575
D.append(D.clearElement(this.e.fileListLabel),
7676
"Loading files for "+F.hashDigits(ciUuid)+"...");
77
- F.fetch('fileedit_filelist',{
78
- urlParams:{checkin: ciUuid},
77
+ F.fetch('fileedit',{
78
+ urlParams:{ajax:'filelist', checkin: ciUuid},
7979
responseType: 'json',
8080
onload
8181
});
8282
return this;
8383
},
@@ -336,12 +336,16 @@
336336
rev = this.finfo.checkin;
337337
}
338338
delete this.finfo;
339339
const self = this;
340340
F.message("Loading content...");
341
- F.fetch('fileedit_content',{
342
- urlParams: {filename:file,checkin:rev},
341
+ F.fetch('fileedit',{
342
+ urlParams: {
343
+ ajax: 'content',
344
+ filename:file,
345
+ checkin:rev
346
+ },
343347
onload:(r)=>{
344348
F.message('Loaded content.');
345349
self.e.taEditor.value = r;
346350
self.updateVersion(file,rev);
347351
self.tabs.switchToTab(self.e.tabs.content);
@@ -388,11 +392,12 @@
388392
fd.append('ln',E('[name=preview_ln]').checked ? 1 : 0);
389393
fd.append('iframe_height', E('[name=preview_html_ems]').value);
390394
fd.append('content',content || '');
391395
F.message(
392396
"Fetching preview..."
393
- ).fetch('fileedit_preview',{
397
+ ).fetch('fileedit',{
398
+ urlParams: {ajax: 'preview'},
394399
payload: fd,
395400
onload: (r)=>{
396401
callback(r);
397402
F.message('Updated preview.');
398403
},
@@ -425,11 +430,12 @@
425430
fd.append('checkin', this.finfo.checkin);
426431
fd.append('sbs', sbs ? 1 : 0);
427432
fd.append('content',content);
428433
F.message(
429434
"Fetching diff..."
430
- ).fetch('fileedit_diff',{
435
+ ).fetch('fileedit',{
436
+ urlParams: {ajax: 'diff'},
431437
payload: fd,
432438
onload: function(c){
433439
f.target.innerHTML = [
434440
"<div>Diff <code>[",
435441
self.finfo.checkin,
@@ -512,15 +518,16 @@
512518
console.error("Missing checkbox? name =",name);
513519
}
514520
});
515521
F.message(
516522
"Checking in..."
517
- ).fetch('fileedit_commit',{
523
+ ).fetch('fileedit',{
524
+ urlParams: {ajax: 'commit'},
518525
payload: fd,
519526
responseType: 'json',
520527
onload: f.updateView
521528
});
522529
return this;
523530
};
524531
525532
526533
})(window.fossil);
527534
--- src/fossil.page.fileedit.js
+++ src/fossil.page.fileedit.js
@@ -22,12 +22,12 @@
22 },
23 loadLeaves: function(){
24 D.append(D.clearElement(this.e.ciListLabel),"Loading leaves...");
25 D.disable(this.e.btnLoadFile, this.e.selectFiles, this.e.selectCi);
26 const self = this;
27 F.fetch('fileedit_filelist',{
28 urlParams:'leaves',
29 responseType: 'json',
30 onload: function(list){
31 D.append(D.clearElement(self.e.ciListLabel),"Open leaves:");
32 self.cache.checkins = list;
33 D.clearElement(D.enable(self.e.selectCi));
@@ -72,12 +72,12 @@
72 }
73 D.disable(selFiles,this.e.btnLoadFile);
74 D.clearElement(selFiles);
75 D.append(D.clearElement(this.e.fileListLabel),
76 "Loading files for "+F.hashDigits(ciUuid)+"...");
77 F.fetch('fileedit_filelist',{
78 urlParams:{checkin: ciUuid},
79 responseType: 'json',
80 onload
81 });
82 return this;
83 },
@@ -336,12 +336,16 @@
336 rev = this.finfo.checkin;
337 }
338 delete this.finfo;
339 const self = this;
340 F.message("Loading content...");
341 F.fetch('fileedit_content',{
342 urlParams: {filename:file,checkin:rev},
 
 
 
 
343 onload:(r)=>{
344 F.message('Loaded content.');
345 self.e.taEditor.value = r;
346 self.updateVersion(file,rev);
347 self.tabs.switchToTab(self.e.tabs.content);
@@ -388,11 +392,12 @@
388 fd.append('ln',E('[name=preview_ln]').checked ? 1 : 0);
389 fd.append('iframe_height', E('[name=preview_html_ems]').value);
390 fd.append('content',content || '');
391 F.message(
392 "Fetching preview..."
393 ).fetch('fileedit_preview',{
 
394 payload: fd,
395 onload: (r)=>{
396 callback(r);
397 F.message('Updated preview.');
398 },
@@ -425,11 +430,12 @@
425 fd.append('checkin', this.finfo.checkin);
426 fd.append('sbs', sbs ? 1 : 0);
427 fd.append('content',content);
428 F.message(
429 "Fetching diff..."
430 ).fetch('fileedit_diff',{
 
431 payload: fd,
432 onload: function(c){
433 f.target.innerHTML = [
434 "<div>Diff <code>[",
435 self.finfo.checkin,
@@ -512,15 +518,16 @@
512 console.error("Missing checkbox? name =",name);
513 }
514 });
515 F.message(
516 "Checking in..."
517 ).fetch('fileedit_commit',{
 
518 payload: fd,
519 responseType: 'json',
520 onload: f.updateView
521 });
522 return this;
523 };
524
525
526 })(window.fossil);
527
--- src/fossil.page.fileedit.js
+++ src/fossil.page.fileedit.js
@@ -22,12 +22,12 @@
22 },
23 loadLeaves: function(){
24 D.append(D.clearElement(this.e.ciListLabel),"Loading leaves...");
25 D.disable(this.e.btnLoadFile, this.e.selectFiles, this.e.selectCi);
26 const self = this;
27 F.fetch('fileedit',{
28 urlParams:'ajax=filelist&leaves',
29 responseType: 'json',
30 onload: function(list){
31 D.append(D.clearElement(self.e.ciListLabel),"Open leaves:");
32 self.cache.checkins = list;
33 D.clearElement(D.enable(self.e.selectCi));
@@ -72,12 +72,12 @@
72 }
73 D.disable(selFiles,this.e.btnLoadFile);
74 D.clearElement(selFiles);
75 D.append(D.clearElement(this.e.fileListLabel),
76 "Loading files for "+F.hashDigits(ciUuid)+"...");
77 F.fetch('fileedit',{
78 urlParams:{ajax:'filelist', checkin: ciUuid},
79 responseType: 'json',
80 onload
81 });
82 return this;
83 },
@@ -336,12 +336,16 @@
336 rev = this.finfo.checkin;
337 }
338 delete this.finfo;
339 const self = this;
340 F.message("Loading content...");
341 F.fetch('fileedit',{
342 urlParams: {
343 ajax: 'content',
344 filename:file,
345 checkin:rev
346 },
347 onload:(r)=>{
348 F.message('Loaded content.');
349 self.e.taEditor.value = r;
350 self.updateVersion(file,rev);
351 self.tabs.switchToTab(self.e.tabs.content);
@@ -388,11 +392,12 @@
392 fd.append('ln',E('[name=preview_ln]').checked ? 1 : 0);
393 fd.append('iframe_height', E('[name=preview_html_ems]').value);
394 fd.append('content',content || '');
395 F.message(
396 "Fetching preview..."
397 ).fetch('fileedit',{
398 urlParams: {ajax: 'preview'},
399 payload: fd,
400 onload: (r)=>{
401 callback(r);
402 F.message('Updated preview.');
403 },
@@ -425,11 +430,12 @@
430 fd.append('checkin', this.finfo.checkin);
431 fd.append('sbs', sbs ? 1 : 0);
432 fd.append('content',content);
433 F.message(
434 "Fetching diff..."
435 ).fetch('fileedit',{
436 urlParams: {ajax: 'diff'},
437 payload: fd,
438 onload: function(c){
439 f.target.innerHTML = [
440 "<div>Diff <code>[",
441 self.finfo.checkin,
@@ -512,15 +518,16 @@
518 console.error("Missing checkbox? name =",name);
519 }
520 });
521 F.message(
522 "Checking in..."
523 ).fetch('fileedit',{
524 urlParams: {ajax: 'commit'},
525 payload: fd,
526 responseType: 'json',
527 onload: f.updateView
528 });
529 return this;
530 };
531
532
533 })(window.fossil);
534

Keyboard Shortcuts

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