Fossil SCM

Add the "recent" query parameter to the /bloblist page, to show the 250 most recently acquired artifacts.

drh 2024-12-20 18:55 trunk
Commit 64ab7d7f2888a277ee2e9b8d70fb15509df19da1de962ca707ea9486800166dc
1 file changed +12 -2
+12 -2
--- src/name.c
+++ src/name.c
@@ -1676,28 +1676,33 @@
16761676
** n=N Show N artifacts
16771677
** s=S Start with artifact number S
16781678
** priv Show only unpublished or private artifacts
16791679
** phan Show only phantom artifacts
16801680
** hclr Color code hash types (SHA1 vs SHA3)
1681
+** recent Show the most recent N artifacts
16811682
*/
16821683
void bloblist_page(void){
16831684
Stmt q;
16841685
int s = atoi(PD("s","0"));
16851686
int n = atoi(PD("n","5000"));
16861687
int mx = db_int(0, "SELECT max(rid) FROM blob");
16871688
int privOnly = PB("priv");
16881689
int phantomOnly = PB("phan");
16891690
int hashClr = PB("hclr");
1691
+ int bRecent = PB("recent");
16901692
char *zRange;
16911693
char *zSha1Bg;
16921694
char *zSha3Bg;
16931695
16941696
login_check_credentials();
16951697
if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
16961698
cgi_check_for_malice();
16971699
style_header("List Of Artifacts");
16981700
style_submenu_element("250 Largest", "bigbloblist");
1701
+ if( bRecent==0 || n!=250 ){
1702
+ style_submenu_element("Recent","bloblist?n=250&recent");
1703
+ }
16991704
if( g.perm.Admin ){
17001705
style_submenu_element("Artifact Log", "rcvfromlist");
17011706
}
17021707
if( !phantomOnly ){
17031708
style_submenu_element("Phantoms", "bloblist?phan");
@@ -1711,18 +1716,19 @@
17111716
privOnly = 0;
17121717
}
17131718
if( g.perm.Write ){
17141719
style_submenu_element("Artifact Stats", "artifact_stats");
17151720
}
1716
- if( !privOnly && !phantomOnly && mx>n && P("s")==0 ){
1721
+ if( !privOnly && !phantomOnly && mx>n && P("s")==0 && !bRecent ){
17171722
int i;
17181723
@ <p>Select a range of artifacts to view:</p>
17191724
@ <ul>
17201725
for(i=1; i<=mx; i+=n){
17211726
@ <li> %z(href("%R/bloblist?s=%d&n=%d",i,n))
17221727
@ %d(i)..%d(i+n-1<mx?i+n-1:mx)</a>
17231728
}
1729
+ @ <li> %z(href("%R/bloblist?n=250&recent"))250 most recent</a>
17241730
@ </ul>
17251731
style_finish_page();
17261732
return;
17271733
}
17281734
if( phantomOnly || privOnly || mx>n ){
@@ -1730,18 +1736,22 @@
17301736
}
17311737
if( privOnly ){
17321738
zRange = mprintf("IN private");
17331739
}else if( phantomOnly ){
17341740
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);
17351744
}else{
17361745
zRange = mprintf("BETWEEN %d AND %d", s, s+n-1);
17371746
}
17381747
describe_artifacts(zRange);
17391748
fossil_free(zRange);
17401749
db_prepare(&q,
17411750
"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*/
17431753
);
17441754
if( skin_detail_boolean("white-foreground") ){
17451755
zSha1Bg = "#714417";
17461756
zSha3Bg = "#177117";
17471757
}else{
17481758
--- 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

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button