Fossil

Check-in [fdf071e1]
Login

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

Overview
Comment:Work toward getting the mode selector to work on /timeline. This check-in is incomplete and is intended only to transfer code between machines.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | sticky-timeline-style
Files: files | file ages | folders
SHA3-256:fdf071e1819d01caf7c631970eedc994009e82a22cc864e809bc497db09248fa
User & Date: drh 2017-11-28 19:41:03
Context
2017-11-28
21:43
Change the style selector query parameter on /timeline to "ss". Other code cleanup. The new style selector is working, but needs default CSS. check-in: f64fa4f1 user: drh tags: sticky-timeline-style
19:41
Work toward getting the mode selector to work on /timeline. This check-in is incomplete and is intended only to transfer code between machines. check-in: fdf071e1 user: drh tags: sticky-timeline-style
16:42
Add the /cookies page for debugging. (Maybe that page can be expanded to allow users to edit their preferences?) Use sticky values for the "n=" and "y=" query parameters on timelines. check-in: 0f446ca6 user: drh tags: sticky-timeline-style
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/timeline.c.

101
102
103
104
105
106
107



108
109
110
111
112
113
114
...
246
247
248
249
250
251
252

253
254
255
256
257
258
259
...
262
263
264
265
266
267
268
269

270
271
272
273
274
275
276
277
278
279
280

281
282
283
284
285
286
287
...
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
...
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
...
459
460
461
462
463
464
465

466
467
468
469
470
471
472
...
485
486
487
488
489
490
491


492
493
494
495
496
497
498
...
523
524
525
526
527
528
529

530
531
532
533
534
535
536
...
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574



575

576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657

658
659
660
661
662
663
664
....
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
....
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625

1626
1627
1628
1629
1630
1631
1632
....
1697
1698
1699
1700
1701
1702
1703






1704
1705
1706
1707
1708
1709
1710
....
1717
1718
1719
1720
1721
1722
1723




1724
1725
1726
1727
1728
1729
1730
....
1790
1791
1792
1793
1794
1795
1796





1797
1798
1799
1800
1801
1802
1803
....
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
#define TIMELINE_FCHANGES 0x0020  /* Detail file changes */
#define TIMELINE_BRCOLOR  0x0040  /* Background color by branch name */
#define TIMELINE_UCOLOR   0x0080  /* Background color by user */
#define TIMELINE_FRENAMES 0x0100  /* Detail only file name changes */
#define TIMELINE_UNHIDE   0x0200  /* Unhide check-ins with "hidden" tag */
#define TIMELINE_SHOWRID  0x0400  /* Show RID values in addition to UUIDs */
#define TIMELINE_BISECT   0x0800  /* Show supplimental bisect information */



#endif

