Fossil SCM
Add the "recent" query parameter to the /bloblist page, to show the 250 most recently acquired artifacts.
Commit
64ab7d7f2888a277ee2e9b8d70fb15509df19da1de962ca707ea9486800166dc
Parent
3057775b543df00…
1 file changed
+12
-2
+12
-2
| --- src/name.c | ||
| +++ src/name.c | ||
| @@ -1676,28 +1676,33 @@ | ||
| 1676 | 1676 | ** n=N Show N artifacts |
| 1677 | 1677 | ** s=S Start with artifact number S |
| 1678 | 1678 | ** priv Show only unpublished or private artifacts |
| 1679 | 1679 | ** phan Show only phantom artifacts |
| 1680 | 1680 | ** hclr Color code hash types (SHA1 vs SHA3) |
| 1681 | +** recent Show the most recent N artifacts | |
| 1681 | 1682 | */ |
| 1682 | 1683 | void bloblist_page(void){ |
| 1683 | 1684 | Stmt q; |
| 1684 | 1685 | int s = atoi(PD("s","0")); |
| 1685 | 1686 | int n = atoi(PD("n","5000")); |
| 1686 | 1687 | int mx = db_int(0, "SELECT max(rid) FROM blob"); |
| 1687 | 1688 | int privOnly = PB("priv"); |
| 1688 | 1689 | int phantomOnly = PB("phan"); |
| 1689 | 1690 | int hashClr = PB("hclr"); |
| 1691 | + int bRecent = PB("recent"); | |
| 1690 | 1692 | char *zRange; |
| 1691 | 1693 | char *zSha1Bg; |
| 1692 | 1694 | char *zSha3Bg; |
| 1693 | 1695 | |
| 1694 | 1696 | login_check_credentials(); |
| 1695 | 1697 | if( !g.perm.Read ){ login_needed(g.anon.Read); return; } |
| 1696 | 1698 | cgi_check_for_malice(); |
| 1697 | 1699 | style_header("List Of Artifacts"); |
| 1698 | 1700 | style_submenu_element("250 Largest", "bigbloblist"); |
| 1701 | + if( bRecent==0 || n!=250 ){ | |
| 1702 | + style_submenu_element("Recent","bloblist?n=250&recent"); | |
| 1703 | + } | |
| 1699 | 1704 | if( g.perm.Admin ){ |
| 1700 | 1705 | style_submenu_element("Artifact Log", "rcvfromlist"); |
| 1701 | 1706 | } |
| 1702 | 1707 | if( !phantomOnly ){ |
| 1703 | 1708 | style_submenu_element("Phantoms", "bloblist?phan"); |
| @@ -1711,18 +1716,19 @@ | ||
| 1711 | 1716 | privOnly = 0; |
| 1712 | 1717 | } |
| 1713 | 1718 | if( g.perm.Write ){ |
| 1714 | 1719 | style_submenu_element("Artifact Stats", "artifact_stats"); |
| 1715 | 1720 | } |
| 1716 | - if( !privOnly && !phantomOnly && mx>n && P("s")==0 ){ | |
| 1721 | + if( !privOnly && !phantomOnly && mx>n && P("s")==0 && !bRecent ){ | |
| 1717 | 1722 | int i; |
| 1718 | 1723 | @ <p>Select a range of artifacts to view:</p> |
| 1719 | 1724 | @ <ul> |
| 1720 | 1725 | for(i=1; i<=mx; i+=n){ |
| 1721 | 1726 | @ <li> %z(href("%R/bloblist?s=%d&n=%d",i,n)) |
| 1722 | 1727 | @ %d(i)..%d(i+n-1<mx?i+n-1:mx)</a> |
| 1723 | 1728 | } |
| 1729 | + @ <li> %z(href("%R/bloblist?n=250&recent"))250 most recent</a> | |
| 1724 | 1730 | @ </ul> |
| 1725 | 1731 | style_finish_page(); |
| 1726 | 1732 | return; |
| 1727 | 1733 | } |
| 1728 | 1734 | if( phantomOnly || privOnly || mx>n ){ |
| @@ -1730,18 +1736,22 @@ | ||
| 1730 | 1736 | } |
| 1731 | 1737 | if( privOnly ){ |
| 1732 | 1738 | zRange = mprintf("IN private"); |
| 1733 | 1739 | }else if( phantomOnly ){ |
| 1734 | 1740 | zRange = mprintf("IN phantom"); |
| 1741 | + }else if( bRecent ){ | |
| 1742 | + zRange = mprintf(">=(SELECT rid FROM blob" | |
| 1743 | + " ORDER BY rid DESC LIMIT 1 OFFSET %d)",n); | |
| 1735 | 1744 | }else{ |
| 1736 | 1745 | zRange = mprintf("BETWEEN %d AND %d", s, s+n-1); |
| 1737 | 1746 | } |
| 1738 | 1747 | describe_artifacts(zRange); |
| 1739 | 1748 | fossil_free(zRange); |
| 1740 | 1749 | db_prepare(&q, |
| 1741 | 1750 | "SELECT rid, uuid, summary, isPrivate, type='phantom', rcvid, ref" |
| 1742 | - " FROM description ORDER BY rid" | |
| 1751 | + " FROM description ORDER BY rid %s", | |
| 1752 | + (bRecent?"DESC":"ASC")/*safe-for-%s*/ | |
| 1743 | 1753 | ); |
| 1744 | 1754 | if( skin_detail_boolean("white-foreground") ){ |
| 1745 | 1755 | zSha1Bg = "#714417"; |
| 1746 | 1756 | zSha3Bg = "#177117"; |
| 1747 | 1757 | }else{ |
| 1748 | 1758 |
| --- src/name.c | |
| +++ src/name.c | |
| @@ -1676,28 +1676,33 @@ | |
| 1676 | ** n=N Show N artifacts |
| 1677 | ** s=S Start with artifact number S |
| 1678 | ** priv Show only unpublished or private artifacts |
| 1679 | ** phan Show only phantom artifacts |
| 1680 | ** hclr Color code hash types (SHA1 vs SHA3) |
| 1681 | */ |
| 1682 | void bloblist_page(void){ |
| 1683 | Stmt q; |
| 1684 | int s = atoi(PD("s","0")); |
| 1685 | int n = atoi(PD("n","5000")); |
| 1686 | int mx = db_int(0, "SELECT max(rid) FROM blob"); |
| 1687 | int privOnly = PB("priv"); |
| 1688 | int phantomOnly = PB("phan"); |
| 1689 | int hashClr = PB("hclr"); |
| 1690 | char *zRange; |
| 1691 | char *zSha1Bg; |
| 1692 | char *zSha3Bg; |
| 1693 | |
| 1694 | login_check_credentials(); |
| 1695 | if( !g.perm.Read ){ login_needed(g.anon.Read); return; } |
| 1696 | cgi_check_for_malice(); |
| 1697 | style_header("List Of Artifacts"); |
| 1698 | style_submenu_element("250 Largest", "bigbloblist"); |
| 1699 | if( g.perm.Admin ){ |
| 1700 | style_submenu_element("Artifact Log", "rcvfromlist"); |
| 1701 | } |
| 1702 | if( !phantomOnly ){ |
| 1703 | style_submenu_element("Phantoms", "bloblist?phan"); |
| @@ -1711,18 +1716,19 @@ | |
| 1711 | privOnly = 0; |
| 1712 | } |
| 1713 | if( g.perm.Write ){ |
| 1714 | style_submenu_element("Artifact Stats", "artifact_stats"); |
| 1715 | } |
| 1716 | if( !privOnly && !phantomOnly && mx>n && P("s")==0 ){ |
| 1717 | int i; |
| 1718 | @ <p>Select a range of artifacts to view:</p> |
| 1719 | @ <ul> |
| 1720 | for(i=1; i<=mx; i+=n){ |
| 1721 | @ <li> %z(href("%R/bloblist?s=%d&n=%d",i,n)) |
| 1722 | @ %d(i)..%d(i+n-1<mx?i+n-1:mx)</a> |
| 1723 | } |
| 1724 | @ </ul> |
| 1725 | style_finish_page(); |
| 1726 | return; |
| 1727 | } |
| 1728 | if( phantomOnly || privOnly || mx>n ){ |
| @@ -1730,18 +1736,22 @@ | |
| 1730 | } |
| 1731 | if( privOnly ){ |
| 1732 | zRange = mprintf("IN private"); |
| 1733 | }else if( phantomOnly ){ |
| 1734 | zRange = mprintf("IN phantom"); |
| 1735 | }else{ |
| 1736 | zRange = mprintf("BETWEEN %d AND %d", s, s+n-1); |
| 1737 | } |
| 1738 | describe_artifacts(zRange); |
| 1739 | fossil_free(zRange); |
| 1740 | db_prepare(&q, |
| 1741 | "SELECT rid, uuid, summary, isPrivate, type='phantom', rcvid, ref" |
| 1742 | " FROM description ORDER BY rid" |
| 1743 | ); |
| 1744 | if( skin_detail_boolean("white-foreground") ){ |
| 1745 | zSha1Bg = "#714417"; |
| 1746 | zSha3Bg = "#177117"; |
| 1747 | }else{ |
| 1748 |
| --- src/name.c | |
| +++ src/name.c | |
| @@ -1676,28 +1676,33 @@ | |
| 1676 | ** n=N Show N artifacts |
| 1677 | ** s=S Start with artifact number S |
| 1678 | ** priv Show only unpublished or private artifacts |
| 1679 | ** phan Show only phantom artifacts |
| 1680 | ** hclr Color code hash types (SHA1 vs SHA3) |
| 1681 | ** recent Show the most recent N artifacts |
| 1682 | */ |
| 1683 | void bloblist_page(void){ |
| 1684 | Stmt q; |
| 1685 | int s = atoi(PD("s","0")); |
| 1686 | int n = atoi(PD("n","5000")); |
| 1687 | int mx = db_int(0, "SELECT max(rid) FROM blob"); |
| 1688 | int privOnly = PB("priv"); |
| 1689 | int phantomOnly = PB("phan"); |
| 1690 | int hashClr = PB("hclr"); |
| 1691 | int bRecent = PB("recent"); |
| 1692 | char *zRange; |
| 1693 | char *zSha1Bg; |
| 1694 | char *zSha3Bg; |
| 1695 | |
| 1696 | login_check_credentials(); |
| 1697 | if( !g.perm.Read ){ login_needed(g.anon.Read); return; } |
| 1698 | cgi_check_for_malice(); |
| 1699 | style_header("List Of Artifacts"); |
| 1700 | style_submenu_element("250 Largest", "bigbloblist"); |
| 1701 | if( bRecent==0 || n!=250 ){ |
| 1702 | style_submenu_element("Recent","bloblist?n=250&recent"); |
| 1703 | } |
| 1704 | if( g.perm.Admin ){ |
| 1705 | style_submenu_element("Artifact Log", "rcvfromlist"); |
| 1706 | } |
| 1707 | if( !phantomOnly ){ |
| 1708 | style_submenu_element("Phantoms", "bloblist?phan"); |
| @@ -1711,18 +1716,19 @@ | |
| 1716 | privOnly = 0; |
| 1717 | } |
| 1718 | if( g.perm.Write ){ |
| 1719 | style_submenu_element("Artifact Stats", "artifact_stats"); |
| 1720 | } |
| 1721 | if( !privOnly && !phantomOnly && mx>n && P("s")==0 && !bRecent ){ |
| 1722 | int i; |
| 1723 | @ <p>Select a range of artifacts to view:</p> |
| 1724 | @ <ul> |
| 1725 | for(i=1; i<=mx; i+=n){ |
| 1726 | @ <li> %z(href("%R/bloblist?s=%d&n=%d",i,n)) |
| 1727 | @ %d(i)..%d(i+n-1<mx?i+n-1:mx)</a> |
| 1728 | } |
| 1729 | @ <li> %z(href("%R/bloblist?n=250&recent"))250 most recent</a> |
| 1730 | @ </ul> |
| 1731 | style_finish_page(); |
| 1732 | return; |
| 1733 | } |
| 1734 | if( phantomOnly || privOnly || mx>n ){ |
| @@ -1730,18 +1736,22 @@ | |
| 1736 | } |
| 1737 | if( privOnly ){ |
| 1738 | zRange = mprintf("IN private"); |
| 1739 | }else if( phantomOnly ){ |
| 1740 | zRange = mprintf("IN phantom"); |
| 1741 | }else if( bRecent ){ |
| 1742 | zRange = mprintf(">=(SELECT rid FROM blob" |
| 1743 | " ORDER BY rid DESC LIMIT 1 OFFSET %d)",n); |
| 1744 | }else{ |
| 1745 | zRange = mprintf("BETWEEN %d AND %d", s, s+n-1); |
| 1746 | } |
| 1747 | describe_artifacts(zRange); |
| 1748 | fossil_free(zRange); |
| 1749 | db_prepare(&q, |
| 1750 | "SELECT rid, uuid, summary, isPrivate, type='phantom', rcvid, ref" |
| 1751 | " FROM description ORDER BY rid %s", |
| 1752 | (bRecent?"DESC":"ASC")/*safe-for-%s*/ |
| 1753 | ); |
| 1754 | if( skin_detail_boolean("white-foreground") ){ |
| 1755 | zSha1Bg = "#714417"; |
| 1756 | zSha3Bg = "#177117"; |
| 1757 | }else{ |
| 1758 |