Fossil SCM
Use the timeline format for /whistory.
Commit
cef8425cf4a482a3f7b77546393f2e90efdaaab22c751b1dfaef0c53d91ef8d3
Parent
91ff34dc17646e4…
1 file changed
+18
-51
+18
-51
| --- src/wiki.c | ||
| +++ src/wiki.c | ||
| @@ -1547,67 +1547,34 @@ | ||
| 1547 | 1547 | ** showid Show RID values |
| 1548 | 1548 | ** |
| 1549 | 1549 | ** Show the complete change history for a single wiki page. |
| 1550 | 1550 | */ |
| 1551 | 1551 | void whistory_page(void){ |
| 1552 | - Stmt q; | |
| 1553 | 1552 | const char *zPageName; |
| 1554 | - double rNow; | |
| 1555 | - int showRid; | |
| 1553 | + Blob sql; | |
| 1554 | + Stmt q; | |
| 1556 | 1555 | login_check_credentials(); |
| 1557 | - if( !g.perm.Hyperlink ){ login_needed(g.anon.Hyperlink); return; } | |
| 1556 | + if( !g.perm.RdWiki ){ login_needed(g.anon.RdWiki); return; } | |
| 1558 | 1557 | zPageName = PD("name",""); |
| 1559 | 1558 | style_header("History Of %s", zPageName); |
| 1560 | - showRid = P("showid")!=0; | |
| 1561 | - db_prepare(&q, | |
| 1562 | - "SELECT" | |
| 1563 | - " event.mtime," | |
| 1564 | - " blob.uuid," | |
| 1565 | - " coalesce(event.euser,event.user)," | |
| 1566 | - " event.objid" | |
| 1567 | - " FROM event, blob, tag, tagxref" | |
| 1568 | - " WHERE event.type='w' AND blob.rid=event.objid" | |
| 1569 | - " AND tag.tagname='wiki-%q'" | |
| 1570 | - " AND tagxref.tagid=tag.tagid AND tagxref.srcid=event.objid" | |
| 1571 | - " ORDER BY event.mtime DESC", | |
| 1572 | - zPageName | |
| 1559 | + blob_init(&sql, 0, 0); | |
| 1560 | + blob_append(&sql, timeline_query_for_www(), -1); | |
| 1561 | + blob_append_sql(&sql, | |
| 1562 | + "AND event.objid IN (" | |
| 1563 | + " SELECT tagxref.srcid" | |
| 1564 | + " FROM tagxref, tag" | |
| 1565 | + " WHERE tagxref.tagid=tag.tagid" | |
| 1566 | + " AND tag.tagname='wiki-%q')" | |
| 1567 | + " ORDER BY mtime DESC", | |
| 1568 | + zPageName | |
| 1573 | 1569 | ); |
| 1574 | - @ <h2>History of <a href="%R/wiki?name=%T(zPageName)">%h(zPageName)</a></h2> | |
| 1575 | - @ <div class="brlist"> | |
| 1576 | - @ <table> | |
| 1577 | - @ <thead><tr> | |
| 1578 | - @ <th>Age</th> | |
| 1579 | - @ <th>Hash</th> | |
| 1580 | - @ <th>User</th> | |
| 1581 | - if( showRid ){ | |
| 1582 | - @ <th>RID</th> | |
| 1583 | - } | |
| 1584 | - @ <th> </th> | |
| 1585 | - @ </tr></thead><tbody> | |
| 1586 | - rNow = db_double(0.0, "SELECT julianday('now')"); | |
| 1587 | - while( db_step(&q)==SQLITE_ROW ){ | |
| 1588 | - double rMtime = db_column_double(&q, 0); | |
| 1589 | - const char *zUuid = db_column_text(&q, 1); | |
| 1590 | - const char *zUser = db_column_text(&q, 2); | |
| 1591 | - int wrid = db_column_int(&q, 3); | |
| 1592 | - /* sqlite3_int64 iMtime = (sqlite3_int64)(rMtime*86400.0); */ | |
| 1593 | - char *zAge = human_readable_age(rNow - rMtime); | |
| 1594 | - @ <tr> | |
| 1595 | - /* @ <td data-sortkey="%016llx(iMtime)">%s(zAge)</td> */ | |
| 1596 | - @ <td>%s(zAge)</td> | |
| 1597 | - fossil_free(zAge); | |
| 1598 | - @ <td>%z(href("%R/info/%s",zUuid))%S(zUuid)</a></td> | |
| 1599 | - @ <td>%h(zUser)</td> | |
| 1600 | - if( showRid ){ | |
| 1601 | - @ <td>%z(href("%R/artifact/%S",zUuid))%d(wrid)</a></td> | |
| 1602 | - } | |
| 1603 | - @ <td>%z(href("%R/wdiff?id=%S",zUuid))diff</a></td> | |
| 1604 | - @ </tr> | |
| 1605 | - } | |
| 1606 | - @ </tbody></table></div> | |
| 1570 | + db_prepare(&q, "%s", blob_sql_text(&sql)); | |
| 1571 | + www_print_timeline(&q, | |
| 1572 | + TIMELINE_DISJOINT|TIMELINE_GRAPH|TIMELINE_REFS, | |
| 1573 | + 0, 0, 0, 0, 0, 0); | |
| 1607 | 1574 | db_finalize(&q); |
| 1608 | - /* style_table_sorter(); */ | |
| 1575 | + blob_reset(&sql); | |
| 1609 | 1576 | style_footer(); |
| 1610 | 1577 | } |
| 1611 | 1578 | |
| 1612 | 1579 | /* |
| 1613 | 1580 | ** WEBPAGE: wdiff |
| 1614 | 1581 |
| --- src/wiki.c | |
| +++ src/wiki.c | |
| @@ -1547,67 +1547,34 @@ | |
| 1547 | ** showid Show RID values |
| 1548 | ** |
| 1549 | ** Show the complete change history for a single wiki page. |
| 1550 | */ |
| 1551 | void whistory_page(void){ |
| 1552 | Stmt q; |
| 1553 | const char *zPageName; |
| 1554 | double rNow; |
| 1555 | int showRid; |
| 1556 | login_check_credentials(); |
| 1557 | if( !g.perm.Hyperlink ){ login_needed(g.anon.Hyperlink); return; } |
| 1558 | zPageName = PD("name",""); |
| 1559 | style_header("History Of %s", zPageName); |
| 1560 | showRid = P("showid")!=0; |
| 1561 | db_prepare(&q, |
| 1562 | "SELECT" |
| 1563 | " event.mtime," |
| 1564 | " blob.uuid," |
| 1565 | " coalesce(event.euser,event.user)," |
| 1566 | " event.objid" |
| 1567 | " FROM event, blob, tag, tagxref" |
| 1568 | " WHERE event.type='w' AND blob.rid=event.objid" |
| 1569 | " AND tag.tagname='wiki-%q'" |
| 1570 | " AND tagxref.tagid=tag.tagid AND tagxref.srcid=event.objid" |
| 1571 | " ORDER BY event.mtime DESC", |
| 1572 | zPageName |
| 1573 | ); |
| 1574 | @ <h2>History of <a href="%R/wiki?name=%T(zPageName)">%h(zPageName)</a></h2> |
| 1575 | @ <div class="brlist"> |
| 1576 | @ <table> |
| 1577 | @ <thead><tr> |
| 1578 | @ <th>Age</th> |
| 1579 | @ <th>Hash</th> |
| 1580 | @ <th>User</th> |
| 1581 | if( showRid ){ |
| 1582 | @ <th>RID</th> |
| 1583 | } |
| 1584 | @ <th> </th> |
| 1585 | @ </tr></thead><tbody> |
| 1586 | rNow = db_double(0.0, "SELECT julianday('now')"); |
| 1587 | while( db_step(&q)==SQLITE_ROW ){ |
| 1588 | double rMtime = db_column_double(&q, 0); |
| 1589 | const char *zUuid = db_column_text(&q, 1); |
| 1590 | const char *zUser = db_column_text(&q, 2); |
| 1591 | int wrid = db_column_int(&q, 3); |
| 1592 | /* sqlite3_int64 iMtime = (sqlite3_int64)(rMtime*86400.0); */ |
| 1593 | char *zAge = human_readable_age(rNow - rMtime); |
| 1594 | @ <tr> |
| 1595 | /* @ <td data-sortkey="%016llx(iMtime)">%s(zAge)</td> */ |
| 1596 | @ <td>%s(zAge)</td> |
| 1597 | fossil_free(zAge); |
| 1598 | @ <td>%z(href("%R/info/%s",zUuid))%S(zUuid)</a></td> |
| 1599 | @ <td>%h(zUser)</td> |
| 1600 | if( showRid ){ |
| 1601 | @ <td>%z(href("%R/artifact/%S",zUuid))%d(wrid)</a></td> |
| 1602 | } |
| 1603 | @ <td>%z(href("%R/wdiff?id=%S",zUuid))diff</a></td> |
| 1604 | @ </tr> |
| 1605 | } |
| 1606 | @ </tbody></table></div> |
| 1607 | db_finalize(&q); |
| 1608 | /* style_table_sorter(); */ |
| 1609 | style_footer(); |
| 1610 | } |
| 1611 | |
| 1612 | /* |
| 1613 | ** WEBPAGE: wdiff |
| 1614 |
| --- src/wiki.c | |
| +++ src/wiki.c | |
| @@ -1547,67 +1547,34 @@ | |
| 1547 | ** showid Show RID values |
| 1548 | ** |
| 1549 | ** Show the complete change history for a single wiki page. |
| 1550 | */ |
| 1551 | void whistory_page(void){ |
| 1552 | const char *zPageName; |
| 1553 | Blob sql; |
| 1554 | Stmt q; |
| 1555 | login_check_credentials(); |
| 1556 | if( !g.perm.RdWiki ){ login_needed(g.anon.RdWiki); return; } |
| 1557 | zPageName = PD("name",""); |
| 1558 | style_header("History Of %s", zPageName); |
| 1559 | blob_init(&sql, 0, 0); |
| 1560 | blob_append(&sql, timeline_query_for_www(), -1); |
| 1561 | blob_append_sql(&sql, |
| 1562 | "AND event.objid IN (" |
| 1563 | " SELECT tagxref.srcid" |
| 1564 | " FROM tagxref, tag" |
| 1565 | " WHERE tagxref.tagid=tag.tagid" |
| 1566 | " AND tag.tagname='wiki-%q')" |
| 1567 | " ORDER BY mtime DESC", |
| 1568 | zPageName |
| 1569 | ); |
| 1570 | db_prepare(&q, "%s", blob_sql_text(&sql)); |
| 1571 | www_print_timeline(&q, |
| 1572 | TIMELINE_DISJOINT|TIMELINE_GRAPH|TIMELINE_REFS, |
| 1573 | 0, 0, 0, 0, 0, 0); |
| 1574 | db_finalize(&q); |
| 1575 | blob_reset(&sql); |
| 1576 | style_footer(); |
| 1577 | } |
| 1578 | |
| 1579 | /* |
| 1580 | ** WEBPAGE: wdiff |
| 1581 |