Fossil SCM
Improved title on on the /forum page.
Commit
dbd96b2c74520c21d39e31a96c07b287ef4d4e24c17b9b5ce3a4a937932178af
Parent
aff20904fad05b0…
1 file changed
+24
-13
+24
-13
| --- src/forum.c | ||
| +++ src/forum.c | ||
| @@ -933,14 +933,13 @@ | ||
| 933 | 933 | style_footer(); |
| 934 | 934 | return; |
| 935 | 935 | } |
| 936 | 936 | iLimit = atoi(PD("n","25")); |
| 937 | 937 | iOfst = atoi(PD("x","0")); |
| 938 | - @ <h1>Recent Threads</h1> | |
| 939 | - @ <div class='fileage'><table width="100%%"> | |
| 938 | + iCnt = 0; | |
| 940 | 939 | if( db_table_exists("repository","forumpost") ){ |
| 941 | - db_prepare(&q, | |
| 940 | + db_prepare(&q, | |
| 942 | 941 | "SELECT" |
| 943 | 942 | " julianday('now') - max(fmtime) AS a," /* 0 */ |
| 944 | 943 | " max(fmtime) - min(fmtime) AS b," /* 1 */ |
| 945 | 944 | " sum(fprev IS NULL) AS c," /* 2 */ |
| 946 | 945 | " (SELECT substr(uuid,1,10) FROM blob WHERE rid=froot)," /* 3 */ |
| @@ -950,35 +949,43 @@ | ||
| 950 | 949 | " ORDER BY fmtime DESC LIMIT 1))" |
| 951 | 950 | " FROM forumpost AS x" |
| 952 | 951 | " GROUP BY froot ORDER BY 1 LIMIT %d OFFSET %d;", |
| 953 | 952 | iLimit+1, iOfst |
| 954 | 953 | ); |
| 955 | - iCnt = 0; | |
| 956 | 954 | while( db_step(&q)==SQLITE_ROW ){ |
| 957 | 955 | char *zAge = 0; |
| 958 | 956 | char *zDuration = 0; |
| 959 | 957 | int nMsg = db_column_int(&q, 2); |
| 960 | 958 | const char *zUuid = db_column_text(&q, 3); |
| 961 | 959 | const char *zTitle = db_column_text(&q, 4); |
| 962 | - if( iCnt==0 && iOfst>0 ){ | |
| 963 | - if( iOfst>iLimit ){ | |
| 964 | - @ <tr><td colspan="3">\ | |
| 965 | - @ %z(href("%R/forum?x=%d&n=%d",iOfst-iLimit,iLimit))\ | |
| 966 | - @ ↑ Newer...</a></td></tr> | |
| 960 | + zAge = human_readable_age(db_column_double(&q,0)); | |
| 961 | + if( iCnt==0 ){ | |
| 962 | + if( iOfst>0 ){ | |
| 963 | + @ <h1>Threads at least %s(zAge) old</h1> | |
| 967 | 964 | }else{ |
| 968 | - @ <tr><td colspan="3">%z(href("%R/forum?n=%d",iLimit))\ | |
| 969 | - @ ↑ Newer...</a></td></tr> | |
| 965 | + @ <h1>Most recent threads</h1> | |
| 966 | + } | |
| 967 | + @ <div class='fileage'><table width="100%%"> | |
| 968 | + if( iOfst>0 ){ | |
| 969 | + if( iOfst>iLimit ){ | |
| 970 | + @ <tr><td colspan="3">\ | |
| 971 | + @ %z(href("%R/forum?x=%d&n=%d",iOfst-iLimit,iLimit))\ | |
| 972 | + @ ↑ Newer...</a></td></tr> | |
| 973 | + }else{ | |
| 974 | + @ <tr><td colspan="3">%z(href("%R/forum?n=%d",iLimit))\ | |
| 975 | + @ ↑ Newer...</a></td></tr> | |
| 976 | + } | |
| 970 | 977 | } |
| 971 | 978 | } |
| 972 | 979 | iCnt++; |
| 973 | 980 | if( iCnt>iLimit ){ |
| 974 | 981 | @ <tr><td colspan="3">\ |
| 975 | 982 | @ %z(href("%R/forum?x=%d&n=%d",iOfst+iLimit,iLimit))\ |
| 976 | 983 | @ ↓ Older...</a></td></tr> |
| 984 | + fossil_free(zAge); | |
| 977 | 985 | break; |
| 978 | 986 | } |
| 979 | - zAge = human_readable_age(db_column_double(&q,0)); | |
| 980 | 987 | @ <tr><td>%h(zAge) ago</td> |
| 981 | 988 | @ <td>%z(href("%R/forumpost/%S",zUuid))%h(zTitle)</a></td> |
| 982 | 989 | if( nMsg<2 ){ |
| 983 | 990 | @ <td>no replies</td> |
| 984 | 991 | }else{ |
| @@ -989,8 +996,12 @@ | ||
| 989 | 996 | fossil_free(zAge); |
| 990 | 997 | fossil_free(zDuration); |
| 991 | 998 | } |
| 992 | 999 | db_finalize(&q); |
| 993 | 1000 | } |
| 994 | - @ </table></div> | |
| 1001 | + if( iCnt>0 ){ | |
| 1002 | + @ </table></div> | |
| 1003 | + }else{ | |
| 1004 | + @ <h1>No forum posts found</h1> | |
| 1005 | + } | |
| 995 | 1006 | style_footer(); |
| 996 | 1007 | } |
| 997 | 1008 |
| --- src/forum.c | |
| +++ src/forum.c | |
| @@ -933,14 +933,13 @@ | |
| 933 | style_footer(); |
| 934 | return; |
| 935 | } |
| 936 | iLimit = atoi(PD("n","25")); |
| 937 | iOfst = atoi(PD("x","0")); |
| 938 | @ <h1>Recent Threads</h1> |
| 939 | @ <div class='fileage'><table width="100%%"> |
| 940 | if( db_table_exists("repository","forumpost") ){ |
| 941 | db_prepare(&q, |
| 942 | "SELECT" |
| 943 | " julianday('now') - max(fmtime) AS a," /* 0 */ |
| 944 | " max(fmtime) - min(fmtime) AS b," /* 1 */ |
| 945 | " sum(fprev IS NULL) AS c," /* 2 */ |
| 946 | " (SELECT substr(uuid,1,10) FROM blob WHERE rid=froot)," /* 3 */ |
| @@ -950,35 +949,43 @@ | |
| 950 | " ORDER BY fmtime DESC LIMIT 1))" |
| 951 | " FROM forumpost AS x" |
| 952 | " GROUP BY froot ORDER BY 1 LIMIT %d OFFSET %d;", |
| 953 | iLimit+1, iOfst |
| 954 | ); |
| 955 | iCnt = 0; |
| 956 | while( db_step(&q)==SQLITE_ROW ){ |
| 957 | char *zAge = 0; |
| 958 | char *zDuration = 0; |
| 959 | int nMsg = db_column_int(&q, 2); |
| 960 | const char *zUuid = db_column_text(&q, 3); |
| 961 | const char *zTitle = db_column_text(&q, 4); |
| 962 | if( iCnt==0 && iOfst>0 ){ |
| 963 | if( iOfst>iLimit ){ |
| 964 | @ <tr><td colspan="3">\ |
| 965 | @ %z(href("%R/forum?x=%d&n=%d",iOfst-iLimit,iLimit))\ |
| 966 | @ ↑ Newer...</a></td></tr> |
| 967 | }else{ |
| 968 | @ <tr><td colspan="3">%z(href("%R/forum?n=%d",iLimit))\ |
| 969 | @ ↑ Newer...</a></td></tr> |
| 970 | } |
| 971 | } |
| 972 | iCnt++; |
| 973 | if( iCnt>iLimit ){ |
| 974 | @ <tr><td colspan="3">\ |
| 975 | @ %z(href("%R/forum?x=%d&n=%d",iOfst+iLimit,iLimit))\ |
| 976 | @ ↓ Older...</a></td></tr> |
| 977 | break; |
| 978 | } |
| 979 | zAge = human_readable_age(db_column_double(&q,0)); |
| 980 | @ <tr><td>%h(zAge) ago</td> |
| 981 | @ <td>%z(href("%R/forumpost/%S",zUuid))%h(zTitle)</a></td> |
| 982 | if( nMsg<2 ){ |
| 983 | @ <td>no replies</td> |
| 984 | }else{ |
| @@ -989,8 +996,12 @@ | |
| 989 | fossil_free(zAge); |
| 990 | fossil_free(zDuration); |
| 991 | } |
| 992 | db_finalize(&q); |
| 993 | } |
| 994 | @ </table></div> |
| 995 | style_footer(); |
| 996 | } |
| 997 |
| --- src/forum.c | |
| +++ src/forum.c | |
| @@ -933,14 +933,13 @@ | |
| 933 | style_footer(); |
| 934 | return; |
| 935 | } |
| 936 | iLimit = atoi(PD("n","25")); |
| 937 | iOfst = atoi(PD("x","0")); |
| 938 | iCnt = 0; |
| 939 | if( db_table_exists("repository","forumpost") ){ |
| 940 | db_prepare(&q, |
| 941 | "SELECT" |
| 942 | " julianday('now') - max(fmtime) AS a," /* 0 */ |
| 943 | " max(fmtime) - min(fmtime) AS b," /* 1 */ |
| 944 | " sum(fprev IS NULL) AS c," /* 2 */ |
| 945 | " (SELECT substr(uuid,1,10) FROM blob WHERE rid=froot)," /* 3 */ |
| @@ -950,35 +949,43 @@ | |
| 949 | " ORDER BY fmtime DESC LIMIT 1))" |
| 950 | " FROM forumpost AS x" |
| 951 | " GROUP BY froot ORDER BY 1 LIMIT %d OFFSET %d;", |
| 952 | iLimit+1, iOfst |
| 953 | ); |
| 954 | while( db_step(&q)==SQLITE_ROW ){ |
| 955 | char *zAge = 0; |
| 956 | char *zDuration = 0; |
| 957 | int nMsg = db_column_int(&q, 2); |
| 958 | const char *zUuid = db_column_text(&q, 3); |
| 959 | const char *zTitle = db_column_text(&q, 4); |
| 960 | zAge = human_readable_age(db_column_double(&q,0)); |
| 961 | if( iCnt==0 ){ |
| 962 | if( iOfst>0 ){ |
| 963 | @ <h1>Threads at least %s(zAge) old</h1> |
| 964 | }else{ |
| 965 | @ <h1>Most recent threads</h1> |
| 966 | } |
| 967 | @ <div class='fileage'><table width="100%%"> |
| 968 | if( iOfst>0 ){ |
| 969 | if( iOfst>iLimit ){ |
| 970 | @ <tr><td colspan="3">\ |
| 971 | @ %z(href("%R/forum?x=%d&n=%d",iOfst-iLimit,iLimit))\ |
| 972 | @ ↑ Newer...</a></td></tr> |
| 973 | }else{ |
| 974 | @ <tr><td colspan="3">%z(href("%R/forum?n=%d",iLimit))\ |
| 975 | @ ↑ Newer...</a></td></tr> |
| 976 | } |
| 977 | } |
| 978 | } |
| 979 | iCnt++; |
| 980 | if( iCnt>iLimit ){ |
| 981 | @ <tr><td colspan="3">\ |
| 982 | @ %z(href("%R/forum?x=%d&n=%d",iOfst+iLimit,iLimit))\ |
| 983 | @ ↓ Older...</a></td></tr> |
| 984 | fossil_free(zAge); |
| 985 | break; |
| 986 | } |
| 987 | @ <tr><td>%h(zAge) ago</td> |
| 988 | @ <td>%z(href("%R/forumpost/%S",zUuid))%h(zTitle)</a></td> |
| 989 | if( nMsg<2 ){ |
| 990 | @ <td>no replies</td> |
| 991 | }else{ |
| @@ -989,8 +996,12 @@ | |
| 996 | fossil_free(zAge); |
| 997 | fossil_free(zDuration); |
| 998 | } |
| 999 | db_finalize(&q); |
| 1000 | } |
| 1001 | if( iCnt>0 ){ |
| 1002 | @ </table></div> |
| 1003 | }else{ |
| 1004 | @ <h1>No forum posts found</h1> |
| 1005 | } |
| 1006 | style_footer(); |
| 1007 | } |
| 1008 |