Fossil SCM
Attempt to make the stats_report?type=byuser tabls sortable by clicking on the column labels. Only works for the "User" column. Further debugging needed.
Commit
d0ce29b031e148aa0724d89383eb6a2fd3ba078a
Parent
21454dda94ea795…
2 files changed
+1
-1
+13
-7
+1
-1
| --- src/report.c | ||
| +++ src/report.c | ||
| @@ -924,11 +924,11 @@ | ||
| 924 | 924 | ** The javascript is derived from: |
| 925 | 925 | ** |
| 926 | 926 | ** http://www.webtoolkit.info/sortable-html-table.html |
| 927 | 927 | ** |
| 928 | 928 | */ |
| 929 | -static void output_table_sorting_javascript(const char *zTableId){ | |
| 929 | +void output_table_sorting_javascript(const char *zTableId){ | |
| 930 | 930 | @ <script> |
| 931 | 931 | @ function SortableTable(tableEl){ |
| 932 | 932 | @ this.tbody = tableEl.getElementsByTagName('tbody'); |
| 933 | 933 | @ this.sort = function (cell) { |
| 934 | 934 | @ var column = cell.cellIndex; |
| 935 | 935 |
| --- src/report.c | |
| +++ src/report.c | |
| @@ -924,11 +924,11 @@ | |
| 924 | ** The javascript is derived from: |
| 925 | ** |
| 926 | ** http://www.webtoolkit.info/sortable-html-table.html |
| 927 | ** |
| 928 | */ |
| 929 | static void output_table_sorting_javascript(const char *zTableId){ |
| 930 | @ <script> |
| 931 | @ function SortableTable(tableEl){ |
| 932 | @ this.tbody = tableEl.getElementsByTagName('tbody'); |
| 933 | @ this.sort = function (cell) { |
| 934 | @ var column = cell.cellIndex; |
| 935 |
| --- src/report.c | |
| +++ src/report.c | |
| @@ -924,11 +924,11 @@ | |
| 924 | ** The javascript is derived from: |
| 925 | ** |
| 926 | ** http://www.webtoolkit.info/sortable-html-table.html |
| 927 | ** |
| 928 | */ |
| 929 | void output_table_sorting_javascript(const char *zTableId){ |
| 930 | @ <script> |
| 931 | @ function SortableTable(tableEl){ |
| 932 | @ this.tbody = tableEl.getElementsByTagName('tbody'); |
| 933 | @ this.sort = function (cell) { |
| 934 | @ var column = cell.cellIndex; |
| 935 |
+13
-7
| --- src/timeline.c | ||
| +++ src/timeline.c | ||
| @@ -1870,11 +1870,12 @@ | ||
| 1870 | 1870 | " ORDER BY timeframe DESC", |
| 1871 | 1871 | -1); |
| 1872 | 1872 | db_prepare(&query, blob_str(&sql)); |
| 1873 | 1873 | blob_reset(&sql); |
| 1874 | 1874 | @ <h1>%b(&header)</h1> |
| 1875 | - @ <table class='statistics-report-table-events' border='0' cellpadding='2' cellspacing='0'> | |
| 1875 | + @ <table class='statistics-report-table-events' border='0' cellpadding='2' | |
| 1876 | + @ cellspacing='0' id='statsTable'> | |
| 1876 | 1877 | @ <thead> |
| 1877 | 1878 | @ <th>%s(zTimeLabel)</th> |
| 1878 | 1879 | @ <th>Events</th> |
| 1879 | 1880 | @ <th><!-- relative commits graph --></th> |
| 1880 | 1881 | @ </thead><tbody> |
| @@ -1909,17 +1910,19 @@ | ||
| 1909 | 1910 | nEventTotal += nCount; |
| 1910 | 1911 | nEventsPerYear += nCount; |
| 1911 | 1912 | @<tr class='row%d(rowClass)'> |
| 1912 | 1913 | @ <td> |
| 1913 | 1914 | if(includeMonth){ |
| 1914 | - @ <a href="%s(g.zTop)/timeline?ym=%s(zTimeframe)&n=%d(nCount)" target="_new">%s(zTimeframe)</a> | |
| 1915 | + @ <a href="%s(g.zTop)/timeline?ym=%s(zTimeframe)&n=%d(nCount)" | |
| 1916 | + @ target="_new">%s(zTimeframe)</a> | |
| 1915 | 1917 | }else { |
| 1916 | 1918 | @ %s(zTimeframe) |
| 1917 | 1919 | } |
| 1918 | 1920 | @ </td><td>%d(nCount)</td> |
| 1919 | 1921 | @ <td> |
| 1920 | - @ <div class='statistics-report-graph-line' style='height:16px; width:%d(nSize)px;'> | |
| 1922 | + @ <div class='statistics-report-graph-line' | |
| 1923 | + @ style='height:16px;width:%d(nSize)px;'> | |
| 1921 | 1924 | @ </div></td> |
| 1922 | 1925 | @</tr> |
| 1923 | 1926 | |
| 1924 | 1927 | /* |
| 1925 | 1928 | Potential improvement: calculate the min/max event counts and |
| @@ -1959,16 +1962,17 @@ | ||
| 1959 | 1962 | "GROUP BY user ORDER BY user", |
| 1960 | 1963 | -1); |
| 1961 | 1964 | db_prepare(&query, blob_str(&sql)); |
| 1962 | 1965 | blob_reset(&sql); |
| 1963 | 1966 | @ <h1>Timeline Events by User</h1> |
| 1964 | - @ <table class='statistics-report-table-events' border='0' cellpadding='2' cellspacing='0'> | |
| 1965 | - @ <thead> | |
| 1967 | + @ <table class='statistics-report-table-events' border='0' | |
| 1968 | + @ cellpadding='2' cellspacing='0' id='statsTable'> | |
| 1969 | + @ <thead><tr> | |
| 1966 | 1970 | @ <th>User</th> |
| 1967 | 1971 | @ <th>Events</th> |
| 1968 | 1972 | @ <th><!-- relative commits graph --></th> |
| 1969 | - @ </thead><tbody> | |
| 1973 | + @ </tr></thead><tbody> | |
| 1970 | 1974 | while( SQLITE_ROW == db_step(&query) ){ |
| 1971 | 1975 | char const * zUser = db_column_text(&query, 0); |
| 1972 | 1976 | int const nCount = db_column_int(&query, 1); |
| 1973 | 1977 | int const nSize = 1+((nPixelsPerEvent * nCount) / 10); |
| 1974 | 1978 | if(!nCount) continue; |
| @@ -1977,11 +1981,12 @@ | ||
| 1977 | 1981 | @<tr class='row%d(rowClass)'> |
| 1978 | 1982 | @ <td> |
| 1979 | 1983 | @ <a href="?view=byyear&user=%h(zUser)" target="_new">%s(zUser)</a> |
| 1980 | 1984 | @ </td><td>%d(nCount)</td> |
| 1981 | 1985 | @ <td> |
| 1982 | - @ <div class='statistics-report-graph-line' style='height:16px; width:%d(nSize)px;'> | |
| 1986 | + @ <div class='statistics-report-graph-line' | |
| 1987 | + @ style='height:16px;width:%d(nSize)px;'> | |
| 1983 | 1988 | @ </div></td> |
| 1984 | 1989 | @</tr> |
| 1985 | 1990 | /* |
| 1986 | 1991 | Potential improvement: calculate the min/max event counts and |
| 1987 | 1992 | use percent-based graph bars. |
| @@ -1992,10 +1997,11 @@ | ||
| 1992 | 1997 | @ <tr class='row%d(rowClass)'> |
| 1993 | 1998 | @ <td colspan='3'>Total events: %d(nEventTotal)</td> |
| 1994 | 1999 | @ </tr> |
| 1995 | 2000 | @ </tbody></table> |
| 1996 | 2001 | db_finalize(&query); |
| 2002 | + output_table_sorting_javascript("statsTable"); | |
| 1997 | 2003 | } |
| 1998 | 2004 | |
| 1999 | 2005 | /* |
| 2000 | 2006 | ** WEBPAGE: stats_report |
| 2001 | 2007 | ** |
| 2002 | 2008 |
| --- src/timeline.c | |
| +++ src/timeline.c | |
| @@ -1870,11 +1870,12 @@ | |
| 1870 | " ORDER BY timeframe DESC", |
| 1871 | -1); |
| 1872 | db_prepare(&query, blob_str(&sql)); |
| 1873 | blob_reset(&sql); |
| 1874 | @ <h1>%b(&header)</h1> |
| 1875 | @ <table class='statistics-report-table-events' border='0' cellpadding='2' cellspacing='0'> |
| 1876 | @ <thead> |
| 1877 | @ <th>%s(zTimeLabel)</th> |
| 1878 | @ <th>Events</th> |
| 1879 | @ <th><!-- relative commits graph --></th> |
| 1880 | @ </thead><tbody> |
| @@ -1909,17 +1910,19 @@ | |
| 1909 | nEventTotal += nCount; |
| 1910 | nEventsPerYear += nCount; |
| 1911 | @<tr class='row%d(rowClass)'> |
| 1912 | @ <td> |
| 1913 | if(includeMonth){ |
| 1914 | @ <a href="%s(g.zTop)/timeline?ym=%s(zTimeframe)&n=%d(nCount)" target="_new">%s(zTimeframe)</a> |
| 1915 | }else { |
| 1916 | @ %s(zTimeframe) |
| 1917 | } |
| 1918 | @ </td><td>%d(nCount)</td> |
| 1919 | @ <td> |
| 1920 | @ <div class='statistics-report-graph-line' style='height:16px; width:%d(nSize)px;'> |
| 1921 | @ </div></td> |
| 1922 | @</tr> |
| 1923 | |
| 1924 | /* |
| 1925 | Potential improvement: calculate the min/max event counts and |
| @@ -1959,16 +1962,17 @@ | |
| 1959 | "GROUP BY user ORDER BY user", |
| 1960 | -1); |
| 1961 | db_prepare(&query, blob_str(&sql)); |
| 1962 | blob_reset(&sql); |
| 1963 | @ <h1>Timeline Events by User</h1> |
| 1964 | @ <table class='statistics-report-table-events' border='0' cellpadding='2' cellspacing='0'> |
| 1965 | @ <thead> |
| 1966 | @ <th>User</th> |
| 1967 | @ <th>Events</th> |
| 1968 | @ <th><!-- relative commits graph --></th> |
| 1969 | @ </thead><tbody> |
| 1970 | while( SQLITE_ROW == db_step(&query) ){ |
| 1971 | char const * zUser = db_column_text(&query, 0); |
| 1972 | int const nCount = db_column_int(&query, 1); |
| 1973 | int const nSize = 1+((nPixelsPerEvent * nCount) / 10); |
| 1974 | if(!nCount) continue; |
| @@ -1977,11 +1981,12 @@ | |
| 1977 | @<tr class='row%d(rowClass)'> |
| 1978 | @ <td> |
| 1979 | @ <a href="?view=byyear&user=%h(zUser)" target="_new">%s(zUser)</a> |
| 1980 | @ </td><td>%d(nCount)</td> |
| 1981 | @ <td> |
| 1982 | @ <div class='statistics-report-graph-line' style='height:16px; width:%d(nSize)px;'> |
| 1983 | @ </div></td> |
| 1984 | @</tr> |
| 1985 | /* |
| 1986 | Potential improvement: calculate the min/max event counts and |
| 1987 | use percent-based graph bars. |
| @@ -1992,10 +1997,11 @@ | |
| 1992 | @ <tr class='row%d(rowClass)'> |
| 1993 | @ <td colspan='3'>Total events: %d(nEventTotal)</td> |
| 1994 | @ </tr> |
| 1995 | @ </tbody></table> |
| 1996 | db_finalize(&query); |
| 1997 | } |
| 1998 | |
| 1999 | /* |
| 2000 | ** WEBPAGE: stats_report |
| 2001 | ** |
| 2002 |
| --- src/timeline.c | |
| +++ src/timeline.c | |
| @@ -1870,11 +1870,12 @@ | |
| 1870 | " ORDER BY timeframe DESC", |
| 1871 | -1); |
| 1872 | db_prepare(&query, blob_str(&sql)); |
| 1873 | blob_reset(&sql); |
| 1874 | @ <h1>%b(&header)</h1> |
| 1875 | @ <table class='statistics-report-table-events' border='0' cellpadding='2' |
| 1876 | @ cellspacing='0' id='statsTable'> |
| 1877 | @ <thead> |
| 1878 | @ <th>%s(zTimeLabel)</th> |
| 1879 | @ <th>Events</th> |
| 1880 | @ <th><!-- relative commits graph --></th> |
| 1881 | @ </thead><tbody> |
| @@ -1909,17 +1910,19 @@ | |
| 1910 | nEventTotal += nCount; |
| 1911 | nEventsPerYear += nCount; |
| 1912 | @<tr class='row%d(rowClass)'> |
| 1913 | @ <td> |
| 1914 | if(includeMonth){ |
| 1915 | @ <a href="%s(g.zTop)/timeline?ym=%s(zTimeframe)&n=%d(nCount)" |
| 1916 | @ target="_new">%s(zTimeframe)</a> |
| 1917 | }else { |
| 1918 | @ %s(zTimeframe) |
| 1919 | } |
| 1920 | @ </td><td>%d(nCount)</td> |
| 1921 | @ <td> |
| 1922 | @ <div class='statistics-report-graph-line' |
| 1923 | @ style='height:16px;width:%d(nSize)px;'> |
| 1924 | @ </div></td> |
| 1925 | @</tr> |
| 1926 | |
| 1927 | /* |
| 1928 | Potential improvement: calculate the min/max event counts and |
| @@ -1959,16 +1962,17 @@ | |
| 1962 | "GROUP BY user ORDER BY user", |
| 1963 | -1); |
| 1964 | db_prepare(&query, blob_str(&sql)); |
| 1965 | blob_reset(&sql); |
| 1966 | @ <h1>Timeline Events by User</h1> |
| 1967 | @ <table class='statistics-report-table-events' border='0' |
| 1968 | @ cellpadding='2' cellspacing='0' id='statsTable'> |
| 1969 | @ <thead><tr> |
| 1970 | @ <th>User</th> |
| 1971 | @ <th>Events</th> |
| 1972 | @ <th><!-- relative commits graph --></th> |
| 1973 | @ </tr></thead><tbody> |
| 1974 | while( SQLITE_ROW == db_step(&query) ){ |
| 1975 | char const * zUser = db_column_text(&query, 0); |
| 1976 | int const nCount = db_column_int(&query, 1); |
| 1977 | int const nSize = 1+((nPixelsPerEvent * nCount) / 10); |
| 1978 | if(!nCount) continue; |
| @@ -1977,11 +1981,12 @@ | |
| 1981 | @<tr class='row%d(rowClass)'> |
| 1982 | @ <td> |
| 1983 | @ <a href="?view=byyear&user=%h(zUser)" target="_new">%s(zUser)</a> |
| 1984 | @ </td><td>%d(nCount)</td> |
| 1985 | @ <td> |
| 1986 | @ <div class='statistics-report-graph-line' |
| 1987 | @ style='height:16px;width:%d(nSize)px;'> |
| 1988 | @ </div></td> |
| 1989 | @</tr> |
| 1990 | /* |
| 1991 | Potential improvement: calculate the min/max event counts and |
| 1992 | use percent-based graph bars. |
| @@ -1992,10 +1997,11 @@ | |
| 1997 | @ <tr class='row%d(rowClass)'> |
| 1998 | @ <td colspan='3'>Total events: %d(nEventTotal)</td> |
| 1999 | @ </tr> |
| 2000 | @ </tbody></table> |
| 2001 | db_finalize(&query); |
| 2002 | output_table_sorting_javascript("statsTable"); |
| 2003 | } |
| 2004 | |
| 2005 | /* |
| 2006 | ** WEBPAGE: stats_report |
| 2007 | ** |
| 2008 |