Fossil SCM
On the /info page for wiki, give a link to the next version of that wiki page in chronological order.
Commit
423c6a938e456b61a4326dc3193ca0b34d946150112237a1a24d20aec99bd5c8
Parent
b695e97d7abf9f4…
2 files changed
+11
-1
+27
+11
-1
| --- src/info.c | ||
| +++ src/info.c | ||
| @@ -891,10 +891,12 @@ | ||
| 891 | 891 | char *zUuid; |
| 892 | 892 | char *zDate; |
| 893 | 893 | Blob wiki; |
| 894 | 894 | int modPending; |
| 895 | 895 | const char *zModAction; |
| 896 | + int tagid; | |
| 897 | + int ridNext; | |
| 896 | 898 | |
| 897 | 899 | login_check_credentials(); |
| 898 | 900 | if( !g.perm.RdWiki ){ login_needed(g.anon.RdWiki); return; } |
| 899 | 901 | rid = name_to_rid_www("name"); |
| 900 | 902 | if( rid==0 || (pWiki = manifest_get(rid, CFTYPE_WIKI, 0))==0 ){ |
| @@ -937,11 +939,13 @@ | ||
| 937 | 939 | if( g.perm.Setup ){ |
| 938 | 940 | @ (%d(rid)) |
| 939 | 941 | } |
| 940 | 942 | modPending = moderation_pending_www(rid); |
| 941 | 943 | @ </td></tr> |
| 942 | - @ <tr><th>Page Name:</th><td>%h(pWiki->zWikiTitle)</td></tr> | |
| 944 | + @ <tr><th>Page Name:</th>\ | |
| 945 | + @ <td>%z(href("%R/whistory?name=%h",pWiki->zWikiTitle))\ | |
| 946 | + @ %h(pWiki->zWikiTitle)</a></td></tr> | |
| 943 | 947 | @ <tr><th>Date:</th><td> |
| 944 | 948 | hyperlink_to_date(zDate, "</td></tr>"); |
| 945 | 949 | @ <tr><th>Original User:</th><td> |
| 946 | 950 | hyperlink_to_user(pWiki->zUser, zDate, "</td></tr>"); |
| 947 | 951 | if( pWiki->zMimetype ){ |
| @@ -954,10 +958,16 @@ | ||
| 954 | 958 | char *zParent = pWiki->azParent[i]; |
| 955 | 959 | @ %z(href("info/%!S",zParent))%s(zParent)</a> |
| 956 | 960 | } |
| 957 | 961 | @ </td></tr> |
| 958 | 962 | } |
| 963 | + tagid = wiki_tagid(pWiki->zWikiTitle); | |
| 964 | + if( tagid>0 && (ridNext = wiki_next(tagid, pWiki->rDate))>0 ){ | |
| 965 | + char *zId = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", ridNext); | |
| 966 | + @ <tr><th>Next</th> | |
| 967 | + @ <td>%z(href("%R/info/%!S",zId))%s(zId)</a></td> | |
| 968 | + } | |
| 959 | 969 | @ </table> |
| 960 | 970 | |
| 961 | 971 | if( g.perm.ModWiki && modPending ){ |
| 962 | 972 | @ <div class="section">Moderation</div> |
| 963 | 973 | @ <blockquote> |
| 964 | 974 |
| --- src/info.c | |
| +++ src/info.c | |
| @@ -891,10 +891,12 @@ | |
| 891 | char *zUuid; |
| 892 | char *zDate; |
| 893 | Blob wiki; |
| 894 | int modPending; |
| 895 | const char *zModAction; |
| 896 | |
| 897 | login_check_credentials(); |
| 898 | if( !g.perm.RdWiki ){ login_needed(g.anon.RdWiki); return; } |
| 899 | rid = name_to_rid_www("name"); |
| 900 | if( rid==0 || (pWiki = manifest_get(rid, CFTYPE_WIKI, 0))==0 ){ |
| @@ -937,11 +939,13 @@ | |
| 937 | if( g.perm.Setup ){ |
| 938 | @ (%d(rid)) |
| 939 | } |
| 940 | modPending = moderation_pending_www(rid); |
| 941 | @ </td></tr> |
| 942 | @ <tr><th>Page Name:</th><td>%h(pWiki->zWikiTitle)</td></tr> |
| 943 | @ <tr><th>Date:</th><td> |
| 944 | hyperlink_to_date(zDate, "</td></tr>"); |
| 945 | @ <tr><th>Original User:</th><td> |
| 946 | hyperlink_to_user(pWiki->zUser, zDate, "</td></tr>"); |
| 947 | if( pWiki->zMimetype ){ |
| @@ -954,10 +958,16 @@ | |
| 954 | char *zParent = pWiki->azParent[i]; |
| 955 | @ %z(href("info/%!S",zParent))%s(zParent)</a> |
| 956 | } |
| 957 | @ </td></tr> |
| 958 | } |
| 959 | @ </table> |
| 960 | |
| 961 | if( g.perm.ModWiki && modPending ){ |
| 962 | @ <div class="section">Moderation</div> |
| 963 | @ <blockquote> |
| 964 |
| --- src/info.c | |
| +++ src/info.c | |
| @@ -891,10 +891,12 @@ | |
| 891 | char *zUuid; |
| 892 | char *zDate; |
| 893 | Blob wiki; |
| 894 | int modPending; |
| 895 | const char *zModAction; |
| 896 | int tagid; |
| 897 | int ridNext; |
| 898 | |
| 899 | login_check_credentials(); |
| 900 | if( !g.perm.RdWiki ){ login_needed(g.anon.RdWiki); return; } |
| 901 | rid = name_to_rid_www("name"); |
| 902 | if( rid==0 || (pWiki = manifest_get(rid, CFTYPE_WIKI, 0))==0 ){ |
| @@ -937,11 +939,13 @@ | |
| 939 | if( g.perm.Setup ){ |
| 940 | @ (%d(rid)) |
| 941 | } |
| 942 | modPending = moderation_pending_www(rid); |
| 943 | @ </td></tr> |
| 944 | @ <tr><th>Page Name:</th>\ |
| 945 | @ <td>%z(href("%R/whistory?name=%h",pWiki->zWikiTitle))\ |
| 946 | @ %h(pWiki->zWikiTitle)</a></td></tr> |
| 947 | @ <tr><th>Date:</th><td> |
| 948 | hyperlink_to_date(zDate, "</td></tr>"); |
| 949 | @ <tr><th>Original User:</th><td> |
| 950 | hyperlink_to_user(pWiki->zUser, zDate, "</td></tr>"); |
| 951 | if( pWiki->zMimetype ){ |
| @@ -954,10 +958,16 @@ | |
| 958 | char *zParent = pWiki->azParent[i]; |
| 959 | @ %z(href("info/%!S",zParent))%s(zParent)</a> |
| 960 | } |
| 961 | @ </td></tr> |
| 962 | } |
| 963 | tagid = wiki_tagid(pWiki->zWikiTitle); |
| 964 | if( tagid>0 && (ridNext = wiki_next(tagid, pWiki->rDate))>0 ){ |
| 965 | char *zId = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", ridNext); |
| 966 | @ <tr><th>Next</th> |
| 967 | @ <td>%z(href("%R/info/%!S",zId))%s(zId)</a></td> |
| 968 | } |
| 969 | @ </table> |
| 970 | |
| 971 | if( g.perm.ModWiki && modPending ){ |
| 972 | @ <div class="section">Moderation</div> |
| 973 | @ <blockquote> |
| 974 |
+27
| --- src/wiki.c | ||
| +++ src/wiki.c | ||
| @@ -71,10 +71,37 @@ | ||
| 71 | 71 | style_footer(); |
| 72 | 72 | return 1; |
| 73 | 73 | } |
| 74 | 74 | return 0; |
| 75 | 75 | } |
| 76 | + | |
| 77 | +/* | |
| 78 | +** Return the tagid associated with a particular wiki page. | |
| 79 | +*/ | |
| 80 | +int wiki_tagid(const char *zPageName){ | |
| 81 | + return db_int(0, "SELECT tagid FROM tag WHERE tagname='wiki-%q'",zPageName); | |
| 82 | +} | |
| 83 | + | |
| 84 | +/* | |
| 85 | +** Return the RID of the next or previous version of a wiki page. | |
| 86 | +** Return 0 if rid is the last/first version. | |
| 87 | +*/ | |
| 88 | +int wiki_next(int tagid, double mtime){ | |
| 89 | + return db_int(0, | |
| 90 | + "SELECT srcid FROM tagxref" | |
| 91 | + " WHERE tagid=%d AND mtime>%.16g" | |
| 92 | + " ORDER BY mtime ASC LIMIT 1", | |
| 93 | + tagid, mtime); | |
| 94 | +} | |
| 95 | +int wiki_prev(int tagid, double mtime){ | |
| 96 | + return db_int(0, | |
| 97 | + "SELECT srcid FROM tagxref" | |
| 98 | + " WHERE tagid=%d AND mtime<%.16g" | |
| 99 | + " ORDER BY mtime DESC LIMIT 1", | |
| 100 | + tagid, mtime); | |
| 101 | +} | |
| 102 | + | |
| 76 | 103 | |
| 77 | 104 | /* |
| 78 | 105 | ** WEBPAGE: home |
| 79 | 106 | ** WEBPAGE: index |
| 80 | 107 | ** WEBPAGE: not_found |
| 81 | 108 |
| --- src/wiki.c | |
| +++ src/wiki.c | |
| @@ -71,10 +71,37 @@ | |
| 71 | style_footer(); |
| 72 | return 1; |
| 73 | } |
| 74 | return 0; |
| 75 | } |
| 76 | |
| 77 | /* |
| 78 | ** WEBPAGE: home |
| 79 | ** WEBPAGE: index |
| 80 | ** WEBPAGE: not_found |
| 81 |
| --- src/wiki.c | |
| +++ src/wiki.c | |
| @@ -71,10 +71,37 @@ | |
| 71 | style_footer(); |
| 72 | return 1; |
| 73 | } |
| 74 | return 0; |
| 75 | } |
| 76 | |
| 77 | /* |
| 78 | ** Return the tagid associated with a particular wiki page. |
| 79 | */ |
| 80 | int wiki_tagid(const char *zPageName){ |
| 81 | return db_int(0, "SELECT tagid FROM tag WHERE tagname='wiki-%q'",zPageName); |
| 82 | } |
| 83 | |
| 84 | /* |
| 85 | ** Return the RID of the next or previous version of a wiki page. |
| 86 | ** Return 0 if rid is the last/first version. |
| 87 | */ |
| 88 | int wiki_next(int tagid, double mtime){ |
| 89 | return db_int(0, |
| 90 | "SELECT srcid FROM tagxref" |
| 91 | " WHERE tagid=%d AND mtime>%.16g" |
| 92 | " ORDER BY mtime ASC LIMIT 1", |
| 93 | tagid, mtime); |
| 94 | } |
| 95 | int wiki_prev(int tagid, double mtime){ |
| 96 | return db_int(0, |
| 97 | "SELECT srcid FROM tagxref" |
| 98 | " WHERE tagid=%d AND mtime<%.16g" |
| 99 | " ORDER BY mtime DESC LIMIT 1", |
| 100 | tagid, mtime); |
| 101 | } |
| 102 | |
| 103 | |
| 104 | /* |
| 105 | ** WEBPAGE: home |
| 106 | ** WEBPAGE: index |
| 107 | ** WEBPAGE: not_found |
| 108 |