Fossil SCM

Initial infrastructure changes for improved WWW editing and creation of check-ins.

drh 2026-05-05 17:41 UTC trunk
Commit 2bee647ed6fd4bf28efa75f05a326fbe15a7914a804f550d66bdbff63475f0eb
3 files changed +4 -1 +4 -1 +17 -4
+4 -1
--- src/branch.c
+++ src/branch.c
@@ -1076,10 +1076,11 @@
10761076
Blob sql = empty_blob;
10771077
Stmt q;
10781078
int tmFlags; /* Timeline display flags */
10791079
int fNoHidden = PB("nohidden")!=0; /* The "nohidden" query parameter */
10801080
int fOnlyHidden = PB("onlyhidden")!=0; /* The "onlyhidden" query parameter */
1081
+ TimelineXtra xtra;
10811082
10821083
login_check_credentials();
10831084
if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
10841085
if( robot_restrict("timelineX") ) return;
10851086
@@ -1109,11 +1110,13 @@
11091110
if( PB("ubg")!=0 ){
11101111
tmFlags |= TIMELINE_UCOLOR;
11111112
}else{
11121113
tmFlags |= TIMELINE_BRCOLOR;
11131114
}
1114
- www_print_timeline(&q, tmFlags, 0, 0, 0, 0, 0, brtimeline_extra);
1115
+ memset(&xtra, 0, sizeof(xtra));
1116
+ xtra.xExtra = brtimeline_extra;
1117
+ www_print_timeline(&q, tmFlags, 0, 0, 0, 0, 0, &xtra);
11151118
db_finalize(&q);
11161119
style_finish_page();
11171120
}
11181121
11191122
/*
11201123
--- src/branch.c
+++ src/branch.c
@@ -1076,10 +1076,11 @@
1076 Blob sql = empty_blob;
1077 Stmt q;
1078 int tmFlags; /* Timeline display flags */
1079 int fNoHidden = PB("nohidden")!=0; /* The "nohidden" query parameter */
1080 int fOnlyHidden = PB("onlyhidden")!=0; /* The "onlyhidden" query parameter */
 
