Fossil

Check-in [8b00a97140]
Login

Check-in [8b00a97140]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Improvements to the display of /brtimeline.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | timeline-enhance-2025
Files: files | file ages | folders
SHA3-256: 8b00a97140e55d955fc8d9e046b1a07ddba6a36b61d1d16eae94bdbbfdad9b87
User & Date: drh 2025-10-17 15:49:24.737
Context
2025-10-17
16:38
Change the title of the /brtimeline page back to the way it was. Add the timelineX restriction to /brtimeline. ... (check-in: 881b705b65 user: drh tags: timeline-enhance-2025)
15:49
Improvements to the display of /brtimeline. ... (check-in: 8b00a97140 user: drh tags: timeline-enhance-2025)
14:18
Use CSS instead of <string> markup to add emphasis to the check-in hash. ... (check-in: 6950c14829 user: drh tags: timeline-enhance-2025)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/branch.c.
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034

1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046






1047
1048

1049
1050
1051


1052
1053
1054
1055
1056
1057
1058
1059
1060
*/
static void brtimeline_extra(
  Stmt *pQuery,               /* Current row of the timeline query */
  int tmFlags,                /* Flags to www_print_timeline() */
  const char *zThisUser,      /* Suppress links to this user */
  const char *zThisTag        /* Suppress links to this tag */
){
  int rid = db_column_int(pQuery, 0);
  Stmt q;
  if( !g.perm.Hyperlink ) return;
  db_prepare(&q,
    "SELECT substr(tagname,5) FROM tagxref, tag"

    " WHERE tagxref.rid=%d"
    "   AND tagxref.tagid=tag.tagid"
    "   AND tagxref.tagtype>0"
    "   AND tag.tagname GLOB 'sym-*'",
    rid
  );
  while( db_step(&q)==SQLITE_ROW ){
    const char *zTagName = db_column_text(&q, 0);
#define OLD_STYLE 1
#if OLD_STYLE
    @  %z(href("%R/timeline?r=%T",zTagName))[timeline]</a>
#else






    char *zBrName = branch_of_rid(rid);
    @  <strong>%h(zBrName)</strong><br>\

    @  %z(href("%R/timeline?r=%T",zTagName))<button>timeline</button></a>
    fossil_free(zBrName);
#endif


  }
  db_finalize(&q);
}

/*
** WEBPAGE: brtimeline
**
** List the first check of every branch, starting with the most recent
** and going backwards in time.







|
|
<
|
|
>
|
<
<
<
|
<
<
<
<
<
<
|
>
>
>
>
>
>
|
<
>
|
<
<
>
>

<







1023
1024
1025
1026
1027
1028
1029
1030
1031

1032
1033
1034
1035



1036






1037
1038
1039
1040
1041
1042
1043
1044

1045
1046


1047
1048
1049

1050
1051
1052
1053
1054
1055
1056
*/
static void brtimeline_extra(
  Stmt *pQuery,               /* Current row of the timeline query */
  int tmFlags,                /* Flags to www_print_timeline() */
  const char *zThisUser,      /* Suppress links to this user */
  const char *zThisTag        /* Suppress links to this tag */
){
  int rid;
  int tmFlagsNew;

  char *zBrName;

  if( (tmFlags & (TIMELINE_CLASSIC|TIMELINE_VERBOSE|TIMELINE_COMPACT))!=0 ){
    tmFlagsNew = (tmFlags & ~TIMELINE_VIEWS) | TIMELINE_MODERN;



    cgi_printf("(");






  }else{
    tmFlagsNew = tmFlags;
  }
  timeline_extra(pQuery,tmFlagsNew,zThisUser,zThisTag);

  if( !g.perm.Hyperlink ) return;
  rid = db_column_int(pQuery,0);
  zBrName = branch_of_rid(rid);

  @  branch:&nbsp;<span class='timelineHash'>\
  @ %z(href("%R/timeline?r=%T",zBrName))%h(zBrName)</a></span>


  if( (tmFlags & (TIMELINE_CLASSIC|TIMELINE_VERBOSE|TIMELINE_COMPACT))!=0 ){
    cgi_printf(")");
  }

}

