Fossil SCM
Perform table sorting using a separate javascript file rather than using in-line javascript.
Commit
6b645d631d44b94d8e95c011c7bf1e5eafd136b57edde78ab64940e0ab83b769
Parent
2f5c2f658c257fd…
15 files changed
+3
-2
+3
-2
+4
-4
+1
+3
-2
+3
-188
+8
-8
+49
+24
-20
+13
-3
+3
-2
+3
-2
+3
-2
+1
+1
+3
-2
| --- src/branch.c | ||
| +++ src/branch.c | ||
| @@ -393,11 +393,12 @@ | ||
| 393 | 393 | style_submenu_checkbox("colors", "Use Branch Colors", 0, 0); |
| 394 | 394 | login_anonymous_available(); |
| 395 | 395 | |
| 396 | 396 | db_prepare(&q, brlistQuery/*works-like:""*/); |
| 397 | 397 | rNow = db_double(0.0, "SELECT julianday('now')"); |
| 398 | - @ <div class="brlist"><table id="branchlisttable"> | |
| 398 | + @ <div class="brlist"> | |
| 399 | + @ <table class='sortable' data-column-types='tkNtt' data-init-sort='2'> | |
| 399 | 400 | @ <thead><tr> |
| 400 | 401 | @ <th>Branch Name</th> |
| 401 | 402 | @ <th>Age</th> |
| 402 | 403 | @ <th>Check-ins</th> |
| 403 | 404 | @ <th>Status</th> |
| @@ -439,11 +440,11 @@ | ||
| 439 | 440 | } |
| 440 | 441 | @ </tr> |
| 441 | 442 | } |
| 442 | 443 | @ </tbody></table></div> |
| 443 | 444 | db_finalize(&q); |
| 444 | - output_table_sorting_javascript("branchlisttable","tkNtt",2); | |
| 445 | + style_table_sorter(); | |
| 445 | 446 | style_footer(); |
| 446 | 447 | } |
| 447 | 448 | |
| 448 | 449 | /* |
| 449 | 450 | ** WEBPAGE: brlist |
| 450 | 451 |
| --- src/branch.c | |
| +++ src/branch.c | |
| @@ -393,11 +393,12 @@ | |
| 393 | style_submenu_checkbox("colors", "Use Branch Colors", 0, 0); |
| 394 | login_anonymous_available(); |
| 395 | |
| 396 | db_prepare(&q, brlistQuery/*works-like:""*/); |
| 397 | rNow = db_double(0.0, "SELECT julianday('now')"); |
| 398 | @ <div class="brlist"><table id="branchlisttable"> |
| 399 | @ <thead><tr> |
| 400 | @ <th>Branch Name</th> |
| 401 | @ <th>Age</th> |
| 402 | @ <th>Check-ins</th> |
| 403 | @ <th>Status</th> |
| @@ -439,11 +440,11 @@ | |
| 439 | } |
| 440 | @ </tr> |
| 441 | } |
| 442 | @ </tbody></table></div> |
| 443 | db_finalize(&q); |
| 444 | output_table_sorting_javascript("branchlisttable","tkNtt",2); |
| 445 | style_footer(); |
| 446 | } |
| 447 | |
| 448 | /* |
| 449 | ** WEBPAGE: brlist |
| 450 |
| --- src/branch.c | |
| +++ src/branch.c | |
| @@ -393,11 +393,12 @@ | |
| 393 | style_submenu_checkbox("colors", "Use Branch Colors", 0, 0); |
| 394 | login_anonymous_available(); |
| 395 | |
| 396 | db_prepare(&q, brlistQuery/*works-like:""*/); |
| 397 | rNow = db_double(0.0, "SELECT julianday('now')"); |
| 398 | @ <div class="brlist"> |
| 399 | @ <table class='sortable' data-column-types='tkNtt' data-init-sort='2'> |
| 400 | @ <thead><tr> |
| 401 | @ <th>Branch Name</th> |
| 402 | @ <th>Age</th> |
| 403 | @ <th>Check-ins</th> |
| 404 | @ <th>Status</th> |
| @@ -439,11 +440,11 @@ | |
| 440 | } |
| 441 | @ </tr> |
| 442 | } |
| 443 | @ </tbody></table></div> |
| 444 | db_finalize(&q); |
| 445 | style_table_sorter(); |
| 446 | style_footer(); |
| 447 | } |
| 448 | |
| 449 | /* |
| 450 | ** WEBPAGE: brlist |
| 451 |
+3
-2
| --- src/doc.c | ||
| +++ src/doc.c | ||
| @@ -382,20 +382,21 @@ | ||
| 382 | 382 | mimetype_verify(); |
| 383 | 383 | style_header("Mimetype List"); |
| 384 | 384 | @ <p>The Fossil <a href="%R/help?cmd=/doc">/doc</a> page uses filename |
| 385 | 385 | @ suffixes and the following table to guess at the appropriate mimetype |
| 386 | 386 | @ for each document.</p> |
| 387 | - @ <table id='mimeTable' border=1 cellpadding=0 class='mimetypetable'> | |
| 387 | + @ <table class='sortable mimetypetable' border=1 cellpadding=0 \ | |
| 388 | + @ data-column-types='tt' data-init-sort='1'> | |
| 388 | 389 | @ <thead> |
| 389 | 390 | @ <tr><th>Suffix<th>Mimetype |
| 390 | 391 | @ </thead> |
| 391 | 392 | @ <tbody> |
| 392 | 393 | for(i=0; i<count(aMime); i++){ |
| 393 | 394 | @ <tr><td>%h(aMime[i].zSuffix)<td>%h(aMime[i].zMimetype)</tr> |
| 394 | 395 | } |
| 395 | 396 | @ </tbody></table> |
| 396 | - output_table_sorting_javascript("mimeTable","tt",1); | |
| 397 | + style_table_sorter(); | |
| 397 | 398 | style_footer(); |
| 398 | 399 | } |
| 399 | 400 | |
| 400 | 401 | /* |
| 401 | 402 | ** Check to see if the file in the pContent blob is "embedded HTML". Return |
| 402 | 403 |
| --- src/doc.c | |
| +++ src/doc.c | |
| @@ -382,20 +382,21 @@ | |
| 382 | mimetype_verify(); |
| 383 | style_header("Mimetype List"); |
| 384 | @ <p>The Fossil <a href="%R/help?cmd=/doc">/doc</a> page uses filename |
| 385 | @ suffixes and the following table to guess at the appropriate mimetype |
| 386 | @ for each document.</p> |
| 387 | @ <table id='mimeTable' border=1 cellpadding=0 class='mimetypetable'> |
| 388 | @ <thead> |
| 389 | @ <tr><th>Suffix<th>Mimetype |
| 390 | @ </thead> |
| 391 | @ <tbody> |
| 392 | for(i=0; i<count(aMime); i++){ |
| 393 | @ <tr><td>%h(aMime[i].zSuffix)<td>%h(aMime[i].zMimetype)</tr> |
| 394 | } |
| 395 | @ </tbody></table> |
| 396 | output_table_sorting_javascript("mimeTable","tt",1); |
| 397 | style_footer(); |
| 398 | } |
| 399 | |
| 400 | /* |
| 401 | ** Check to see if the file in the pContent blob is "embedded HTML". Return |
| 402 |
| --- src/doc.c | |
| +++ src/doc.c | |
| @@ -382,20 +382,21 @@ | |
| 382 | mimetype_verify(); |
| 383 | style_header("Mimetype List"); |
| 384 | @ <p>The Fossil <a href="%R/help?cmd=/doc">/doc</a> page uses filename |
| 385 | @ suffixes and the following table to guess at the appropriate mimetype |
| 386 | @ for each document.</p> |
| 387 | @ <table class='sortable mimetypetable' border=1 cellpadding=0 \ |
| 388 | @ data-column-types='tt' data-init-sort='1'> |
| 389 | @ <thead> |
| 390 | @ <tr><th>Suffix<th>Mimetype |
| 391 | @ </thead> |
| 392 | @ <tbody> |
| 393 | for(i=0; i<count(aMime); i++){ |
| 394 | @ <tr><td>%h(aMime[i].zSuffix)<td>%h(aMime[i].zMimetype)</tr> |
| 395 | } |
| 396 | @ </tbody></table> |
| 397 | style_table_sorter(); |
| 398 | style_footer(); |
| 399 | } |
| 400 | |
| 401 | /* |
| 402 | ** Check to see if the file in the pContent blob is "embedded HTML". Return |
| 403 |
+4
-4
| --- src/finfo.c | ||
| +++ src/finfo.c | ||
| @@ -686,14 +686,15 @@ | ||
| 686 | 686 | " WHERE mlink.fnid=%d" |
| 687 | 687 | " AND event.objid=mlink.mid" |
| 688 | 688 | " ORDER BY 1 DESC", |
| 689 | 689 | fnid |
| 690 | 690 | ); |
| 691 | + style_table_sorter(); | |
| 691 | 692 | @ <h1>MLINK table for file |
| 692 | 693 | @ <a href='%R/finfo?name=%t(zFName)'>%h(zFName)</a></h1> |
| 693 | 694 | @ <div class='brlist'> |
| 694 | - @ <table id='mlinktable'> | |
| 695 | + @ <table class='sortable' data-column-types='tttxtttt' data-init-sort='1'> | |
| 695 | 696 | @ <thead><tr> |
| 696 | 697 | @ <th>Date</th> |
| 697 | 698 | @ <th>Check-in</th> |
| 698 | 699 | @ <th>Parent<br>Check-in</th> |
| 699 | 700 | @ <th>Merge?</th> |
| @@ -743,11 +744,10 @@ | ||
| 743 | 744 | } |
| 744 | 745 | db_finalize(&q); |
| 745 | 746 | @ </tbody> |
| 746 | 747 | @ </table> |
| 747 | 748 | @ </div> |
| 748 | - output_table_sorting_javascript("mlinktable","tttxtttt",1); | |
| 749 | 749 | }else{ |
| 750 | 750 | int mid = name_to_rid_www("ci"); |
| 751 | 751 | db_prepare(&q, |
| 752 | 752 | "SELECT" |
| 753 | 753 | /* 0 */ " (SELECT name FROM filename WHERE fnid=mlink.fnid)," |
| @@ -761,13 +761,14 @@ | ||
| 761 | 761 | " FROM mlink WHERE mid=%d ORDER BY 1", |
| 762 | 762 | mid |
| 763 | 763 | ); |
| 764 | 764 | @ <h1>MLINK table for check-in %h(zCI)</h1> |
| 765 | 765 | render_checkin_context(mid, 1); |
| 766 | + style_table_sorter(); | |
| 766 | 767 | @ <hr /> |
| 767 | 768 | @ <div class='brlist'> |
| 768 | - @ <table id='mlinktable'> | |
| 769 | + @ <table class='sortable' data-column-types='ttxtttt' data-init-sort='1'> | |
| 769 | 770 | @ <thead><tr> |
| 770 | 771 | @ <th>File</th> |
| 771 | 772 | @ <th>Parent<br>Check-in</th> |
| 772 | 773 | @ <th>Merge?</th> |
| 773 | 774 | @ <th>New</th> |
| @@ -814,9 +815,8 @@ | ||
| 814 | 815 | } |
| 815 | 816 | db_finalize(&q); |
| 816 | 817 | @ </tbody> |
| 817 | 818 | @ </table> |
| 818 | 819 | @ </div> |
| 819 | - output_table_sorting_javascript("mlinktable","ttxtttt",1); | |
| 820 | 820 | } |
| 821 | 821 | style_footer(); |
| 822 | 822 | } |
| 823 | 823 |
| --- src/finfo.c | |
| +++ src/finfo.c | |
| @@ -686,14 +686,15 @@ | |
| 686 | " WHERE mlink.fnid=%d" |
| 687 | " AND event.objid=mlink.mid" |
| 688 | " ORDER BY 1 DESC", |
| 689 | fnid |
| 690 | ); |
| 691 | @ <h1>MLINK table for file |
| 692 | @ <a href='%R/finfo?name=%t(zFName)'>%h(zFName)</a></h1> |
| 693 | @ <div class='brlist'> |
| 694 | @ <table id='mlinktable'> |
| 695 | @ <thead><tr> |
| 696 | @ <th>Date</th> |
| 697 | @ <th>Check-in</th> |
| 698 | @ <th>Parent<br>Check-in</th> |
| 699 | @ <th>Merge?</th> |
| @@ -743,11 +744,10 @@ | |
| 743 | } |
| 744 | db_finalize(&q); |
| 745 | @ </tbody> |
| 746 | @ </table> |
| 747 | @ </div> |
| 748 | output_table_sorting_javascript("mlinktable","tttxtttt",1); |
| 749 | }else{ |
| 750 | int mid = name_to_rid_www("ci"); |
| 751 | db_prepare(&q, |
| 752 | "SELECT" |
| 753 | /* 0 */ " (SELECT name FROM filename WHERE fnid=mlink.fnid)," |
| @@ -761,13 +761,14 @@ | |
| 761 | " FROM mlink WHERE mid=%d ORDER BY 1", |
| 762 | mid |
| 763 | ); |
| 764 | @ <h1>MLINK table for check-in %h(zCI)</h1> |
| 765 | render_checkin_context(mid, 1); |
| 766 | @ <hr /> |
| 767 | @ <div class='brlist'> |
| 768 | @ <table id='mlinktable'> |
| 769 | @ <thead><tr> |
| 770 | @ <th>File</th> |
| 771 | @ <th>Parent<br>Check-in</th> |
| 772 | @ <th>Merge?</th> |
| 773 | @ <th>New</th> |
| @@ -814,9 +815,8 @@ | |
| 814 | } |
| 815 | db_finalize(&q); |
| 816 | @ </tbody> |
| 817 | @ </table> |
| 818 | @ </div> |
| 819 | output_table_sorting_javascript("mlinktable","ttxtttt",1); |
| 820 | } |
| 821 | style_footer(); |
| 822 | } |
| 823 |
| --- src/finfo.c | |
| +++ src/finfo.c | |
| @@ -686,14 +686,15 @@ | |
| 686 | " WHERE mlink.fnid=%d" |
| 687 | " AND event.objid=mlink.mid" |
| 688 | " ORDER BY 1 DESC", |
| 689 | fnid |
| 690 | ); |
| 691 | style_table_sorter(); |
| 692 | @ <h1>MLINK table for file |
| 693 | @ <a href='%R/finfo?name=%t(zFName)'>%h(zFName)</a></h1> |
| 694 | @ <div class='brlist'> |
| 695 | @ <table class='sortable' data-column-types='tttxtttt' data-init-sort='1'> |
| 696 | @ <thead><tr> |
| 697 | @ <th>Date</th> |
| 698 | @ <th>Check-in</th> |
| 699 | @ <th>Parent<br>Check-in</th> |
| 700 | @ <th>Merge?</th> |
| @@ -743,11 +744,10 @@ | |
| 744 | } |
| 745 | db_finalize(&q); |
| 746 | @ </tbody> |
| 747 | @ </table> |
| 748 | @ </div> |
| 749 | }else{ |
| 750 | int mid = name_to_rid_www("ci"); |
| 751 | db_prepare(&q, |
| 752 | "SELECT" |
| 753 | /* 0 */ " (SELECT name FROM filename WHERE fnid=mlink.fnid)," |
| @@ -761,13 +761,14 @@ | |
| 761 | " FROM mlink WHERE mid=%d ORDER BY 1", |
| 762 | mid |
| 763 | ); |
| 764 | @ <h1>MLINK table for check-in %h(zCI)</h1> |
| 765 | render_checkin_context(mid, 1); |
| 766 | style_table_sorter(); |
| 767 | @ <hr /> |
| 768 | @ <div class='brlist'> |
| 769 | @ <table class='sortable' data-column-types='ttxtttt' data-init-sort='1'> |
| 770 | @ <thead><tr> |
| 771 | @ <th>File</th> |
| 772 | @ <th>Parent<br>Check-in</th> |
| 773 | @ <th>Merge?</th> |
| 774 | @ <th>New</th> |
| @@ -814,9 +815,8 @@ | |
| 815 | } |
| 816 | db_finalize(&q); |
| 817 | @ </tbody> |
| 818 | @ </table> |
| 819 | @ </div> |
| 820 | } |
| 821 | style_footer(); |
| 822 | } |
| 823 |
+1
| --- src/main.mk | ||
| +++ src/main.mk | ||
| @@ -199,10 +199,11 @@ | ||
| 199 | 199 | $(SRCDIR)/graph.js \ |
| 200 | 200 | $(SRCDIR)/href.js \ |
| 201 | 201 | $(SRCDIR)/markdown.md \ |
| 202 | 202 | $(SRCDIR)/menu.js \ |
| 203 | 203 | $(SRCDIR)/sbsdiff.js \ |
| 204 | + $(SRCDIR)/sorttable.js \ | |
| 204 | 205 | $(SRCDIR)/tree.js \ |
| 205 | 206 | $(SRCDIR)/wiki.wiki |
| 206 | 207 | |
| 207 | 208 | TRANS_SRC = \ |
| 208 | 209 | $(OBJDIR)/add_.c \ |
| 209 | 210 |
| --- src/main.mk | |
| +++ src/main.mk | |
| @@ -199,10 +199,11 @@ | |
| 199 | $(SRCDIR)/graph.js \ |
| 200 | $(SRCDIR)/href.js \ |
| 201 | $(SRCDIR)/markdown.md \ |
| 202 | $(SRCDIR)/menu.js \ |
| 203 | $(SRCDIR)/sbsdiff.js \ |
| 204 | $(SRCDIR)/tree.js \ |
| 205 | $(SRCDIR)/wiki.wiki |
| 206 | |
| 207 | TRANS_SRC = \ |
| 208 | $(OBJDIR)/add_.c \ |
| 209 |
| --- src/main.mk | |
| +++ src/main.mk | |
| @@ -199,10 +199,11 @@ | |
| 199 | $(SRCDIR)/graph.js \ |
| 200 | $(SRCDIR)/href.js \ |
| 201 | $(SRCDIR)/markdown.md \ |
| 202 | $(SRCDIR)/menu.js \ |
| 203 | $(SRCDIR)/sbsdiff.js \ |
| 204 | $(SRCDIR)/sorttable.js \ |
| 205 | $(SRCDIR)/tree.js \ |
| 206 | $(SRCDIR)/wiki.wiki |
| 207 | |
| 208 | TRANS_SRC = \ |
| 209 | $(OBJDIR)/add_.c \ |
| 210 |
+3
-2
| --- src/name.c | ||
| +++ src/name.c | ||
| @@ -1115,11 +1115,12 @@ | ||
| 1115 | 1115 | " datetime(description.ctime)" |
| 1116 | 1116 | " FROM description, blob LEFT JOIN delta ON delta.rid=blob.rid" |
| 1117 | 1117 | " WHERE description.rid=blob.rid" |
| 1118 | 1118 | " ORDER BY length(content) DESC" |
| 1119 | 1119 | ); |
| 1120 | - @ <table cellpadding="2" cellspacing="0" border="1" id="bigblobtab"> | |
| 1120 | + @ <table cellpadding="2" cellspacing="0" border="1" \ | |
| 1121 | + @ class='sortable' data-column-types='NnnttT' data-init-sort='0'> | |
| 1121 | 1122 | @ <thead><tr><th align="right">Size<th align="right">RID |
| 1122 | 1123 | @ <th align="right">Delta From<th>Hash<th>Description<th>Date</tr></thead> |
| 1123 | 1124 | @ <tbody> |
| 1124 | 1125 | while( db_step(&q)==SQLITE_ROW ){ |
| 1125 | 1126 | int rid = db_column_int(&q,0); |
| @@ -1136,11 +1137,11 @@ | ||
| 1136 | 1137 | @ <td align="left">%z(href("%R/timeline?c=%T",zDate))%s(zDate)</a></td> |
| 1137 | 1138 | @ </tr> |
| 1138 | 1139 | } |
| 1139 | 1140 | @ </tbody></table> |
| 1140 | 1141 | db_finalize(&q); |
| 1141 | - output_table_sorting_javascript("bigblobtab", "NnnttT", -1); | |
| 1142 | + style_table_sorter(); | |
| 1142 | 1143 | style_footer(); |
| 1143 | 1144 | } |
| 1144 | 1145 | |
| 1145 | 1146 | /* |
| 1146 | 1147 | ** COMMAND: test-unsent |
| 1147 | 1148 |
| --- src/name.c | |
| +++ src/name.c | |
| @@ -1115,11 +1115,12 @@ | |
| 1115 | " datetime(description.ctime)" |
| 1116 | " FROM description, blob LEFT JOIN delta ON delta.rid=blob.rid" |
| 1117 | " WHERE description.rid=blob.rid" |
| 1118 | " ORDER BY length(content) DESC" |
| 1119 | ); |
| 1120 | @ <table cellpadding="2" cellspacing="0" border="1" id="bigblobtab"> |
| 1121 | @ <thead><tr><th align="right">Size<th align="right">RID |
| 1122 | @ <th align="right">Delta From<th>Hash<th>Description<th>Date</tr></thead> |
| 1123 | @ <tbody> |
| 1124 | while( db_step(&q)==SQLITE_ROW ){ |
| 1125 | int rid = db_column_int(&q,0); |
| @@ -1136,11 +1137,11 @@ | |
| 1136 | @ <td align="left">%z(href("%R/timeline?c=%T",zDate))%s(zDate)</a></td> |
| 1137 | @ </tr> |
| 1138 | } |
| 1139 | @ </tbody></table> |
| 1140 | db_finalize(&q); |
| 1141 | output_table_sorting_javascript("bigblobtab", "NnnttT", -1); |
| 1142 | style_footer(); |
| 1143 | } |
| 1144 | |
| 1145 | /* |
| 1146 | ** COMMAND: test-unsent |
| 1147 |
| --- src/name.c | |
| +++ src/name.c | |
| @@ -1115,11 +1115,12 @@ | |
| 1115 | " datetime(description.ctime)" |
| 1116 | " FROM description, blob LEFT JOIN delta ON delta.rid=blob.rid" |
| 1117 | " WHERE description.rid=blob.rid" |
| 1118 | " ORDER BY length(content) DESC" |
| 1119 | ); |
| 1120 | @ <table cellpadding="2" cellspacing="0" border="1" \ |
| 1121 | @ class='sortable' data-column-types='NnnttT' data-init-sort='0'> |
| 1122 | @ <thead><tr><th align="right">Size<th align="right">RID |
| 1123 | @ <th align="right">Delta From<th>Hash<th>Description<th>Date</tr></thead> |
| 1124 | @ <tbody> |
| 1125 | while( db_step(&q)==SQLITE_ROW ){ |
| 1126 | int rid = db_column_int(&q,0); |
| @@ -1136,11 +1137,11 @@ | |
| 1137 | @ <td align="left">%z(href("%R/timeline?c=%T",zDate))%s(zDate)</a></td> |
| 1138 | @ </tr> |
| 1139 | } |
| 1140 | @ </tbody></table> |
| 1141 | db_finalize(&q); |
| 1142 | style_table_sorter(); |
| 1143 | style_footer(); |
| 1144 | } |
| 1145 | |
| 1146 | /* |
| 1147 | ** COMMAND: test-unsent |
| 1148 |
+3
-188
| --- src/report.c | ||
| +++ src/report.c | ||
| @@ -945,195 +945,10 @@ | ||
| 945 | 945 | } |
| 946 | 946 | rc = sqlite3_finalize(pStmt); |
| 947 | 947 | fossil_free((void *)azVals); |
| 948 | 948 | return rc; |
| 949 | 949 | } |
| 950 | - | |
| 951 | -/* | |
| 952 | -** Output Javascript code that will enables sorting of the table with | |
| 953 | -** the id zTableId by clicking. | |
| 954 | -** | |
| 955 | -** The javascript was originally derived from: | |
| 956 | -** | |
| 957 | -** http://www.webtoolkit.info/sortable-html-table.html | |
| 958 | -** | |
| 959 | -** But there have been extensive modifications. | |
| 960 | -** | |
| 961 | -** This variation allows column types to be expressed using the second | |
| 962 | -** argument. Each character of the second argument represent a column. | |
| 963 | -** | |
| 964 | -** t Sort by text | |
| 965 | -** n Sort numerically | |
| 966 | -** k Sort by the data-sortkey property | |
| 967 | -** x This column is not sortable | |
| 968 | -** | |
| 969 | -** Capital letters mean sort in reverse order. | |
| 970 | -** If there are fewer characters in zColumnTypes[] than their are columns, | |
| 971 | -** then all extra columns assume type "t" (text). | |
| 972 | -** | |
| 973 | -** The third parameter is the column that was initially sorted (using 1-based | |
| 974 | -** column numbers, like SQL). Make this value 0 if none of the columns are | |
| 975 | -** initially sorted. Make the value negative if the column is initially sorted | |
| 976 | -** in reverse order. | |
| 977 | -** | |
| 978 | -** Clicking on the same column header twice in a row inverts the sort. | |
| 979 | -*/ | |
| 980 | -void output_table_sorting_javascript( | |
| 981 | - const char *zTableId, /* ID of table to sort */ | |
| 982 | - const char *zColumnTypes, /* String for column types */ | |
| 983 | - int iInitSort /* Initially sorted column. Leftmost is 1. 0 for NONE */ | |
| 984 | -){ | |
| 985 | - @ <script> | |
| 986 | - @ function SortableTable(tableEl,columnTypes,initSort){ | |
| 987 | - @ this.tbody = tableEl.getElementsByTagName('tbody'); | |
| 988 | - @ this.columnTypes = columnTypes; | |
| 989 | - @ var ncols = tableEl.rows[0].cells.length; | |
| 990 | - @ for(var i = columnTypes.length; i<=ncols; i++){this.columnTypes += 't';} | |
| 991 | - @ this.sort = function (cell) { | |
| 992 | - @ var column = cell.cellIndex; | |
| 993 | - @ var sortFn; | |
| 994 | - @ switch( cell.sortType ){ | |
| 995 | - if( strchr(zColumnTypes,'n') ){ | |
| 996 | - @ case "n": sortFn = this.sortNumeric; break; | |
| 997 | - } | |
| 998 | - if( strchr(zColumnTypes,'N') ){ | |
| 999 | - @ case "N": sortFn = this.sortReverseNumeric; break; | |
| 1000 | - } | |
| 1001 | - @ case "t": sortFn = this.sortText; break; | |
| 1002 | - if( strchr(zColumnTypes,'T') ){ | |
| 1003 | - @ case "T": sortFn = this.sortReverseText; break; | |
| 1004 | - } | |
| 1005 | - if( strchr(zColumnTypes,'k') ){ | |
| 1006 | - @ case "k": sortFn = this.sortKey; break; | |
| 1007 | - } | |
| 1008 | - if( strchr(zColumnTypes,'K') ){ | |
| 1009 | - @ case "K": sortFn = this.sortReverseKey; break; | |
| 1010 | - } | |
| 1011 | - @ default: return; | |
| 1012 | - @ } | |
| 1013 | - @ this.sortIndex = column; | |
| 1014 | - @ var newRows = new Array(); | |
| 1015 | - @ for (j = 0; j < this.tbody[0].rows.length; j++) { | |
| 1016 | - @ newRows[j] = this.tbody[0].rows[j]; | |
| 1017 | - @ } | |
| 1018 | - @ if( this.sortIndex==Math.abs(this.prevColumn)-1 ){ | |
| 1019 | - @ newRows.reverse(); | |
| 1020 | - @ this.prevColumn = -this.prevColumn; | |
| 1021 | - @ }else{ | |
| 1022 | - @ newRows.sort(sortFn); | |
| 1023 | - @ this.prevColumn = this.sortIndex+1; | |
| 1024 | - @ } | |
| 1025 | - @ for (i=0;i<newRows.length;i++) { | |
| 1026 | - @ this.tbody[0].appendChild(newRows[i]); | |
| 1027 | - @ } | |
| 1028 | - @ this.setHdrIcons(); | |
| 1029 | - @ } | |
| 1030 | - @ this.setHdrIcons = function() { | |
| 1031 | - @ for (var i=0; i<this.hdrRow.cells.length; i++) { | |
| 1032 | - @ if( this.columnTypes[i]=='x' ) continue; | |
| 1033 | - @ var sortType; | |
| 1034 | - @ if( this.prevColumn==i+1 ){ | |
| 1035 | - @ sortType = 'asc'; | |
| 1036 | - @ }else if( this.prevColumn==(-1-i) ){ | |
| 1037 | - @ sortType = 'desc' | |
| 1038 | - @ }else{ | |
| 1039 | - @ sortType = 'none'; | |
| 1040 | - @ } | |
| 1041 | - @ var hdrCell = this.hdrRow.cells[i]; | |
| 1042 | - @ var clsName = hdrCell.className.replace(/\s*\bsort\s*\w+/, ''); | |
| 1043 | - @ clsName += ' sort ' + sortType; | |
| 1044 | - @ hdrCell.className = clsName; | |
| 1045 | - @ } | |
| 1046 | - @ } | |
| 1047 | - @ this.sortText = function(a,b) { | |
| 1048 | - @ var i = thisObject.sortIndex; | |
| 1049 | - @ aa = a.cells[i].textContent.replace(/^\W+/,'').toLowerCase(); | |
| 1050 | - @ bb = b.cells[i].textContent.replace(/^\W+/,'').toLowerCase(); | |
| 1051 | - @ if(aa<bb) return -1; | |
| 1052 | - @ if(aa==bb) return a.rowIndex-b.rowIndex; | |
| 1053 | - @ return 1; | |
| 1054 | - @ } | |
| 1055 | - if( strchr(zColumnTypes,'T') ){ | |
| 1056 | - @ this.sortReverseText = function(a,b) { | |
| 1057 | - @ var i = thisObject.sortIndex; | |
| 1058 | - @ aa = a.cells[i].textContent.replace(/^\W+/,'').toLowerCase(); | |
| 1059 | - @ bb = b.cells[i].textContent.replace(/^\W+/,'').toLowerCase(); | |
| 1060 | - @ if(aa<bb) return +1; | |
| 1061 | - @ if(aa==bb) return a.rowIndex-b.rowIndex; | |
| 1062 | - @ return -1; | |
| 1063 | - @ } | |
| 1064 | - } | |
| 1065 | - if( strchr(zColumnTypes,'n') ){ | |
| 1066 | - @ this.sortNumeric = function(a,b) { | |
| 1067 | - @ var i = thisObject.sortIndex; | |
| 1068 | - @ aa = parseFloat(a.cells[i].textContent); | |
| 1069 | - @ if (isNaN(aa)) aa = 0; | |
| 1070 | - @ bb = parseFloat(b.cells[i].textContent); | |
| 1071 | - @ if (isNaN(bb)) bb = 0; | |
| 1072 | - @ if(aa==bb) return a.rowIndex-b.rowIndex; | |
| 1073 | - @ return aa-bb; | |
| 1074 | - @ } | |
| 1075 | - } | |
| 1076 | - if( strchr(zColumnTypes,'N') ){ | |
| 1077 | - @ this.sortReverseNumeric = function(a,b) { | |
| 1078 | - @ var i = thisObject.sortIndex; | |
| 1079 | - @ aa = parseFloat(a.cells[i].textContent); | |
| 1080 | - @ if (isNaN(aa)) aa = 0; | |
| 1081 | - @ bb = parseFloat(b.cells[i].textContent); | |
| 1082 | - @ if (isNaN(bb)) bb = 0; | |
| 1083 | - @ if(aa==bb) return a.rowIndex-b.rowIndex; | |
| 1084 | - @ return bb-aa; | |
| 1085 | - @ } | |
| 1086 | - } | |
| 1087 | - if( strchr(zColumnTypes,'k') ){ | |
| 1088 | - @ this.sortKey = function(a,b) { | |
| 1089 | - @ var i = thisObject.sortIndex; | |
| 1090 | - @ aa = a.cells[i].getAttribute("data-sortkey"); | |
| 1091 | - @ bb = b.cells[i].getAttribute("data-sortkey"); | |
| 1092 | - @ if(aa<bb) return -1; | |
| 1093 | - @ if(aa==bb) return a.rowIndex-b.rowIndex; | |
| 1094 | - @ return 1; | |
| 1095 | - @ } | |
| 1096 | - } | |
| 1097 | - if( strchr(zColumnTypes,'K') ){ | |
| 1098 | - @ this.sortReverseKey = function(a,b) { | |
| 1099 | - @ var i = thisObject.sortIndex; | |
| 1100 | - @ aa = a.cells[i].getAttribute("data-sortkey"); | |
| 1101 | - @ bb = b.cells[i].getAttribute("data-sortkey"); | |
| 1102 | - @ if(aa<bb) return +1; | |
| 1103 | - @ if(aa==bb) return a.rowIndex-b.rowIndex; | |
| 1104 | - @ return -1; | |
| 1105 | - @ } | |
| 1106 | - } | |
| 1107 | - @ var x = tableEl.getElementsByTagName('thead'); | |
| 1108 | - @ if(!(this.tbody && this.tbody[0].rows && this.tbody[0].rows.length>0)){ | |
| 1109 | - @ return; | |
| 1110 | - @ } | |
| 1111 | - @ if(x && x[0].rows && x[0].rows.length > 0) { | |
| 1112 | - @ this.hdrRow = x[0].rows[0]; | |
| 1113 | - @ } else { | |
| 1114 | - @ return; | |
| 1115 | - @ } | |
| 1116 | - @ var thisObject = this; | |
| 1117 | - @ this.prevColumn = initSort; | |
| 1118 | - @ for (var i=0; i<this.hdrRow.cells.length; i++) { | |
| 1119 | - @ if( columnTypes[i]=='x' ) continue; | |
| 1120 | - @ var hdrcell = this.hdrRow.cells[i]; | |
| 1121 | - @ hdrcell.sTable = this; | |
| 1122 | - @ hdrcell.style.cursor = "pointer"; | |
| 1123 | - @ hdrcell.sortType = columnTypes[i] || 't'; | |
| 1124 | - @ hdrcell.onclick = function () { | |
| 1125 | - @ this.sTable.sort(this); | |
| 1126 | - @ return false; | |
| 1127 | - @ } | |
| 1128 | - @ } | |
| 1129 | - @ this.setHdrIcons() | |
| 1130 | - @ } | |
| 1131 | - @ var t = new SortableTable(gebi("%s(zTableId)"),"%s(zColumnTypes)",%d(iInitSort)); | |
| 1132 | - @ </script> | |
| 1133 | -} | |
| 1134 | - | |
| 1135 | 950 | |
| 1136 | 951 | /* |
| 1137 | 952 | ** WEBPAGE: rptview |
| 1138 | 953 | ** |
| 1139 | 954 | ** Generate a report. The rn query parameter is the report number |
| @@ -1211,12 +1026,12 @@ | ||
| 1211 | 1026 | style_submenu_element("New Ticket", "%s/tktnew", g.zTop); |
| 1212 | 1027 | } |
| 1213 | 1028 | style_header("%s", zTitle); |
| 1214 | 1029 | output_color_key(zClrKey, 1, |
| 1215 | 1030 | "border=\"0\" cellpadding=\"3\" cellspacing=\"0\" class=\"report\""); |
| 1216 | - @ <table border="1" cellpadding="2" cellspacing="0" class="report" | |
| 1217 | - @ id="reportTable"> | |
| 1031 | + @ <table border="1" cellpadding="2" cellspacing="0" class="report sortable" | |
| 1032 | + @ data-column-types='' data-init-sort='0'> | |
| 1218 | 1033 | sState.rn = rn; |
| 1219 | 1034 | sState.nCount = 0; |
| 1220 | 1035 | report_restrict_sql(&zErr1); |
| 1221 | 1036 | db_exec_readonly(g.db, zSql, generate_html, &sState, &zErr2); |
| 1222 | 1037 | report_unrestrict_sql(); |
| @@ -1224,11 +1039,11 @@ | ||
| 1224 | 1039 | if( zErr1 ){ |
| 1225 | 1040 | @ <p class="reportError">Error: %h(zErr1)</p> |
| 1226 | 1041 | }else if( zErr2 ){ |
| 1227 | 1042 | @ <p class="reportError">Error: %h(zErr2)</p> |
| 1228 | 1043 | } |
| 1229 | - output_table_sorting_javascript("reportTable","",0); | |
| 1044 | + style_table_sorter(); | |
| 1230 | 1045 | style_footer(); |
| 1231 | 1046 | }else{ |
| 1232 | 1047 | report_restrict_sql(&zErr1); |
| 1233 | 1048 | db_exec_readonly(g.db, zSql, output_tab_separated, &count, &zErr2); |
| 1234 | 1049 | report_unrestrict_sql(); |
| 1235 | 1050 |
| --- src/report.c | |
| +++ src/report.c | |
| @@ -945,195 +945,10 @@ | |
| 945 | } |
| 946 | rc = sqlite3_finalize(pStmt); |
| 947 | fossil_free((void *)azVals); |
| 948 | return rc; |
| 949 | } |
| 950 | |
| 951 | /* |
| 952 | ** Output Javascript code that will enables sorting of the table with |
| 953 | ** the id zTableId by clicking. |
| 954 | ** |
| 955 | ** The javascript was originally derived from: |
| 956 | ** |
| 957 | ** http://www.webtoolkit.info/sortable-html-table.html |
| 958 | ** |
| 959 | ** But there have been extensive modifications. |
| 960 | ** |
| 961 | ** This variation allows column types to be expressed using the second |
| 962 | ** argument. Each character of the second argument represent a column. |
| 963 | ** |
| 964 | ** t Sort by text |
| 965 | ** n Sort numerically |
| 966 | ** k Sort by the data-sortkey property |
| 967 | ** x This column is not sortable |
| 968 | ** |
| 969 | ** Capital letters mean sort in reverse order. |
| 970 | ** If there are fewer characters in zColumnTypes[] than their are columns, |
| 971 | ** then all extra columns assume type "t" (text). |
| 972 | ** |
| 973 | ** The third parameter is the column that was initially sorted (using 1-based |
| 974 | ** column numbers, like SQL). Make this value 0 if none of the columns are |
| 975 | ** initially sorted. Make the value negative if the column is initially sorted |
| 976 | ** in reverse order. |
| 977 | ** |
| 978 | ** Clicking on the same column header twice in a row inverts the sort. |
| 979 | */ |
| 980 | void output_table_sorting_javascript( |
| 981 | const char *zTableId, /* ID of table to sort */ |
| 982 | const char *zColumnTypes, /* String for column types */ |
| 983 | int iInitSort /* Initially sorted column. Leftmost is 1. 0 for NONE */ |
| 984 | ){ |
| 985 | @ <script> |
| 986 | @ function SortableTable(tableEl,columnTypes,initSort){ |
| 987 | @ this.tbody = tableEl.getElementsByTagName('tbody'); |
| 988 | @ this.columnTypes = columnTypes; |
| 989 | @ var ncols = tableEl.rows[0].cells.length; |
| 990 | @ for(var i = columnTypes.length; i<=ncols; i++){this.columnTypes += 't';} |
| 991 | @ this.sort = function (cell) { |
| 992 | @ var column = cell.cellIndex; |
| 993 | @ var sortFn; |
| 994 | @ switch( cell.sortType ){ |
| 995 | if( strchr(zColumnTypes,'n') ){ |
| 996 | @ case "n": sortFn = this.sortNumeric; break; |
| 997 | } |
| 998 | if( strchr(zColumnTypes,'N') ){ |
| 999 | @ case "N": sortFn = this.sortReverseNumeric; break; |
| 1000 | } |
| 1001 | @ case "t": sortFn = this.sortText; break; |
| 1002 | if( strchr(zColumnTypes,'T') ){ |
| 1003 | @ case "T": sortFn = this.sortReverseText; break; |
| 1004 | } |
| 1005 | if( strchr(zColumnTypes,'k') ){ |
| 1006 | @ case "k": sortFn = this.sortKey; break; |
| 1007 | } |
| 1008 | if( strchr(zColumnTypes,'K') ){ |
| 1009 | @ case "K": sortFn = this.sortReverseKey; break; |
| 1010 | } |
| 1011 | @ default: return; |
| 1012 | @ } |
| 1013 | @ this.sortIndex = column; |
| 1014 | @ var newRows = new Array(); |
| 1015 | @ for (j = 0; j < this.tbody[0].rows.length; j++) { |
| 1016 | @ newRows[j] = this.tbody[0].rows[j]; |
| 1017 | @ } |
| 1018 | @ if( this.sortIndex==Math.abs(this.prevColumn)-1 ){ |
| 1019 | @ newRows.reverse(); |
| 1020 | @ this.prevColumn = -this.prevColumn; |
| 1021 | @ }else{ |
| 1022 | @ newRows.sort(sortFn); |
| 1023 | @ this.prevColumn = this.sortIndex+1; |
| 1024 | @ } |
| 1025 | @ for (i=0;i<newRows.length;i++) { |
| 1026 | @ this.tbody[0].appendChild(newRows[i]); |
| 1027 | @ } |
| 1028 | @ this.setHdrIcons(); |
| 1029 | @ } |
| 1030 | @ this.setHdrIcons = function() { |
| 1031 | @ for (var i=0; i<this.hdrRow.cells.length; i++) { |
| 1032 | @ if( this.columnTypes[i]=='x' ) continue; |
| 1033 | @ var sortType; |
| 1034 | @ if( this.prevColumn==i+1 ){ |
| 1035 | @ sortType = 'asc'; |
| 1036 | @ }else if( this.prevColumn==(-1-i) ){ |
| 1037 | @ sortType = 'desc' |
| 1038 | @ }else{ |
| 1039 | @ sortType = 'none'; |
| 1040 | @ } |
| 1041 | @ var hdrCell = this.hdrRow.cells[i]; |
| 1042 | @ var clsName = hdrCell.className.replace(/\s*\bsort\s*\w+/, ''); |
| 1043 | @ clsName += ' sort ' + sortType; |
| 1044 | @ hdrCell.className = clsName; |
| 1045 | @ } |
| 1046 | @ } |
| 1047 | @ this.sortText = function(a,b) { |
| 1048 | @ var i = thisObject.sortIndex; |
| 1049 | @ aa = a.cells[i].textContent.replace(/^\W+/,'').toLowerCase(); |
| 1050 | @ bb = b.cells[i].textContent.replace(/^\W+/,'').toLowerCase(); |
| 1051 | @ if(aa<bb) return -1; |
| 1052 | @ if(aa==bb) return a.rowIndex-b.rowIndex; |
| 1053 | @ return 1; |
| 1054 | @ } |
| 1055 | if( strchr(zColumnTypes,'T') ){ |
| 1056 | @ this.sortReverseText = function(a,b) { |
| 1057 | @ var i = thisObject.sortIndex; |
| 1058 | @ aa = a.cells[i].textContent.replace(/^\W+/,'').toLowerCase(); |
| 1059 | @ bb = b.cells[i].textContent.replace(/^\W+/,'').toLowerCase(); |
| 1060 | @ if(aa<bb) return +1; |
| 1061 | @ if(aa==bb) return a.rowIndex-b.rowIndex; |
| 1062 | @ return -1; |
| 1063 | @ } |
| 1064 | } |
| 1065 | if( strchr(zColumnTypes,'n') ){ |
| 1066 | @ this.sortNumeric = function(a,b) { |
| 1067 | @ var i = thisObject.sortIndex; |
| 1068 | @ aa = parseFloat(a.cells[i].textContent); |
| 1069 | @ if (isNaN(aa)) aa = 0; |
| 1070 | @ bb = parseFloat(b.cells[i].textContent); |
| 1071 | @ if (isNaN(bb)) bb = 0; |
| 1072 | @ if(aa==bb) return a.rowIndex-b.rowIndex; |
| 1073 | @ return aa-bb; |
| 1074 | @ } |
| 1075 | } |
| 1076 | if( strchr(zColumnTypes,'N') ){ |
| 1077 | @ this.sortReverseNumeric = function(a,b) { |
| 1078 | @ var i = thisObject.sortIndex; |
| 1079 | @ aa = parseFloat(a.cells[i].textContent); |
| 1080 | @ if (isNaN(aa)) aa = 0; |
| 1081 | @ bb = parseFloat(b.cells[i].textContent); |
| 1082 | @ if (isNaN(bb)) bb = 0; |
| 1083 | @ if(aa==bb) return a.rowIndex-b.rowIndex; |
| 1084 | @ return bb-aa; |
| 1085 | @ } |
| 1086 | } |
| 1087 | if( strchr(zColumnTypes,'k') ){ |
| 1088 | @ this.sortKey = function(a,b) { |
| 1089 | @ var i = thisObject.sortIndex; |
| 1090 | @ aa = a.cells[i].getAttribute("data-sortkey"); |
| 1091 | @ bb = b.cells[i].getAttribute("data-sortkey"); |
| 1092 | @ if(aa<bb) return -1; |
| 1093 | @ if(aa==bb) return a.rowIndex-b.rowIndex; |
| 1094 | @ return 1; |
| 1095 | @ } |
| 1096 | } |
| 1097 | if( strchr(zColumnTypes,'K') ){ |
| 1098 | @ this.sortReverseKey = function(a,b) { |
| 1099 | @ var i = thisObject.sortIndex; |
| 1100 | @ aa = a.cells[i].getAttribute("data-sortkey"); |
| 1101 | @ bb = b.cells[i].getAttribute("data-sortkey"); |
| 1102 | @ if(aa<bb) return +1; |
| 1103 | @ if(aa==bb) return a.rowIndex-b.rowIndex; |
| 1104 | @ return -1; |
| 1105 | @ } |
| 1106 | } |
| 1107 | @ var x = tableEl.getElementsByTagName('thead'); |
| 1108 | @ if(!(this.tbody && this.tbody[0].rows && this.tbody[0].rows.length>0)){ |
| 1109 | @ return; |
| 1110 | @ } |
| 1111 | @ if(x && x[0].rows && x[0].rows.length > 0) { |
| 1112 | @ this.hdrRow = x[0].rows[0]; |
| 1113 | @ } else { |
| 1114 | @ return; |
| 1115 | @ } |
| 1116 | @ var thisObject = this; |
| 1117 | @ this.prevColumn = initSort; |
| 1118 | @ for (var i=0; i<this.hdrRow.cells.length; i++) { |
| 1119 | @ if( columnTypes[i]=='x' ) continue; |
| 1120 | @ var hdrcell = this.hdrRow.cells[i]; |
| 1121 | @ hdrcell.sTable = this; |
| 1122 | @ hdrcell.style.cursor = "pointer"; |
| 1123 | @ hdrcell.sortType = columnTypes[i] || 't'; |
| 1124 | @ hdrcell.onclick = function () { |
| 1125 | @ this.sTable.sort(this); |
| 1126 | @ return false; |
| 1127 | @ } |
| 1128 | @ } |
| 1129 | @ this.setHdrIcons() |
| 1130 | @ } |
| 1131 | @ var t = new SortableTable(gebi("%s(zTableId)"),"%s(zColumnTypes)",%d(iInitSort)); |
| 1132 | @ </script> |
| 1133 | } |
| 1134 | |
| 1135 | |
| 1136 | /* |
| 1137 | ** WEBPAGE: rptview |
| 1138 | ** |
| 1139 | ** Generate a report. The rn query parameter is the report number |
| @@ -1211,12 +1026,12 @@ | |
| 1211 | style_submenu_element("New Ticket", "%s/tktnew", g.zTop); |
| 1212 | } |
| 1213 | style_header("%s", zTitle); |
| 1214 | output_color_key(zClrKey, 1, |
| 1215 | "border=\"0\" cellpadding=\"3\" cellspacing=\"0\" class=\"report\""); |
| 1216 | @ <table border="1" cellpadding="2" cellspacing="0" class="report" |
| 1217 | @ id="reportTable"> |
| 1218 | sState.rn = rn; |
| 1219 | sState.nCount = 0; |
| 1220 | report_restrict_sql(&zErr1); |
| 1221 | db_exec_readonly(g.db, zSql, generate_html, &sState, &zErr2); |
| 1222 | report_unrestrict_sql(); |
| @@ -1224,11 +1039,11 @@ | |
| 1224 | if( zErr1 ){ |
| 1225 | @ <p class="reportError">Error: %h(zErr1)</p> |
| 1226 | }else if( zErr2 ){ |
| 1227 | @ <p class="reportError">Error: %h(zErr2)</p> |
| 1228 | } |
| 1229 | output_table_sorting_javascript("reportTable","",0); |
| 1230 | style_footer(); |
| 1231 | }else{ |
| 1232 | report_restrict_sql(&zErr1); |
| 1233 | db_exec_readonly(g.db, zSql, output_tab_separated, &count, &zErr2); |
| 1234 | report_unrestrict_sql(); |
| 1235 |
| --- src/report.c | |
| +++ src/report.c | |
| @@ -945,195 +945,10 @@ | |
| 945 | } |
| 946 | rc = sqlite3_finalize(pStmt); |
| 947 | fossil_free((void *)azVals); |
| 948 | return rc; |
| 949 | } |
| 950 | |
| 951 | /* |
| 952 | ** WEBPAGE: rptview |
| 953 | ** |
| 954 | ** Generate a report. The rn query parameter is the report number |
| @@ -1211,12 +1026,12 @@ | |
| 1026 | style_submenu_element("New Ticket", "%s/tktnew", g.zTop); |
| 1027 | } |
| 1028 | style_header("%s", zTitle); |
| 1029 | output_color_key(zClrKey, 1, |
| 1030 | "border=\"0\" cellpadding=\"3\" cellspacing=\"0\" class=\"report\""); |
| 1031 | @ <table border="1" cellpadding="2" cellspacing="0" class="report sortable" |
| 1032 | @ data-column-types='' data-init-sort='0'> |
| 1033 | sState.rn = rn; |
| 1034 | sState.nCount = 0; |
| 1035 | report_restrict_sql(&zErr1); |
| 1036 | db_exec_readonly(g.db, zSql, generate_html, &sState, &zErr2); |
| 1037 | report_unrestrict_sql(); |
| @@ -1224,11 +1039,11 @@ | |
| 1039 | if( zErr1 ){ |
| 1040 | @ <p class="reportError">Error: %h(zErr1)</p> |
| 1041 | }else if( zErr2 ){ |
| 1042 | @ <p class="reportError">Error: %h(zErr2)</p> |
| 1043 | } |
| 1044 | style_table_sorter(); |
| 1045 | style_footer(); |
| 1046 | }else{ |
| 1047 | report_restrict_sql(&zErr1); |
| 1048 | db_exec_readonly(g.db, zSql, output_tab_separated, &count, &zErr2); |
| 1049 | report_unrestrict_sql(); |
| 1050 |
+8
-8
| --- src/setup.c | ||
| +++ src/setup.c | ||
| @@ -208,11 +208,12 @@ | ||
| 208 | 208 | }else{ |
| 209 | 209 | style_header("Users With Capabilities \"%h\"", zWith); |
| 210 | 210 | } |
| 211 | 211 | @ </tbody></table> |
| 212 | 212 | @ <div class='section'>Users</div> |
| 213 | - @ <table border=1 cellpadding=2 cellspacing=0 class='userTable' id='userlist'> | |
| 213 | + @ <table border=1 cellpadding=2 cellspacing=0 class='userTable sortable' \ | |
| 214 | + @ data-column-types='nktxTTK' data-init-sort='2'> | |
| 214 | 215 | @ <thead><tr> |
| 215 | 216 | @ <th>ID<th>Login Name<th>Caps<th>Info<th>Date<th>Expire<th>Last Login</tr></thead> |
| 216 | 217 | @ <tbody> |
| 217 | 218 | db_multi_exec( |
| 218 | 219 | "CREATE TEMP TABLE lastAccess(uname TEXT PRIMARY KEY, atime REAL) WITHOUT ROWID;" |
| @@ -267,11 +268,11 @@ | ||
| 267 | 268 | @ </tr> |
| 268 | 269 | fossil_free(zAge); |
| 269 | 270 | } |
| 270 | 271 | @ </tbody></table> |
| 271 | 272 | db_finalize(&s); |
| 272 | - output_table_sorting_javascript("userlist","nktxTTK",2); | |
| 273 | + style_table_sorter(); | |
| 273 | 274 | style_footer(); |
| 274 | 275 | } |
| 275 | 276 | |
| 276 | 277 | /* |
| 277 | 278 | ** Render the user-capability table |
| @@ -1410,11 +1411,11 @@ | ||
| 1410 | 1411 | @ IP octets</a> in the login cookie across all repositories in the |
| 1411 | 1412 | @ same Login Group. |
| 1412 | 1413 | @ <hr /><h2>Implementation Details</h2> |
| 1413 | 1414 | @ <p>The following are fields from the CONFIG table related to login-groups, |
| 1414 | 1415 | @ provided here for instructional and debugging purposes:</p> |
| 1415 | - @ <table border='1' id='configTab'> | |
| 1416 | + @ <table border='1' class='sortable' data-column-types='ttt' data-init-sort='1'> | |
| 1416 | 1417 | @ <thead><tr> |
| 1417 | 1418 | @ <th>Config.Name<th>Config.Value<th>Config.mtime</tr> |
| 1418 | 1419 | @ </thead><tbody> |
| 1419 | 1420 | db_prepare(&q, "SELECT name, value, datetime(mtime,'unixepoch') FROM config" |
| 1420 | 1421 | " WHERE name GLOB 'peer-*'" |
| @@ -1426,11 +1427,11 @@ | ||
| 1426 | 1427 | @ <td>%h(db_column_text(&q,1))</td> |
| 1427 | 1428 | @ <td>%h(db_column_text(&q,2))</td></tr> |
| 1428 | 1429 | } |
| 1429 | 1430 | db_finalize(&q); |
| 1430 | 1431 | @ </tbody></table> |
| 1431 | - output_table_sorting_javascript("configTab","ttt",1); | |
| 1432 | + style_table_sorter(); | |
| 1432 | 1433 | } |
| 1433 | 1434 | style_footer(); |
| 1434 | 1435 | } |
| 1435 | 1436 | |
| 1436 | 1437 | /* |
| @@ -2242,12 +2243,13 @@ | ||
| 2242 | 2243 | } |
| 2243 | 2244 | db_prepare(&stLog, |
| 2244 | 2245 | "SELECT datetime(time,'unixepoch'), who, page, what " |
| 2245 | 2246 | "FROM admin_log " |
| 2246 | 2247 | "ORDER BY time DESC"); |
| 2247 | - | |
| 2248 | - @ <table id="adminLogTable" class="adminLogTable" width="100%%"> | |
| 2248 | + style_table_sorter(); | |
| 2249 | + @ <table class="sortable adminLogTable" width="100%%" \ | |
| 2250 | + @ data-column-types='Tttx' data-init-sort='1'> | |
| 2249 | 2251 | @ <thead> |
| 2250 | 2252 | @ <th>Time</th> |
| 2251 | 2253 | @ <th>User</th> |
| 2252 | 2254 | @ <th>Page</th> |
| 2253 | 2255 | @ <th width="60%%">Message</th> |
| @@ -2269,12 +2271,10 @@ | ||
| 2269 | 2271 | } |
| 2270 | 2272 | @ </tbody></table> |
| 2271 | 2273 | if( counter>ofst+limit ){ |
| 2272 | 2274 | @ <p><a href="admin_log?n=%d(limit)&x=%d(limit+ofst)">[Older]</a></p> |
| 2273 | 2275 | } |
| 2274 | - | |
| 2275 | - output_table_sorting_javascript("adminLogTable", "Tttx", 1); | |
| 2276 | 2276 | style_footer(); |
| 2277 | 2277 | } |
| 2278 | 2278 | |
| 2279 | 2279 | /* |
| 2280 | 2280 | ** WEBPAGE: srchsetup |
| 2281 | 2281 | |
| 2282 | 2282 | ADDED src/sorttable.js |
| --- src/setup.c | |
| +++ src/setup.c | |
| @@ -208,11 +208,12 @@ | |
| 208 | }else{ |
| 209 | style_header("Users With Capabilities \"%h\"", zWith); |
| 210 | } |
| 211 | @ </tbody></table> |
| 212 | @ <div class='section'>Users</div> |
| 213 | @ <table border=1 cellpadding=2 cellspacing=0 class='userTable' id='userlist'> |
| 214 | @ <thead><tr> |
| 215 | @ <th>ID<th>Login Name<th>Caps<th>Info<th>Date<th>Expire<th>Last Login</tr></thead> |
| 216 | @ <tbody> |
| 217 | db_multi_exec( |
| 218 | "CREATE TEMP TABLE lastAccess(uname TEXT PRIMARY KEY, atime REAL) WITHOUT ROWID;" |
| @@ -267,11 +268,11 @@ | |
| 267 | @ </tr> |
| 268 | fossil_free(zAge); |
| 269 | } |
| 270 | @ </tbody></table> |
| 271 | db_finalize(&s); |
| 272 | output_table_sorting_javascript("userlist","nktxTTK",2); |
| 273 | style_footer(); |
| 274 | } |
| 275 | |
| 276 | /* |
| 277 | ** Render the user-capability table |
| @@ -1410,11 +1411,11 @@ | |
| 1410 | @ IP octets</a> in the login cookie across all repositories in the |
| 1411 | @ same Login Group. |
| 1412 | @ <hr /><h2>Implementation Details</h2> |
| 1413 | @ <p>The following are fields from the CONFIG table related to login-groups, |
| 1414 | @ provided here for instructional and debugging purposes:</p> |
| 1415 | @ <table border='1' id='configTab'> |
| 1416 | @ <thead><tr> |
| 1417 | @ <th>Config.Name<th>Config.Value<th>Config.mtime</tr> |
| 1418 | @ </thead><tbody> |
| 1419 | db_prepare(&q, "SELECT name, value, datetime(mtime,'unixepoch') FROM config" |
| 1420 | " WHERE name GLOB 'peer-*'" |
| @@ -1426,11 +1427,11 @@ | |
| 1426 | @ <td>%h(db_column_text(&q,1))</td> |
| 1427 | @ <td>%h(db_column_text(&q,2))</td></tr> |
| 1428 | } |
| 1429 | db_finalize(&q); |
| 1430 | @ </tbody></table> |
| 1431 | output_table_sorting_javascript("configTab","ttt",1); |
| 1432 | } |
| 1433 | style_footer(); |
| 1434 | } |
| 1435 | |
| 1436 | /* |
| @@ -2242,12 +2243,13 @@ | |
| 2242 | } |
| 2243 | db_prepare(&stLog, |
| 2244 | "SELECT datetime(time,'unixepoch'), who, page, what " |
| 2245 | "FROM admin_log " |
| 2246 | "ORDER BY time DESC"); |
| 2247 | |
| 2248 | @ <table id="adminLogTable" class="adminLogTable" width="100%%"> |
| 2249 | @ <thead> |
| 2250 | @ <th>Time</th> |
| 2251 | @ <th>User</th> |
| 2252 | @ <th>Page</th> |
| 2253 | @ <th width="60%%">Message</th> |
| @@ -2269,12 +2271,10 @@ | |
| 2269 | } |
| 2270 | @ </tbody></table> |
| 2271 | if( counter>ofst+limit ){ |
| 2272 | @ <p><a href="admin_log?n=%d(limit)&x=%d(limit+ofst)">[Older]</a></p> |
| 2273 | } |
| 2274 | |
| 2275 | output_table_sorting_javascript("adminLogTable", "Tttx", 1); |
| 2276 | style_footer(); |
| 2277 | } |
| 2278 | |
| 2279 | /* |
| 2280 | ** WEBPAGE: srchsetup |
| 2281 | |
| 2282 | DDED src/sorttable.js |
| --- src/setup.c | |
| +++ src/setup.c | |
| @@ -208,11 +208,12 @@ | |
| 208 | }else{ |
| 209 | style_header("Users With Capabilities \"%h\"", zWith); |
| 210 | } |
| 211 | @ </tbody></table> |
| 212 | @ <div class='section'>Users</div> |
| 213 | @ <table border=1 cellpadding=2 cellspacing=0 class='userTable sortable' \ |
| 214 | @ data-column-types='nktxTTK' data-init-sort='2'> |
| 215 | @ <thead><tr> |
| 216 | @ <th>ID<th>Login Name<th>Caps<th>Info<th>Date<th>Expire<th>Last Login</tr></thead> |
| 217 | @ <tbody> |
| 218 | db_multi_exec( |
| 219 | "CREATE TEMP TABLE lastAccess(uname TEXT PRIMARY KEY, atime REAL) WITHOUT ROWID;" |
| @@ -267,11 +268,11 @@ | |
| 268 | @ </tr> |
| 269 | fossil_free(zAge); |
| 270 | } |
| 271 | @ </tbody></table> |
| 272 | db_finalize(&s); |
| 273 | style_table_sorter(); |
| 274 | style_footer(); |
| 275 | } |
| 276 | |
| 277 | /* |
| 278 | ** Render the user-capability table |
| @@ -1410,11 +1411,11 @@ | |
| 1411 | @ IP octets</a> in the login cookie across all repositories in the |
| 1412 | @ same Login Group. |
| 1413 | @ <hr /><h2>Implementation Details</h2> |
| 1414 | @ <p>The following are fields from the CONFIG table related to login-groups, |
| 1415 | @ provided here for instructional and debugging purposes:</p> |
| 1416 | @ <table border='1' class='sortable' data-column-types='ttt' data-init-sort='1'> |
| 1417 | @ <thead><tr> |
| 1418 | @ <th>Config.Name<th>Config.Value<th>Config.mtime</tr> |
| 1419 | @ </thead><tbody> |
| 1420 | db_prepare(&q, "SELECT name, value, datetime(mtime,'unixepoch') FROM config" |
| 1421 | " WHERE name GLOB 'peer-*'" |
| @@ -1426,11 +1427,11 @@ | |
| 1427 | @ <td>%h(db_column_text(&q,1))</td> |
| 1428 | @ <td>%h(db_column_text(&q,2))</td></tr> |
| 1429 | } |
| 1430 | db_finalize(&q); |
| 1431 | @ </tbody></table> |
| 1432 | style_table_sorter(); |
| 1433 | } |
| 1434 | style_footer(); |
| 1435 | } |
| 1436 | |
| 1437 | /* |
| @@ -2242,12 +2243,13 @@ | |
| 2243 | } |
| 2244 | db_prepare(&stLog, |
| 2245 | "SELECT datetime(time,'unixepoch'), who, page, what " |
| 2246 | "FROM admin_log " |
| 2247 | "ORDER BY time DESC"); |
| 2248 | style_table_sorter(); |
| 2249 | @ <table class="sortable adminLogTable" width="100%%" \ |
| 2250 | @ data-column-types='Tttx' data-init-sort='1'> |
| 2251 | @ <thead> |
| 2252 | @ <th>Time</th> |
| 2253 | @ <th>User</th> |
| 2254 | @ <th>Page</th> |
| 2255 | @ <th width="60%%">Message</th> |
| @@ -2269,12 +2271,10 @@ | |
| 2271 | } |
| 2272 | @ </tbody></table> |
| 2273 | if( counter>ofst+limit ){ |
| 2274 | @ <p><a href="admin_log?n=%d(limit)&x=%d(limit+ofst)">[Older]</a></p> |
| 2275 | } |
| 2276 | style_footer(); |
| 2277 | } |
| 2278 | |
| 2279 | /* |
| 2280 | ** WEBPAGE: srchsetup |
| 2281 | |
| 2282 | DDED src/sorttable.js |
+49
| --- a/src/sorttable.js | ||
| +++ b/src/sorttable.js | ||
| @@ -0,0 +1,49 @@ | ||
| 1 | +: sortFn = this.sortReverseText; b1; | |
| 2 | + aa = a.cells[i]. = columnTypes.length; i<=ncols; i++){this.columnTypes += 't';} | |
| 3 | + this.sort = function (cell) { | |
| 4 | + var column = cell.cellIndex; | |
| 5 | + var sortFn; | |
| 6 | + switch( cell.sortType ){ | |
| 7 | + case "n": sortFn = this.sortNumeric; break; | |
| 8 | + case "N": sortFn = this.sortReverseNumeric; break; | |
| 9 | + : sortFn = this.sortReverseText; break; | |
| 10 | + case "k": sortFn = this.sortKey; break; | |
| 11 | + case "K": sortFn = this.sortReverseKey; break; | |
| 12 | + default: return; | |
| 13 | + } | |
| 14 | + this.sortIndex = column; | |
| 15 | + var newRows = new Array(); | |
| 16 | + for (j = 0; j < this.tbody[0].rows.length; j++) { | |
| 17 | + newRows[j] = this.tbody[0].rows[j]; | |
| 18 | + } | |
| 19 | + if( this.sortIndex==Math.abs(this.prevColumn)-1 ){ | |
| 20 | + newRows.reverse(); | |
| 21 | + this.prevColumn = -this.prevColumn; | |
| 22 | + }else{ | |
| 23 | + newRows.sort(sortFn); | |
| 24 | + this.prevColumn = this.sortIndex+1; | |
| 25 | + } | |
| 26 | + for (i=0;i<newRows.length;i++) { | |
| 27 | + this.tbody[0].appendChild(newRows[i]); | |
| 28 | + } | |
| 29 | + this.setHdrIcons(); | |
| 30 | + } | |
| 31 | + this.setHdrIcons = function() { | |
| 32 | + for (var i=0; i<this.hdrRow.cells.length; i++) { | |
| 33 | + if( this.columnTypes[i]=='x' ) continue; | |
| 34 | + var sortType; | |
| 35 | + if( this.prevColumn==i+1 ){ | |
| 36 | + sortType = 'asc'; | |
| 37 | + }else if( this.prevColumn==(-1-i) ){ | |
| 38 | + sortType = 'desc' | |
| 39 | + }else{ | |
| 40 | + sortType = 'none'; | |
| 41 | + } | |
| 42 | + var hdrCell = this.hdrRow.cells[i]; | |
| 43 | + var clsName = hdrCell.className.replace(/\s*\bsort\s*\w+/, ''); | |
| 44 | + clsName += ' sort ' + sortType; | |
| 45 | + hdrCell.className = clsName; | |
| 46 | + } | |
| 47 | + } | |
| 48 | + this.sortject.sor9710b1ab5d4 */ | |
| 49 | + if |
| --- a/src/sorttable.js | |
| +++ b/src/sorttable.js | |
| @@ -0,0 +1,49 @@ | |
| --- a/src/sorttable.js | |
| +++ b/src/sorttable.js | |
| @@ -0,0 +1,49 @@ | |
| 1 | : sortFn = this.sortReverseText; b1; |
| 2 | aa = a.cells[i]. = columnTypes.length; i<=ncols; i++){this.columnTypes += 't';} |
| 3 | this.sort = function (cell) { |
| 4 | var column = cell.cellIndex; |
| 5 | var sortFn; |
| 6 | switch( cell.sortType ){ |
| 7 | case "n": sortFn = this.sortNumeric; break; |
| 8 | case "N": sortFn = this.sortReverseNumeric; break; |
| 9 | : sortFn = this.sortReverseText; break; |
| 10 | case "k": sortFn = this.sortKey; break; |
| 11 | case "K": sortFn = this.sortReverseKey; break; |
| 12 | default: return; |
| 13 | } |
| 14 | this.sortIndex = column; |
| 15 | var newRows = new Array(); |
| 16 | for (j = 0; j < this.tbody[0].rows.length; j++) { |
| 17 | newRows[j] = this.tbody[0].rows[j]; |
| 18 | } |
| 19 | if( this.sortIndex==Math.abs(this.prevColumn)-1 ){ |
| 20 | newRows.reverse(); |
| 21 | this.prevColumn = -this.prevColumn; |
| 22 | }else{ |
| 23 | newRows.sort(sortFn); |
| 24 | this.prevColumn = this.sortIndex+1; |
| 25 | } |
| 26 | for (i=0;i<newRows.length;i++) { |
| 27 | this.tbody[0].appendChild(newRows[i]); |
| 28 | } |
| 29 | this.setHdrIcons(); |
| 30 | } |
| 31 | this.setHdrIcons = function() { |
| 32 | for (var i=0; i<this.hdrRow.cells.length; i++) { |
| 33 | if( this.columnTypes[i]=='x' ) continue; |
| 34 | var sortType; |
| 35 | if( this.prevColumn==i+1 ){ |
| 36 | sortType = 'asc'; |
| 37 | }else if( this.prevColumn==(-1-i) ){ |
| 38 | sortType = 'desc' |
| 39 | }else{ |
| 40 | sortType = 'none'; |
| 41 | } |
| 42 | var hdrCell = this.hdrRow.cells[i]; |
| 43 | var clsName = hdrCell.className.replace(/\s*\bsort\s*\w+/, ''); |
| 44 | clsName += ' sort ' + sortType; |
| 45 | hdrCell.className = clsName; |
| 46 | } |
| 47 | } |
| 48 | this.sortject.sor9710b1ab5d4 */ |
| 49 | if |
+24
-20
| --- src/statrep.c | ||
| +++ src/statrep.c | ||
| @@ -202,12 +202,18 @@ | ||
| 202 | 202 | @ by year%s(includeMonth ? "/month" : "") |
| 203 | 203 | if( zUserName ){ |
| 204 | 204 | @ for user %h(zUserName) |
| 205 | 205 | } |
| 206 | 206 | @ </h1> |
| 207 | - @ <table class='statistics-report-table-events' border='0' cellpadding='2' | |
| 208 | - @ cellspacing='0' id='statsTable'> | |
| 207 | + @ <table border='0' cellpadding='2' cellspacing='0' \ | |
| 208 | + if( !includeMonth ){ | |
| 209 | + @ class='statistics-report-table-events sortable' \ | |
| 210 | + @ data-column-types='tnx' data-init-sort='0'> | |
| 211 | + style_table_sorter(); | |
| 212 | + }else{ | |
| 213 | + @ class='statistics-report-table-events'> | |
| 214 | + } | |
| 209 | 215 | @ <thead> |
| 210 | 216 | @ <th>%s(zTimeLabel)</th> |
| 211 | 217 | @ <th>Events</th> |
| 212 | 218 | @ <th width='90%%'><!-- relative commits graph --></th> |
| 213 | 219 | @ </thead><tbody> |
| @@ -315,13 +321,10 @@ | ||
| 315 | 321 | int nAvg = iterations ? (nEventTotal/iterations) : 0; |
| 316 | 322 | @ <br /><div>Total events: %d(nEventTotal) |
| 317 | 323 | @ <br />Average per active %s(zAvgLabel): %d(nAvg) |
| 318 | 324 | @ </div> |
| 319 | 325 | } |
| 320 | - if( !includeMonth ){ | |
| 321 | - output_table_sorting_javascript("statsTable","tnx",-1); | |
| 322 | - } | |
| 323 | 326 | } |
| 324 | 327 | |
| 325 | 328 | /* |
| 326 | 329 | ** Implements the "byuser" view for /reports. |
| 327 | 330 | */ |
| @@ -344,12 +347,13 @@ | ||
| 344 | 347 | if( db_int(0, "SELECT count(*) FROM piechart")>=2 ){ |
| 345 | 348 | @ <center><svg width=700 height=400> |
| 346 | 349 | piechart_render(700, 400, PIE_OTHER|PIE_PERCENT); |
| 347 | 350 | @ </svg></centre><hr /> |
| 348 | 351 | } |
| 349 | - @ <table class='statistics-report-table-events' border='0' | |
| 350 | - @ cellpadding='2' cellspacing='0' id='statsTable'> | |
| 352 | + style_table_sorter(); | |
| 353 | + @ <table class='statistics-report-table-events sortable' border='0' \ | |
| 354 | + @ cellpadding='2' cellspacing='0' data-column-types='tkx' data-init-sort='2'> | |
| 351 | 355 | @ <thead><tr> |
| 352 | 356 | @ <th>User</th> |
| 353 | 357 | @ <th>Events</th> |
| 354 | 358 | @ <th width='90%%'><!-- relative commits graph --></th> |
| 355 | 359 | @ </tr></thead><tbody> |
| @@ -390,11 +394,10 @@ | ||
| 390 | 394 | use percent-based graph bars. |
| 391 | 395 | */ |
| 392 | 396 | } |
| 393 | 397 | @ </tbody></table> |
| 394 | 398 | db_finalize(&query); |
| 395 | - output_table_sorting_javascript("statsTable","tkx",2); | |
| 396 | 399 | } |
| 397 | 400 | |
| 398 | 401 | /* |
| 399 | 402 | ** Implements the "byfile" view for /reports. If zUserName is not NULL then the |
| 400 | 403 | ** report is restricted to events created by the named user account. |
| @@ -421,12 +424,13 @@ | ||
| 421 | 424 | @ <h1>Check-ins Per File |
| 422 | 425 | if( zUserName ){ |
| 423 | 426 | @ for user %h(zUserName) |
| 424 | 427 | } |
| 425 | 428 | @ </h1> |
| 426 | - @ <table class='statistics-report-table-events' border='0' | |
| 427 | - @ cellpadding='2' cellspacing='0' id='statsTable'> | |
| 429 | + style_table_sorter(); | |
| 430 | + @ <table class='statistics-report-table-events sortable' border='0' \ | |
| 431 | + @ cellpadding='2' cellspacing='0' data-column-types='tNx' data-init-sort='2'> | |
| 428 | 432 | @ <thead><tr> |
| 429 | 433 | @ <th>File</th> |
| 430 | 434 | @ <th>Check-ins</th> |
| 431 | 435 | @ <th width='90%%'><!-- relative commits graph --></th> |
| 432 | 436 | @ </tr></thead><tbody> |
| @@ -446,11 +450,11 @@ | ||
| 446 | 450 | @ </td> |
| 447 | 451 | @</tr> |
| 448 | 452 | } |
| 449 | 453 | @ </tbody></table> |
| 450 | 454 | db_finalize(&query); |
| 451 | - output_table_sorting_javascript("statsTable","tNx",2); | |
| 455 | + | |
| 452 | 456 | } |
| 453 | 457 | |
| 454 | 458 | /* |
| 455 | 459 | ** Implements the "byweekday" view for /reports. If zUserName is not NULL then |
| 456 | 460 | ** the report is restricted to events created by the named user account. |
| @@ -505,12 +509,13 @@ | ||
| 505 | 509 | if( db_int(0, "SELECT count(*) FROM piechart")>=2 ){ |
| 506 | 510 | @ <center><svg width=700 height=400> |
| 507 | 511 | piechart_render(700, 400, PIE_OTHER|PIE_PERCENT); |
| 508 | 512 | @ </svg></centre><hr /> |
| 509 | 513 | } |
| 510 | - @ <table class='statistics-report-table-events' border='0' | |
| 511 | - @ cellpadding='2' cellspacing='0' id='statsTable'> | |
| 514 | + style_table_sorter(); | |
| 515 | + @ <table class='statistics-report-table-events sortable' border='0' \ | |
| 516 | + @ cellpadding='2' cellspacing='0' data-column-types='ntnx' data-init-sort='1'> | |
| 512 | 517 | @ <thead><tr> |
| 513 | 518 | @ <th>DoW</th> |
| 514 | 519 | @ <th>Day</th> |
| 515 | 520 | @ <th>Events</th> |
| 516 | 521 | @ <th width='90%%'><!-- relative commits graph --></th> |
| @@ -542,11 +547,10 @@ | ||
| 542 | 547 | @ </td> |
| 543 | 548 | @</tr> |
| 544 | 549 | } |
| 545 | 550 | @ </tbody></table> |
| 546 | 551 | db_finalize(&query); |
| 547 | - output_table_sorting_javascript("statsTable","ntnx",1); | |
| 548 | 552 | } |
| 549 | 553 | |
| 550 | 554 | |
| 551 | 555 | /* |
| 552 | 556 | ** Helper for stats_report_by_month_year(), which generates a list of |
| @@ -586,13 +590,14 @@ | ||
| 586 | 590 | @ for the calendar weeks of %h(zYear) |
| 587 | 591 | if( zUserName ){ |
| 588 | 592 | @ for user %h(zUserName) |
| 589 | 593 | } |
| 590 | 594 | @ </h1> |
| 591 | - cgi_printf("<table class='statistics-report-table-events' " | |
| 595 | + style_table_sorter(); | |
| 596 | + cgi_printf("<table class='statistics-report-table-events sortable' " | |
| 592 | 597 | "border='0' cellpadding='2' width='100%%' " |
| 593 | - "cellspacing='0' id='statsTable'>"); | |
| 598 | + "cellspacing='0' data-column-types='tnx' data-init-sort='0'>"); | |
| 594 | 599 | cgi_printf("<thead><tr>" |
| 595 | 600 | "<th>Week</th>" |
| 596 | 601 | "<th>Events</th>" |
| 597 | 602 | "<th width='90%%'><!-- relative commits graph --></th>" |
| 598 | 603 | "</tr></thead>" |
| @@ -637,11 +642,10 @@ | ||
| 637 | 642 | int nAvg = iterations ? (total/iterations) : 0; |
| 638 | 643 | cgi_printf("<br /><div>Total events: %d<br />" |
| 639 | 644 | "Average per active week: %d</div>", |
| 640 | 645 | total, nAvg); |
| 641 | 646 | } |
| 642 | - output_table_sorting_javascript("statsTable","tnx",-1); | |
| 643 | 647 | } |
| 644 | 648 | |
| 645 | 649 | |
| 646 | 650 | /* |
| 647 | 651 | ** Generate a report that shows the most recent change for each user. |
| @@ -650,14 +654,15 @@ | ||
| 650 | 654 | Stmt s; |
| 651 | 655 | double rNow; |
| 652 | 656 | char *zBaseUrl; |
| 653 | 657 | |
| 654 | 658 | stats_report_init_view(); |
| 659 | + style_table_sorter(); | |
| 655 | 660 | @ <h1>Event Summary |
| 656 | 661 | @ (%s(stats_report_label_for_type())) by User</h1> |
| 657 | - @ <table border=1 class='statistics-report-table-events' | |
| 658 | - @ cellpadding=2 cellspacing=0 id='lastchng'> | |
| 662 | + @ <table border=1 class='statistics-report-table-events sortable' \ | |
| 663 | + @ cellpadding=2 cellspacing=0 data-column-types='tNK' data-init-sort='3'> | |
| 659 | 664 | @ <thead><tr> |
| 660 | 665 | @ <th>User<th>Total Changes<th>Last Change</tr></thead> |
| 661 | 666 | @ <tbody> |
| 662 | 667 | zBaseUrl = mprintf("%R/timeline?y=%t&u=", PD("type","ci")); |
| 663 | 668 | db_prepare(&s, |
| @@ -681,11 +686,10 @@ | ||
| 681 | 686 | @ </tr> |
| 682 | 687 | fossil_free(zAge); |
| 683 | 688 | } |
| 684 | 689 | @ </tbody></table> |
| 685 | 690 | db_finalize(&s); |
| 686 | - output_table_sorting_javascript("lastchng","tNK",3); | |
| 687 | 691 | } |
| 688 | 692 | |
| 689 | 693 | |
| 690 | 694 | /* Report types |
| 691 | 695 | */ |
| 692 | 696 |
| --- src/statrep.c | |
| +++ src/statrep.c | |
| @@ -202,12 +202,18 @@ | |
| 202 | @ by year%s(includeMonth ? "/month" : "") |
| 203 | if( zUserName ){ |
| 204 | @ for user %h(zUserName) |
| 205 | } |
| 206 | @ </h1> |
| 207 | @ <table class='statistics-report-table-events' border='0' cellpadding='2' |
| 208 | @ cellspacing='0' id='statsTable'> |
| 209 | @ <thead> |
| 210 | @ <th>%s(zTimeLabel)</th> |
| 211 | @ <th>Events</th> |
| 212 | @ <th width='90%%'><!-- relative commits graph --></th> |
| 213 | @ </thead><tbody> |
| @@ -315,13 +321,10 @@ | |
| 315 | int nAvg = iterations ? (nEventTotal/iterations) : 0; |
| 316 | @ <br /><div>Total events: %d(nEventTotal) |
| 317 | @ <br />Average per active %s(zAvgLabel): %d(nAvg) |
| 318 | @ </div> |
| 319 | } |
| 320 | if( !includeMonth ){ |
| 321 | output_table_sorting_javascript("statsTable","tnx",-1); |
| 322 | } |
| 323 | } |
| 324 | |
| 325 | /* |
| 326 | ** Implements the "byuser" view for /reports. |
| 327 | */ |
| @@ -344,12 +347,13 @@ | |
| 344 | if( db_int(0, "SELECT count(*) FROM piechart")>=2 ){ |
| 345 | @ <center><svg width=700 height=400> |
| 346 | piechart_render(700, 400, PIE_OTHER|PIE_PERCENT); |
| 347 | @ </svg></centre><hr /> |
| 348 | } |
| 349 | @ <table class='statistics-report-table-events' border='0' |
| 350 | @ cellpadding='2' cellspacing='0' id='statsTable'> |
| 351 | @ <thead><tr> |
| 352 | @ <th>User</th> |
| 353 | @ <th>Events</th> |
| 354 | @ <th width='90%%'><!-- relative commits graph --></th> |
| 355 | @ </tr></thead><tbody> |
| @@ -390,11 +394,10 @@ | |
| 390 | use percent-based graph bars. |
| 391 | */ |
| 392 | } |
| 393 | @ </tbody></table> |
| 394 | db_finalize(&query); |
| 395 | output_table_sorting_javascript("statsTable","tkx",2); |
| 396 | } |
| 397 | |
| 398 | /* |
| 399 | ** Implements the "byfile" view for /reports. If zUserName is not NULL then the |
| 400 | ** report is restricted to events created by the named user account. |
| @@ -421,12 +424,13 @@ | |
| 421 | @ <h1>Check-ins Per File |
| 422 | if( zUserName ){ |
| 423 | @ for user %h(zUserName) |
| 424 | } |
| 425 | @ </h1> |
| 426 | @ <table class='statistics-report-table-events' border='0' |
| 427 | @ cellpadding='2' cellspacing='0' id='statsTable'> |
| 428 | @ <thead><tr> |
| 429 | @ <th>File</th> |
| 430 | @ <th>Check-ins</th> |
| 431 | @ <th width='90%%'><!-- relative commits graph --></th> |
| 432 | @ </tr></thead><tbody> |
| @@ -446,11 +450,11 @@ | |
| 446 | @ </td> |
| 447 | @</tr> |
| 448 | } |
| 449 | @ </tbody></table> |
| 450 | db_finalize(&query); |
| 451 | output_table_sorting_javascript("statsTable","tNx",2); |
| 452 | } |
| 453 | |
| 454 | /* |
| 455 | ** Implements the "byweekday" view for /reports. If zUserName is not NULL then |
| 456 | ** the report is restricted to events created by the named user account. |
| @@ -505,12 +509,13 @@ | |
| 505 | if( db_int(0, "SELECT count(*) FROM piechart")>=2 ){ |
| 506 | @ <center><svg width=700 height=400> |
| 507 | piechart_render(700, 400, PIE_OTHER|PIE_PERCENT); |
| 508 | @ </svg></centre><hr /> |
| 509 | } |
| 510 | @ <table class='statistics-report-table-events' border='0' |
| 511 | @ cellpadding='2' cellspacing='0' id='statsTable'> |
| 512 | @ <thead><tr> |
| 513 | @ <th>DoW</th> |
| 514 | @ <th>Day</th> |
| 515 | @ <th>Events</th> |
| 516 | @ <th width='90%%'><!-- relative commits graph --></th> |
| @@ -542,11 +547,10 @@ | |
| 542 | @ </td> |
| 543 | @</tr> |
| 544 | } |
| 545 | @ </tbody></table> |
| 546 | db_finalize(&query); |
| 547 | output_table_sorting_javascript("statsTable","ntnx",1); |
| 548 | } |
| 549 | |
| 550 | |
| 551 | /* |
| 552 | ** Helper for stats_report_by_month_year(), which generates a list of |
| @@ -586,13 +590,14 @@ | |
| 586 | @ for the calendar weeks of %h(zYear) |
| 587 | if( zUserName ){ |
| 588 | @ for user %h(zUserName) |
| 589 | } |
| 590 | @ </h1> |
| 591 | cgi_printf("<table class='statistics-report-table-events' " |
| 592 | "border='0' cellpadding='2' width='100%%' " |
| 593 | "cellspacing='0' id='statsTable'>"); |
| 594 | cgi_printf("<thead><tr>" |
| 595 | "<th>Week</th>" |
| 596 | "<th>Events</th>" |
| 597 | "<th width='90%%'><!-- relative commits graph --></th>" |
| 598 | "</tr></thead>" |
| @@ -637,11 +642,10 @@ | |
| 637 | int nAvg = iterations ? (total/iterations) : 0; |
| 638 | cgi_printf("<br /><div>Total events: %d<br />" |
| 639 | "Average per active week: %d</div>", |
| 640 | total, nAvg); |
| 641 | } |
| 642 | output_table_sorting_javascript("statsTable","tnx",-1); |
| 643 | } |
| 644 | |
| 645 | |
| 646 | /* |
| 647 | ** Generate a report that shows the most recent change for each user. |
| @@ -650,14 +654,15 @@ | |
| 650 | Stmt s; |
| 651 | double rNow; |
| 652 | char *zBaseUrl; |
| 653 | |
| 654 | stats_report_init_view(); |
| 655 | @ <h1>Event Summary |
| 656 | @ (%s(stats_report_label_for_type())) by User</h1> |
| 657 | @ <table border=1 class='statistics-report-table-events' |
| 658 | @ cellpadding=2 cellspacing=0 id='lastchng'> |
| 659 | @ <thead><tr> |
| 660 | @ <th>User<th>Total Changes<th>Last Change</tr></thead> |
| 661 | @ <tbody> |
| 662 | zBaseUrl = mprintf("%R/timeline?y=%t&u=", PD("type","ci")); |
| 663 | db_prepare(&s, |
| @@ -681,11 +686,10 @@ | |
| 681 | @ </tr> |
| 682 | fossil_free(zAge); |
| 683 | } |
| 684 | @ </tbody></table> |
| 685 | db_finalize(&s); |
| 686 | output_table_sorting_javascript("lastchng","tNK",3); |
| 687 | } |
| 688 | |
| 689 | |
| 690 | /* Report types |
| 691 | */ |
| 692 |
| --- src/statrep.c | |
| +++ src/statrep.c | |
| @@ -202,12 +202,18 @@ | |
| 202 | @ by year%s(includeMonth ? "/month" : "") |
| 203 | if( zUserName ){ |
| 204 | @ for user %h(zUserName) |
| 205 | } |
| 206 | @ </h1> |
| 207 | @ <table border='0' cellpadding='2' cellspacing='0' \ |
| 208 | if( !includeMonth ){ |
| 209 | @ class='statistics-report-table-events sortable' \ |
| 210 | @ data-column-types='tnx' data-init-sort='0'> |
| 211 | style_table_sorter(); |
| 212 | }else{ |
| 213 | @ class='statistics-report-table-events'> |
| 214 | } |
| 215 | @ <thead> |
| 216 | @ <th>%s(zTimeLabel)</th> |
| 217 | @ <th>Events</th> |
| 218 | @ <th width='90%%'><!-- relative commits graph --></th> |
| 219 | @ </thead><tbody> |
| @@ -315,13 +321,10 @@ | |
| 321 | int nAvg = iterations ? (nEventTotal/iterations) : 0; |
| 322 | @ <br /><div>Total events: %d(nEventTotal) |
| 323 | @ <br />Average per active %s(zAvgLabel): %d(nAvg) |
| 324 | @ </div> |
| 325 | } |
| 326 | } |
| 327 | |
| 328 | /* |
| 329 | ** Implements the "byuser" view for /reports. |
| 330 | */ |
| @@ -344,12 +347,13 @@ | |
| 347 | if( db_int(0, "SELECT count(*) FROM piechart")>=2 ){ |
| 348 | @ <center><svg width=700 height=400> |
| 349 | piechart_render(700, 400, PIE_OTHER|PIE_PERCENT); |
| 350 | @ </svg></centre><hr /> |
| 351 | } |
| 352 | style_table_sorter(); |
| 353 | @ <table class='statistics-report-table-events sortable' border='0' \ |
| 354 | @ cellpadding='2' cellspacing='0' data-column-types='tkx' data-init-sort='2'> |
| 355 | @ <thead><tr> |
| 356 | @ <th>User</th> |
| 357 | @ <th>Events</th> |
| 358 | @ <th width='90%%'><!-- relative commits graph --></th> |
| 359 | @ </tr></thead><tbody> |
| @@ -390,11 +394,10 @@ | |
| 394 | use percent-based graph bars. |
| 395 | */ |
| 396 | } |
| 397 | @ </tbody></table> |
| 398 | db_finalize(&query); |
| 399 | } |
| 400 | |
| 401 | /* |
| 402 | ** Implements the "byfile" view for /reports. If zUserName is not NULL then the |
| 403 | ** report is restricted to events created by the named user account. |
| @@ -421,12 +424,13 @@ | |
| 424 | @ <h1>Check-ins Per File |
| 425 | if( zUserName ){ |
| 426 | @ for user %h(zUserName) |
| 427 | } |
| 428 | @ </h1> |
| 429 | style_table_sorter(); |
| 430 | @ <table class='statistics-report-table-events sortable' border='0' \ |
| 431 | @ cellpadding='2' cellspacing='0' data-column-types='tNx' data-init-sort='2'> |
| 432 | @ <thead><tr> |
| 433 | @ <th>File</th> |
| 434 | @ <th>Check-ins</th> |
| 435 | @ <th width='90%%'><!-- relative commits graph --></th> |
| 436 | @ </tr></thead><tbody> |
| @@ -446,11 +450,11 @@ | |
| 450 | @ </td> |
| 451 | @</tr> |
| 452 | } |
| 453 | @ </tbody></table> |
| 454 | db_finalize(&query); |
| 455 | |
| 456 | } |
| 457 | |
| 458 | /* |
| 459 | ** Implements the "byweekday" view for /reports. If zUserName is not NULL then |
| 460 | ** the report is restricted to events created by the named user account. |
| @@ -505,12 +509,13 @@ | |
| 509 | if( db_int(0, "SELECT count(*) FROM piechart")>=2 ){ |
| 510 | @ <center><svg width=700 height=400> |
| 511 | piechart_render(700, 400, PIE_OTHER|PIE_PERCENT); |
| 512 | @ </svg></centre><hr /> |
| 513 | } |
| 514 | style_table_sorter(); |
| 515 | @ <table class='statistics-report-table-events sortable' border='0' \ |
| 516 | @ cellpadding='2' cellspacing='0' data-column-types='ntnx' data-init-sort='1'> |
| 517 | @ <thead><tr> |
| 518 | @ <th>DoW</th> |
| 519 | @ <th>Day</th> |
| 520 | @ <th>Events</th> |
| 521 | @ <th width='90%%'><!-- relative commits graph --></th> |
| @@ -542,11 +547,10 @@ | |
| 547 | @ </td> |
| 548 | @</tr> |
| 549 | } |
| 550 | @ </tbody></table> |
| 551 | db_finalize(&query); |
| 552 | } |
| 553 | |
| 554 | |
| 555 | /* |
| 556 | ** Helper for stats_report_by_month_year(), which generates a list of |
| @@ -586,13 +590,14 @@ | |
| 590 | @ for the calendar weeks of %h(zYear) |
| 591 | if( zUserName ){ |
| 592 | @ for user %h(zUserName) |
| 593 | } |
| 594 | @ </h1> |
| 595 | style_table_sorter(); |
| 596 | cgi_printf("<table class='statistics-report-table-events sortable' " |
| 597 | "border='0' cellpadding='2' width='100%%' " |
| 598 | "cellspacing='0' data-column-types='tnx' data-init-sort='0'>"); |
| 599 | cgi_printf("<thead><tr>" |
| 600 | "<th>Week</th>" |
| 601 | "<th>Events</th>" |
| 602 | "<th width='90%%'><!-- relative commits graph --></th>" |
| 603 | "</tr></thead>" |
| @@ -637,11 +642,10 @@ | |
| 642 | int nAvg = iterations ? (total/iterations) : 0; |
| 643 | cgi_printf("<br /><div>Total events: %d<br />" |
| 644 | "Average per active week: %d</div>", |
| 645 | total, nAvg); |
| 646 | } |
| 647 | } |
| 648 | |
| 649 | |
| 650 | /* |
| 651 | ** Generate a report that shows the most recent change for each user. |
| @@ -650,14 +654,15 @@ | |
| 654 | Stmt s; |
| 655 | double rNow; |
| 656 | char *zBaseUrl; |
| 657 | |
| 658 | stats_report_init_view(); |
| 659 | style_table_sorter(); |
| 660 | @ <h1>Event Summary |
| 661 | @ (%s(stats_report_label_for_type())) by User</h1> |
| 662 | @ <table border=1 class='statistics-report-table-events sortable' \ |
| 663 | @ cellpadding=2 cellspacing=0 data-column-types='tNK' data-init-sort='3'> |
| 664 | @ <thead><tr> |
| 665 | @ <th>User<th>Total Changes<th>Last Change</tr></thead> |
| 666 | @ <tbody> |
| 667 | zBaseUrl = mprintf("%R/timeline?y=%t&u=", PD("type","ci")); |
| 668 | db_prepare(&s, |
| @@ -681,11 +686,10 @@ | |
| 686 | @ </tr> |
| 687 | fossil_free(zAge); |
| 688 | } |
| 689 | @ </tbody></table> |
| 690 | db_finalize(&s); |
| 691 | } |
| 692 | |
| 693 | |
| 694 | /* Report types |
| 695 | */ |
| 696 |
+13
-3
| --- src/style.c | ||
| +++ src/style.c | ||
| @@ -81,14 +81,14 @@ | ||
| 81 | 81 | ** Ad-unit styles. |
| 82 | 82 | */ |
| 83 | 83 | static unsigned adUnitFlags = 0; |
| 84 | 84 | |
| 85 | 85 | /* |
| 86 | -** True if the "href.js" javascript file is required. | |
| 86 | +** Flags for various javascript files needed prior to </body> | |
| 87 | 87 | */ |
| 88 | -static int needHrefJs = 0; | |
| 89 | - | |
| 88 | +static int needHrefJs = 0; /* href.js */ | |
| 89 | +static int needSortJs = 0; /* sorttable.js */ | |
| 90 | 90 | |
| 91 | 91 | /* |
| 92 | 92 | ** Generate and return a anchor tag like this: |
| 93 | 93 | ** |
| 94 | 94 | ** <a href="URL"> |
| @@ -497,10 +497,17 @@ | ||
| 497 | 497 | }else if( !fossil_all_whitespace(zAd = db_get("adunit",0)) ){ |
| 498 | 498 | return zAd; |
| 499 | 499 | } |
| 500 | 500 | return 0; |
| 501 | 501 | } |
| 502 | + | |
| 503 | +/* | |
| 504 | +** Indicate that the table-sorting javascript is needed. | |
| 505 | +*/ | |
| 506 | +void style_table_sorter(void){ | |
| 507 | + needSortJs = 1; | |
| 508 | +} | |
| 502 | 509 | |
| 503 | 510 | /* |
| 504 | 511 | ** Generate code to load a single javascript file |
| 505 | 512 | */ |
| 506 | 513 | void style_load_one_js_file(const char *zFile){ |
| @@ -519,10 +526,13 @@ | ||
| 519 | 526 | && db_get_boolean("auto-hyperlink-mouseover",0); |
| 520 | 527 | @ <script id='href-data' type='application/json'>\ |
| 521 | 528 | @ {"delay":%d(nDelay),"mouseover":%d(bMouseover)}</script> |
| 522 | 529 | style_load_one_js_file("href.js"); |
| 523 | 530 | } |
| 531 | + if( needSortJs ){ | |
| 532 | + style_load_one_js_file("sorttable.js"); | |
| 533 | + } | |
| 524 | 534 | } |
| 525 | 535 | |
| 526 | 536 | /* |
| 527 | 537 | ** Draw the footer at the bottom of the page. |
| 528 | 538 | */ |
| 529 | 539 |
| --- src/style.c | |
| +++ src/style.c | |
| @@ -81,14 +81,14 @@ | |
| 81 | ** Ad-unit styles. |
| 82 | */ |
| 83 | static unsigned adUnitFlags = 0; |
| 84 | |
| 85 | /* |
| 86 | ** True if the "href.js" javascript file is required. |
| 87 | */ |
| 88 | static int needHrefJs = 0; |
| 89 | |
| 90 | |
| 91 | /* |
| 92 | ** Generate and return a anchor tag like this: |
| 93 | ** |
| 94 | ** <a href="URL"> |
| @@ -497,10 +497,17 @@ | |
| 497 | }else if( !fossil_all_whitespace(zAd = db_get("adunit",0)) ){ |
| 498 | return zAd; |
| 499 | } |
| 500 | return 0; |
| 501 | } |
| 502 | |
| 503 | /* |
| 504 | ** Generate code to load a single javascript file |
| 505 | */ |
| 506 | void style_load_one_js_file(const char *zFile){ |
| @@ -519,10 +526,13 @@ | |
| 519 | && db_get_boolean("auto-hyperlink-mouseover",0); |
| 520 | @ <script id='href-data' type='application/json'>\ |
| 521 | @ {"delay":%d(nDelay),"mouseover":%d(bMouseover)}</script> |
| 522 | style_load_one_js_file("href.js"); |
| 523 | } |
| 524 | } |
| 525 | |
| 526 | /* |
| 527 | ** Draw the footer at the bottom of the page. |
| 528 | */ |
| 529 |
| --- src/style.c | |
| +++ src/style.c | |
| @@ -81,14 +81,14 @@ | |
| 81 | ** Ad-unit styles. |
| 82 | */ |
| 83 | static unsigned adUnitFlags = 0; |
| 84 | |
| 85 | /* |
| 86 | ** Flags for various javascript files needed prior to </body> |
| 87 | */ |
| 88 | static int needHrefJs = 0; /* href.js */ |
| 89 | static int needSortJs = 0; /* sorttable.js */ |
| 90 | |
| 91 | /* |
| 92 | ** Generate and return a anchor tag like this: |
| 93 | ** |
| 94 | ** <a href="URL"> |
| @@ -497,10 +497,17 @@ | |
| 497 | }else if( !fossil_all_whitespace(zAd = db_get("adunit",0)) ){ |
| 498 | return zAd; |
| 499 | } |
| 500 | return 0; |
| 501 | } |
| 502 | |
| 503 | /* |
| 504 | ** Indicate that the table-sorting javascript is needed. |
| 505 | */ |
| 506 | void style_table_sorter(void){ |
| 507 | needSortJs = 1; |
| 508 | } |
| 509 | |
| 510 | /* |
| 511 | ** Generate code to load a single javascript file |
| 512 | */ |
| 513 | void style_load_one_js_file(const char *zFile){ |
| @@ -519,10 +526,13 @@ | |
| 526 | && db_get_boolean("auto-hyperlink-mouseover",0); |
| 527 | @ <script id='href-data' type='application/json'>\ |
| 528 | @ {"delay":%d(nDelay),"mouseover":%d(bMouseover)}</script> |
| 529 | style_load_one_js_file("href.js"); |
| 530 | } |
| 531 | if( needSortJs ){ |
| 532 | style_load_one_js_file("sorttable.js"); |
| 533 | } |
| 534 | } |
| 535 | |
| 536 | /* |
| 537 | ** Draw the footer at the bottom of the page. |
| 538 | */ |
| 539 |
+3
-2
| --- src/timeline.c | ||
| +++ src/timeline.c | ||
| @@ -2515,11 +2515,13 @@ | ||
| 2515 | 2515 | const char *zStatus = db_column_int(&q,2) ? "Open" |
| 2516 | 2516 | : "Resolved by editing date"; |
| 2517 | 2517 | const char *zUser = db_column_text(&q, 3); |
| 2518 | 2518 | char *zHref = href("%R/timeline?c=%S", zCkin); |
| 2519 | 2519 | if( cnt==0 ){ |
| 2520 | - @ <div class="brlist"><table id="timewarptable"> | |
| 2520 | + style_table_sorter(); | |
| 2521 | + @ <div class="brlist"> | |
| 2522 | + @ <table class='sortable' data-column-types='tttt' data-init-sort='2'> | |
| 2521 | 2523 | @ <thead><tr> |
| 2522 | 2524 | @ <th>Check-in</th> |
| 2523 | 2525 | @ <th>Date</th> |
| 2524 | 2526 | @ <th>User</th> |
| 2525 | 2527 | @ <th>Status</th> |
| @@ -2537,9 +2539,8 @@ | ||
| 2537 | 2539 | db_finalize(&q); |
| 2538 | 2540 | if( cnt==0 ){ |
| 2539 | 2541 | @ <p>No timewarps in this repository</p> |
| 2540 | 2542 | }else{ |
| 2541 | 2543 | @ </tbody></table></div> |
| 2542 | - output_table_sorting_javascript("timewarptable","tttt",2); | |
| 2543 | 2544 | } |
| 2544 | 2545 | style_footer(); |
| 2545 | 2546 | } |
| 2546 | 2547 |
| --- src/timeline.c | |
| +++ src/timeline.c | |
| @@ -2515,11 +2515,13 @@ | |
| 2515 | const char *zStatus = db_column_int(&q,2) ? "Open" |
| 2516 | : "Resolved by editing date"; |
| 2517 | const char *zUser = db_column_text(&q, 3); |
| 2518 | char *zHref = href("%R/timeline?c=%S", zCkin); |
| 2519 | if( cnt==0 ){ |
| 2520 | @ <div class="brlist"><table id="timewarptable"> |
| 2521 | @ <thead><tr> |
| 2522 | @ <th>Check-in</th> |
| 2523 | @ <th>Date</th> |
| 2524 | @ <th>User</th> |
| 2525 | @ <th>Status</th> |
| @@ -2537,9 +2539,8 @@ | |
| 2537 | db_finalize(&q); |
| 2538 | if( cnt==0 ){ |
| 2539 | @ <p>No timewarps in this repository</p> |
| 2540 | }else{ |
| 2541 | @ </tbody></table></div> |
| 2542 | output_table_sorting_javascript("timewarptable","tttt",2); |
| 2543 | } |
| 2544 | style_footer(); |
| 2545 | } |
| 2546 |
| --- src/timeline.c | |
| +++ src/timeline.c | |
| @@ -2515,11 +2515,13 @@ | |
| 2515 | const char *zStatus = db_column_int(&q,2) ? "Open" |
| 2516 | : "Resolved by editing date"; |
| 2517 | const char *zUser = db_column_text(&q, 3); |
| 2518 | char *zHref = href("%R/timeline?c=%S", zCkin); |
| 2519 | if( cnt==0 ){ |
| 2520 | style_table_sorter(); |
| 2521 | @ <div class="brlist"> |
| 2522 | @ <table class='sortable' data-column-types='tttt' data-init-sort='2'> |
| 2523 | @ <thead><tr> |
| 2524 | @ <th>Check-in</th> |
| 2525 | @ <th>Date</th> |
| 2526 | @ <th>User</th> |
| 2527 | @ <th>Status</th> |
| @@ -2537,9 +2539,8 @@ | |
| 2539 | db_finalize(&q); |
| 2540 | if( cnt==0 ){ |
| 2541 | @ <p>No timewarps in this repository</p> |
| 2542 | }else{ |
| 2543 | @ </tbody></table></div> |
| 2544 | } |
| 2545 | style_footer(); |
| 2546 | } |
| 2547 |
+3
-2
| --- src/unversioned.c | ||
| +++ src/unversioned.c | ||
| @@ -508,12 +508,14 @@ | ||
| 508 | 508 | char *zAge = human_readable_age((iNow - mtime)/86400.0); |
| 509 | 509 | const char *zLogin = db_column_text(&q, 4); |
| 510 | 510 | int rcvid = db_column_int(&q,5); |
| 511 | 511 | if( zLogin==0 ) zLogin = ""; |
| 512 | 512 | if( (n++)==0 ){ |
| 513 | + style_table_sorter(); | |
| 513 | 514 | @ <div class="uvlist"> |
| 514 | - @ <table cellpadding="2" cellspacing="0" border="1" id="uvtab"> | |
| 515 | + @ <table cellpadding="2" cellspacing="0" border="1" class='sortable' \ | |
| 516 | + @ data-column-types='tkKttn' data-init-sort='1'> | |
| 515 | 517 | @ <thead><tr> |
| 516 | 518 | @ <th> Name |
| 517 | 519 | @ <th> Age |
| 518 | 520 | @ <th> Size |
| 519 | 521 | @ <th> User |
| @@ -559,11 +561,10 @@ | ||
| 559 | 561 | if( g.perm.Admin ){ |
| 560 | 562 | @ <td> |
| 561 | 563 | } |
| 562 | 564 | @ </tfoot> |
| 563 | 565 | @ </table></div> |
| 564 | - output_table_sorting_javascript("uvtab","tkKttN",1); | |
| 565 | 566 | }else{ |
| 566 | 567 | @ No unversioned files on this server. |
| 567 | 568 | } |
| 568 | 569 | style_footer(); |
| 569 | 570 | } |
| 570 | 571 |
| --- src/unversioned.c | |
| +++ src/unversioned.c | |
| @@ -508,12 +508,14 @@ | |
| 508 | char *zAge = human_readable_age((iNow - mtime)/86400.0); |
| 509 | const char *zLogin = db_column_text(&q, 4); |
| 510 | int rcvid = db_column_int(&q,5); |
| 511 | if( zLogin==0 ) zLogin = ""; |
| 512 | if( (n++)==0 ){ |
| 513 | @ <div class="uvlist"> |
| 514 | @ <table cellpadding="2" cellspacing="0" border="1" id="uvtab"> |
| 515 | @ <thead><tr> |
| 516 | @ <th> Name |
| 517 | @ <th> Age |
| 518 | @ <th> Size |
| 519 | @ <th> User |
| @@ -559,11 +561,10 @@ | |
| 559 | if( g.perm.Admin ){ |
| 560 | @ <td> |
| 561 | } |
| 562 | @ </tfoot> |
| 563 | @ </table></div> |
| 564 | output_table_sorting_javascript("uvtab","tkKttN",1); |
| 565 | }else{ |
| 566 | @ No unversioned files on this server. |
| 567 | } |
| 568 | style_footer(); |
| 569 | } |
| 570 |
| --- src/unversioned.c | |
| +++ src/unversioned.c | |
| @@ -508,12 +508,14 @@ | |
| 508 | char *zAge = human_readable_age((iNow - mtime)/86400.0); |
| 509 | const char *zLogin = db_column_text(&q, 4); |
| 510 | int rcvid = db_column_int(&q,5); |
| 511 | if( zLogin==0 ) zLogin = ""; |
| 512 | if( (n++)==0 ){ |
| 513 | style_table_sorter(); |
| 514 | @ <div class="uvlist"> |
| 515 | @ <table cellpadding="2" cellspacing="0" border="1" class='sortable' \ |
| 516 | @ data-column-types='tkKttn' data-init-sort='1'> |
| 517 | @ <thead><tr> |
| 518 | @ <th> Name |
| 519 | @ <th> Age |
| 520 | @ <th> Size |
| 521 | @ <th> User |
| @@ -559,11 +561,10 @@ | |
| 561 | if( g.perm.Admin ){ |
| 562 | @ <td> |
| 563 | } |
| 564 | @ </tfoot> |
| 565 | @ </table></div> |
| 566 | }else{ |
| 567 | @ No unversioned files on this server. |
| 568 | } |
| 569 | style_footer(); |
| 570 | } |
| 571 |
+3
-2
| --- src/user.c | ||
| +++ src/user.c | ||
| @@ -687,11 +687,12 @@ | ||
| 687 | 687 | } |
| 688 | 688 | rc = db_prepare_ignore_error(&q, "%s", blob_sql_text(&sql)); |
| 689 | 689 | fLogEnabled = db_get_boolean("access-log", 0); |
| 690 | 690 | @ <div align="center">Access logging is %s(fLogEnabled?"on":"off"). |
| 691 | 691 | @ (Change this on the <a href="setup_settings">settings</a> page.)</div> |
| 692 | - @ <table border="1" cellpadding="5" id="logtable" align="center"> | |
| 692 | + @ <table border="1" cellpadding="5" class="sortable" align="center" \ | |
| 693 | + @ data-column-types='Ttt' data-init-sort='1'> | |
| 693 | 694 | @ <thead><tr><th width="33%%">Date</th><th width="34%%">User</th> |
| 694 | 695 | @ <th width="33%%">IP Address</th></tr></thead><tbody> |
| 695 | 696 | while( rc==SQLITE_OK && db_step(&q)==SQLITE_ROW ){ |
| 696 | 697 | const char *zName = db_column_text(&q, 0); |
| 697 | 698 | const char *zIP = db_column_text(&q, 1); |
| @@ -734,8 +735,8 @@ | ||
| 734 | 735 | @ <form method="post" action="%s(g.zTop)/access_log"> |
| 735 | 736 | @ <label><input type="checkbox" name="delall"> |
| 736 | 737 | @ Delete all entries</input></label> |
| 737 | 738 | @ <input type="submit" name="delallbtn" value="Delete"></input> |
| 738 | 739 | @ </form> |
| 739 | - output_table_sorting_javascript("logtable", "Ttt", 1); | |
| 740 | + style_table_sorter(); | |
| 740 | 741 | style_footer(); |
| 741 | 742 | } |
| 742 | 743 |
| --- src/user.c | |
| +++ src/user.c | |
| @@ -687,11 +687,12 @@ | |
| 687 | } |
| 688 | rc = db_prepare_ignore_error(&q, "%s", blob_sql_text(&sql)); |
| 689 | fLogEnabled = db_get_boolean("access-log", 0); |
| 690 | @ <div align="center">Access logging is %s(fLogEnabled?"on":"off"). |
| 691 | @ (Change this on the <a href="setup_settings">settings</a> page.)</div> |
| 692 | @ <table border="1" cellpadding="5" id="logtable" align="center"> |
| 693 | @ <thead><tr><th width="33%%">Date</th><th width="34%%">User</th> |
| 694 | @ <th width="33%%">IP Address</th></tr></thead><tbody> |
| 695 | while( rc==SQLITE_OK && db_step(&q)==SQLITE_ROW ){ |
| 696 | const char *zName = db_column_text(&q, 0); |
| 697 | const char *zIP = db_column_text(&q, 1); |
| @@ -734,8 +735,8 @@ | |
| 734 | @ <form method="post" action="%s(g.zTop)/access_log"> |
| 735 | @ <label><input type="checkbox" name="delall"> |
| 736 | @ Delete all entries</input></label> |
| 737 | @ <input type="submit" name="delallbtn" value="Delete"></input> |
| 738 | @ </form> |
| 739 | output_table_sorting_javascript("logtable", "Ttt", 1); |
| 740 | style_footer(); |
| 741 | } |
| 742 |
| --- src/user.c | |
| +++ src/user.c | |
| @@ -687,11 +687,12 @@ | |
| 687 | } |
| 688 | rc = db_prepare_ignore_error(&q, "%s", blob_sql_text(&sql)); |
| 689 | fLogEnabled = db_get_boolean("access-log", 0); |
| 690 | @ <div align="center">Access logging is %s(fLogEnabled?"on":"off"). |
| 691 | @ (Change this on the <a href="setup_settings">settings</a> page.)</div> |
| 692 | @ <table border="1" cellpadding="5" class="sortable" align="center" \ |
| 693 | @ data-column-types='Ttt' data-init-sort='1'> |
| 694 | @ <thead><tr><th width="33%%">Date</th><th width="34%%">User</th> |
| 695 | @ <th width="33%%">IP Address</th></tr></thead><tbody> |
| 696 | while( rc==SQLITE_OK && db_step(&q)==SQLITE_ROW ){ |
| 697 | const char *zName = db_column_text(&q, 0); |
| 698 | const char *zIP = db_column_text(&q, 1); |
| @@ -734,8 +735,8 @@ | |
| 735 | @ <form method="post" action="%s(g.zTop)/access_log"> |
| 736 | @ <label><input type="checkbox" name="delall"> |
| 737 | @ Delete all entries</input></label> |
| 738 | @ <input type="submit" name="delallbtn" value="Delete"></input> |
| 739 | @ </form> |
| 740 | style_table_sorter(); |
| 741 | style_footer(); |
| 742 | } |
| 743 |
+1
| --- win/Makefile.mingw | ||
| +++ win/Makefile.mingw | ||
| @@ -608,10 +608,11 @@ | ||
| 608 | 608 | $(SRCDIR)/graph.js \ |
| 609 | 609 | $(SRCDIR)/href.js \ |
| 610 | 610 | $(SRCDIR)/markdown.md \ |
| 611 | 611 | $(SRCDIR)/menu.js \ |
| 612 | 612 | $(SRCDIR)/sbsdiff.js \ |
| 613 | + $(SRCDIR)/sorttable.js \ | |
| 613 | 614 | $(SRCDIR)/tree.js \ |
| 614 | 615 | $(SRCDIR)/wiki.wiki |
| 615 | 616 | |
| 616 | 617 | TRANS_SRC = \ |
| 617 | 618 | $(OBJDIR)/add_.c \ |
| 618 | 619 |
| --- win/Makefile.mingw | |
| +++ win/Makefile.mingw | |
| @@ -608,10 +608,11 @@ | |
| 608 | $(SRCDIR)/graph.js \ |
| 609 | $(SRCDIR)/href.js \ |
| 610 | $(SRCDIR)/markdown.md \ |
| 611 | $(SRCDIR)/menu.js \ |
| 612 | $(SRCDIR)/sbsdiff.js \ |
| 613 | $(SRCDIR)/tree.js \ |
| 614 | $(SRCDIR)/wiki.wiki |
| 615 | |
| 616 | TRANS_SRC = \ |
| 617 | $(OBJDIR)/add_.c \ |
| 618 |
| --- win/Makefile.mingw | |
| +++ win/Makefile.mingw | |
| @@ -608,10 +608,11 @@ | |
| 608 | $(SRCDIR)/graph.js \ |
| 609 | $(SRCDIR)/href.js \ |
| 610 | $(SRCDIR)/markdown.md \ |
| 611 | $(SRCDIR)/menu.js \ |
| 612 | $(SRCDIR)/sbsdiff.js \ |
| 613 | $(SRCDIR)/sorttable.js \ |
| 614 | $(SRCDIR)/tree.js \ |
| 615 | $(SRCDIR)/wiki.wiki |
| 616 | |
| 617 | TRANS_SRC = \ |
| 618 | $(OBJDIR)/add_.c \ |
| 619 |
+1
| --- win/Makefile.msc | ||
| +++ win/Makefile.msc | ||
| @@ -534,10 +534,11 @@ | ||
| 534 | 534 | $(SRCDIR)\graph.js \ |
| 535 | 535 | $(SRCDIR)\href.js \ |
| 536 | 536 | $(SRCDIR)\markdown.md \ |
| 537 | 537 | $(SRCDIR)\menu.js \ |
| 538 | 538 | $(SRCDIR)\sbsdiff.js \ |
| 539 | + $(SRCDIR)\sorttable.js \ | |
| 539 | 540 | $(SRCDIR)\tree.js \ |
| 540 | 541 | $(SRCDIR)\wiki.wiki |
| 541 | 542 | |
| 542 | 543 | OBJ = $(OX)\add$O \ |
| 543 | 544 | $(OX)\allrepo$O \ |
| 544 | 545 |
| --- win/Makefile.msc | |
| +++ win/Makefile.msc | |
| @@ -534,10 +534,11 @@ | |
| 534 | $(SRCDIR)\graph.js \ |
| 535 | $(SRCDIR)\href.js \ |
| 536 | $(SRCDIR)\markdown.md \ |
| 537 | $(SRCDIR)\menu.js \ |
| 538 | $(SRCDIR)\sbsdiff.js \ |
| 539 | $(SRCDIR)\tree.js \ |
| 540 | $(SRCDIR)\wiki.wiki |
| 541 | |
| 542 | OBJ = $(OX)\add$O \ |
| 543 | $(OX)\allrepo$O \ |
| 544 |
| --- win/Makefile.msc | |
| +++ win/Makefile.msc | |
| @@ -534,10 +534,11 @@ | |
| 534 | $(SRCDIR)\graph.js \ |
| 535 | $(SRCDIR)\href.js \ |
| 536 | $(SRCDIR)\markdown.md \ |
| 537 | $(SRCDIR)\menu.js \ |
| 538 | $(SRCDIR)\sbsdiff.js \ |
| 539 | $(SRCDIR)\sorttable.js \ |
| 540 | $(SRCDIR)\tree.js \ |
| 541 | $(SRCDIR)\wiki.wiki |
| 542 | |
| 543 | OBJ = $(OX)\add$O \ |
| 544 | $(OX)\allrepo$O \ |
| 545 |