/*
** Hash a string and use the hash to determine a background color.
*/
char *hash_color(const char *z){
  int i;                       /* Loop counter */
................................................................................
  int fchngQueryInit = 0;     /* True if fchngQuery is initialized */
  Stmt fchngQuery;            /* Query for file changes on check-ins */
  static Stmt qbranch;
  int pendingEndTr = 0;       /* True if a </td></tr> is needed */
  int vid = 0;                /* Current checkout version */
  int dateFormat = 0;         /* 0: HH:MM (default) */
  int bCommentGitStyle = 0;   /* Only show comments through first blank line */

  int bHashBeforeComment = 0; /* Show hash before the comment */
  int bHashAfterComment = 0;  /* Show hash after the comment */
  int bHashInDetail = 0;      /* Show the hash inside the detail section */
  int bShowDetail;            /* Show the detail section */
  int bSeparateDetail;        /* Detail in a separate column */
  int eCommentFormat;         /* value for timeline-comment-format */
  const char *zDateFmt;
................................................................................
  if( fossil_strcmp(g.zIpAddr, "127.0.0.1")==0 && db_open_local(0) ){
    vid = db_lget_int("checkout", 0);
  }
  zPrevDate[0] = 0;
  mxWikiLen = db_get_int("timeline-max-comment", 0);
  dateFormat = db_get_int("timeline-date-format", 0);
  bCommentGitStyle = db_get_int("timeline-truncate-at-blank", 0);
  {

    /* Undocumented query parameter commentformat=N takes a numeric parameter to
    ** adjust the comment-format for testing purposes. */
    const char *z = P("commentformat");
    eCommentFormat = z ? atoi(z) : db_get_int("timeline-comment-format", 4);
  }
  bShowDetail = (eCommentFormat & 1)==0;      /* Bit 0 suppresses the comment */
  bSeparateDetail = (eCommentFormat & 8)!=0;  /* Bit 3 turns on the detail column */ 
  switch( (eCommentFormat>>1)&3 ){
    case 1:  bHashAfterComment = 1;  break;
    case 2:  bHashInDetail = 1;      break;
    default: bHashBeforeComment = 1; break;

  }
  zDateFmt = P("datefmt");
  if( zDateFmt ) dateFormat = atoi(zDateFmt);
  if( tmFlags & TIMELINE_GRAPH ){
    pGraph = graph_init();
  }
  db_static_prepare(&qbranch,
................................................................................
    const char *zTagList = db_column_text(pQuery, 8);
    int tagid = db_column_int(pQuery, 9);
    const char *zDispUser = zUser && zUser[0] ? zUser : "anonymous";
    const char *zBr = 0;      /* Branch */
    int commentColumn = 3;    /* Column containing comment text */
    int modPending;           /* Pending moderation */
    char *zDateLink;          /* URL for the link on the timestamp */
    int drawDetailEllipsis = 1;     /* True to show ellipsis in place of detail */
    char zTime[20];

    if( zDate==0 ){
      zDate = "YYYY-MM-DD HH:MM:SS";  /* Something wrong with the repo */
    }
    modPending = moderation_pending(rid);
    if( tagid ){
................................................................................
      gidx = graph_add_row(pGraph, rid, nParent, aParent, zBr, zBgClr,
                           zUuid, isLeaf);
      db_reset(&qbranch);
      @ <div id="m%d(gidx)" class="tl-nodemark"></div>
    }
    @</td>
    if( zBgClr && zBgClr[0] && rid!=selectedRid ){
      @ <td class="timelineTableCell" style="background-color: %h(zBgClr);">
    }else{
      @ <td class="timelineTableCell">
    }
    if( pGraph && zType[0]!='c' ){
      @ &bull;
    }
    if( modPending ){
      @ <span class="modpending">(Awaiting Moderator Approval)</span>
    }
................................................................................
      db_bind_int(&bisectQuery, ":rid", rid);
      if( db_step(&bisectQuery)==SQLITE_ROW ){
        @ <b>%s(db_column_text(&bisectQuery,1))</b>
        @ (%d(db_column_int(&bisectQuery,0)))
      }
      db_reset(&bisectQuery);
    }

    if( bHashBeforeComment ){
      if( zType[0]=='c' ){
        hyperlink_to_uuid(zUuid);
        if( isLeaf ){
          if( db_exists("SELECT 1 FROM tagxref"
                        " WHERE rid=%d AND tagid=%d AND tagtype>0",
                        rid, TAG_CLOSED) ){
................................................................................
        if( srcId ){
          @ (%d(rid)&larr;%d(srcId))
        }else{
          @ (%d(rid))
        }
      }
    }


    db_column_blob(pQuery, commentColumn, &comment);
    if( zType[0]!='c' ){
      /* Comments for anything other than a check-in are generated by
      ** "fossil rebuild" and expect to be rendered as text/x-fossil-wiki */
      @ <span class='timelineComment' onclick='toggleDetail(%d(rid))'>
      wiki_convert(&comment, 0, WIKI_INLINE);
      @ </span>
................................................................................
      }else{
        cgi_printf("%W",blob_str(&comment));
      }
      @ </span>
    }
    blob_reset(&comment);


    if( bHashAfterComment ){
      if( zType[0]=='c' ){
        hyperlink_to_uuid(zUuid);
        if( isLeaf ){
          if( db_exists("SELECT 1 FROM tagxref"
                        " WHERE rid=%d AND tagid=%d AND tagtype>0",
                        rid, TAG_CLOSED) ){
................................................................................
          @ (%d(rid)&larr;%d(srcId))
        }else{
          @ (%d(rid))
        }
      }
      drawDetailEllipsis = 1;
    }


    /* Generate extra information and hyperlinks to follow the comment.
    ** Example:  "(check-in: [abcdefg], user: drh, tags: trunk)"
    */
    if( bShowDetail ){
      if( drawDetailEllipsis ){
        @ <span class='timelineEllipsis anticlutter' id='ellipsis-%d(rid)' \
        @  onclick='toggleDetail(%d(rid))'>...</span>
      }
      if( bSeparateDetail ){
        if( zBgClr && zBgClr[0] && rid!=selectedRid ){
          @ <td class="timelineTableCell timelineDetailCell"
          @  style="background-color: %h(zBgClr);">
        }else{
          @ <td class="timelineTableCell timelineDetailCell">
        }
      }



      cgi_printf("<span class='clutter' id='detail-%d'>", rid);

      if( zType[0]=='c' ){
        cgi_printf("<span class='timelineDetail timelineCheckinDetail'>(");
      }else{
        cgi_printf("<span class='timelineDetail'>(");
      }
  
      if( bHashInDetail ){
        if( zType[0]=='c' ){
          if( isLeaf ){
            if( db_exists("SELECT 1 FROM tagxref"
                          " WHERE rid=%d AND tagid=%d AND tagtype>0",
                          rid, TAG_CLOSED) ){
              @ <span class='timelineLeaf'>Closed-Leaf</span>
            }else{
              @ <span class='timelineLeaf'>Leaf</span>
            }
          }
          cgi_printf("check-in: ");
          hyperlink_to_uuid(zUuid);
        }else if( zType[0]=='e' && tagid ){
          cgi_printf("technote: ");
          hyperlink_to_event_tagid(tagid<0?-tagid:tagid);
        }else{
          cgi_printf("artifact: ");
          hyperlink_to_uuid(zUuid);
        }
      }
  
      if( g.perm.Hyperlink && fossil_strcmp(zDispUser, zThisUser)!=0 ){
        char *zLink = mprintf("%R/timeline?u=%h&c=%t&nd&n=200", zDispUser, zDate);
        cgi_printf("user: %z%h</a>", href("%z",zLink), zDispUser);
      }else{
        cgi_printf("user: %h", zDispUser);
      }
  
      /* Generate the "tags: TAGLIST" at the end of the comment, together
      ** with hyperlinks to the tag list.
      */
      if( zTagList && zTagList[0]==0 ) zTagList = 0;
      if( zTagList ){
        if( g.perm.Hyperlink ){
          int i;
          const char *z = zTagList;
          Blob links;
          blob_zero(&links);
          while( z && z[0] ){
            for(i=0; z[i] && (z[i]!=',' || z[i+1]!=' '); i++){}
            if( zThisTag==0 || memcmp(z, zThisTag, i)!=0 || zThisTag[i]!=0 ){
              blob_appendf(&links,
                    "%z%#h</a>%.2s",
                    href("%R/timeline?r=%#t&nd&c=%t&n=200",i,z,zDate), i,z, &z[i]
              );
            }else{
              blob_appendf(&links, "%#h", i+2, z);
            }
            if( z[i]==0 ) break;
            z += i+2;
          }
          cgi_printf(" tags: %s", blob_str(&links));
          blob_reset(&links);
        }else{
          cgi_printf(" tags: %h", zTagList);
        }
      }
  
      if( tmFlags & TIMELINE_SHOWRID ){
        int srcId = delta_source_rid(rid);
        if( srcId ){
          cgi_printf(" id: %d&larr;%d", rid, srcId);
        }else{
          cgi_printf(" id: %d", rid);
        }
      }
      cgi_printf(")</span></span>\n");  /* End of the details section */
    }
  
    tag_private_status(rid);

    /* Generate extra hyperlinks at the end of the comment */
    if( xExtra ){
      xExtra(rid);
    }


    /* Generate the file-change list if requested */
    if( (tmFlags & (TIMELINE_FCHANGES|TIMELINE_FRENAMES))!=0
     && zType[0]=='c' && g.perm.Hyperlink
    ){
      int inUl = 0;
      if( !fchngQueryInit ){
................................................................................
    if( g.perm.RdWiki ){
      az[i++] = "w";
      az[i++] = "Wiki";
    }
    assert( i<=count(az) );
  }
  if( i>2 ){
    style_submenu_multichoice("y", i/2, az, isDisabled|STYLE_CLUTTER);
  }
}

/*
** If the zChng string is not NULL, then it should be a comma-separated
** list of glob patterns for filenames.  Add an term to the WHERE clause
** for the SQL statement under construction that excludes any check-in that
................................................................................
**    p=CHECKIN       Parents and ancestors of CHECKIN
**    d=CHECKIN       Children and descendants of CHECKIN
**    dp=CHECKIN      The same as d=CHECKIN&p=CHECKIN
**    t=TAG           Show only check-ins with the given TAG
**    r=TAG           Show check-ins related to TAG, equivalent to t=TAG&rel
**    rel             Show related check-ins as well as those matching t=TAG
**    mionly          Limit rel to show ancestors but not descendants
**    ms=STYLE        Set tag match style to EXACT, GLOB, LIKE, REGEXP
**    u=USER          Only show items associated with USER
**    y=TYPE          'ci', 'w', 't', 'e', or 'all'.  'ci' is the default.

**    ng              No Graph.
**    nd              Do not highlight the focus check-in
**    v               Show details of files changed
**    f=CHECKIN       Show family (immediate parents and children) of CHECKIN
**    from=CHECKIN    Path from...
**    to=CHECKIN        ... to this
**    shortest          ... show only the shortest path
................................................................................
  int pd_rid;
  double rBefore, rAfter, rCirca;     /* Boundary times */
  const char *z;
  char *zOlderButton = 0;             /* URL for Older button at the bottom */
  char *zNewerButton = 0;             /* URL for Newer button at the top */
  int selectedRid = -9999999;         /* Show a highlight on this RID */
  int disableY = 0;                   /* Disable type selector on submenu */







  /* Set number of rows to display */
  cookie_parse("fossil_display_settings");
  cookie_link_parameter("n","tln");
  z = P("n");
  if( z==0 ) z = db_get("timeline-default-length",0);
  if( z ){
................................................................................
        nEntry = 10;
      }
    }
  }else{
    cgi_replace_query_parameter("n","50");
    nEntry = 50;
  }





  /* To view the timeline, must have permission to read project data.
  */
  pd_rid = name_to_typed_rid(P("dp"),"ci");
  if( pd_rid ){
    p_rid = d_rid = pd_rid;
  }
................................................................................
  }
  if( (zTagSql && db_int(0,"SELECT count(*) "
      "FROM tagxref NATURAL JOIN tag WHERE %s",zTagSql/*safe-for-%s*/)<=nEntry)
  ){
    nEntry = -1;
    zCirca = 0;
  }





  if( zType[0]=='a' ){
    tmFlags |= TIMELINE_BRIEF | TIMELINE_GRAPH;
  }else{
    tmFlags |= TIMELINE_GRAPH;
  }
  if( PB("ng") || zSearch!=0 ){
    tmFlags &= ~TIMELINE_GRAPH;
................................................................................
        }
        free(zDate);
      }
      if( zType[0]=='a' || zType[0]=='c' ){
        style_submenu_checkbox("unhide", "Unhide", STYLE_CLUTTER, 0);
      }
      style_submenu_checkbox("v", "Files", (zType[0]!='a' && zType[0]!='c')|STYLE_CLUTTER,0);
      style_submenu_entry("n","Max:",4,STYLE_CLUTTER);
      timeline_y_submenu(disableY);
      style_submenu_entry("t", "Tag Filter:", -8, STYLE_CLUTTER);
      style_submenu_multichoice("ms", count(azMatchStyles)/2, azMatchStyles, STYLE_CLUTTER);
    }
    blob_zero(&cond);
  }
  if( PB("showsql") ){







>
>
>







 







>







 







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







 







|







 







|

|







 







>







 







>
>







 







>







 







|




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

<
<



>







 







|







 







|

|
>







 







>
>
>
>
>
>







 







>
>
>
>







 







>
>
>
>
>







 







|







101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
...
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
...
266
267
268
269
270
271
272

273
274
275
276
277







278
279
280
281
282
283
284
285
...
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
...
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
...
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
...
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
...
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
...
552
553
554
555
556
557
558
559
560
561
562
563

564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653



654


655
656
657
658
659
660
661
662
663
664
665
....
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
....
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
....
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
....
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
....
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
....
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
#define TIMELINE_FCHANGES 0x0020  /* Detail file changes */
#define TIMELINE_BRCOLOR  0x0040  /* Background color by branch name */
#define TIMELINE_UCOLOR   0x0080  /* Background color by user */
#define TIMELINE_FRENAMES 0x0100  /* Detail only file name changes */
#define TIMELINE_UNHIDE   0x0200  /* Unhide check-ins with "hidden" tag */
#define TIMELINE_SHOWRID  0x0400  /* Show RID values in addition to UUIDs */
#define TIMELINE_BISECT   0x0800  /* Show supplimental bisect information */
#define TIMELINE_COMPACT  0x1000  /* Use the "compact" view style */
#define TIMELINE_DETAILED 0x2000  /* Use the "detailed" view style */
#define TIMELINE_NORMAL   0x4000  /* Use the "normal" view style */
#endif

/*
** Hash a string and use the hash to determine a background color.
*/
char *hash_color(const char *z){
  int i;                       /* Loop counter */
................................................................................
  int fchngQueryInit = 0;     /* True if fchngQuery is initialized */
  Stmt fchngQuery;            /* Query for file changes on check-ins */
  static Stmt qbranch;
  int pendingEndTr = 0;       /* True if a </td></tr> is needed */
  int vid = 0;                /* Current checkout version */
  int dateFormat = 0;         /* 0: HH:MM (default) */
  int bCommentGitStyle = 0;   /* Only show comments through first blank line */
  const char *zTdClass;
  int bHashBeforeComment = 0; /* Show hash before the comment */
  int bHashAfterComment = 0;  /* Show hash after the comment */
  int bHashInDetail = 0;      /* Show the hash inside the detail section */
  int bShowDetail;            /* Show the detail section */
  int bSeparateDetail;        /* Detail in a separate column */
  int eCommentFormat;         /* value for timeline-comment-format */
  const char *zDateFmt;
................................................................................
  if( fossil_strcmp(g.zIpAddr, "127.0.0.1")==0 && db_open_local(0) ){
    vid = db_lget_int("checkout", 0);
  }
  zPrevDate[0] = 0;
  mxWikiLen = db_get_int("timeline-max-comment", 0);
  dateFormat = db_get_int("timeline-date-format", 0);
  bCommentGitStyle = db_get_int("timeline-truncate-at-blank", 0);

  if( tmFlags & TIMELINE_NORMAL ){
    zTdClass = "timelineStyleNormal";
  }else if( tmFlags & TIMELINE_COMPACT ){
    zTdClass = "timelineStyleCompact";
  }else if( tmFlags & TIMELINE_DETAILED ){







    zTdClass = "timelineStyleDetailed";
  }
  zDateFmt = P("datefmt");
  if( zDateFmt ) dateFormat = atoi(zDateFmt);
  if( tmFlags & TIMELINE_GRAPH ){
    pGraph = graph_init();
  }
  db_static_prepare(&qbranch,
................................................................................
    const char *zTagList = db_column_text(pQuery, 8);
    int tagid = db_column_int(pQuery, 9);
    const char *zDispUser = zUser && zUser[0] ? zUser : "anonymous";
    const char *zBr = 0;      /* Branch */
    int commentColumn = 3;    /* Column containing comment text */
    int modPending;           /* Pending moderation */
    char *zDateLink;          /* URL for the link on the timestamp */
    int drawDetailEllipsis;   /* True to show ellipsis in place of detail */
    char zTime[20];

    if( zDate==0 ){
      zDate = "YYYY-MM-DD HH:MM:SS";  /* Something wrong with the repo */
    }
    modPending = moderation_pending(rid);
    if( tagid ){
................................................................................
      gidx = graph_add_row(pGraph, rid, nParent, aParent, zBr, zBgClr,
                           zUuid, isLeaf);
      db_reset(&qbranch);
      @ <div id="m%d(gidx)" class="tl-nodemark"></div>
    }
    @</td>
    if( zBgClr && zBgClr[0] && rid!=selectedRid ){
      @ <td class="timelineTableCell %s(zTdClass)" style="background-color: %h(zBgClr);">
    }else{
      @ <td class="timelineTableCell %s(zTdClass)">
    }
    if( pGraph && zType[0]!='c' ){
      @ &bull;
    }
    if( modPending ){
      @ <span class="modpending">(Awaiting Moderator Approval)</span>
    }
................................................................................
      db_bind_int(&bisectQuery, ":rid", rid);
      if( db_step(&bisectQuery)==SQLITE_ROW ){
        @ <b>%s(db_column_text(&bisectQuery,1))</b>
        @ (%d(db_column_int(&bisectQuery,0)))
      }
      db_reset(&bisectQuery);
    }
#if 0
    if( bHashBeforeComment ){
      if( zType[0]=='c' ){
        hyperlink_to_uuid(zUuid);
        if( isLeaf ){
          if( db_exists("SELECT 1 FROM tagxref"
                        " WHERE rid=%d AND tagid=%d AND tagtype>0",
                        rid, TAG_CLOSED) ){
................................................................................
        if( srcId ){
          @ (%d(rid)&larr;%d(srcId))
        }else{
          @ (%d(rid))
        }
      }
    }
#endif
    drawDetailEllipsis = (tmFlags & TIMELINE_COMPACT)!=0;
    db_column_blob(pQuery, commentColumn, &comment);
    if( zType[0]!='c' ){
      /* Comments for anything other than a check-in are generated by
      ** "fossil rebuild" and expect to be rendered as text/x-fossil-wiki */
      @ <span class='timelineComment' onclick='toggleDetail(%d(rid))'>
      wiki_convert(&comment, 0, WIKI_INLINE);
      @ </span>
................................................................................
      }else{
        cgi_printf("%W",blob_str(&comment));
      }
      @ </span>
    }
    blob_reset(&comment);

#if 0
    if( bHashAfterComment ){
      if( zType[0]=='c' ){
        hyperlink_to_uuid(zUuid);
        if( isLeaf ){
          if( db_exists("SELECT 1 FROM tagxref"
                        " WHERE rid=%d AND tagid=%d AND tagtype>0",
                        rid, TAG_CLOSED) ){
................................................................................
          @ (%d(rid)&larr;%d(srcId))
        }else{
          @ (%d(rid))
        }
      }
      drawDetailEllipsis = 1;
    }
#endif

    /* Generate extra information and hyperlinks to follow the comment.
    ** Example:  "(check-in: [abcdefg], user: drh, tags: trunk)"
    */

    if( drawDetailEllipsis ){
      @ <span class='timelineEllipsis anticlutter' id='ellipsis-%d(rid)' \
      @  onclick='toggleDetail(%d(rid))'>...</span>
    }
    if( bSeparateDetail ){
      if( zBgClr && zBgClr[0] && rid!=selectedRid ){
        @ <td class="timelineTableCell timelineDetailCell"
        @  style="background-color: %h(zBgClr);">
      }else{
        @ <td class="timelineTableCell timelineDetailCell">
      }
    }
    if( tmFlags & TIMELINE_COMPACT ){
      cgi_printf("<span class='timelineDetailWrapper clutter' id='detail-%d'>", rid);
    }else{
      cgi_printf("<span class='timelineDetailWrapper'>");
    }
    if( zType[0]=='c' ){
      cgi_printf("<span class='timelineDetail timelineCheckinDetail'>");
    }else{
      cgi_printf("<span class='timelineDetail'>");
    }

    if( bHashInDetail ){
      if( zType[0]=='c' ){
        if( isLeaf ){
          if( db_exists("SELECT 1 FROM tagxref"
                        " WHERE rid=%d AND tagid=%d AND tagtype>0",
                        rid, TAG_CLOSED) ){
            @ <span class='timelineLeaf'>Closed-Leaf</span>
          }else{
            @ <span class='timelineLeaf'>Leaf</span>
          }
        }
        cgi_printf("check-in: ");
        hyperlink_to_uuid(zUuid);
      }else if( zType[0]=='e' && tagid ){
        cgi_printf("technote: ");
        hyperlink_to_event_tagid(tagid<0?-tagid:tagid);
      }else{
        cgi_printf("artifact: ");
        hyperlink_to_uuid(zUuid);
      }
    }

    if( g.perm.Hyperlink && fossil_strcmp(zDispUser, zThisUser)!=0 ){
      char *zLink = mprintf("%R/timeline?u=%h&c=%t&nd&n=200", zDispUser, zDate);
      cgi_printf("user: %z%h</a>", href("%z",zLink), zDispUser);
    }else{
      cgi_printf("user: %h", zDispUser);
    }

    /* Generate the "tags: TAGLIST" at the end of the comment, together
    ** with hyperlinks to the tag list.
    */
    if( zTagList && zTagList[0]==0 ) zTagList = 0;
    if( zTagList ){
      if( g.perm.Hyperlink ){
        int i;
        const char *z = zTagList;
        Blob links;
        blob_zero(&links);
        while( z && z[0] ){
          for(i=0; z[i] && (z[i]!=',' || z[i+1]!=' '); i++){}
          if( zThisTag==0 || memcmp(z, zThisTag, i)!=0 || zThisTag[i]!=0 ){
            blob_appendf(&links,
                  "%z%#h</a>%.2s",
                  href("%R/timeline?r=%#t&nd&c=%t&n=200",i,z,zDate), i,z, &z[i]
            );
          }else{
            blob_appendf(&links, "%#h", i+2, z);
          }
          if( z[i]==0 ) break;
          z += i+2;
        }
        cgi_printf(" tags: %s", blob_str(&links));
        blob_reset(&links);
      }else{
        cgi_printf(" tags: %h", zTagList);
      }
    }

    if( tmFlags & TIMELINE_SHOWRID ){
      int srcId = delta_source_rid(rid);
      if( srcId ){
        cgi_printf(" id: %d&larr;%d", rid, srcId);
      }else{
        cgi_printf(" id: %d", rid);
      }
    }



    tag_private_status(rid);


    if( xExtra ){
      xExtra(rid);
    }
    cgi_printf("</span></span>\n");   /* End timelineDetail and timelineDetailWrapper */

    /* Generate the file-change list if requested */
    if( (tmFlags & (TIMELINE_FCHANGES|TIMELINE_FRENAMES))!=0
     && zType[0]=='c' && g.perm.Hyperlink
    ){
      int inUl = 0;
      if( !fchngQueryInit ){
................................................................................
    if( g.perm.RdWiki ){
      az[i++] = "w";
      az[i++] = "Wiki";
    }
    assert( i<=count(az) );
  }
  if( i>2 ){
    style_submenu_multichoice("y", i/2, az, isDisabled);
  }
}

/*
** If the zChng string is not NULL, then it should be a comma-separated
** list of glob patterns for filenames.  Add an term to the WHERE clause
** for the SQL statement under construction that excludes any check-in that
................................................................................
**    p=CHECKIN       Parents and ancestors of CHECKIN
**    d=CHECKIN       Children and descendants of CHECKIN
**    dp=CHECKIN      The same as d=CHECKIN&p=CHECKIN
**    t=TAG           Show only check-ins with the given TAG
**    r=TAG           Show check-ins related to TAG, equivalent to t=TAG&rel
**    rel             Show related check-ins as well as those matching t=TAG
**    mionly          Limit rel to show ancestors but not descendants
**    ms=MATCHSTYLE   Set tag match style to EXACT, GLOB, LIKE, REGEXP
**    u=USER          Only show items associated with USER
**    y=TYPE          'ci', 'w', 't', 'e', or 'all'.
**    vs=VIEWSTYLE    c: "compact"  d: "detail"   n: "normal"
**    ng              No Graph.
**    nd              Do not highlight the focus check-in
**    v               Show details of files changed
**    f=CHECKIN       Show family (immediate parents and children) of CHECKIN
**    from=CHECKIN    Path from...
**    to=CHECKIN        ... to this
**    shortest          ... show only the shortest path
................................................................................
  int pd_rid;
  double rBefore, rAfter, rCirca;     /* Boundary times */
  const char *z;
  char *zOlderButton = 0;             /* URL for Older button at the bottom */
  char *zNewerButton = 0;             /* URL for Newer button at the top */
  int selectedRid = -9999999;         /* Show a highlight on this RID */
  int disableY = 0;                   /* Disable type selector on submenu */
  char cViewStyle;                    /* Overall style of the page */
  static const char *azViewStyles[] = {
     "n", "Normal",
     "c", "Compact",
     "d", "Detailed",
  };

  /* Set number of rows to display */
  cookie_parse("fossil_display_settings");
  cookie_link_parameter("n","tln");
  z = P("n");
  if( z==0 ) z = db_get("timeline-default-length",0);
  if( z ){
................................................................................
        nEntry = 10;
      }
    }
  }else{
    cgi_replace_query_parameter("n","50");
    nEntry = 50;
  }
  cookie_link_parameter("vs","tlvs");
  cViewStyle = PD("vs","n")[0];
  style_submenu_multichoice("vs", 3, azViewStyles, 0);
  

  /* To view the timeline, must have permission to read project data.
  */
  pd_rid = name_to_typed_rid(P("dp"),"ci");
  if( pd_rid ){
    p_rid = d_rid = pd_rid;
  }
................................................................................
  }
  if( (zTagSql && db_int(0,"SELECT count(*) "
      "FROM tagxref NATURAL JOIN tag WHERE %s",zTagSql/*safe-for-%s*/)<=nEntry)
  ){
    nEntry = -1;
    zCirca = 0;
  }
  switch( cViewStyle ){
    case 'n':  tmFlags |= TIMELINE_NORMAL;  break;
    case 'c':  tmFlags |= TIMELINE_COMPACT;  break;
    case 'd':  tmFlags |= TIMELINE_DETAILED;  break;
  }    
  if( zType[0]=='a' ){
    tmFlags |= TIMELINE_BRIEF | TIMELINE_GRAPH;
  }else{
    tmFlags |= TIMELINE_GRAPH;
  }
  if( PB("ng") || zSearch!=0 ){
    tmFlags &= ~TIMELINE_GRAPH;
................................................................................
        }
        free(zDate);
      }
      if( zType[0]=='a' || zType[0]=='c' ){
        style_submenu_checkbox("unhide", "Unhide", STYLE_CLUTTER, 0);
      }
      style_submenu_checkbox("v", "Files", (zType[0]!='a' && zType[0]!='c')|STYLE_CLUTTER,0);
      style_submenu_entry("n","Max:",4,0);
      timeline_y_submenu(disableY);
      style_submenu_entry("t", "Tag Filter:", -8, STYLE_CLUTTER);
      style_submenu_multichoice("ms", count(azMatchStyles)/2, azMatchStyles, STYLE_CLUTTER);
    }
    blob_zero(&cond);
  }
  if( PB("showsql") ){