1081
1082 login_check_credentials();
1083 if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
1084 if( robot_restrict("timelineX") ) return;
1085
@@ -1109,11 +1110,13 @@
1109 if( PB("ubg")!=0 ){
1110 tmFlags |= TIMELINE_UCOLOR;
1111 }else{
1112 tmFlags |= TIMELINE_BRCOLOR;
1113 }
1114 www_print_timeline(&q, tmFlags, 0, 0, 0, 0, 0, brtimeline_extra);
 
 
1115 db_finalize(&q);
1116 style_finish_page();
1117 }
1118
1119 /*
1120
--- src/branch.c
+++ src/branch.c
@@ -1076,10 +1076,11 @@
1076 Blob sql = empty_blob;
1077 Stmt q;
1078 int tmFlags; /* Timeline display flags */
1079 int fNoHidden = PB("nohidden")!=0; /* The "nohidden" query parameter */
1080 int fOnlyHidden = PB("onlyhidden")!=0; /* The "onlyhidden" query parameter */
1081 TimelineXtra xtra;
1082
1083 login_check_credentials();
1084 if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
1085 if( robot_restrict("timelineX") ) return;
1086
@@ -1109,11 +1110,13 @@
1110 if( PB("ubg")!=0 ){
1111 tmFlags |= TIMELINE_UCOLOR;
1112 }else{
1113 tmFlags |= TIMELINE_BRCOLOR;
1114 }
1115 memset(&xtra, 0, sizeof(xtra));
1116 xtra.xExtra = brtimeline_extra;
1117 www_print_timeline(&q, tmFlags, 0, 0, 0, 0, 0, &xtra);
1118 db_finalize(&q);
1119 style_finish_page();
1120 }
1121
1122 /*
1123
+4 -1
--- src/tar.c
+++ src/tar.c
@@ -1248,10 +1248,11 @@
12481248
12491249
n = db_int(0, "SELECT count(*) FROM tarlist");
12501250
if( n==0 ){
12511251
@ <h2>No tarball/ZIP suggestions are available at this time</h2>
12521252
}else{
1253
+ TimelineXtra xtra;
12531254
@ <h2>%d(n) Tarball/ZIP Download Suggestion%s(n>1?"s":""):</h2>
12541255
db_prepare(&q,
12551256
"WITH matches AS (%s AND blob.rid IN (SELECT rid FROM tarlist))\n"
12561257
"SELECT blobRid, uuid, timestamp,"
12571258
" com||comment,"
@@ -1261,11 +1262,13 @@
12611262
timeline_query_for_www()
12621263
);
12631264
12641265
tmFlags = TIMELINE_DISJOINT | TIMELINE_NOSCROLL | TIMELINE_COLUMNAR
12651266
| TIMELINE_BRCOLOR;
1266
- www_print_timeline(&q, tmFlags, 0, 0, 0, 0, 0, download_extra);
1267
+ memset(&xtra, 0, sizeof(xtra));
1268
+ xtra.xExtra = download_extra;
1269
+ www_print_timeline(&q, tmFlags, 0, 0, 0, 0, 0, &xtra);
12671270
db_finalize(&q);
12681271
}
12691272
if( g.perm.Clone ){
12701273
char *zNm = fossil_strdup(db_get("project-name","clone"));
12711274
sanitize_name(zNm);
12721275
--- src/tar.c
+++ src/tar.c
@@ -1248,10 +1248,11 @@
1248
1249 n = db_int(0, "SELECT count(*) FROM tarlist");
1250 if( n==0 ){
1251 @ <h2>No tarball/ZIP suggestions are available at this time</h2>
1252 }else{
 
1253 @ <h2>%d(n) Tarball/ZIP Download Suggestion%s(n>1?"s":""):</h2>
1254 db_prepare(&q,
1255 "WITH matches AS (%s AND blob.rid IN (SELECT rid FROM tarlist))\n"
1256 "SELECT blobRid, uuid, timestamp,"
1257 " com||comment,"
@@ -1261,11 +1262,13 @@
1261 timeline_query_for_www()
1262 );
1263
1264 tmFlags = TIMELINE_DISJOINT | TIMELINE_NOSCROLL | TIMELINE_COLUMNAR
1265 | TIMELINE_BRCOLOR;
1266 www_print_timeline(&q, tmFlags, 0, 0, 0, 0, 0, download_extra);
 
 
1267 db_finalize(&q);
1268 }
1269 if( g.perm.Clone ){
1270 char *zNm = fossil_strdup(db_get("project-name","clone"));
1271 sanitize_name(zNm);
1272
--- src/tar.c
+++ src/tar.c
@@ -1248,10 +1248,11 @@
1248
1249 n = db_int(0, "SELECT count(*) FROM tarlist");
1250 if( n==0 ){
1251 @ <h2>No tarball/ZIP suggestions are available at this time</h2>
1252 }else{
1253 TimelineXtra xtra;
1254 @ <h2>%d(n) Tarball/ZIP Download Suggestion%s(n>1?"s":""):</h2>
1255 db_prepare(&q,
1256 "WITH matches AS (%s AND blob.rid IN (SELECT rid FROM tarlist))\n"
1257 "SELECT blobRid, uuid, timestamp,"
1258 " com||comment,"
@@ -1261,11 +1262,13 @@
1262 timeline_query_for_www()
1263 );
1264
1265 tmFlags = TIMELINE_DISJOINT | TIMELINE_NOSCROLL | TIMELINE_COLUMNAR
1266 | TIMELINE_BRCOLOR;
1267 memset(&xtra, 0, sizeof(xtra));
1268 xtra.xExtra = download_extra;
1269 www_print_timeline(&q, tmFlags, 0, 0, 0, 0, 0, &xtra);
1270 db_finalize(&q);
1271 }
1272 if( g.perm.Clone ){
1273 char *zNm = fossil_strdup(db_get("project-name","clone"));
1274 sanitize_name(zNm);
1275
+17 -4
--- src/timeline.c
+++ src/timeline.c
@@ -308,10 +308,21 @@
308308
if( (tmFlags & TIMELINE_INLINE)!=0 ){
309309
cgi_printf(")");
310310
}
311311
}
312312
313
+/*
314
+** Clients of the www_print_timeline() routine can create an instance
315
+** of the following object to pass supplemental information into
316
+** www_print_timeline() as the last (8th) argument.
317
+*/
318
+#if INTERFACE
319
+struct TimelineXtra {
320
+ void (*xExtra)(Stmt*,int,const char*,const char*); /* generate "extra" text */
321
+};
322
+#endif
323
+
313324
314325
/*
315326
** SETTING: timeline-truncate-at-blank boolean default=off
316327
**
317328
** If enabled, check-in comments displayed on the timeline are truncated
@@ -368,11 +379,11 @@
368379
const char *zThisUser, /* Suppress links to this user */
369380
const char *zThisTag, /* Suppress links to this tag */
370381
Matcher *pLeftBranch, /* Comparison function to use for zLeftBranch */
371382
int selectedRid, /* Highlight the line with this RID value or zero */
372383
int secondRid, /* Secondary highlight (or zero) */
373
- void (*xExtra)(Stmt*,int,const char*,const char*) /* generate "extra" text */
384
+ TimelineXtra *pXtra /* Supplemental information */
374385
){
375386
int mxWikiLen;
376387
Blob comment;
377388
int prevTagid = 0;
378389
int suppressCnt = 0;
@@ -390,15 +401,13 @@
390401
int iTableId = timeline_tableid();
391402
int bTimestampLinksToInfo; /* True if timestamp hyperlinks go to the /info
392403
** page rather than the /timeline page */
393404
const char *zMainBranch = db_main_branch();
394405
395
-
396406
if( cgi_is_loopback(g.zIpAddr) && db_open_local(0) ){
397407
vid = db_lget_int("checkout", 0);
398408
}
399
- if( xExtra==0 ) xExtra = timeline_extra;
400409
zPrevDate[0] = 0;
401410
mxWikiLen = db_get_int("timeline-max-comment", 0);
402411
dateFormat = db_get_int("timeline-date-format", 0);
403412
bCommentGitStyle = db_get_int("timeline-truncate-at-blank", 0);
404413
bTimestampLinksToInfo = db_get_boolean("timeline-tslink-info", 0);
@@ -781,11 +790,15 @@
781790
}
782791
if( tmFlags & TIMELINE_COMPACT ){
783792
cgi_printf("<span class='clutter' id='detail-%d'>",rid);
784793
}
785794
cgi_printf("<span class='timeline%sDetail'>", zStyle);
786
- xExtra(pQuery, tmFlags, zThisUser, zThisTag);
795
+ if( pXtra && pXtra->xExtra ){
796
+ pXtra->xExtra(pQuery, tmFlags, zThisUser, zThisTag);
797
+ }else{
798
+ timeline_extra(pQuery, tmFlags, zThisUser, zThisTag);
799
+ }
787800
if( tmFlags & TIMELINE_COMPACT ){
788801
@ </span></span>
789802
}else{
790803
@ </span>
791804
}
792805
--- src/timeline.c
+++ src/timeline.c
@@ -308,10 +308,21 @@
308 if( (tmFlags & TIMELINE_INLINE)!=0 ){
309 cgi_printf(")");
310 }
311 }
312
 
 
 
 
 
 
 
 
 
 
 
