Fossil SCM
Place Newer and Older buttons on circa queries to make browsing easier.
Commit
ced021fd57ac2bac3087a203525decb721b3e579
Parent
14b8475598268f3…
1 file changed
+28
-10
+28
-10
| --- src/timeline.c | ||
| +++ src/timeline.c | ||
| @@ -1420,11 +1420,11 @@ | ||
| 1420 | 1420 | if( (tmFlags & TIMELINE_UNHIDE)==0 ){ |
| 1421 | 1421 | timeline_submenu(&url, "Unhide", "unhide", "", 0); |
| 1422 | 1422 | } |
| 1423 | 1423 | }else{ |
| 1424 | 1424 | /* Otherwise, a timeline based on a span of time */ |
| 1425 | - int n; | |
| 1425 | + int n, nBefore, nAfter; | |
| 1426 | 1426 | const char *zEType = "timeline item"; |
| 1427 | 1427 | char *zDate; |
| 1428 | 1428 | if( zUses ){ |
| 1429 | 1429 | blob_append_sql(&sql, " AND event.objid IN usesfile "); |
| 1430 | 1430 | } |
| @@ -1628,20 +1628,38 @@ | ||
| 1628 | 1628 | } |
| 1629 | 1629 | if( zSearch ){ |
| 1630 | 1630 | blob_appendf(&desc, " matching \"%h\"", zSearch); |
| 1631 | 1631 | } |
| 1632 | 1632 | if( g.perm.Hyperlink ){ |
| 1633 | - if( zAfter || n==nEntry ){ | |
| 1633 | + if( zCirca && rCirca ){ | |
| 1634 | + nBefore = db_int(0, | |
| 1635 | + "SELECT count(*) FROM timeline WHERE etype!='div'" | |
| 1636 | + " AND sortby<=%f /*scan*/", rCirca); | |
| 1637 | + nAfter = db_int(0, | |
| 1638 | + "SELECT count(*) FROM timeline WHERE etype!='div'" | |
| 1639 | + " AND sortby>=%f /*scan*/", rCirca); | |
| 1634 | 1640 | zDate = db_text(0, "SELECT min(timestamp) FROM timeline /*scan*/"); |
| 1635 | - timeline_submenu(&url, "Older", "b", zDate, "a"); | |
| 1636 | - zOlderButton = fossil_strdup(url_render(&url, "b", zDate, "a", 0)); | |
| 1637 | - free(zDate); | |
| 1638 | - } | |
| 1639 | - if( zBefore || (zAfter && n==nEntry) ){ | |
| 1640 | - zDate = db_text(0, "SELECT max(timestamp) FROM timeline /*scan*/"); | |
| 1641 | - timeline_submenu(&url, "Newer", "a", zDate, "b"); | |
| 1642 | - free(zDate); | |
| 1641 | + if( nBefore>=nEntry ){ | |
| 1642 | + timeline_submenu(&url, "Older", "b", zDate, "c"); | |
| 1643 | + zOlderButton = fossil_strdup(url_render(&url, "b", zDate, "c", 0)); | |
| 1644 | + } | |
| 1645 | + if( nAfter>=nEntry ){ | |
| 1646 | + timeline_submenu(&url, "Newer", "a", zDate, "c"); | |
| 1647 | + } | |
| 1648 | + free(zDate); | |
| 1649 | + }else{ | |
| 1650 | + if( zAfter || n==nEntry ){ | |
| 1651 | + zDate = db_text(0, "SELECT min(timestamp) FROM timeline /*scan*/"); | |
| 1652 | + timeline_submenu(&url, "Older", "b", zDate, "a"); | |
| 1653 | + zOlderButton = fossil_strdup(url_render(&url, "b", zDate, "a", 0)); | |
| 1654 | + free(zDate); | |
| 1655 | + } | |
| 1656 | + if( zBefore || (zAfter && n==nEntry) ){ | |
| 1657 | + zDate = db_text(0, "SELECT max(timestamp) FROM timeline /*scan*/"); | |
| 1658 | + timeline_submenu(&url, "Newer", "a", zDate, "b"); | |
| 1659 | + free(zDate); | |
| 1660 | + } | |
| 1643 | 1661 | } |
| 1644 | 1662 | if( zType[0]=='a' || zType[0]=='c' ){ |
| 1645 | 1663 | if( (tmFlags & TIMELINE_UNHIDE)==0 ){ |
| 1646 | 1664 | timeline_submenu(&url, "Unhide", "unhide", "", 0); |
| 1647 | 1665 | } |
| 1648 | 1666 |
| --- src/timeline.c | |
| +++ src/timeline.c | |
| @@ -1420,11 +1420,11 @@ | |
| 1420 | if( (tmFlags & TIMELINE_UNHIDE)==0 ){ |
| 1421 | timeline_submenu(&url, "Unhide", "unhide", "", 0); |
| 1422 | } |
| 1423 | }else{ |
| 1424 | /* Otherwise, a timeline based on a span of time */ |
| 1425 | int n; |
| 1426 | const char *zEType = "timeline item"; |
| 1427 | char *zDate; |
| 1428 | if( zUses ){ |
| 1429 | blob_append_sql(&sql, " AND event.objid IN usesfile "); |
| 1430 | } |
| @@ -1628,20 +1628,38 @@ | |
| 1628 | } |
| 1629 | if( zSearch ){ |
| 1630 | blob_appendf(&desc, " matching \"%h\"", zSearch); |
| 1631 | } |
| 1632 | if( g.perm.Hyperlink ){ |
| 1633 | if( zAfter || n==nEntry ){ |
| 1634 | zDate = db_text(0, "SELECT min(timestamp) FROM timeline /*scan*/"); |
| 1635 | timeline_submenu(&url, "Older", "b", zDate, "a"); |
| 1636 | zOlderButton = fossil_strdup(url_render(&url, "b", zDate, "a", 0)); |
| 1637 | free(zDate); |
| 1638 | } |
| 1639 | if( zBefore || (zAfter && n==nEntry) ){ |
| 1640 | zDate = db_text(0, "SELECT max(timestamp) FROM timeline /*scan*/"); |
| 1641 | timeline_submenu(&url, "Newer", "a", zDate, "b"); |
| 1642 | free(zDate); |
| 1643 | } |
| 1644 | if( zType[0]=='a' || zType[0]=='c' ){ |
| 1645 | if( (tmFlags & TIMELINE_UNHIDE)==0 ){ |
| 1646 | timeline_submenu(&url, "Unhide", "unhide", "", 0); |
| 1647 | } |
| 1648 |
| --- src/timeline.c | |
| +++ src/timeline.c | |
| @@ -1420,11 +1420,11 @@ | |
| 1420 | if( (tmFlags & TIMELINE_UNHIDE)==0 ){ |
| 1421 | timeline_submenu(&url, "Unhide", "unhide", "", 0); |
| 1422 | } |
| 1423 | }else{ |
| 1424 | /* Otherwise, a timeline based on a span of time */ |
| 1425 | int n, nBefore, nAfter; |
| 1426 | const char *zEType = "timeline item"; |
| 1427 | char *zDate; |
| 1428 | if( zUses ){ |
| 1429 | blob_append_sql(&sql, " AND event.objid IN usesfile "); |
| 1430 | } |
| @@ -1628,20 +1628,38 @@ | |
| 1628 | } |
| 1629 | if( zSearch ){ |
| 1630 | blob_appendf(&desc, " matching \"%h\"", zSearch); |
| 1631 | } |
| 1632 | if( g.perm.Hyperlink ){ |
| 1633 | if( zCirca && rCirca ){ |
| 1634 | nBefore = db_int(0, |
| 1635 | "SELECT count(*) FROM timeline WHERE etype!='div'" |
| 1636 | " AND sortby<=%f /*scan*/", rCirca); |
| 1637 | nAfter = db_int(0, |
| 1638 | "SELECT count(*) FROM timeline WHERE etype!='div'" |
| 1639 | " AND sortby>=%f /*scan*/", rCirca); |
| 1640 | zDate = db_text(0, "SELECT min(timestamp) FROM timeline /*scan*/"); |
| 1641 | if( nBefore>=nEntry ){ |
| 1642 | timeline_submenu(&url, "Older", "b", zDate, "c"); |
| 1643 | zOlderButton = fossil_strdup(url_render(&url, "b", zDate, "c", 0)); |
| 1644 | } |
| 1645 | if( nAfter>=nEntry ){ |
| 1646 | timeline_submenu(&url, "Newer", "a", zDate, "c"); |
| 1647 | } |
| 1648 | free(zDate); |
| 1649 | }else{ |
| 1650 | if( zAfter || n==nEntry ){ |
| 1651 | zDate = db_text(0, "SELECT min(timestamp) FROM timeline /*scan*/"); |
| 1652 | timeline_submenu(&url, "Older", "b", zDate, "a"); |
| 1653 | zOlderButton = fossil_strdup(url_render(&url, "b", zDate, "a", 0)); |
| 1654 | free(zDate); |
| 1655 | } |
| 1656 | if( zBefore || (zAfter && n==nEntry) ){ |
| 1657 | zDate = db_text(0, "SELECT max(timestamp) FROM timeline /*scan*/"); |
| 1658 | timeline_submenu(&url, "Newer", "a", zDate, "b"); |
| 1659 | free(zDate); |
| 1660 | } |
| 1661 | } |
| 1662 | if( zType[0]=='a' || zType[0]=='c' ){ |
| 1663 | if( (tmFlags & TIMELINE_UNHIDE)==0 ){ |
| 1664 | timeline_submenu(&url, "Unhide", "unhide", "", 0); |
| 1665 | } |
| 1666 |