Fossil SCM

Add icons on sortable table headers to show which columns are sortable and which is the current sort column. This code is inspired by the brlist-visual-enhancement branch, but is a completely new implementation.

drh 2015-01-06 01:06 trunk
Commit 8533365e44fab97b6e2375eb42d9ca22ac033fd0
3 files changed +3 -5 +49 -15 +5 -5
+3 -5
--- src/branch.c
+++ src/branch.c
@@ -324,11 +324,11 @@
324324
@ WHERE tagxref.tagid=tag.tagid
325325
@ AND tagxref.tagtype>0
326326
@ AND tag.tagname='branch'
327327
@ AND event.objid=tagxref.rid
328328
@ GROUP BY 1
329
-@ ORDER BY %d DESC;
329
+@ ORDER BY 2 DESC;
330330
;
331331
332332
/*
333333
** This is the new-style branch-list page that shows the branch names
334334
** together with their ages (time of last check-in) and whether or not
@@ -338,18 +338,16 @@
338338
** if there are no query parameters.
339339
*/
340340
static void new_brlist_page(void){
341341
Stmt q;
342342
double rNow;
343
- int orderByMtime = P("mtime")!=0;
344343
login_check_credentials();
345344
if( !g.perm.Read ){ login_needed(); return; }
346345
style_header("Branches");
347346
login_anonymous_available();
348347
349
- assert( orderByMtime==0 || orderByMtime==1 );
350
- db_prepare(&q, brlistQuery/*works-like:"%d"*/, 2-orderByMtime);
348
+ db_prepare(&q, brlistQuery/*works-like:""*/);
351349
rNow = db_double(0.0, "SELECT julianday('now')");
352350
@ <div class="brlist"><table id="branchlisttable">
353351
@ <thead><tr>
354352
@ <th>Branch Name</th>
355353
@ <th>Age</th>
@@ -381,11 +379,11 @@
381379
}
382380
@ </tr>
383381
}
384382
@ </tbody></table></div>
385383
db_finalize(&q);
386
- output_table_sorting_javascript("branchlisttable","tkktx");
384
+ output_table_sorting_javascript("branchlisttable","tkktx",2);
387385
style_footer();
388386
}
389387
390388
/*
391389
** WEBPAGE: brlist
392390
--- src/branch.c
+++ src/branch.c
@@ -324,11 +324,11 @@
324 @ WHERE tagxref.tagid=tag.tagid
325 @ AND tagxref.tagtype>0
326 @ AND tag.tagname='branch'
327 @ AND event.objid=tagxref.rid
328 @ GROUP BY 1
329 @ ORDER BY %d DESC;
330 ;
331
332 /*
333 ** This is the new-style branch-list page that shows the branch names
334 ** together with their ages (time of last check-in) and whether or not
@@ -338,18 +338,16 @@
338 ** if there are no query parameters.
339 */
340 static void new_brlist_page(void){
341 Stmt q;
342 double rNow;
343 int orderByMtime = P("mtime")!=0;
344 login_check_credentials();
345 if( !g.perm.Read ){ login_needed(); return; }
346 style_header("Branches");
347 login_anonymous_available();
348
349 assert( orderByMtime==0 || orderByMtime==1 );
350 db_prepare(&q, brlistQuery/*works-like:"%d"*/, 2-orderByMtime);
351 rNow = db_double(0.0, "SELECT julianday('now')");
352 @ <div class="brlist"><table id="branchlisttable">
353 @ <thead><tr>
354 @ <th>Branch Name</th>
355 @ <th>Age</th>
@@ -381,11 +379,11 @@
381 }
382 @ </tr>
383 }
384 @ </tbody></table></div>
385 db_finalize(&q);
386 output_table_sorting_javascript("branchlisttable","tkktx");
387 style_footer();
388 }
389
390 /*
391 ** WEBPAGE: brlist
392
--- src/branch.c
+++ src/branch.c
@@ -324,11 +324,11 @@
324 @ WHERE tagxref.tagid=tag.tagid
325 @ AND tagxref.tagtype>0
326 @ AND tag.tagname='branch'
327 @ AND event.objid=tagxref.rid
328 @ GROUP BY 1
329 @ ORDER BY 2 DESC;
330 ;
331
332 /*
333 ** This is the new-style branch-list page that shows the branch names
334 ** together with their ages (time of last check-in) and whether or not
@@ -338,18 +338,16 @@
338 ** if there are no query parameters.
339 */
340 static void new_brlist_page(void){
341 Stmt q;
342 double rNow;
 
343 login_check_credentials();
344 if( !g.perm.Read ){ login_needed(); return; }
345 style_header("Branches");
346 login_anonymous_available();
347
348 db_prepare(&q, brlistQuery/*works-like:""*/);
 
349 rNow = db_double(0.0, "SELECT julianday('now')");
350 @ <div class="brlist"><table id="branchlisttable">
351 @ <thead><tr>
352 @ <th>Branch Name</th>
353 @ <th>Age</th>
@@ -381,11 +379,11 @@
379 }
380 @ </tr>
381 }
382 @ </tbody></table></div>
383 db_finalize(&q);
384 output_table_sorting_javascript("branchlisttable","tkktx",2);
385 style_footer();
386 }
387
388 /*
389 ** WEBPAGE: brlist
390
+49 -15
--- src/report.c
+++ src/report.c
@@ -922,13 +922,15 @@
922922
923923
/*
924924
** Output Javascript code that will enables sorting of the table with
925925
** the id zTableId by clicking.
926926
**
927
-** The javascript is derived from:
927
+** The javascript was originally derived from:
928928
**
929929
** http://www.webtoolkit.info/sortable-html-table.html
930
+**
931
+** But there have been extensive modifications.
930932
**
931933
** This variation allows column types to be expressed using the second
932934
** argument. Each character of the second argument represent a column.
933935
**
934936
** t Sort by text
@@ -936,17 +938,27 @@
936938
** k Sort by the data-sortkey property
937939
** x This column is not sortable
938940
**
939941
** If there are fewer characters in zColumnTypes[] than their are columns,
940942
** the all extra columns assume type "t" (text).
943
+**
944
+** The third parameter is the column that was initially sorted (using 1-based
945
+** column numbers, like SQL). Make this value 0 if none of the columns are
946
+** initially sorted. Make the value negative if the column is initially sorted
947
+** in reverse order.
941948
**
942949
** Clicking on the same column header twice in a row inverts the sort.
943950
*/
944
-void output_table_sorting_javascript(const char *zTableId, const char *zColumnTypes){
951
+void output_table_sorting_javascript(
952
+ const char *zTableId, /* ID of table to sort */
953
+ const char *zColumnTypes, /* String for column types */
954
+ int iInitSort /* Initially sorted column. Leftmost is 1. 0 for NONE */
955
+){
945956
@ <script>
946
- @ function SortableTable(tableEl,columnTypes){
957
+ @ function SortableTable(tableEl,columnTypes,initSort){
947958
@ this.tbody = tableEl.getElementsByTagName('tbody');
959
+ @ this.columnTypes = columnTypes;
948960
@ this.sort = function (cell) {
949961
@ var column = cell.cellIndex;
950962
@ var sortFn;
951963
@ switch( cell.sortType ){
952964
@ case "n": sortFn = this.sortNumeric; break;
@@ -957,19 +969,39 @@
957969
@ this.sortIndex = column;
958970
@ var newRows = new Array();
959971
@ for (j = 0; j < this.tbody[0].rows.length; j++) {
960972
@ newRows[j] = this.tbody[0].rows[j];
961973
@ }
962
- @ if( this.sortIndex==this.prevColumn ){
974
+ @ if( this.sortIndex==Math.abs(this.prevColumn)-1 ){
963975
@ newRows.reverse();
976
+ @ this.prevColumn = -this.prevColumn;
964977
@ }else{
965978
@ newRows.sort(sortFn);
966
- @ this.prevColumn = this.sortIndex;
979
+ @ this.prevColumn = this.sortIndex+1;
967980
@ }
968981
@ for (i=0;i<newRows.length;i++) {
969982
@ this.tbody[0].appendChild(newRows[i]);
970983
@ }
984
+ @ this.setHdrIcons();
985
+ @ }
986
+ @ this.setHdrIcons = function() {
987
+ @ var arrowdiv = this.hdrRow.getElementsByClassName("sortarrow");
988
+ @ while( arrowdiv[0] ){
989
+ @ arrowdiv[0].parentNode.removeChild(arrowdiv[0]);
990
+ @ }
991
+ @ for (var i=0; i<this.hdrRow.cells.length; i++) {
992
+ @ if( this.columnTypes[i]=='x' ) continue;
993
+ @ if( this.prevColumn==i+1 ){
994
+ @ arrow = "\u2b07";
995
+ @ }else if( this.prevColumn==(-1-i) ){
996
+ @ arrow = "\u2b06";
997
+ @ }else{
998
+ @ arrow = "\u21f3";
999
+ @ }
1000
+ @ this.hdrRow.cells[i].innerHTML +=
1001
+ @ "<span class='sortarrow'>" + arrow + "</div>";
1002
+ @ }
9711003
@ }
9721004
@ this.sortText = function(a,b) {
9731005
@ var i = thisObject.sortIndex;
9741006
@ aa = a.cells[i].textContent.replace(/^\W+/,'').toLowerCase();
9751007
@ bb = b.cells[i].textContent.replace(/^\W+/,'').toLowerCase();
@@ -991,33 +1023,35 @@
9911023
@ bb = b.cells[i].getAttribute("data-sortkey");
9921024
@ if(aa==bb) return 0;
9931025
@ if(aa<bb) return -1;
9941026
@ return 1;
9951027
@ }
996
- @ var thisObject = this;
997
- @ var prevColumn = -1;
9981028
@ var x = tableEl.getElementsByTagName('thead');
9991029
@ if(!(this.tbody && this.tbody[0].rows && this.tbody[0].rows.length>0)){
10001030
@ return;
10011031
@ }
10021032
@ if(x && x[0].rows && x[0].rows.length > 0) {
1003
- @ var sortRow = x[0].rows[0];
1033
+ @ this.hdrRow = x[0].rows[0];
10041034
@ } else {
10051035
@ return;
10061036
@ }
1007
- @ for (var i=0; i<sortRow.cells.length; i++) {
1037
+ @ var thisObject = this;
1038
+ @ this.prevColumn = initSort;
1039
+ @ for (var i=0; i<this.hdrRow.cells.length; i++) {
10081040
@ if( columnTypes[i]=='x' ) continue;
1009
- @ sortRow.cells[i].sTable = this;
1010
- @ sortRow.cells[i].style.cursor = "pointer";
1011
- @ sortRow.cells[i].sortType = columnTypes[i] || 't';
1012
- @ sortRow.cells[i].onclick = function () {
1041
+ @ var hdrcell = this.hdrRow.cells[i];
1042
+ @ hdrcell.sTable = this;
1043
+ @ hdrcell.style.cursor = "pointer";
1044
+ @ hdrcell.sortType = columnTypes[i] || 't';
1045
+ @ hdrcell.onclick = function () {
10131046
@ this.sTable.sort(this);
10141047
@ return false;
10151048
@ }
10161049
@ }
1050
+ @ this.setHdrIcons()
10171051
@ }
1018
- @ var t = new SortableTable(gebi("%s(zTableId)"),"%s(zColumnTypes)");
1052
+ @ var t = new SortableTable(gebi("%s(zTableId)"),"%s(zColumnTypes)",%d(iInitSort));
10191053
@ </script>
10201054
}
10211055
10221056
10231057
/*
@@ -1109,11 +1143,11 @@
11091143
if( zErr1 ){
11101144
@ <p class="reportError">Error: %h(zErr1)</p>
11111145
}else if( zErr2 ){
11121146
@ <p class="reportError">Error: %h(zErr2)</p>
11131147
}
1114
- output_table_sorting_javascript("reportTable","");
1148
+ output_table_sorting_javascript("reportTable","",0);
11151149
style_footer();
11161150
}else{
11171151
report_restrict_sql(&zErr1);
11181152
db_exec_readonly(g.db, zSql, output_tab_separated, &count, &zErr2);
11191153
report_unrestrict_sql();
11201154
--- src/report.c
+++ src/report.c
@@ -922,13 +922,15 @@
922
923 /*
924 ** Output Javascript code that will enables sorting of the table with
925 ** the id zTableId by clicking.
926 **
927 ** The javascript is derived from:
928 **
929 ** http://www.webtoolkit.info/sortable-html-table.html
 
 
930 **
931 ** This variation allows column types to be expressed using the second
932 ** argument. Each character of the second argument represent a column.
933 **
934 ** t Sort by text
@@ -936,17 +938,27 @@
936 ** k Sort by the data-sortkey property
937 ** x This column is not sortable
938 **
939 ** If there are fewer characters in zColumnTypes[] than their are columns,
940 ** the all extra columns assume type "t" (text).
 
 
 
 
 
941 **
942 ** Clicking on the same column header twice in a row inverts the sort.
943 */
944 void output_table_sorting_javascript(const char *zTableId, const char *zColumnTypes){
 
 
 
 
945 @ <script>
946 @ function SortableTable(tableEl,columnTypes){
947 @ this.tbody = tableEl.getElementsByTagName('tbody');
 
948 @ this.sort = function (cell) {
949 @ var column = cell.cellIndex;
950 @ var sortFn;
951 @ switch( cell.sortType ){
952 @ case "n": sortFn = this.sortNumeric; break;
@@ -957,19 +969,39 @@
957 @ this.sortIndex = column;
958 @ var newRows = new Array();
959 @ for (j = 0; j < this.tbody[0].rows.length; j++) {
960 @ newRows[j] = this.tbody[0].rows[j];
961 @ }
962 @ if( this.sortIndex==this.prevColumn ){
963 @ newRows.reverse();
 
964 @ }else{
965 @ newRows.sort(sortFn);
966 @ this.prevColumn = this.sortIndex;
967 @ }
968 @ for (i=0;i<newRows.length;i++) {
969 @ this.tbody[0].appendChild(newRows[i]);
970 @ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
971 @ }
972 @ this.sortText = function(a,b) {
973 @ var i = thisObject.sortIndex;
974 @ aa = a.cells[i].textContent.replace(/^\W+/,'').toLowerCase();
975 @ bb = b.cells[i].textContent.replace(/^\W+/,'').toLowerCase();
@@ -991,33 +1023,35 @@
991 @ bb = b.cells[i].getAttribute("data-sortkey");
992 @ if(aa==bb) return 0;
993 @ if(aa<bb) return -1;
994 @ return 1;
995 @ }
996 @ var thisObject = this;
997 @ var prevColumn = -1;
998 @ var x = tableEl.getElementsByTagName('thead');
999 @ if(!(this.tbody && this.tbody[0].rows && this.tbody[0].rows.length>0)){
1000 @ return;
1001 @ }
1002 @ if(x && x[0].rows && x[0].rows.length > 0) {
1003 @ var sortRow = x[0].rows[0];
1004 @ } else {
1005 @ return;
1006 @ }
1007 @ for (var i=0; i<sortRow.cells.length; i++) {
 
 
1008 @ if( columnTypes[i]=='x' ) continue;
1009 @ sortRow.cells[i].sTable = this;
1010 @ sortRow.cells[i].style.cursor = "pointer";
1011 @ sortRow.cells[i].sortType = columnTypes[i] || 't';
1012 @ sortRow.cells[i].onclick = function () {
 
1013 @ this.sTable.sort(this);
1014 @ return false;
1015 @ }
1016 @ }
 
1017 @ }
1018 @ var t = new SortableTable(gebi("%s(zTableId)"),"%s(zColumnTypes)");
1019 @ </script>
1020 }
1021
1022
1023 /*
@@ -1109,11 +1143,11 @@
1109 if( zErr1 ){
1110 @ <p class="reportError">Error: %h(zErr1)</p>
1111 }else if( zErr2 ){
1112 @ <p class="reportError">Error: %h(zErr2)</p>
1113 }
1114 output_table_sorting_javascript("reportTable","");
1115 style_footer();
1116 }else{
1117 report_restrict_sql(&zErr1);
1118 db_exec_readonly(g.db, zSql, output_tab_separated, &count, &zErr2);
1119 report_unrestrict_sql();
1120
--- src/report.c
+++ src/report.c
@@ -922,13 +922,15 @@
922
923 /*
924 ** Output Javascript code that will enables sorting of the table with
925 ** the id zTableId by clicking.
926 **
927 ** The javascript was originally derived from:
928 **
929 ** http://www.webtoolkit.info/sortable-html-table.html
930 **
931 ** But there have been extensive modifications.
932 **
933 ** This variation allows column types to be expressed using the second
934 ** argument. Each character of the second argument represent a column.
935 **
936 ** t Sort by text
@@ -936,17 +938,27 @@
938 ** k Sort by the data-sortkey property
939 ** x This column is not sortable
940 **
941 ** If there are fewer characters in zColumnTypes[] than their are columns,
942 ** the all extra columns assume type "t" (text).
943 **
944 ** The third parameter is the column that was initially sorted (using 1-based
945 ** column numbers, like SQL). Make this value 0 if none of the columns are
946 ** initially sorted. Make the value negative if the column is initially sorted
947 ** in reverse order.
948 **
949 ** Clicking on the same column header twice in a row inverts the sort.
950 */
951 void output_table_sorting_javascript(
952 const char *zTableId, /* ID of table to sort */
953 const char *zColumnTypes, /* String for column types */
954 int iInitSort /* Initially sorted column. Leftmost is 1. 0 for NONE */
955 ){
956 @ <script>
957 @ function SortableTable(tableEl,columnTypes,initSort){
958 @ this.tbody = tableEl.getElementsByTagName('tbody');
959 @ this.columnTypes = columnTypes;
960 @ this.sort = function (cell) {
961 @ var column = cell.cellIndex;
962 @ var sortFn;
963 @ switch( cell.sortType ){
964 @ case "n": sortFn = this.sortNumeric; break;
@@ -957,19 +969,39 @@
969 @ this.sortIndex = column;
970 @ var newRows = new Array();
971 @ for (j = 0; j < this.tbody[0].rows.length; j++) {
972 @ newRows[j] = this.tbody[0].rows[j];
973 @ }
974 @ if( this.sortIndex==Math.abs(this.prevColumn)-1 ){
975 @ newRows.reverse();
976 @ this.prevColumn = -this.prevColumn;
977 @ }else{
978 @ newRows.sort(sortFn);
979 @ this.prevColumn = this.sortIndex+1;
980 @ }
981 @ for (i=0;i<newRows.length;i++) {
982 @ this.tbody[0].appendChild(newRows[i]);
983 @ }
984 @ this.setHdrIcons();
985 @ }
986 @ this.setHdrIcons = function() {
987 @ var arrowdiv = this.hdrRow.getElementsByClassName("sortarrow");
988 @ while( arrowdiv[0] ){
989 @ arrowdiv[0].parentNode.removeChild(arrowdiv[0]);
990 @ }
991 @ for (var i=0; i<this.hdrRow.cells.length; i++) {
992 @ if( this.columnTypes[i]=='x' ) continue;
993 @ if( this.prevColumn==i+1 ){
994 @ arrow = "\u2b07";
995 @ }else if( this.prevColumn==(-1-i) ){
996 @ arrow = "\u2b06";
997 @ }else{
998 @ arrow = "\u21f3";
999 @ }
1000 @ this.hdrRow.cells[i].innerHTML +=
1001 @ "<span class='sortarrow'>" + arrow + "</div>";
1002 @ }
1003 @ }
1004 @ this.sortText = function(a,b) {
1005 @ var i = thisObject.sortIndex;
1006 @ aa = a.cells[i].textContent.replace(/^\W+/,'').toLowerCase();
1007 @ bb = b.cells[i].textContent.replace(/^\W+/,'').toLowerCase();
@@ -991,33 +1023,35 @@
1023 @ bb = b.cells[i].getAttribute("data-sortkey");
1024 @ if(aa==bb) return 0;
1025 @ if(aa<bb) return -1;
1026 @ return 1;
1027 @ }
 
 
1028 @ var x = tableEl.getElementsByTagName('thead');
1029 @ if(!(this.tbody && this.tbody[0].rows && this.tbody[0].rows.length>0)){
1030 @ return;
1031 @ }
1032 @ if(x && x[0].rows && x[0].rows.length > 0) {
1033 @ this.hdrRow = x[0].rows[0];
1034 @ } else {
1035 @ return;
1036 @ }
1037 @ var thisObject = this;
1038 @ this.prevColumn = initSort;
1039 @ for (var i=0; i<this.hdrRow.cells.length; i++) {
1040 @ if( columnTypes[i]=='x' ) continue;
1041 @ var hdrcell = this.hdrRow.cells[i];
1042 @ hdrcell.sTable = this;
1043 @ hdrcell.style.cursor = "pointer";
1044 @ hdrcell.sortType = columnTypes[i] || 't';
1045 @ hdrcell.onclick = function () {
1046 @ this.sTable.sort(this);
1047 @ return false;
1048 @ }
1049 @ }
1050 @ this.setHdrIcons()
1051 @ }
1052 @ var t = new SortableTable(gebi("%s(zTableId)"),"%s(zColumnTypes)",%d(iInitSort));
1053 @ </script>
1054 }
1055
1056
1057 /*
@@ -1109,11 +1143,11 @@
1143 if( zErr1 ){
1144 @ <p class="reportError">Error: %h(zErr1)</p>
1145 }else if( zErr2 ){
1146 @ <p class="reportError">Error: %h(zErr2)</p>
1147 }
1148 output_table_sorting_javascript("reportTable","",0);
1149 style_footer();
1150 }else{
1151 report_restrict_sql(&zErr1);
1152 db_exec_readonly(g.db, zSql, output_tab_separated, &count, &zErr2);
1153 report_unrestrict_sql();
1154
+5 -5
--- src/timeline.c
+++ src/timeline.c
@@ -2399,11 +2399,11 @@
23992399
@ <br><div>Total events: %d(nEventTotal)
24002400
@ <br>Average per active %s(zAvgLabel): %d(nAvg)
24012401
@ </div>
24022402
}
24032403
if( !includeMonth ){
2404
- output_table_sorting_javascript("statsTable","tnx");
2404
+ output_table_sorting_javascript("statsTable","tnx",-1);
24052405
}
24062406
}
24072407
24082408
/*
24092409
** Implements the "byuser" view for /reports.
@@ -2450,11 +2450,11 @@
24502450
rowClass = ++nRowNumber % 2;
24512451
nEventTotal += nCount;
24522452
@<tr class='row%d(rowClass)'>
24532453
@ <td>
24542454
@ <a href="?view=bymonth&user=%h(zUser)&type=%c((char)statsReportType)">%h(zUser)</a>
2455
- @ </td><td>%d(nCount)</td>
2455
+ @ </td><td data-sortkey='%08x(-nCount)'>%d(nCount)</td>
24562456
@ <td>
24572457
@ <div class='statistics-report-graph-line'
24582458
@ style='width:%d(nSize)%%;'>&nbsp;</div>
24592459
@ </td>
24602460
@</tr>
@@ -2463,11 +2463,11 @@
24632463
use percent-based graph bars.
24642464
*/
24652465
}
24662466
@ </tbody></table>
24672467
db_finalize(&query);
2468
- output_table_sorting_javascript("statsTable","tnx");
2468
+ output_table_sorting_javascript("statsTable","tkx",2);
24692469
}
24702470
24712471
/*
24722472
** Implements the "byweekday" view for /reports.
24732473
*/
@@ -2528,11 +2528,11 @@
25282528
@ </td>
25292529
@</tr>
25302530
}
25312531
@ </tbody></table>
25322532
db_finalize(&query);
2533
- output_table_sorting_javascript("statsTable","ntnx");
2533
+ output_table_sorting_javascript("statsTable","ntnx",1);
25342534
}
25352535
25362536
25372537
/*
25382538
** Helper for stats_report_by_month_year(), which generates a list of
@@ -2661,11 +2661,11 @@
26612661
int nAvg = iterations ? (total/iterations) : 0;
26622662
cgi_printf("<br><div>Total events: %d<br>"
26632663
"Average per active week: %d</div>",
26642664
total, nAvg);
26652665
}
2666
- output_table_sorting_javascript("statsTable","tnx");
2666
+ output_table_sorting_javascript("statsTable","tnx",-1);
26672667
}
26682668
}
26692669
26702670
/*
26712671
** WEBPAGE: reports
26722672
--- src/timeline.c
+++ src/timeline.c
@@ -2399,11 +2399,11 @@
2399 @ <br><div>Total events: %d(nEventTotal)
2400 @ <br>Average per active %s(zAvgLabel): %d(nAvg)
2401 @ </div>
2402 }
2403 if( !includeMonth ){
2404 output_table_sorting_javascript("statsTable","tnx");
2405 }
2406 }
2407
2408 /*
2409 ** Implements the "byuser" view for /reports.
@@ -2450,11 +2450,11 @@
2450 rowClass = ++nRowNumber % 2;
2451 nEventTotal += nCount;
2452 @<tr class='row%d(rowClass)'>
2453 @ <td>
2454 @ <a href="?view=bymonth&user=%h(zUser)&type=%c((char)statsReportType)">%h(zUser)</a>
2455 @ </td><td>%d(nCount)</td>
2456 @ <td>
2457 @ <div class='statistics-report-graph-line'
2458 @ style='width:%d(nSize)%%;'>&nbsp;</div>
2459 @ </td>
2460 @</tr>
@@ -2463,11 +2463,11 @@
2463 use percent-based graph bars.
2464 */
2465 }
2466 @ </tbody></table>
2467 db_finalize(&query);
2468 output_table_sorting_javascript("statsTable","tnx");
2469 }
2470
2471 /*
2472 ** Implements the "byweekday" view for /reports.
2473 */
@@ -2528,11 +2528,11 @@
2528 @ </td>
2529 @</tr>
2530 }
2531 @ </tbody></table>
2532 db_finalize(&query);
2533 output_table_sorting_javascript("statsTable","ntnx");
2534 }
2535
2536
2537 /*
2538 ** Helper for stats_report_by_month_year(), which generates a list of
@@ -2661,11 +2661,11 @@
2661 int nAvg = iterations ? (total/iterations) : 0;
2662 cgi_printf("<br><div>Total events: %d<br>"
2663 "Average per active week: %d</div>",
2664 total, nAvg);
2665 }
2666 output_table_sorting_javascript("statsTable","tnx");
2667 }
2668 }
2669
2670 /*
2671 ** WEBPAGE: reports
2672
--- src/timeline.c
+++ src/timeline.c
@@ -2399,11 +2399,11 @@
2399 @ <br><div>Total events: %d(nEventTotal)
2400 @ <br>Average per active %s(zAvgLabel): %d(nAvg)
2401 @ </div>
2402 }
2403 if( !includeMonth ){
2404 output_table_sorting_javascript("statsTable","tnx",-1);
2405 }
2406 }
2407
2408 /*
2409 ** Implements the "byuser" view for /reports.
@@ -2450,11 +2450,11 @@
2450 rowClass = ++nRowNumber % 2;
2451 nEventTotal += nCount;
2452 @<tr class='row%d(rowClass)'>
2453 @ <td>
2454 @ <a href="?view=bymonth&user=%h(zUser)&type=%c((char)statsReportType)">%h(zUser)</a>
2455 @ </td><td data-sortkey='%08x(-nCount)'>%d(nCount)</td>
2456 @ <td>
2457 @ <div class='statistics-report-graph-line'
2458 @ style='width:%d(nSize)%%;'>&nbsp;</div>
2459 @ </td>
2460 @</tr>
@@ -2463,11 +2463,11 @@
2463 use percent-based graph bars.
2464 */
2465 }
2466 @ </tbody></table>
2467 db_finalize(&query);
2468 output_table_sorting_javascript("statsTable","tkx",2);
2469 }
2470
2471 /*
2472 ** Implements the "byweekday" view for /reports.
2473 */
@@ -2528,11 +2528,11 @@
2528 @ </td>
2529 @</tr>
2530 }
2531 @ </tbody></table>
2532 db_finalize(&query);
2533 output_table_sorting_javascript("statsTable","ntnx",1);
2534 }
2535
2536
2537 /*
2538 ** Helper for stats_report_by_month_year(), which generates a list of
@@ -2661,11 +2661,11 @@
2661 int nAvg = iterations ? (total/iterations) : 0;
2662 cgi_printf("<br><div>Total events: %d<br>"
2663 "Average per active week: %d</div>",
2664 total, nAvg);
2665 }
2666 output_table_sorting_javascript("statsTable","tnx",-1);
2667 }
2668 }
2669
2670 /*
2671 ** WEBPAGE: reports
2672

Keyboard Shortcuts

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