/*
** WEBPAGE: brtimeline
**
** List the first check of every branch, starting with the most recent
** and going backwards in time.
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
  login_check_credentials();
  if( !g.perm.Read ){ login_needed(g.anon.Read); return; }

  style_set_current_feature("branch");
  style_header("Branches");
  style_submenu_element("Branch List", "brlist");
  login_anonymous_available();
#if OLD_STYLE
  timeline_ss_submenu();
#endif
  cgi_check_for_malice();
  @ <h2>First check-in for every branch, starting with the most recent
  @ and going backwards in time.</h2>
  blob_append(&sql, timeline_query_for_www(), -1);
  blob_append_sql(&sql,
    "AND blob.rid IN (SELECT rid FROM tagxref"
    "                  WHERE tagtype>0 AND tagid=%d AND srcid!=0)", TAG_BRANCH);
  if( fNoHidden || fOnlyHidden ){
    const char* zUnaryOp = fNoHidden ? "NOT" : "";
    blob_append_sql(&sql,
      " AND %s EXISTS(SELECT 1 FROM tagxref"
      " WHERE tagid=%d AND tagtype>0 AND rid=blob.rid)\n",
      zUnaryOp/*safe-for-%s*/, TAG_HIDDEN);
  }
  db_prepare(&q, "%s ORDER BY event.mtime DESC", blob_sql_text(&sql));
  blob_reset(&sql);
  /* Always specify TIMELINE_DISJOINT, or graph_finish() may fail because of too
  ** many descenders to (off-screen) parents. */
  tmFlags = TIMELINE_DISJOINT | TIMELINE_NOSCROLL;
#if !OLD_STYLE
  tmFlags |= TIMELINE_COLUMNAR;
#endif
  if( PB("ubg")!=0 ){
    tmFlags |= TIMELINE_UCOLOR;
  }else{
    tmFlags |= TIMELINE_BRCOLOR;
  }
  www_print_timeline(&q, tmFlags, 0, 0, 0, 0, 0, brtimeline_extra);
  db_finalize(&q);







<

<



















<
<
<







1069
1070
1071
1072
1073
1074
1075

1076

1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095



1096
1097
1098
1099
1100
1101
1102
  login_check_credentials();
  if( !g.perm.Read ){ login_needed(g.anon.Read); return; }

  style_set_current_feature("branch");
  style_header("Branches");
  style_submenu_element("Branch List", "brlist");
  login_anonymous_available();

  timeline_ss_submenu();

  cgi_check_for_malice();
  @ <h2>First check-in for every branch, starting with the most recent
  @ and going backwards in time.</h2>
  blob_append(&sql, timeline_query_for_www(), -1);
  blob_append_sql(&sql,
    "AND blob.rid IN (SELECT rid FROM tagxref"
    "                  WHERE tagtype>0 AND tagid=%d AND srcid!=0)", TAG_BRANCH);
  if( fNoHidden || fOnlyHidden ){
    const char* zUnaryOp = fNoHidden ? "NOT" : "";
    blob_append_sql(&sql,
      " AND %s EXISTS(SELECT 1 FROM tagxref"
      " WHERE tagid=%d AND tagtype>0 AND rid=blob.rid)\n",
      zUnaryOp/*safe-for-%s*/, TAG_HIDDEN);
  }
  db_prepare(&q, "%s ORDER BY event.mtime DESC", blob_sql_text(&sql));
  blob_reset(&sql);
  /* Always specify TIMELINE_DISJOINT, or graph_finish() may fail because of too
  ** many descenders to (off-screen) parents. */
  tmFlags = TIMELINE_DISJOINT | TIMELINE_NOSCROLL;



  if( PB("ubg")!=0 ){
    tmFlags |= TIMELINE_UCOLOR;
  }else{
    tmFlags |= TIMELINE_BRCOLOR;
  }
  www_print_timeline(&q, tmFlags, 0, 0, 0, 0, 0, brtimeline_extra);
  db_finalize(&q);
Changes to src/timeline.c.
196
197
198
199
200
201
202



203



204
205
206
207
208
209
210
211
  int tagid = db_column_int(pQuery, 9);
  const char *zDispUser = zUser && zUser[0] ? zUser : "anonymous";

  if( (tmFlags & (TIMELINE_CLASSIC|TIMELINE_VERBOSE|TIMELINE_COMPACT))!=0 ){
    cgi_printf("(");
  }




