Fossil SCM
Click on the column labels to sort on the /brlist page.
Commit
e35b9cb74cbf0de3f577529487f768b38be772d3
Parent
12fb5d04e37b53c…
2 files changed
+7
-6
+15
-1
+7
-6
| --- src/branch.c | ||
| +++ src/branch.c | ||
| @@ -346,26 +346,27 @@ | ||
| 346 | 346 | login_anonymous_available(); |
| 347 | 347 | |
| 348 | 348 | assert( orderByMtime==0 || orderByMtime==1 ); |
| 349 | 349 | db_prepare(&q, brlistQuery/*works-like:"%d"*/, 2-orderByMtime); |
| 350 | 350 | rNow = db_double(0.0, "SELECT julianday('now')"); |
| 351 | - @ <div class="brlist"><table> | |
| 352 | - @ <tr> | |
| 351 | + @ <div class="brlist"><table id="branchlisttable"> | |
| 352 | + @ <thead><tr> | |
| 353 | 353 | @ <th>Branch Name</th> |
| 354 | 354 | @ <th>Age</th> |
| 355 | 355 | @ <th>Status</th> |
| 356 | - @ </tr> | |
| 356 | + @ </tr></thead><tbody> | |
| 357 | 357 | while( db_step(&q)==SQLITE_ROW ){ |
| 358 | 358 | const char *zBranch = db_column_text(&q, 0); |
| 359 | 359 | double rMtime = db_column_double(&q, 1); |
| 360 | 360 | int isClosed = db_column_int(&q, 2); |
| 361 | 361 | const char *zMergeTo = db_column_text(&q, 3); |
| 362 | 362 | char *zAge = human_readable_age(rNow - rMtime); |
| 363 | + sqlite3_int64 iMtime = (sqlite3_int64)(rMtime*86400.0); | |
| 363 | 364 | if( zMergeTo && zMergeTo[0]==0 ) zMergeTo = 0; |
| 364 | 365 | @ <tr> |
| 365 | 366 | @ <td>%z(href("%R/timeline?n=100&r=%T",zBranch))%h(zBranch)</a> |
| 366 | - @ <td>%s(zAge) | |
| 367 | + @ <td data-sortkey="%016llx(iMtime)">%s(zAge) | |
| 367 | 368 | fossil_free(zAge); |
| 368 | 369 | if( isClosed && zMergeTo ){ |
| 369 | 370 | @ <td>closed, |
| 370 | 371 | }else if( isClosed ){ |
| 371 | 372 | @ <td>closed |
| @@ -375,13 +376,13 @@ | ||
| 375 | 376 | if( zMergeTo ){ |
| 376 | 377 | @ merged into %z(href("%R/timeline?r=%T",zMergeTo))%h(zMergeTo)</a> |
| 377 | 378 | } |
| 378 | 379 | @ </tr> |
| 379 | 380 | } |
| 380 | - @ </table></div> | |
| 381 | - | |
| 381 | + @ </tbody></table></div> | |
| 382 | 382 | db_finalize(&q); |
| 383 | + output_table_sorting_javascript("branchlisttable","tkx"); | |
| 383 | 384 | style_footer(); |
| 384 | 385 | } |
| 385 | 386 | |
| 386 | 387 | /* |
| 387 | 388 | ** WEBPAGE: brlist |
| 388 | 389 |
| --- src/branch.c | |
| +++ src/branch.c | |
| @@ -346,26 +346,27 @@ | |
| 346 | login_anonymous_available(); |
| 347 | |
| 348 | assert( orderByMtime==0 || orderByMtime==1 ); |
| 349 | db_prepare(&q, brlistQuery/*works-like:"%d"*/, 2-orderByMtime); |
| 350 | rNow = db_double(0.0, "SELECT julianday('now')"); |
| 351 | @ <div class="brlist"><table> |
| 352 | @ <tr> |
| 353 | @ <th>Branch Name</th> |
| 354 | @ <th>Age</th> |
| 355 | @ <th>Status</th> |
| 356 | @ </tr> |
| 357 | while( db_step(&q)==SQLITE_ROW ){ |
| 358 | const char *zBranch = db_column_text(&q, 0); |
| 359 | double rMtime = db_column_double(&q, 1); |
| 360 | int isClosed = db_column_int(&q, 2); |
| 361 | const char *zMergeTo = db_column_text(&q, 3); |
| 362 | char *zAge = human_readable_age(rNow - rMtime); |
| 363 | if( zMergeTo && zMergeTo[0]==0 ) zMergeTo = 0; |
| 364 | @ <tr> |
| 365 | @ <td>%z(href("%R/timeline?n=100&r=%T",zBranch))%h(zBranch)</a> |
| 366 | @ <td>%s(zAge) |
| 367 | fossil_free(zAge); |
| 368 | if( isClosed && zMergeTo ){ |
| 369 | @ <td>closed, |
| 370 | }else if( isClosed ){ |
| 371 | @ <td>closed |
| @@ -375,13 +376,13 @@ | |
| 375 | if( zMergeTo ){ |
| 376 | @ merged into %z(href("%R/timeline?r=%T",zMergeTo))%h(zMergeTo)</a> |
| 377 | } |
| 378 | @ </tr> |
| 379 | } |
| 380 | @ </table></div> |
| 381 | |
| 382 | db_finalize(&q); |
| 383 | style_footer(); |
| 384 | } |
| 385 | |
| 386 | /* |
| 387 | ** WEBPAGE: brlist |
| 388 |
| --- src/branch.c | |
| +++ src/branch.c | |
| @@ -346,26 +346,27 @@ | |
| 346 | login_anonymous_available(); |
| 347 | |
| 348 | assert( orderByMtime==0 || orderByMtime==1 ); |
| 349 | db_prepare(&q, brlistQuery/*works-like:"%d"*/, 2-orderByMtime); |
| 350 | rNow = db_double(0.0, "SELECT julianday('now')"); |
| 351 | @ <div class="brlist"><table id="branchlisttable"> |
| 352 | @ <thead><tr> |
| 353 | @ <th>Branch Name</th> |
| 354 | @ <th>Age</th> |
| 355 | @ <th>Status</th> |
| 356 | @ </tr></thead><tbody> |
| 357 | while( db_step(&q)==SQLITE_ROW ){ |
| 358 | const char *zBranch = db_column_text(&q, 0); |
| 359 | double rMtime = db_column_double(&q, 1); |
| 360 | int isClosed = db_column_int(&q, 2); |
| 361 | const char *zMergeTo = db_column_text(&q, 3); |
| 362 | char *zAge = human_readable_age(rNow - rMtime); |
| 363 | sqlite3_int64 iMtime = (sqlite3_int64)(rMtime*86400.0); |
| 364 | if( zMergeTo && zMergeTo[0]==0 ) zMergeTo = 0; |
| 365 | @ <tr> |
| 366 | @ <td>%z(href("%R/timeline?n=100&r=%T",zBranch))%h(zBranch)</a> |
| 367 | @ <td data-sortkey="%016llx(iMtime)">%s(zAge) |
| 368 | fossil_free(zAge); |
| 369 | if( isClosed && zMergeTo ){ |
| 370 | @ <td>closed, |
| 371 | }else if( isClosed ){ |
| 372 | @ <td>closed |
| @@ -375,13 +376,13 @@ | |
| 376 | if( zMergeTo ){ |
| 377 | @ merged into %z(href("%R/timeline?r=%T",zMergeTo))%h(zMergeTo)</a> |
| 378 | } |
| 379 | @ </tr> |
| 380 | } |
| 381 | @ </tbody></table></div> |
| 382 | db_finalize(&q); |
| 383 | output_table_sorting_javascript("branchlisttable","tkx"); |
| 384 | style_footer(); |
| 385 | } |
| 386 | |
| 387 | /* |
| 388 | ** WEBPAGE: brlist |
| 389 |
+15
-1
| --- src/report.c | ||
| +++ src/report.c | ||
| @@ -938,11 +938,17 @@ | ||
| 938 | 938 | @ <script> |
| 939 | 939 | @ function SortableTable(tableEl,columnTypes){ |
| 940 | 940 | @ this.tbody = tableEl.getElementsByTagName('tbody'); |
| 941 | 941 | @ this.sort = function (cell) { |
| 942 | 942 | @ var column = cell.cellIndex; |
| 943 | - @ var sortFn = cell.sortType=="n" ? this.sortNumeric : this.sortText; | |
| 943 | + @ var sortFn; | |
| 944 | + @ switch( cell.sortType ){ | |
| 945 | + @ case "n": sortFn = this.sortNumeric; break; | |
| 946 | + @ case "t": sortFn = this.sortText; break; | |
| 947 | + @ case "k": sortFn = this.sortKey; break; | |
| 948 | + @ case "x": return; | |
| 949 | + @ } | |
| 944 | 950 | @ this.sortIndex = column; |
| 945 | 951 | @ var newRows = new Array(); |
| 946 | 952 | @ for (j = 0; j < this.tbody[0].rows.length; j++) { |
| 947 | 953 | @ newRows[j] = this.tbody[0].rows[j]; |
| 948 | 954 | @ } |
| @@ -970,10 +976,18 @@ | ||
| 970 | 976 | @ aa = parseFloat(a.cells[i].textContent); |
| 971 | 977 | @ if (isNaN(aa)) aa = 0; |
| 972 | 978 | @ bb = parseFloat(b.cells[i].textContent); |
| 973 | 979 | @ if (isNaN(bb)) bb = 0; |
| 974 | 980 | @ return aa-bb; |
| 981 | + @ } | |
| 982 | + @ this.sortKey = function(a,b) { | |
| 983 | + @ var i = thisObject.sortIndex; | |
| 984 | + @ aa = a.cells[i].getAttribute("data-sortkey"); | |
| 985 | + @ bb = b.cells[i].getAttribute("data-sortkey"); | |
| 986 | + @ if(aa==bb) return 0; | |
| 987 | + @ if(aa<bb) return -1; | |
| 988 | + @ return 1; | |
| 975 | 989 | @ } |
| 976 | 990 | @ var thisObject = this; |
| 977 | 991 | @ var x = tableEl.getElementsByTagName('thead'); |
| 978 | 992 | @ if(!(this.tbody && this.tbody[0].rows && this.tbody[0].rows.length>0)){ |
| 979 | 993 | @ return; |
| 980 | 994 |
| --- src/report.c | |
| +++ src/report.c | |
| @@ -938,11 +938,17 @@ | |
| 938 | @ <script> |
| 939 | @ function SortableTable(tableEl,columnTypes){ |
| 940 | @ this.tbody = tableEl.getElementsByTagName('tbody'); |
| 941 | @ this.sort = function (cell) { |
| 942 | @ var column = cell.cellIndex; |
| 943 | @ var sortFn = cell.sortType=="n" ? this.sortNumeric : this.sortText; |
| 944 | @ this.sortIndex = column; |
| 945 | @ var newRows = new Array(); |
| 946 | @ for (j = 0; j < this.tbody[0].rows.length; j++) { |
| 947 | @ newRows[j] = this.tbody[0].rows[j]; |
| 948 | @ } |
| @@ -970,10 +976,18 @@ | |
| 970 | @ aa = parseFloat(a.cells[i].textContent); |
| 971 | @ if (isNaN(aa)) aa = 0; |
| 972 | @ bb = parseFloat(b.cells[i].textContent); |
| 973 | @ if (isNaN(bb)) bb = 0; |
| 974 | @ return aa-bb; |
| 975 | @ } |
| 976 | @ var thisObject = this; |
| 977 | @ var x = tableEl.getElementsByTagName('thead'); |
| 978 | @ if(!(this.tbody && this.tbody[0].rows && this.tbody[0].rows.length>0)){ |
| 979 | @ return; |
| 980 |
| --- src/report.c | |
| +++ src/report.c | |
| @@ -938,11 +938,17 @@ | |
| 938 | @ <script> |
| 939 | @ function SortableTable(tableEl,columnTypes){ |
| 940 | @ this.tbody = tableEl.getElementsByTagName('tbody'); |
| 941 | @ this.sort = function (cell) { |
| 942 | @ var column = cell.cellIndex; |
| 943 | @ var sortFn; |
| 944 | @ switch( cell.sortType ){ |
| 945 | @ case "n": sortFn = this.sortNumeric; break; |
| 946 | @ case "t": sortFn = this.sortText; break; |
| 947 | @ case "k": sortFn = this.sortKey; break; |
| 948 | @ case "x": return; |
| 949 | @ } |
| 950 | @ this.sortIndex = column; |
| 951 | @ var newRows = new Array(); |
| 952 | @ for (j = 0; j < this.tbody[0].rows.length; j++) { |
| 953 | @ newRows[j] = this.tbody[0].rows[j]; |
| 954 | @ } |
| @@ -970,10 +976,18 @@ | |
| 976 | @ aa = parseFloat(a.cells[i].textContent); |
| 977 | @ if (isNaN(aa)) aa = 0; |
| 978 | @ bb = parseFloat(b.cells[i].textContent); |
| 979 | @ if (isNaN(bb)) bb = 0; |
| 980 | @ return aa-bb; |
| 981 | @ } |
| 982 | @ this.sortKey = function(a,b) { |
| 983 | @ var i = thisObject.sortIndex; |
| 984 | @ aa = a.cells[i].getAttribute("data-sortkey"); |
| 985 | @ bb = b.cells[i].getAttribute("data-sortkey"); |
| 986 | @ if(aa==bb) return 0; |
| 987 | @ if(aa<bb) return -1; |
| 988 | @ return 1; |
| 989 | @ } |
| 990 | @ var thisObject = this; |
| 991 | @ var x = tableEl.getElementsByTagName('thead'); |
| 992 | @ if(!(this.tbody && this.tbody[0].rows && this.tbody[0].rows.length>0)){ |
| 993 | @ return; |
| 994 |