Fossil SCM

Renamed the file=filename, r=checkin query params to filename=..., checkin=..., for consistency with the annotate/blame URLs and possibly others.

stephan 2020-05-06 17:52 fileedit-ajaxify
Commit 6b7805e056ddd9eb86cf3e9e98b574af2beb93cb34d6584dcb258c9bb8dfdb27
+22 -21
--- src/fileedit.c
+++ src/fileedit.c
@@ -1072,12 +1072,13 @@
10721072
}
10731073
return 1;
10741074
}
10751075
10761076
/*
1077
-** Passed the values of the "r" and "file" request properties,
1078
-** this function verifies that they are valid and populates:
1077
+** Passed the values of the "checkin" and "filename" request
1078
+** properties, this function verifies that they are valid and
1079
+** populates:
10791080
**
10801081
** - *zRevUuid = the fully-expanded value of zRev (owned by the
10811082
** caller). zRevUuid may be NULL.
10821083
**
10831084
** - *vid = the RID of zRevUuid. May not be NULL.
@@ -1129,21 +1130,21 @@
11291130
/*
11301131
** WEBPAGE: fileedit_content
11311132
**
11321133
** Query parameters:
11331134
**
1134
-** file=FILENAME
1135
-** r=CHECKIN_NAME
1135
+** filename=FILENAME
1136
+** checkin=CHECKIN_NAME
11361137
**
11371138
** User must have Write access to use this page.
11381139
**
11391140
** Responds with the raw content of the given page. On error it
11401141
** produces a JSON response as documented for fileedit_ajax_error().
11411142
*/
11421143
void fileedit_ajax_content(){
1143
- const char * zFilename = PD("file",P("name"));
1144
- const char * zRev = P("r");
1144
+ const char * zFilename = PD("filename",P("name"));
1145
+ const char * zRev = P("checkin");
11451146
int vid, frid;
11461147
Blob content = empty_blob;
11471148
const char * zMime;
11481149
11491150
if(!fileedit_ajax_boostrap()
@@ -1167,11 +1168,11 @@
11671168
/*
11681169
** WEBPAGE: fileedit_preview
11691170
**
11701171
** Required query parameters:
11711172
**
1172
-** file=FILENAME
1173
+** filename=FILENAME
11731174
** content=text
11741175
**
11751176
** Optional query parameters:
11761177
**
11771178
** render_mode=integer (FE_RENDER_xxx) (default=FE_RENDER_GUESS)
@@ -1186,11 +1187,11 @@
11861187
**
11871188
** Responds with the HTML content of the preview. On error it produces
11881189
** a JSON response as documented for fileedit_ajax_error().
11891190
*/
11901191
void fileedit_ajax_preview(){
1191
- const char * zFilename = PD("file",P("name"));
1192
+ const char * zFilename = PD("filename",P("name"));
11921193
const char * zContent = P("content");
11931194
int renderMode = atoi(PD("render_mode","0"));
11941195
int ln = atoi(PD("ln","0"));
11951196
int iframeHeight = atoi(PD("iframe_height","40"));
11961197
Blob content = empty_blob;
@@ -1209,13 +1210,13 @@
12091210
/*
12101211
** WEBPAGE: fileedit_diff
12111212
**
12121213
** Required query parameters:
12131214
**
1214
-** file=FILENAME
1215
+** filename=FILENAME
12151216
** content=text
1216
-** r=checkin version
1217
+** checkin=checkin version
12171218
**
12181219
** Optional parameters:
12191220
**
12201221
** sbs=integer (1=side-by-side or 0=unified, default=0)
12211222
**
@@ -1229,12 +1230,12 @@
12291230
** Reminder: we only need the filename to perform valdiation
12301231
** against fileedit_is_editable(), else this route could be
12311232
** abused to get diffs against content disallowed by the
12321233
** whitelist.
12331234
*/
1234
- const char * zFilename = PD("file",P("name"));
1235
- const char * zRev = P("r");
1235
+ const char * zFilename = PD("filename",P("name"));
1236
+ const char * zRev = P("checkin");
12361237
const char * zContent = P("content");
12371238
char * zRevUuid = 0;
12381239
int isSbs = atoi(PD("sbs","0"));
12391240
int vid, frid;
12401241
Blob content = empty_blob;
@@ -1272,11 +1273,11 @@
12721273
char * zFileUuid = 0; /* UUID of file content */
12731274
const char * zFlag; /* generic flag */
12741275
int rc = 0, vid = 0, frid = 0; /* result code, checkin/file rids */
12751276
12761277
#define fail(EXPR) blob_appendf EXPR; goto end_fail
1277
- zFlag = PD("file",P("name"));
1278
+ zFlag = PD("filename",P("name"));
12781279
if(zFlag==0 || !*zFlag){
12791280
rc = 400;
12801281
fail((pErr,"Missing required 'file' parameter."));
12811282
}
12821283
p->zFilename = mprintf("%s",zFlag);
@@ -1287,11 +1288,11 @@
12871288
"by the [fileedit-glob] repository "
12881289
"setting.",
12891290
p->zFilename));
12901291
}
12911292
1292
- zFlag = P("r");
1293
+ zFlag = P("checkin");
12931294
if(!zFlag){
12941295
rc = 400;
12951296
fail((pErr,"Missing required 'r' parameter."));
12961297
}
12971298
vid = symbolic_name_to_rid(zFlag, "ci");
@@ -1382,12 +1383,12 @@
13821383
/*
13831384
** WEBPAGE: fileedit_commit
13841385
**
13851386
** Required query parameters:
13861387
**
1387
-** file=FILENAME
1388
-** r=Parent checkin UUID
1388
+** filename=FILENAME
1389
+** checkin=Parent checkin UUID
13891390
** content=text
13901391
** comment=text
13911392
**
13921393
** Optional query parameters:
13931394
**
@@ -1460,13 +1461,13 @@
14601461
** EXPERIMENTAL and subject to change and removal at any time. The goal
14611462
** is to allow online edits of files.
14621463
**
14631464
** Query parameters:
14641465
**
1465
-** file=FILENAME Repo-relative path to the file.
1466
-** r=VERSION Checkin version, using any unambiguous
1467
-** supported symbolic version name.
1466
+** filename=FILENAME Repo-relative path to the file.
1467
+** checkin=VERSION Checkin version, using any unambiguous
1468
+** supported symbolic version name.
14681469
**
14691470
** All other parameters are for internal use only, submitted via the
14701471
** form-submission process, and may change with any given revision of
14711472
** this code.
14721473
*/
@@ -1521,13 +1522,13 @@
15211522
CX("<p>This page is <em>NEW AND EXPERIMENTAL</em>. "
15221523
"USE AT YOUR OWN RISK, preferably on a test "
15231524
"repo.</p>\n");
15241525
15251526
/******* Hidden fields *******/
1526
- CX("<input type='hidden' name='r' value='%s'>",
1527
+ CX("<input type='hidden' name='checkin' value='%s'>",
15271528
cimi.zParentUuid);
1528
- CX("<input type='hidden' name='file' value='%T'>",
1529
+ CX("<input type='hidden' name='filename' value='%T'>",
15291530
zFilename);
15301531
15311532
/* Status bar */
15321533
CX("<div id='fossil-status-bar'>Async. status messages will go "
15331534
"here.</div>\n"/* will be moved into the tab container via JS */);
15341535
--- src/fileedit.c
+++ src/fileedit.c
@@ -1072,12 +1072,13 @@
1072 }
1073 return 1;
1074 }
1075
1076 /*
1077 ** Passed the values of the "r" and "file" request properties,
1078 ** this function verifies that they are valid and populates:
 
1079 **
1080 ** - *zRevUuid = the fully-expanded value of zRev (owned by the
1081 ** caller). zRevUuid may be NULL.
1082 **
1083 ** - *vid = the RID of zRevUuid. May not be NULL.
@@ -1129,21 +1130,21 @@
1129 /*
1130 ** WEBPAGE: fileedit_content
1131 **
1132 ** Query parameters:
1133 **
1134 ** file=FILENAME
1135 ** r=CHECKIN_NAME
1136 **
1137 ** User must have Write access to use this page.
1138 **
1139 ** Responds with the raw content of the given page. On error it
1140 ** produces a JSON response as documented for fileedit_ajax_error().
1141 */
1142 void fileedit_ajax_content(){
1143 const char * zFilename = PD("file",P("name"));
1144 const char * zRev = P("r");
1145 int vid, frid;
1146 Blob content = empty_blob;
1147 const char * zMime;
1148
1149 if(!fileedit_ajax_boostrap()
@@ -1167,11 +1168,11 @@
1167 /*
1168 ** WEBPAGE: fileedit_preview
1169 **
1170 ** Required query parameters:
1171 **
1172 ** file=FILENAME
1173 ** content=text
1174 **
1175 ** Optional query parameters:
1176 **
1177 ** render_mode=integer (FE_RENDER_xxx) (default=FE_RENDER_GUESS)
@@ -1186,11 +1187,11 @@
1186 **
1187 ** Responds with the HTML content of the preview. On error it produces
1188 ** a JSON response as documented for fileedit_ajax_error().
1189 */
1190 void fileedit_ajax_preview(){
1191 const char * zFilename = PD("file",P("name"));
1192 const char * zContent = P("content");
1193 int renderMode = atoi(PD("render_mode","0"));
1194 int ln = atoi(PD("ln","0"));
1195 int iframeHeight = atoi(PD("iframe_height","40"));
1196 Blob content = empty_blob;
@@ -1209,13 +1210,13 @@
1209 /*
1210 ** WEBPAGE: fileedit_diff
1211 **
1212 ** Required query parameters:
1213 **
1214 ** file=FILENAME
1215 ** content=text
1216 ** r=checkin version
1217 **
1218 ** Optional parameters:
1219 **
1220 ** sbs=integer (1=side-by-side or 0=unified, default=0)
1221 **
@@ -1229,12 +1230,12 @@
1229 ** Reminder: we only need the filename to perform valdiation
1230 ** against fileedit_is_editable(), else this route could be
1231 ** abused to get diffs against content disallowed by the
1232 ** whitelist.
1233 */
1234 const char * zFilename = PD("file",P("name"));
1235 const char * zRev = P("r");
1236 const char * zContent = P("content");
1237 char * zRevUuid = 0;
1238 int isSbs = atoi(PD("sbs","0"));
1239 int vid, frid;
1240 Blob content = empty_blob;
@@ -1272,11 +1273,11 @@
1272 char * zFileUuid = 0; /* UUID of file content */
1273 const char * zFlag; /* generic flag */
1274 int rc = 0, vid = 0, frid = 0; /* result code, checkin/file rids */
1275
1276 #define fail(EXPR) blob_appendf EXPR; goto end_fail
1277 zFlag = PD("file",P("name"));
1278 if(zFlag==0 || !*zFlag){
1279 rc = 400;
1280 fail((pErr,"Missing required 'file' parameter."));
1281 }
1282 p->zFilename = mprintf("%s",zFlag);
@@ -1287,11 +1288,11 @@
1287 "by the [fileedit-glob] repository "
1288 "setting.",
1289 p->zFilename));
1290 }
1291
1292 zFlag = P("r");
1293 if(!zFlag){
1294 rc = 400;
1295 fail((pErr,"Missing required 'r' parameter."));
1296 }
1297 vid = symbolic_name_to_rid(zFlag, "ci");
@@ -1382,12 +1383,12 @@
1382 /*
1383 ** WEBPAGE: fileedit_commit
1384 **
1385 ** Required query parameters:
1386 **
1387 ** file=FILENAME
1388 ** r=Parent checkin UUID
1389 ** content=text
1390 ** comment=text
1391 **
1392 ** Optional query parameters:
1393 **
@@ -1460,13 +1461,13 @@
1460 ** EXPERIMENTAL and subject to change and removal at any time. The goal
1461 ** is to allow online edits of files.
1462 **
1463 ** Query parameters:
1464 **
1465 ** file=FILENAME Repo-relative path to the file.
1466 ** r=VERSION Checkin version, using any unambiguous
1467 ** supported symbolic version name.
1468 **
1469 ** All other parameters are for internal use only, submitted via the
1470 ** form-submission process, and may change with any given revision of
1471 ** this code.
1472 */
@@ -1521,13 +1522,13 @@
1521 CX("<p>This page is <em>NEW AND EXPERIMENTAL</em>. "
1522 "USE AT YOUR OWN RISK, preferably on a test "
1523 "repo.</p>\n");
1524
1525 /******* Hidden fields *******/
1526 CX("<input type='hidden' name='r' value='%s'>",
1527 cimi.zParentUuid);
1528 CX("<input type='hidden' name='file' value='%T'>",
1529 zFilename);
1530
1531 /* Status bar */
1532 CX("<div id='fossil-status-bar'>Async. status messages will go "
1533 "here.</div>\n"/* will be moved into the tab container via JS */);
1534
--- src/fileedit.c
+++ src/fileedit.c
@@ -1072,12 +1072,13 @@
1072 }
1073 return 1;
1074 }
1075
1076 /*
1077 ** Passed the values of the "checkin" and "filename" request
1078 ** properties, this function verifies that they are valid and
1079 ** populates:
1080 **
1081 ** - *zRevUuid = the fully-expanded value of zRev (owned by the
1082 ** caller). zRevUuid may be NULL.
1083 **
1084 ** - *vid = the RID of zRevUuid. May not be NULL.
@@ -1129,21 +1130,21 @@
1130 /*
1131 ** WEBPAGE: fileedit_content
1132 **
1133 ** Query parameters:
1134 **
1135 ** filename=FILENAME
1136 ** checkin=CHECKIN_NAME
1137 **
1138 ** User must have Write access to use this page.
1139 **
1140 ** Responds with the raw content of the given page. On error it
1141 ** produces a JSON response as documented for fileedit_ajax_error().
1142 */
1143 void fileedit_ajax_content(){
1144 const char * zFilename = PD("filename",P("name"));
1145 const char * zRev = P("checkin");
1146 int vid, frid;
1147 Blob content = empty_blob;
1148 const char * zMime;
1149
1150 if(!fileedit_ajax_boostrap()
@@ -1167,11 +1168,11 @@
1168 /*
1169 ** WEBPAGE: fileedit_preview
1170 **
1171 ** Required query parameters:
1172 **
1173 ** filename=FILENAME
1174 ** content=text
1175 **
1176 ** Optional query parameters:
1177 **
1178 ** render_mode=integer (FE_RENDER_xxx) (default=FE_RENDER_GUESS)
@@ -1186,11 +1187,11 @@
1187 **
1188 ** Responds with the HTML content of the preview. On error it produces
1189 ** a JSON response as documented for fileedit_ajax_error().
1190 */
1191 void fileedit_ajax_preview(){
1192 const char * zFilename = PD("filename",P("name"));
1193 const char * zContent = P("content");
1194 int renderMode = atoi(PD("render_mode","0"));
1195 int ln = atoi(PD("ln","0"));
1196 int iframeHeight = atoi(PD("iframe_height","40"));
1197 Blob content = empty_blob;
@@ -1209,13 +1210,13 @@
1210 /*
1211 ** WEBPAGE: fileedit_diff
1212 **
1213 ** Required query parameters:
1214 **
1215 ** filename=FILENAME
1216 ** content=text
1217 ** checkin=checkin version
1218 **
1219 ** Optional parameters:
1220 **
1221 ** sbs=integer (1=side-by-side or 0=unified, default=0)
1222 **
@@ -1229,12 +1230,12 @@
1230 ** Reminder: we only need the filename to perform valdiation
1231 ** against fileedit_is_editable(), else this route could be
1232 ** abused to get diffs against content disallowed by the
1233 ** whitelist.
1234 */
1235 const char * zFilename = PD("filename",P("name"));
1236 const char * zRev = P("checkin");
1237 const char * zContent = P("content");
1238 char * zRevUuid = 0;
1239 int isSbs = atoi(PD("sbs","0"));
1240 int vid, frid;
1241 Blob content = empty_blob;
@@ -1272,11 +1273,11 @@
1273 char * zFileUuid = 0; /* UUID of file content */
1274 const char * zFlag; /* generic flag */
1275 int rc = 0, vid = 0, frid = 0; /* result code, checkin/file rids */
1276
1277 #define fail(EXPR) blob_appendf EXPR; goto end_fail
1278 zFlag = PD("filename",P("name"));
1279 if(zFlag==0 || !*zFlag){
1280 rc = 400;
1281 fail((pErr,"Missing required 'file' parameter."));
1282 }
1283 p->zFilename = mprintf("%s",zFlag);
@@ -1287,11 +1288,11 @@
1288 "by the [fileedit-glob] repository "
1289 "setting.",
1290 p->zFilename));
1291 }
1292
1293 zFlag = P("checkin");
1294 if(!zFlag){
1295 rc = 400;
1296 fail((pErr,"Missing required 'r' parameter."));
1297 }
1298 vid = symbolic_name_to_rid(zFlag, "ci");
@@ -1382,12 +1383,12 @@
1383 /*
1384 ** WEBPAGE: fileedit_commit
1385 **
1386 ** Required query parameters:
1387 **
1388 ** filename=FILENAME
1389 ** checkin=Parent checkin UUID
1390 ** content=text
1391 ** comment=text
1392 **
1393 ** Optional query parameters:
1394 **
@@ -1460,13 +1461,13 @@
1461 ** EXPERIMENTAL and subject to change and removal at any time. The goal
1462 ** is to allow online edits of files.
1463 **
1464 ** Query parameters:
1465 **
1466 ** filename=FILENAME Repo-relative path to the file.
1467 ** checkin=VERSION Checkin version, using any unambiguous
1468 ** supported symbolic version name.
1469 **
1470 ** All other parameters are for internal use only, submitted via the
1471 ** form-submission process, and may change with any given revision of
1472 ** this code.
1473 */
@@ -1521,13 +1522,13 @@
1522 CX("<p>This page is <em>NEW AND EXPERIMENTAL</em>. "
1523 "USE AT YOUR OWN RISK, preferably on a test "
1524 "repo.</p>\n");
1525
1526 /******* Hidden fields *******/
1527 CX("<input type='hidden' name='checkin' value='%s'>",
1528 cimi.zParentUuid);
1529 CX("<input type='hidden' name='filename' value='%T'>",
1530 zFilename);
1531
1532 /* Status bar */
1533 CX("<div id='fossil-status-bar'>Async. status messages will go "
1534 "here.</div>\n"/* will be moved into the tab container via JS */);
1535
+1 -1
--- src/finfo.c
+++ src/finfo.c
@@ -622,11 +622,11 @@
622622
@ %z(href("%R/timeline?n=all&uf=%!S",zUuid))[check-ins&nbsp;using]</a>
623623
if( fpid>0 ){
624624
@ %z(href("%R/fdiff?v1=%!S&v2=%!S",zPUuid,zUuid))[diff]</a>
625625
}
626626
if( fileedit_is_editable(zFilename) ){
627
- @ %z(href("%R/fileedit?file=%T&r=%!S",zFilename,zCkin))[edit]</a>
627
+ @ %z(href("%R/fileedit?filename=%T&checkin=%!S",zFilename,zCkin))[edit]</a>
628628
}
629629
@ </span></span>
630630
}
631631
if( fDebug & FINFO_DEBUG_MLINK ){
632632
int ii;
633633
--- src/finfo.c
+++ src/finfo.c
@@ -622,11 +622,11 @@
622 @ %z(href("%R/timeline?n=all&uf=%!S",zUuid))[check-ins&nbsp;using]</a>
623 if( fpid>0 ){
624 @ %z(href("%R/fdiff?v1=%!S&v2=%!S",zPUuid,zUuid))[diff]</a>
625 }
626 if( fileedit_is_editable(zFilename) ){
627 @ %z(href("%R/fileedit?file=%T&r=%!S",zFilename,zCkin))[edit]</a>
628 }
629 @ </span></span>
630 }
631 if( fDebug & FINFO_DEBUG_MLINK ){
632 int ii;
633
--- src/finfo.c
+++ src/finfo.c
@@ -622,11 +622,11 @@
622 @ %z(href("%R/timeline?n=all&uf=%!S",zUuid))[check-ins&nbsp;using]</a>
623 if( fpid>0 ){
624 @ %z(href("%R/fdiff?v1=%!S&v2=%!S",zPUuid,zUuid))[diff]</a>
625 }
626 if( fileedit_is_editable(zFilename) ){
627 @ %z(href("%R/fileedit?filename=%T&checkin=%!S",zFilename,zCkin))[edit]</a>
628 }
629 @ </span></span>
630 }
631 if( fDebug & FINFO_DEBUG_MLINK ){
632 int ii;
633
--- src/fossil.page.fileedit.js
+++ src/fossil.page.fileedit.js
@@ -112,11 +112,11 @@
112112
elements...
113113
114114
Returns this object.
115115
*/
116116
P.updateVersion = function(file,rev){
117
- this.finfo = {file,r:rev};
117
+ this.finfo = {filename:file,checkin:rev};
118118
const E = (s)=>document.querySelector(s),
119119
euc = encodeURIComponent,
120120
rShort = rev.substr(0,16);
121121
E('#r-label').innerText=rev;
122122
E('#finfo-link').setAttribute(
@@ -127,11 +127,14 @@
127127
E('#r-link').setAttribute(
128128
'href',
129129
F.repoUrl('info/'+rev)
130130
);
131131
E('#r-label').innerText = rev;
132
- const purlArgs = F.encodeUrlArgs({file, r:rShort},false,true);
132
+ const purlArgs = F.encodeUrlArgs({
133
+ filename: this.finfo.filename,
134
+ checkin: this.finfo.checkin
135
+ },false,true);
133136
const purl = F.repoUrl('fileedit',purlArgs);
134137
const e = E('#permalink');
135138
e.innerText='fileedit?'+purlArgs;
136139
e.setAttribute('href',purl);
137140
return this;
@@ -144,18 +147,18 @@
144147
Returns this object, noting that the load is async.
145148
*/
146149
P.loadFile = function(file,rev){
147150
if(0===arguments.length){
148151
if(!this.finfo) return this;
149
- file = this.finfo.file;
150
- rev = this.finfo.r;
152
+ file = this.finfo.filename;
153
+ rev = this.finfo.checkin;
151154
}
152155
delete this.finfo;
153156
const self = this;
154157
F.message("Loading content...");
155158
F.fetch('fileedit_content',{
156
- urlParams:{file:file,r:rev},
159
+ urlParams: {filename:file,checkin:rev},
157160
onload:(r)=>{
158161
F.message('Loaded content.');
159162
self.e.taEditor.value = r;
160163
self.updateVersion(file,rev);
161164
self.preview();
@@ -184,11 +187,10 @@
184187
const updateView = function(c){
185188
D.clearElement(target);
186189
if('string'===typeof c){
187190
target.innerHTML = c;
188191
}
189
- F.message('Updated preview.');
190192
if(switchToTab) self.tabs.switchToTab(self.e.tabs.preview);
191193
};
192194
if(!content){
193195
updateView('');
194196
return this;
@@ -205,17 +207,20 @@
205207
callback(content);
206208
return;
207209
}
208210
const fd = new FormData();
209211
fd.append('render_mode',E('select[name=preview_render_mode]').value);
210
- fd.append('file',this.finfo.file);
212
+ fd.append('filename',this.finfo.filename);
211213
fd.append('ln',E('[name=preview_ln]').checked ? 1 : 0);
212214
fd.append('iframe_height', E('[name=preview_html_ems]').value);
213215
fd.append('content',content || '');
214216
fossil.fetch('fileedit_preview',{
215217
payload: fd,
216
- onload: callback,
218
+ onload: (r)=>{
219
+ callback(r);
220
+ F.message('Updated preview.');
221
+ },
217222
onerror: (e)=>{
218223
fossil.fetch.onerror(e);
219224
callback("Error fetching preview: "+e);
220225
}
221226
});
@@ -237,22 +242,22 @@
237242
target = this.e.tabs.diff.querySelector(
238243
'#fileedit-tab-diff-wrapper'
239244
),
240245
self = this;
241246
const fd = new FormData();
242
- fd.append('file',this.finfo.file);
243
- fd.append('r', this.finfo.r);
247
+ fd.append('filename',this.finfo.filename);
248
+ fd.append('checkin', this.finfo.checkin);
244249
fd.append('sbs', sbs ? 1 : 0);
245250
fd.append('content',content);
246251
F.message(
247252
"Fetching diff..."
248253
).fetch('fileedit_diff',{
249254
payload: fd,
250255
onload: function(c){
251256
target.innerHTML = [
252257
"<div>Diff <code>[",
253
- self.finfo.r,
258
+ self.finfo.checkin,
254259
"]</code> &rarr; Local Edits</div>",
255260
c||'No changes.'
256261
].join('');
257262
F.message('Updated diff.');
258263
self.tabs.switchToTab(self.e.tabs.diff);
@@ -275,11 +280,11 @@
275280
const self = this;
276281
const content = this.e.taEditor.value,
277282
target = document.querySelector('#fileedit-manifest'),
278283
cbDryRun = E('[name=dry_run]'),
279284
isDryRun = cbDryRun.checked,
280
- filename = this.finfo.file;
285
+ filename = this.finfo.filename;
281286
if(!f.updateView){
282287
f.updateView = function(c){
283288
target.innerHTML = [
284289
"<h3>Manifest",
285290
(c.dryRun?" (dry run)":""),
@@ -306,12 +311,12 @@
306311
if(!content){
307312
f.updateView('');
308313
return this;
309314
}
310315
const fd = new FormData();
311
- fd.append('file',filename);
312
- fd.append('r', this.finfo.r);
316
+ fd.append('filename',filename);
317
+ fd.append('checkin', this.finfo.checkin);
313318
fd.append('content',content);
314319
fd.append('dry_run',isDryRun ? 1 : 0);
315320
/* Text fields or select lists... */
316321
['comment_mimetype',
317322
'comment'
318323
--- src/fossil.page.fileedit.js
+++ src/fossil.page.fileedit.js
@@ -112,11 +112,11 @@
112 elements...
113
114 Returns this object.
115 */
116 P.updateVersion = function(file,rev){
117 this.finfo = {file,r:rev};
118 const E = (s)=>document.querySelector(s),
119 euc = encodeURIComponent,
120 rShort = rev.substr(0,16);
121 E('#r-label').innerText=rev;
122 E('#finfo-link').setAttribute(
@@ -127,11 +127,14 @@
127 E('#r-link').setAttribute(
128 'href',
129 F.repoUrl('info/'+rev)
130 );
131 E('#r-label').innerText = rev;
132 const purlArgs = F.encodeUrlArgs({file, r:rShort},false,true);
 
 
 
133 const purl = F.repoUrl('fileedit',purlArgs);
134 const e = E('#permalink');
135 e.innerText='fileedit?'+purlArgs;
136 e.setAttribute('href',purl);
137 return this;
@@ -144,18 +147,18 @@
144 Returns this object, noting that the load is async.
145 */
146 P.loadFile = function(file,rev){
147 if(0===arguments.length){
148 if(!this.finfo) return this;
149 file = this.finfo.file;
150 rev = this.finfo.r;
151 }
152 delete this.finfo;
153 const self = this;
154 F.message("Loading content...");
155 F.fetch('fileedit_content',{
156 urlParams:{file:file,r:rev},
157 onload:(r)=>{
158 F.message('Loaded content.');
159 self.e.taEditor.value = r;
160 self.updateVersion(file,rev);
161 self.preview();
@@ -184,11 +187,10 @@
184 const updateView = function(c){
185 D.clearElement(target);
186 if('string'===typeof c){
187 target.innerHTML = c;
188 }
189 F.message('Updated preview.');
190 if(switchToTab) self.tabs.switchToTab(self.e.tabs.preview);
191 };
192 if(!content){
193 updateView('');
194 return this;
@@ -205,17 +207,20 @@
205 callback(content);
206 return;
207 }
208 const fd = new FormData();
209 fd.append('render_mode',E('select[name=preview_render_mode]').value);
210 fd.append('file',this.finfo.file);
211 fd.append('ln',E('[name=preview_ln]').checked ? 1 : 0);
212 fd.append('iframe_height', E('[name=preview_html_ems]').value);
213 fd.append('content',content || '');
214 fossil.fetch('fileedit_preview',{
215 payload: fd,
216 onload: callback,
 
 
 
217 onerror: (e)=>{
218 fossil.fetch.onerror(e);
219 callback("Error fetching preview: "+e);
220 }
221 });
@@ -237,22 +242,22 @@
237 target = this.e.tabs.diff.querySelector(
238 '#fileedit-tab-diff-wrapper'
239 ),
240 self = this;
241 const fd = new FormData();
242 fd.append('file',this.finfo.file);
243 fd.append('r', this.finfo.r);
244 fd.append('sbs', sbs ? 1 : 0);
245 fd.append('content',content);
246 F.message(
247 "Fetching diff..."
248 ).fetch('fileedit_diff',{
249 payload: fd,
250 onload: function(c){
251 target.innerHTML = [
252 "<div>Diff <code>[",
253 self.finfo.r,
254 "]</code> &rarr; Local Edits</div>",
255 c||'No changes.'
256 ].join('');
257 F.message('Updated diff.');
258 self.tabs.switchToTab(self.e.tabs.diff);
@@ -275,11 +280,11 @@
275 const self = this;
276 const content = this.e.taEditor.value,
277 target = document.querySelector('#fileedit-manifest'),
278 cbDryRun = E('[name=dry_run]'),
279 isDryRun = cbDryRun.checked,
280 filename = this.finfo.file;
281 if(!f.updateView){
282 f.updateView = function(c){
283 target.innerHTML = [
284 "<h3>Manifest",
285 (c.dryRun?" (dry run)":""),
@@ -306,12 +311,12 @@
306 if(!content){
307 f.updateView('');
308 return this;
309 }
310 const fd = new FormData();
311 fd.append('file',filename);
312 fd.append('r', this.finfo.r);
313 fd.append('content',content);
314 fd.append('dry_run',isDryRun ? 1 : 0);
315 /* Text fields or select lists... */
316 ['comment_mimetype',
317 'comment'
318
--- src/fossil.page.fileedit.js
+++ src/fossil.page.fileedit.js
@@ -112,11 +112,11 @@
112 elements...
113
114 Returns this object.
115 */
116 P.updateVersion = function(file,rev){
117 this.finfo = {filename:file,checkin:rev};
118 const E = (s)=>document.querySelector(s),
119 euc = encodeURIComponent,
120 rShort = rev.substr(0,16);
121 E('#r-label').innerText=rev;
122 E('#finfo-link').setAttribute(
@@ -127,11 +127,14 @@
127 E('#r-link').setAttribute(
128 'href',
129 F.repoUrl('info/'+rev)
130 );
131 E('#r-label').innerText = rev;
132 const purlArgs = F.encodeUrlArgs({
133 filename: this.finfo.filename,
134 checkin: this.finfo.checkin
135 },false,true);
136 const purl = F.repoUrl('fileedit',purlArgs);
137 const e = E('#permalink');
138 e.innerText='fileedit?'+purlArgs;
139 e.setAttribute('href',purl);
140 return this;
@@ -144,18 +147,18 @@
147 Returns this object, noting that the load is async.
148 */
149 P.loadFile = function(file,rev){
150 if(0===arguments.length){
151 if(!this.finfo) return this;
152 file = this.finfo.filename;
153 rev = this.finfo.checkin;
154 }
155 delete this.finfo;
156 const self = this;
157 F.message("Loading content...");
158 F.fetch('fileedit_content',{
159 urlParams: {filename:file,checkin:rev},
160 onload:(r)=>{
161 F.message('Loaded content.');
162 self.e.taEditor.value = r;
163 self.updateVersion(file,rev);
164 self.preview();
@@ -184,11 +187,10 @@
187 const updateView = function(c){
188 D.clearElement(target);
189 if('string'===typeof c){
190 target.innerHTML = c;
191 }
 
192 if(switchToTab) self.tabs.switchToTab(self.e.tabs.preview);
193 };
194 if(!content){
195 updateView('');
196 return this;
@@ -205,17 +207,20 @@
207 callback(content);
208 return;
209 }
210 const fd = new FormData();
211 fd.append('render_mode',E('select[name=preview_render_mode]').value);
212 fd.append('filename',this.finfo.filename);
213 fd.append('ln',E('[name=preview_ln]').checked ? 1 : 0);
214 fd.append('iframe_height', E('[name=preview_html_ems]').value);
215 fd.append('content',content || '');
216 fossil.fetch('fileedit_preview',{
217 payload: fd,
218 onload: (r)=>{
219 callback(r);
220 F.message('Updated preview.');
221 },
222 onerror: (e)=>{
223 fossil.fetch.onerror(e);
224 callback("Error fetching preview: "+e);
225 }
226 });
@@ -237,22 +242,22 @@
242 target = this.e.tabs.diff.querySelector(
243 '#fileedit-tab-diff-wrapper'
244 ),
245 self = this;
246 const fd = new FormData();
247 fd.append('filename',this.finfo.filename);
248 fd.append('checkin', this.finfo.checkin);
249 fd.append('sbs', sbs ? 1 : 0);
250 fd.append('content',content);
251 F.message(
252 "Fetching diff..."
253 ).fetch('fileedit_diff',{
254 payload: fd,
255 onload: function(c){
256 target.innerHTML = [
257 "<div>Diff <code>[",
258 self.finfo.checkin,
259 "]</code> &rarr; Local Edits</div>",
260 c||'No changes.'
261 ].join('');
262 F.message('Updated diff.');
263 self.tabs.switchToTab(self.e.tabs.diff);
@@ -275,11 +280,11 @@
280 const self = this;
281 const content = this.e.taEditor.value,
282 target = document.querySelector('#fileedit-manifest'),
283 cbDryRun = E('[name=dry_run]'),
284 isDryRun = cbDryRun.checked,
285 filename = this.finfo.filename;
286 if(!f.updateView){
287 f.updateView = function(c){
288 target.innerHTML = [
289 "<h3>Manifest",
290 (c.dryRun?" (dry run)":""),
@@ -306,12 +311,12 @@
311 if(!content){
312 f.updateView('');
313 return this;
314 }
315 const fd = new FormData();
316 fd.append('filename',filename);
317 fd.append('checkin', this.finfo.checkin);
318 fd.append('content',content);
319 fd.append('dry_run',isDryRun ? 1 : 0);
320 /* Text fields or select lists... */
321 ['comment_mimetype',
322 'comment'
323
+1 -1
--- src/info.c
+++ src/info.c
@@ -1457,11 +1457,11 @@
14571457
@ [annotate]</a>
14581458
@ %z(href("%R/blame?filename=%T&checkin=%!S",zName,zVers))
14591459
@ [blame]</a>
14601460
@ %z(href("%R/timeline?n=all&uf=%!S",zUuid))[check-ins&nbsp;using]</a>
14611461
if( fileedit_is_editable(zName) ){
1462
- @ %z(href("%R/fileedit?file=%T&r=%!S",zName,zVers))[edit]</a>
1462
+ @ %z(href("%R/fileedit?filename=%T&checkin=%!S",zName,zVers))[edit]</a>
14631463
}
14641464
}
14651465
cnt++;
14661466
if( pDownloadName && blob_size(pDownloadName)==0 ){
14671467
blob_append(pDownloadName, zName, -1);
14681468
--- src/info.c
+++ src/info.c
@@ -1457,11 +1457,11 @@
1457 @ [annotate]</a>
1458 @ %z(href("%R/blame?filename=%T&checkin=%!S",zName,zVers))
1459 @ [blame]</a>
1460 @ %z(href("%R/timeline?n=all&uf=%!S",zUuid))[check-ins&nbsp;using]</a>
1461 if( fileedit_is_editable(zName) ){
1462 @ %z(href("%R/fileedit?file=%T&r=%!S",zName,zVers))[edit]</a>
1463 }
1464 }
1465 cnt++;
1466 if( pDownloadName && blob_size(pDownloadName)==0 ){
1467 blob_append(pDownloadName, zName, -1);
1468
--- src/info.c
+++ src/info.c
@@ -1457,11 +1457,11 @@
1457 @ [annotate]</a>
1458 @ %z(href("%R/blame?filename=%T&checkin=%!S",zName,zVers))
1459 @ [blame]</a>
1460 @ %z(href("%R/timeline?n=all&uf=%!S",zUuid))[check-ins&nbsp;using]</a>
1461 if( fileedit_is_editable(zName) ){
1462 @ %z(href("%R/fileedit?filename=%T&checkin=%!S",zName,zVers))[edit]</a>
1463 }
1464 }
1465 cnt++;
1466 if( pDownloadName && blob_size(pDownloadName)==0 ){
1467 blob_append(pDownloadName, zName, -1);
1468

Keyboard Shortcuts

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