313
314 /*
315 ** SETTING: timeline-truncate-at-blank boolean default=off
316 **
317 ** If enabled, check-in comments displayed on the timeline are truncated
@@ -368,11 +379,11 @@
368 const char *zThisUser, /* Suppress links to this user */
369 const char *zThisTag, /* Suppress links to this tag */
370 Matcher *pLeftBranch, /* Comparison function to use for zLeftBranch */
371 int selectedRid, /* Highlight the line with this RID value or zero */
372 int secondRid, /* Secondary highlight (or zero) */
373 void (*xExtra)(Stmt*,int,const char*,const char*) /* generate "extra" text */
374 ){
375 int mxWikiLen;
376 Blob comment;
377 int prevTagid = 0;
378 int suppressCnt = 0;
@@ -390,15 +401,13 @@
390 int iTableId = timeline_tableid();
391 int bTimestampLinksToInfo; /* True if timestamp hyperlinks go to the /info
392 ** page rather than the /timeline page */
393 const char *zMainBranch = db_main_branch();
394
395
396 if( cgi_is_loopback(g.zIpAddr) && db_open_local(0) ){
397 vid = db_lget_int("checkout", 0);
398 }
399 if( xExtra==0 ) xExtra = timeline_extra;
400 zPrevDate[0] = 0;
401 mxWikiLen = db_get_int("timeline-max-comment", 0);
402 dateFormat = db_get_int("timeline-date-format", 0);
403 bCommentGitStyle = db_get_int("timeline-truncate-at-blank", 0);
404 bTimestampLinksToInfo = db_get_boolean("timeline-tslink-info", 0);
@@ -781,11 +790,15 @@
781 }
782 if( tmFlags & TIMELINE_COMPACT ){
783 cgi_printf("<span class='clutter' id='detail-%d'>",rid);
784 }
785 cgi_printf("<span class='timeline%sDetail'>", zStyle);
786 xExtra(pQuery, tmFlags, zThisUser, zThisTag);
 
 
 
 
787 if( tmFlags & TIMELINE_COMPACT ){
788 @ </span></span>
789 }else{
790 @ </span>
791 }
792
--- src/timeline.c
+++ src/timeline.c
@@ -308,10 +308,21 @@
308 if( (tmFlags & TIMELINE_INLINE)!=0 ){
309 cgi_printf(")");
310 }
311 }
312
313 /*
314 ** Clients of the www_print_timeline() routine can create an instance
315 ** of the following object to pass supplemental information into
316 ** www_print_timeline() as the last (8th) argument.
317 */
318 #if INTERFACE
319 struct TimelineXtra {
320 void (*xExtra)(Stmt*,int,const char*,const char*); /* generate "extra" text */
321 };
322 #endif
323
324
325 /*
326 ** SETTING: timeline-truncate-at-blank boolean default=off
327 **
328 ** If enabled, check-in comments displayed on the timeline are truncated
@@ -368,11 +379,11 @@
379 const char *zThisUser, /* Suppress links to this user */
380 const char *zThisTag, /* Suppress links to this tag */
381 Matcher *pLeftBranch, /* Comparison function to use for zLeftBranch */
382 int selectedRid, /* Highlight the line with this RID value or zero */
383 int secondRid, /* Secondary highlight (or zero) */
384 TimelineXtra *pXtra /* Supplemental information */
385 ){
386 int mxWikiLen;
387 Blob comment;
388 int prevTagid = 0;
389 int suppressCnt = 0;
@@ -390,15 +401,13 @@
401 int iTableId = timeline_tableid();
402 int bTimestampLinksToInfo; /* True if timestamp hyperlinks go to the /info
403 ** page rather than the /timeline page */
404 const char *zMainBranch = db_main_branch();
405
 
406 if( cgi_is_loopback(g.zIpAddr) && db_open_local(0) ){
407 vid = db_lget_int("checkout", 0);
408 }
 
409 zPrevDate[0] = 0;
410 mxWikiLen = db_get_int("timeline-max-comment", 0);
411 dateFormat = db_get_int("timeline-date-format", 0);
412 bCommentGitStyle = db_get_int("timeline-truncate-at-blank", 0);
413 bTimestampLinksToInfo = db_get_boolean("timeline-tslink-info", 0);
@@ -781,11 +790,15 @@
790 }
791 if( tmFlags & TIMELINE_COMPACT ){
792 cgi_printf("<span class='clutter' id='detail-%d'>",rid);
793 }
794 cgi_printf("<span class='timeline%sDetail'>", zStyle);
795 if( pXtra && pXtra->xExtra ){
796 pXtra->xExtra(pQuery, tmFlags, zThisUser, zThisTag);
797 }else{
798 timeline_extra(pQuery, tmFlags, zThisUser, zThisTag);
799 }
800 if( tmFlags & TIMELINE_COMPACT ){
801 @ </span></span>
802 }else{
803 @ </span>
804 }
805

Keyboard Shortcuts

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