Fossil

Check-in [cef8425c]
Login

Check-in [cef8425c]

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

Overview
Comment:Use the timeline format for /whistory.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: cef8425cf4a482a3f7b77546393f2e90efdaaab22c751b1dfaef0c53d91ef8d3
User & Date: drh 2020-08-28 09:34:41
References
2021-03-23
14:50
Implement selection of two arbitrary versions of a wiki for comparison (radio-button selects a baseline, anchor sign clears this selection). Also let several sequential edits by the same user be "recycled" into a single row. Effectively this backouts [cef8425cf4a482a3]. See also a forum thread ... (check-in: 6ebf5c7c user: george tags: trunk)
Context
2020-08-28
09:47
Unprotect the ssl-identity property when setting it. ... (check-in: e3636830 user: drh tags: trunk)
09:34
Use the timeline format for /whistory. ... (check-in: cef8425c user: drh tags: trunk)
2020-08-27
23:54
Typo fix: Turns out "edited" only has one "t". Who knew? ... (check-in: 91ff34dc user: drh tags: trunk)
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/wiki.c.

1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566

1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596

1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
** Additional parameters:
**
**     showid          Show RID values
**
** Show the complete change history for a single wiki page.
*/
void whistory_page(void){
  Stmt q;
  const char *zPageName;
  double rNow;
  int showRid;
  login_check_credentials();
  if( !g.perm.Hyperlink ){ login_needed(g.anon.Hyperlink); return; }
  zPageName = PD("name","");
  style_header("History Of %s", zPageName);
  showRid = P("showid")!=0;
  db_prepare(&q,
    "SELECT"
    "  event.mtime,"
    "  blob.uuid,"
    "  coalesce(event.euser,event.user),"
    "  event.objid"

    " FROM event, blob, tag, tagxref"
    " WHERE event.type='w' AND blob.rid=event.objid"
    "   AND tag.tagname='wiki-%q'"
    "   AND tagxref.tagid=tag.tagid AND tagxref.srcid=event.objid"
    " ORDER BY event.mtime DESC",
    zPageName
  );
  @ <h2>History of <a href="%R/wiki?name=%T(zPageName)">%h(zPageName)</a></h2>
  @ <div class="brlist">
  @ <table>
  @ <thead><tr>
  @ <th>Age</th>
  @ <th>Hash</th>
  @ <th>User</th>
  if( showRid ){
    @ <th>RID</th>
  }
  @ <th>&nbsp;</th>
  @ </tr></thead><tbody>
  rNow = db_double(0.0, "SELECT julianday('now')");
  while( db_step(&q)==SQLITE_ROW ){
    double rMtime = db_column_double(&q, 0);
    const char *zUuid = db_column_text(&q, 1);
    const char *zUser = db_column_text(&q, 2);
    int wrid = db_column_int(&q, 3);
    /* sqlite3_int64 iMtime = (sqlite3_int64)(rMtime*86400.0); */
    char *zAge = human_readable_age(rNow - rMtime);
    @ <tr>
    /* @ <td data-sortkey="%016llx(iMtime)">%s(zAge)</td> */
    @ <td>%s(zAge)</td>

    fossil_free(zAge);
    @ <td>%z(href("%R/info/%s",zUuid))%S(zUuid)</a></td>
    @ <td>%h(zUser)</td>
    if( showRid ){
      @ <td>%z(href("%R/artifact/%S",zUuid))%d(wrid)</a></td>
    }
    @ <td>%z(href("%R/wdiff?id=%S",zUuid))diff</a></td>
    @ </tr>
  }
  @ </tbody></table></div>
  db_finalize(&q);
  /* style_table_sorter(); */
  style_footer();
}

/*
** WEBPAGE: wdiff
**
** Show the changes to a wiki page.







<

|
|

|


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

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

|







1545
1546
1547
1548
1549
1550
1551

1552
1553
1554
1555
1556
1557
1558

1559

1560
1561

1562
1563
1564
1565
1566

1567
1568
1569















1570
1571






1572
1573









1574
1575
1576
1577
1578
1579
1580
1581
1582
** Additional parameters:
**
**     showid          Show RID values
**
** Show the complete change history for a single wiki page.
*/
void whistory_page(void){

  const char *zPageName;
  Blob sql;
  Stmt q;
  login_check_credentials();
  if( !g.perm.RdWiki ){ login_needed(g.anon.RdWiki); return; }
  zPageName = PD("name","");
  style_header("History Of %s", zPageName);

  blob_init(&sql, 0, 0);

  blob_append(&sql, timeline_query_for_www(), -1);
  blob_append_sql(&sql,

     "AND event.objid IN ("
     " SELECT tagxref.srcid"
     " FROM tagxref, tag"
     " WHERE tagxref.tagid=tag.tagid"
     " AND tag.tagname='wiki-%q')"

     " ORDER BY mtime DESC",
     zPageName
  );















  db_prepare(&q, "%s", blob_sql_text(&sql));
  www_print_timeline(&q,






    TIMELINE_DISJOINT|TIMELINE_GRAPH|TIMELINE_REFS,
    0, 0, 0, 0, 0, 0);









  db_finalize(&q);
  blob_reset(&sql);
  style_footer();
}

/*
** WEBPAGE: wdiff
**
** Show the changes to a wiki page.