Fossil SCM
Use an ordinary table to display /whistory rather than a timeline, as the timeline comments are not helpful.
Commit
734e1ea7471933eed54699b2ded4239bf88c18378c4b5ad29a24a379fa4284c6
Parent
98f5b402337af52…
1 file changed
+49
-28
+49
-28
| --- src/wiki.c | ||
| +++ src/wiki.c | ||
| @@ -853,25 +853,10 @@ | ||
| 853 | 853 | captcha_generate(0); |
| 854 | 854 | @ </form> |
| 855 | 855 | style_footer(); |
| 856 | 856 | } |
| 857 | 857 | |
| 858 | -/* | |
| 859 | -** Name of the wiki history page being generated | |
| 860 | -*/ | |
| 861 | -static const char *zWikiPageName; | |
| 862 | - | |
| 863 | -/* | |
| 864 | -** Function called to output extra text at the end of each line in | |
| 865 | -** a wiki history listing. | |
| 866 | -*/ | |
| 867 | -static void wiki_history_extra(int rid){ | |
| 868 | - if( db_exists("SELECT 1 FROM tagxref WHERE rid=%d", rid) ){ | |
| 869 | - @ op: %z(href("%R/wdiff?rid=%d",rid))diff</a>\ | |
| 870 | - } | |
| 871 | -} | |
| 872 | - | |
| 873 | 858 | /* |
| 874 | 859 | ** WEBPAGE: whistory |
| 875 | 860 | ** URL: /whistory?name=PAGENAME |
| 876 | 861 | ** |
| 877 | 862 | ** Additional parameters: |
| @@ -881,28 +866,64 @@ | ||
| 881 | 866 | ** Show the complete change history for a single wiki page. |
| 882 | 867 | */ |
| 883 | 868 | void whistory_page(void){ |
| 884 | 869 | Stmt q; |
| 885 | 870 | const char *zPageName; |
| 886 | - int tmFlags = TIMELINE_ARTID; | |
| 871 | + double rNow; | |
| 872 | + int showRid; | |
| 887 | 873 | login_check_credentials(); |
| 888 | 874 | if( !g.perm.Hyperlink ){ login_needed(g.anon.Hyperlink); return; } |
| 889 | 875 | zPageName = PD("name",""); |
| 890 | 876 | style_header("History Of %s", zPageName); |
| 891 | - if( P("showid")!=0 ) tmFlags |= TIMELINE_SHOWRID; | |
| 892 | - tmFlags |= timeline_ss_submenu(); | |
| 893 | - | |
| 894 | - db_prepare(&q, "%s AND event.objid IN " | |
| 895 | - " (SELECT rid FROM tagxref WHERE tagid=" | |
| 896 | - "(SELECT tagid FROM tag WHERE tagname='wiki-%q')" | |
| 897 | - " UNION SELECT attachid FROM attachment" | |
| 898 | - " WHERE target=%Q)" | |
| 899 | - "ORDER BY mtime DESC", | |
| 900 | - timeline_query_for_www(), zPageName, zPageName); | |
| 901 | - zWikiPageName = zPageName; | |
| 902 | - www_print_timeline(&q, tmFlags, 0, 0, 0, wiki_history_extra); | |
| 877 | + showRid = P("showid")!=0; | |
| 878 | + db_prepare(&q, | |
| 879 | + "SELECT" | |
| 880 | + " event.mtime," | |
| 881 | + " blob.uuid," | |
| 882 | + " coalesce(event.euser,event.user)," | |
| 883 | + " event.objid" | |
| 884 | + " FROM event, blob, tag, tagxref" | |
| 885 | + " WHERE event.type='w' AND blob.rid=event.objid" | |
| 886 | + " AND tag.tagname='wiki-%q'" | |
| 887 | + " AND tagxref.tagid=tag.tagid AND tagxref.srcid=event.objid" | |
| 888 | + " ORDER BY event.mtime DESC", | |
| 889 | + zPageName | |
| 890 | + ); | |
| 891 | + @ <h2>History of <a href="%R/wiki?name=%T(zPageName)">%h(zPageName)</a></h2> | |
| 892 | + @ <div class="brlist"> | |
| 893 | + @ <table class='xsortable' data-column-types='Kttn' data-init-sort='1'> | |
| 894 | + @ <thead><tr> | |
| 895 | + @ <th>Age</th> | |
| 896 | + @ <th>Hash</th> | |
| 897 | + @ <th>User</th> | |
| 898 | + if( showRid ){ | |
| 899 | + @ <th>RID</th> | |
| 900 | + } | |
| 901 | + @ <th> </th> | |
| 902 | + @ </tr></thead><tbody> | |
| 903 | + rNow = db_double(0.0, "SELECT julianday('now')"); | |
| 904 | + while( db_step(&q)==SQLITE_ROW ){ | |
| 905 | + double rMtime = db_column_double(&q, 0); | |
| 906 | + const char *zUuid = db_column_text(&q, 1); | |
| 907 | + const char *zUser = db_column_text(&q, 2); | |
| 908 | + int wrid = db_column_int(&q, 3); | |
| 909 | + sqlite3_int64 iMtime = (sqlite3_int64)(rMtime*86400.0); | |
| 910 | + char *zAge = human_readable_age(rNow - rMtime); | |
| 911 | + @ <tr> | |
| 912 | + @ <td data-sortkey="%016llx(iMtime)">%s(zAge)</td> | |
| 913 | + fossil_free(zAge); | |
| 914 | + @ <td>%z(href("%R/info/%s",zUuid))%S(zUuid)</a></td> | |
| 915 | + @ <td>%h(zUser)</td> | |
| 916 | + if( showRid ){ | |
| 917 | + @ <td>%z(href("%R/artifact/%S",zUuid))%d(wrid)</a></td> | |
| 918 | + } | |
| 919 | + @ <td>%z(href("%R/wdiff?id=%S",zUuid))diff</a></td> | |
| 920 | + @ </tr> | |
| 921 | + } | |
| 922 | + @ </tbody></table></div> | |
| 903 | 923 | db_finalize(&q); |
| 924 | + style_table_sorter(); | |
| 904 | 925 | style_footer(); |
| 905 | 926 | } |
| 906 | 927 | |
| 907 | 928 | /* |
| 908 | 929 | ** WEBPAGE: wdiff |
| 909 | 930 |
| --- src/wiki.c | |
| +++ src/wiki.c | |
| @@ -853,25 +853,10 @@ | |
| 853 | captcha_generate(0); |
| 854 | @ </form> |
| 855 | style_footer(); |
| 856 | } |
| 857 | |
| 858 | /* |
| 859 | ** Name of the wiki history page being generated |
| 860 | */ |
| 861 | static const char *zWikiPageName; |
| 862 | |
| 863 | /* |
| 864 | ** Function called to output extra text at the end of each line in |
| 865 | ** a wiki history listing. |
| 866 | */ |
| 867 | static void wiki_history_extra(int rid){ |
| 868 | if( db_exists("SELECT 1 FROM tagxref WHERE rid=%d", rid) ){ |
| 869 | @ op: %z(href("%R/wdiff?rid=%d",rid))diff</a>\ |
| 870 | } |
| 871 | } |
| 872 | |
| 873 | /* |
| 874 | ** WEBPAGE: whistory |
| 875 | ** URL: /whistory?name=PAGENAME |
| 876 | ** |
| 877 | ** Additional parameters: |
| @@ -881,28 +866,64 @@ | |
| 881 | ** Show the complete change history for a single wiki page. |
| 882 | */ |
| 883 | void whistory_page(void){ |
| 884 | Stmt q; |
| 885 | const char *zPageName; |
| 886 | int tmFlags = TIMELINE_ARTID; |
| 887 | login_check_credentials(); |
| 888 | if( !g.perm.Hyperlink ){ login_needed(g.anon.Hyperlink); return; } |
| 889 | zPageName = PD("name",""); |
| 890 | style_header("History Of %s", zPageName); |
| 891 | if( P("showid")!=0 ) tmFlags |= TIMELINE_SHOWRID; |
| 892 | tmFlags |= timeline_ss_submenu(); |
| 893 | |
| 894 | db_prepare(&q, "%s AND event.objid IN " |
| 895 | " (SELECT rid FROM tagxref WHERE tagid=" |
| 896 | "(SELECT tagid FROM tag WHERE tagname='wiki-%q')" |
| 897 | " UNION SELECT attachid FROM attachment" |
| 898 | " WHERE target=%Q)" |
| 899 | "ORDER BY mtime DESC", |
| 900 | timeline_query_for_www(), zPageName, zPageName); |
| 901 | zWikiPageName = zPageName; |
| 902 | www_print_timeline(&q, tmFlags, 0, 0, 0, wiki_history_extra); |
| 903 | db_finalize(&q); |
| 904 | style_footer(); |
| 905 | } |
| 906 | |
| 907 | /* |
| 908 | ** WEBPAGE: wdiff |
| 909 |
| --- src/wiki.c | |
| +++ src/wiki.c | |
| @@ -853,25 +853,10 @@ | |
| 853 | captcha_generate(0); |
| 854 | @ </form> |
| 855 | style_footer(); |
| 856 | } |
| 857 | |
| 858 | /* |
| 859 | ** WEBPAGE: whistory |
| 860 | ** URL: /whistory?name=PAGENAME |
| 861 | ** |
| 862 | ** Additional parameters: |
| @@ -881,28 +866,64 @@ | |
| 866 | ** Show the complete change history for a single wiki page. |
| 867 | */ |
| 868 | void whistory_page(void){ |
| 869 | Stmt q; |
| 870 | const char *zPageName; |
| 871 | double rNow; |
| 872 | int showRid; |
| 873 | login_check_credentials(); |
| 874 | if( !g.perm.Hyperlink ){ login_needed(g.anon.Hyperlink); return; } |
| 875 | zPageName = PD("name",""); |
| 876 | style_header("History Of %s", zPageName); |
| 877 | showRid = P("showid")!=0; |
| 878 | db_prepare(&q, |
| 879 | "SELECT" |
| 880 | " event.mtime," |
| 881 | " blob.uuid," |
| 882 | " coalesce(event.euser,event.user)," |
| 883 | " event.objid" |
| 884 | " FROM event, blob, tag, tagxref" |
| 885 | " WHERE event.type='w' AND blob.rid=event.objid" |
| 886 | " AND tag.tagname='wiki-%q'" |
| 887 | " AND tagxref.tagid=tag.tagid AND tagxref.srcid=event.objid" |
| 888 | " ORDER BY event.mtime DESC", |
| 889 | zPageName |
| 890 | ); |
| 891 | @ <h2>History of <a href="%R/wiki?name=%T(zPageName)">%h(zPageName)</a></h2> |
| 892 | @ <div class="brlist"> |
| 893 | @ <table class='xsortable' data-column-types='Kttn' data-init-sort='1'> |
| 894 | @ <thead><tr> |
| 895 | @ <th>Age</th> |
| 896 | @ <th>Hash</th> |
| 897 | @ <th>User</th> |
| 898 | if( showRid ){ |
| 899 | @ <th>RID</th> |
| 900 | } |
| 901 | @ <th> </th> |
| 902 | @ </tr></thead><tbody> |
| 903 | rNow = db_double(0.0, "SELECT julianday('now')"); |
| 904 | while( db_step(&q)==SQLITE_ROW ){ |
| 905 | double rMtime = db_column_double(&q, 0); |
| 906 | const char *zUuid = db_column_text(&q, 1); |
| 907 | const char *zUser = db_column_text(&q, 2); |
| 908 | int wrid = db_column_int(&q, 3); |
| 909 | sqlite3_int64 iMtime = (sqlite3_int64)(rMtime*86400.0); |
| 910 | char *zAge = human_readable_age(rNow - rMtime); |
| 911 | @ <tr> |
| 912 | @ <td data-sortkey="%016llx(iMtime)">%s(zAge)</td> |
| 913 | fossil_free(zAge); |
| 914 | @ <td>%z(href("%R/info/%s",zUuid))%S(zUuid)</a></td> |
| 915 | @ <td>%h(zUser)</td> |
| 916 | if( showRid ){ |
| 917 | @ <td>%z(href("%R/artifact/%S",zUuid))%d(wrid)</a></td> |
| 918 | } |
| 919 | @ <td>%z(href("%R/wdiff?id=%S",zUuid))diff</a></td> |
| 920 | @ </tr> |
| 921 | } |
| 922 | @ </tbody></table></div> |
| 923 | db_finalize(&q); |
| 924 | style_table_sorter(); |
| 925 | style_footer(); |
| 926 | } |
| 927 | |
| 928 | /* |
| 929 | ** WEBPAGE: wdiff |
| 930 |