/* Set to 0 for historical appearance.  Set to 1 or more for new looks */



#define EXTRA_FORMAT 2
#if EXTRA_FORMAT==0
  if( (tmFlags & TIMELINE_CLASSIC)==0 ){
    if( zType[0]=='c' ){
      int isLeaf = db_column_int(pQuery, 5);
      if( isLeaf ){
        if( has_closed_tag(rid) ){
          @ <span class='timelineLeaf'>Closed-Leaf</span>







>
>
>
|
>
>
>
|







196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
  int tagid = db_column_int(pQuery, 9);
  const char *zDispUser = zUser && zUser[0] ? zUser : "anonymous";

  if( (tmFlags & (TIMELINE_CLASSIC|TIMELINE_VERBOSE|TIMELINE_COMPACT))!=0 ){
    cgi_printf("(");
  }

  /* The EXTRA_FORMAT macro is an integer that controls various experiments
  ** in the layout of the extra text.
  **
  **   0   Legacy appearance.
  **   1   Deemphasize "Leaf" and "Closed-Leaf".  Highlight check-in hash.
  **   2   Omit "Leaf"/"Closed-Leaf".  But check-in hash at the end.
  */    
#define EXTRA_FORMAT 1
#if EXTRA_FORMAT==0
  if( (tmFlags & TIMELINE_CLASSIC)==0 ){
    if( zType[0]=='c' ){
      int isLeaf = db_column_int(pQuery, 5);
      if( isLeaf ){
        if( has_closed_tag(rid) ){
          @ <span class='timelineLeaf'>Closed-Leaf</span>
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
                 href("%R/info/%!S",zUuid),zUuid);
    }
  }else if( zType[0]=='g' || zType[0]=='w' || zType[0]=='t'
            || zType[0]=='n' || zType[0]=='f'){
    cgi_printf("artifact:&nbsp;%z%S</a> ",href("%R/info/%!S",zUuid),zUuid);
  }
#endif /* EXTRA_FORMAT==0 */
#if EXTRA_FORMAT==2
  if( (tmFlags & TIMELINE_CLASSIC)==0 ){
    if( zType[0]=='c' ){
      int isLeaf = db_column_int(pQuery, 5);
      const char *zPrefix;
      if( isLeaf ){
        zPrefix = has_closed_tag(rid) ? "closed&nbsp;" : "leaf&nbsp;";
      }else{







|







229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
                 href("%R/info/%!S",zUuid),zUuid);
    }
  }else if( zType[0]=='g' || zType[0]=='w' || zType[0]=='t'
            || zType[0]=='n' || zType[0]=='f'){
    cgi_printf("artifact:&nbsp;%z%S</a> ",href("%R/info/%!S",zUuid),zUuid);
  }
#endif /* EXTRA_FORMAT==0 */
#if EXTRA_FORMAT==1
  if( (tmFlags & TIMELINE_CLASSIC)==0 ){
    if( zType[0]=='c' ){
      int isLeaf = db_column_int(pQuery, 5);
      const char *zPrefix;
      if( isLeaf ){
        zPrefix = has_closed_tag(rid) ? "closed&nbsp;" : "leaf&nbsp;";
      }else{
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
      cgi_printf("artifact:&nbsp;%z%S</a> ",
                 href("%R/info/%!S",zUuid),zUuid);
    }
  }else if( zType[0]=='g' || zType[0]=='w' || zType[0]=='t'
            || zType[0]=='n' || zType[0]=='f'){
    cgi_printf("artifact:&nbsp;%z%S</a> ",href("%R/info/%!S",zUuid),zUuid);
  }
#endif /* EXTRA_FORMAT==0 */

  if( g.perm.Hyperlink && fossil_strcmp(zDispUser, zThisUser)!=0 ){
    char *zLink;
    if( zType[0]!='f' || (tmFlags & TIMELINE_FORUMTXT)==0 ){
      zLink = mprintf("%R/timeline?u=%h&c=%t&y=a", zDispUser, zDate);
    }else{
      zLink = mprintf("%R/timeline?u=%h&c=%t&y=a&vfx", zDispUser, zDate);







|







253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
      cgi_printf("artifact:&nbsp;%z%S</a> ",
                 href("%R/info/%!S",zUuid),zUuid);
    }
  }else if( zType[0]=='g' || zType[0]=='w' || zType[0]=='t'
            || zType[0]=='n' || zType[0]=='f'){
    cgi_printf("artifact:&nbsp;%z%S</a> ",href("%R/info/%!S",zUuid),zUuid);
  }
#endif /* EXTRA_FORMAT==1 */

  if( g.perm.Hyperlink && fossil_strcmp(zDispUser, zThisUser)!=0 ){
    char *zLink;
    if( zType[0]!='f' || (tmFlags & TIMELINE_FORUMTXT)==0 ){
      zLink = mprintf("%R/timeline?u=%h&c=%t&y=a", zDispUser, zDate);
    }else{
      zLink = mprintf("%R/timeline?u=%h&c=%t&y=a&vfx", zDispUser, zDate);
303
304
305
306
307
308
309
310
311
312
313


314
315
316

317

318
319



320
321

322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
    }else{
      cgi_printf(" id:&nbsp;%z%d</a>",
                 href("%R/deltachain/%d",rid), rid);
    }
  }
  tag_private_status(rid);

#if EXTRA_FORMAT==1
  if( (tmFlags & TIMELINE_CLASSIC)==0 ){
    if( zType[0]=='e' && tagid ){
      char *zId = db_text(0,


          "SELECT substr(tagname,7) FROM tag WHERE tagid=abs(%d)", tagid);
      cgi_printf(" technote:&nbsp;%z%S</a>",
                 href("%R/technote/%t",zId), zId);

    }else{

      cgi_printf(" hash:&nbsp;%z%S</a>", href("%R/info/%!S", zUuid), zUuid);
    }



  }
#endif /* EXTRA_FORMAT==1 */


  /* End timelineDetail */
  if( (tmFlags & (TIMELINE_CLASSIC|TIMELINE_VERBOSE|TIMELINE_COMPACT))!=0 ){
    cgi_printf(")");
  }

  if( tmFlags & TIMELINE_COMPACT ){
    @ </span></span>
  }else{
    @ </span>
  }
}


/*
** SETTING: timeline-truncate-at-blank  boolean default=off
**
** If enabled, check-in comments displayed on the timeline are truncated







|

|
|
>
>
|
|
<
>

>
|

>
>
>

|
>





<
<
<
<
<
<







309
310
311
312
313
314
315
316
317
318
319
320
321
322
323

324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339






340
341
342
343
344
345
346
    }else{
      cgi_printf(" id:&nbsp;%z%d</a>",
                 href("%R/deltachain/%d",rid), rid);
    }
  }
  tag_private_status(rid);

#if EXTRA_FORMAT==2
  if( (tmFlags & TIMELINE_CLASSIC)==0 ){
    if( zType[0]=='c' ){
      cgi_printf(" check-in:&nbsp;%z<span class='timelineHash'>"
                 "%S</span></a>",
                  href("%R/info/%!S",zUuid),zUuid);
    }else if( zType[0]=='e' && tagid ){
      cgi_printf(" technote:&nbsp;");

      hyperlink_to_event_tagid(tagid<0?-tagid:tagid);
    }else{
      cgi_printf(" artifact:&nbsp;%z%S</a>",
                 href("%R/info/%!S",zUuid),zUuid);
    }
  }else if( zType[0]=='g' || zType[0]=='w' || zType[0]=='t'
            || zType[0]=='n' || zType[0]=='f'){
    cgi_printf(" artifact:&nbsp;%z%S</a>",href("%R/info/%!S",zUuid),zUuid);
  }
#endif /* EXTRA_FORMAT==2 */


  /* End timelineDetail */
  if( (tmFlags & (TIMELINE_CLASSIC|TIMELINE_VERBOSE|TIMELINE_COMPACT))!=0 ){
    cgi_printf(")");
  }






}


/*
** SETTING: timeline-truncate-at-blank  boolean default=off
**
** If enabled, check-in comments displayed on the timeline are truncated