Fossil SCM
Enhance the table sorting javascript to support initial reverse-order sorting. Add table sorting to the user log.
Commit
0cdec7d290da52b472d3a4e0e4997203a4e7e673
Parent
fe61f4958d1b898…
3 files changed
+2
-2
+8
-4
+5
-4
+2
-2
| --- src/branch.c | ||
| +++ src/branch.c | ||
| @@ -367,11 +367,11 @@ | ||
| 367 | 367 | sqlite3_int64 iMtime = (sqlite3_int64)(rMtime*86400.0); |
| 368 | 368 | if( zMergeTo && zMergeTo[0]==0 ) zMergeTo = 0; |
| 369 | 369 | @ <tr> |
| 370 | 370 | @ <td>%z(href("%R/timeline?n=100&r=%T",zBranch))%h(zBranch)</a></td> |
| 371 | 371 | @ <td data-sortkey="%016llx(-iMtime)">%s(zAge)</td> |
| 372 | - @ <td data-sortkey="%08x(-nCkin)">%d(nCkin)</td> | |
| 372 | + @ <td>%d(nCkin)</td> | |
| 373 | 373 | fossil_free(zAge); |
| 374 | 374 | @ <td>%s(isClosed?"closed":"")</td> |
| 375 | 375 | if( zMergeTo ){ |
| 376 | 376 | @ <td>merged into |
| 377 | 377 | @ %z(href("%R/timeline?f=%s",zLastCkin))%h(zMergeTo)</a></td> |
| @@ -380,11 +380,11 @@ | ||
| 380 | 380 | } |
| 381 | 381 | @ </tr> |
| 382 | 382 | } |
| 383 | 383 | @ </tbody></table></div> |
| 384 | 384 | db_finalize(&q); |
| 385 | - output_table_sorting_javascript("branchlisttable","tkktt",2); | |
| 385 | + output_table_sorting_javascript("branchlisttable","tkNtt",2); | |
| 386 | 386 | style_footer(); |
| 387 | 387 | } |
| 388 | 388 | |
| 389 | 389 | /* |
| 390 | 390 | ** WEBPAGE: brlist |
| 391 | 391 |
| --- src/branch.c | |
| +++ src/branch.c | |
| @@ -367,11 +367,11 @@ | |
| 367 | sqlite3_int64 iMtime = (sqlite3_int64)(rMtime*86400.0); |
| 368 | if( zMergeTo && zMergeTo[0]==0 ) zMergeTo = 0; |
| 369 | @ <tr> |
| 370 | @ <td>%z(href("%R/timeline?n=100&r=%T",zBranch))%h(zBranch)</a></td> |
| 371 | @ <td data-sortkey="%016llx(-iMtime)">%s(zAge)</td> |
| 372 | @ <td data-sortkey="%08x(-nCkin)">%d(nCkin)</td> |
| 373 | fossil_free(zAge); |
| 374 | @ <td>%s(isClosed?"closed":"")</td> |
| 375 | if( zMergeTo ){ |
| 376 | @ <td>merged into |
| 377 | @ %z(href("%R/timeline?f=%s",zLastCkin))%h(zMergeTo)</a></td> |
| @@ -380,11 +380,11 @@ | |
| 380 | } |
| 381 | @ </tr> |
| 382 | } |
| 383 | @ </tbody></table></div> |
| 384 | db_finalize(&q); |
| 385 | output_table_sorting_javascript("branchlisttable","tkktt",2); |
| 386 | style_footer(); |
| 387 | } |
| 388 | |
| 389 | /* |
| 390 | ** WEBPAGE: brlist |
| 391 |
| --- src/branch.c | |
| +++ src/branch.c | |
| @@ -367,11 +367,11 @@ | |
| 367 | sqlite3_int64 iMtime = (sqlite3_int64)(rMtime*86400.0); |
| 368 | if( zMergeTo && zMergeTo[0]==0 ) zMergeTo = 0; |
| 369 | @ <tr> |
| 370 | @ <td>%z(href("%R/timeline?n=100&r=%T",zBranch))%h(zBranch)</a></td> |
| 371 | @ <td data-sortkey="%016llx(-iMtime)">%s(zAge)</td> |
| 372 | @ <td>%d(nCkin)</td> |
| 373 | fossil_free(zAge); |
| 374 | @ <td>%s(isClosed?"closed":"")</td> |
| 375 | if( zMergeTo ){ |
| 376 | @ <td>merged into |
| 377 | @ %z(href("%R/timeline?f=%s",zLastCkin))%h(zMergeTo)</a></td> |
| @@ -380,11 +380,11 @@ | |
| 380 | } |
| 381 | @ </tr> |
| 382 | } |
| 383 | @ </tbody></table></div> |
| 384 | db_finalize(&q); |
| 385 | output_table_sorting_javascript("branchlisttable","tkNtt",2); |
| 386 | style_footer(); |
| 387 | } |
| 388 | |
| 389 | /* |
| 390 | ** WEBPAGE: brlist |
| 391 |
+8
-4
| --- src/report.c | ||
| +++ src/report.c | ||
| @@ -933,10 +933,11 @@ | ||
| 933 | 933 | ** t Sort by text |
| 934 | 934 | ** n Sort numerically |
| 935 | 935 | ** k Sort by the data-sortkey property |
| 936 | 936 | ** x This column is not sortable |
| 937 | 937 | ** |
| 938 | +** Capital letters mean sort in reverse order. | |
| 938 | 939 | ** If there are fewer characters in zColumnTypes[] than their are columns, |
| 939 | 940 | ** the all extra columns assume type "t" (text). |
| 940 | 941 | ** |
| 941 | 942 | ** The third parameter is the column that was initially sorted (using 1-based |
| 942 | 943 | ** column numbers, like SQL). Make this value 0 if none of the columns are |
| @@ -956,14 +957,14 @@ | ||
| 956 | 957 | @ this.columnTypes = columnTypes; |
| 957 | 958 | @ this.sort = function (cell) { |
| 958 | 959 | @ var column = cell.cellIndex; |
| 959 | 960 | @ var sortFn; |
| 960 | 961 | @ switch( cell.sortType ){ |
| 961 | - @ case "n": sortFn = this.sortNumeric; break; | |
| 962 | - @ case "t": sortFn = this.sortText; break; | |
| 963 | - @ case "k": sortFn = this.sortKey; break; | |
| 964 | - @ case "x": return; | |
| 962 | + @ case "N": case "n": sortFn = this.sortNumeric; break; | |
| 963 | + @ case "T": case "t": sortFn = this.sortText; break; | |
| 964 | + @ case "K": case "k": sortFn = this.sortKey; break; | |
| 965 | + @ default: return; | |
| 965 | 966 | @ } |
| 966 | 967 | @ this.sortIndex = column; |
| 967 | 968 | @ var newRows = new Array(); |
| 968 | 969 | @ for (j = 0; j < this.tbody[0].rows.length; j++) { |
| 969 | 970 | @ newRows[j] = this.tbody[0].rows[j]; |
| @@ -972,10 +973,13 @@ | ||
| 972 | 973 | @ newRows.reverse(); |
| 973 | 974 | @ this.prevColumn = -this.prevColumn; |
| 974 | 975 | @ }else{ |
| 975 | 976 | @ newRows.sort(sortFn); |
| 976 | 977 | @ this.prevColumn = this.sortIndex+1; |
| 978 | + @ if( cell.sortType>="A" && cell.sortType<="Z" ){ | |
| 979 | + @ newRows.reverse(); | |
| 980 | + @ } | |
| 977 | 981 | @ } |
| 978 | 982 | @ for (i=0;i<newRows.length;i++) { |
| 979 | 983 | @ this.tbody[0].appendChild(newRows[i]); |
| 980 | 984 | @ } |
| 981 | 985 | @ this.setHdrIcons(); |
| 982 | 986 |
| --- src/report.c | |
| +++ src/report.c | |
| @@ -933,10 +933,11 @@ | |
| 933 | ** t Sort by text |
| 934 | ** n Sort numerically |
| 935 | ** k Sort by the data-sortkey property |
| 936 | ** x This column is not sortable |
| 937 | ** |
| 938 | ** If there are fewer characters in zColumnTypes[] than their are columns, |
| 939 | ** the all extra columns assume type "t" (text). |
| 940 | ** |
| 941 | ** The third parameter is the column that was initially sorted (using 1-based |
| 942 | ** column numbers, like SQL). Make this value 0 if none of the columns are |
| @@ -956,14 +957,14 @@ | |
| 956 | @ this.columnTypes = columnTypes; |
| 957 | @ this.sort = function (cell) { |
| 958 | @ var column = cell.cellIndex; |
| 959 | @ var sortFn; |
| 960 | @ switch( cell.sortType ){ |
| 961 | @ case "n": sortFn = this.sortNumeric; break; |
| 962 | @ case "t": sortFn = this.sortText; break; |
| 963 | @ case "k": sortFn = this.sortKey; break; |
| 964 | @ case "x": return; |
| 965 | @ } |
| 966 | @ this.sortIndex = column; |
| 967 | @ var newRows = new Array(); |
| 968 | @ for (j = 0; j < this.tbody[0].rows.length; j++) { |
| 969 | @ newRows[j] = this.tbody[0].rows[j]; |
| @@ -972,10 +973,13 @@ | |
| 972 | @ newRows.reverse(); |
| 973 | @ this.prevColumn = -this.prevColumn; |
| 974 | @ }else{ |
| 975 | @ newRows.sort(sortFn); |
| 976 | @ this.prevColumn = this.sortIndex+1; |
| 977 | @ } |
| 978 | @ for (i=0;i<newRows.length;i++) { |
| 979 | @ this.tbody[0].appendChild(newRows[i]); |
| 980 | @ } |
| 981 | @ this.setHdrIcons(); |
| 982 |
| --- src/report.c | |
| +++ src/report.c | |
| @@ -933,10 +933,11 @@ | |
| 933 | ** t Sort by text |
| 934 | ** n Sort numerically |
| 935 | ** k Sort by the data-sortkey property |
| 936 | ** x This column is not sortable |
| 937 | ** |
| 938 | ** Capital letters mean sort in reverse order. |
| 939 | ** If there are fewer characters in zColumnTypes[] than their are columns, |
| 940 | ** the all extra columns assume type "t" (text). |
| 941 | ** |
| 942 | ** The third parameter is the column that was initially sorted (using 1-based |
| 943 | ** column numbers, like SQL). Make this value 0 if none of the columns are |
| @@ -956,14 +957,14 @@ | |
| 957 | @ this.columnTypes = columnTypes; |
| 958 | @ this.sort = function (cell) { |
| 959 | @ var column = cell.cellIndex; |
| 960 | @ var sortFn; |
| 961 | @ switch( cell.sortType ){ |
| 962 | @ case "N": case "n": sortFn = this.sortNumeric; break; |
| 963 | @ case "T": case "t": sortFn = this.sortText; break; |
| 964 | @ case "K": case "k": sortFn = this.sortKey; break; |
| 965 | @ default: return; |
| 966 | @ } |
| 967 | @ this.sortIndex = column; |
| 968 | @ var newRows = new Array(); |
| 969 | @ for (j = 0; j < this.tbody[0].rows.length; j++) { |
| 970 | @ newRows[j] = this.tbody[0].rows[j]; |
| @@ -972,10 +973,13 @@ | |
| 973 | @ newRows.reverse(); |
| 974 | @ this.prevColumn = -this.prevColumn; |
| 975 | @ }else{ |
| 976 | @ newRows.sort(sortFn); |
| 977 | @ this.prevColumn = this.sortIndex+1; |
| 978 | @ if( cell.sortType>="A" && cell.sortType<="Z" ){ |
| 979 | @ newRows.reverse(); |
| 980 | @ } |
| 981 | @ } |
| 982 | @ for (i=0;i<newRows.length;i++) { |
| 983 | @ this.tbody[0].appendChild(newRows[i]); |
| 984 | @ } |
| 985 | @ this.setHdrIcons(); |
| 986 |
+5
-4
| --- src/user.c | ||
| +++ src/user.c | ||
| @@ -467,13 +467,13 @@ | ||
| 467 | 467 | style_submenu_element("Newer", "Newer entries", |
| 468 | 468 | "%s/access_log?o=%d&n=%d&y=%d", g.zTop, skip>=n ? skip-n : 0, |
| 469 | 469 | n, y); |
| 470 | 470 | } |
| 471 | 471 | rc = db_prepare_ignore_error(&q, "%s", blob_sql_text(&sql)); |
| 472 | - @ <center><table border="1" cellpadding="5"> | |
| 473 | - @ <tr><th width="33%%">Date</th><th width="34%%">User</th> | |
| 474 | - @ <th width="33%%">IP Address</th></tr> | |
| 472 | + @ <center><table border="1" cellpadding="5" id='logtable'> | |
| 473 | + @ <thead><tr><th width="33%%">Date</th><th width="34%%">User</th> | |
| 474 | + @ <th width="33%%">IP Address</th></tr></thead><tbody> | |
| 475 | 475 | while( rc==SQLITE_OK && db_step(&q)==SQLITE_ROW ){ |
| 476 | 476 | const char *zName = db_column_text(&q, 0); |
| 477 | 477 | const char *zIP = db_column_text(&q, 1); |
| 478 | 478 | const char *zDate = db_column_text(&q, 2); |
| 479 | 479 | int bSuccess = db_column_int(&q, 3); |
| @@ -492,11 +492,11 @@ | ||
| 492 | 492 | } |
| 493 | 493 | if( skip>0 || cnt>n ){ |
| 494 | 494 | style_submenu_element("All", "All entries", |
| 495 | 495 | "%s/access_log?n=10000000", g.zTop); |
| 496 | 496 | } |
| 497 | - @ </table></center> | |
| 497 | + @ </tbody></table></center> | |
| 498 | 498 | db_finalize(&q); |
| 499 | 499 | @ <hr> |
| 500 | 500 | @ <form method="post" action="%s(g.zTop)/access_log"> |
| 501 | 501 | @ <label><input type="checkbox" name="delold"> |
| 502 | 502 | @ Delete all but the most recent 200 entries</input></label> |
| @@ -515,7 +515,8 @@ | ||
| 515 | 515 | @ <form method="post" action="%s(g.zTop)/access_log"> |
| 516 | 516 | @ <label><input type="checkbox" name="delall"> |
| 517 | 517 | @ Delete all entries</input></label> |
| 518 | 518 | @ <input type="submit" name="delallbtn" value="Delete"></input> |
| 519 | 519 | @ </form> |
| 520 | + output_table_sorting_javascript("logtable", "Ttt", 1); | |
| 520 | 521 | style_footer(); |
| 521 | 522 | } |
| 522 | 523 |
| --- src/user.c | |
| +++ src/user.c | |
| @@ -467,13 +467,13 @@ | |
| 467 | style_submenu_element("Newer", "Newer entries", |
| 468 | "%s/access_log?o=%d&n=%d&y=%d", g.zTop, skip>=n ? skip-n : 0, |
| 469 | n, y); |
| 470 | } |
| 471 | rc = db_prepare_ignore_error(&q, "%s", blob_sql_text(&sql)); |
| 472 | @ <center><table border="1" cellpadding="5"> |
| 473 | @ <tr><th width="33%%">Date</th><th width="34%%">User</th> |
| 474 | @ <th width="33%%">IP Address</th></tr> |
| 475 | while( rc==SQLITE_OK && db_step(&q)==SQLITE_ROW ){ |
| 476 | const char *zName = db_column_text(&q, 0); |
| 477 | const char *zIP = db_column_text(&q, 1); |
| 478 | const char *zDate = db_column_text(&q, 2); |
| 479 | int bSuccess = db_column_int(&q, 3); |
| @@ -492,11 +492,11 @@ | |
| 492 | } |
| 493 | if( skip>0 || cnt>n ){ |
| 494 | style_submenu_element("All", "All entries", |
| 495 | "%s/access_log?n=10000000", g.zTop); |
| 496 | } |
| 497 | @ </table></center> |
| 498 | db_finalize(&q); |
| 499 | @ <hr> |
| 500 | @ <form method="post" action="%s(g.zTop)/access_log"> |
| 501 | @ <label><input type="checkbox" name="delold"> |
| 502 | @ Delete all but the most recent 200 entries</input></label> |
| @@ -515,7 +515,8 @@ | |
| 515 | @ <form method="post" action="%s(g.zTop)/access_log"> |
| 516 | @ <label><input type="checkbox" name="delall"> |
| 517 | @ Delete all entries</input></label> |
| 518 | @ <input type="submit" name="delallbtn" value="Delete"></input> |
| 519 | @ </form> |
| 520 | style_footer(); |
| 521 | } |
| 522 |
| --- src/user.c | |
| +++ src/user.c | |
| @@ -467,13 +467,13 @@ | |
| 467 | style_submenu_element("Newer", "Newer entries", |
| 468 | "%s/access_log?o=%d&n=%d&y=%d", g.zTop, skip>=n ? skip-n : 0, |
| 469 | n, y); |
| 470 | } |
| 471 | rc = db_prepare_ignore_error(&q, "%s", blob_sql_text(&sql)); |
| 472 | @ <center><table border="1" cellpadding="5" id='logtable'> |
| 473 | @ <thead><tr><th width="33%%">Date</th><th width="34%%">User</th> |
| 474 | @ <th width="33%%">IP Address</th></tr></thead><tbody> |
| 475 | while( rc==SQLITE_OK && db_step(&q)==SQLITE_ROW ){ |
| 476 | const char *zName = db_column_text(&q, 0); |
| 477 | const char *zIP = db_column_text(&q, 1); |
| 478 | const char *zDate = db_column_text(&q, 2); |
| 479 | int bSuccess = db_column_int(&q, 3); |
| @@ -492,11 +492,11 @@ | |
| 492 | } |
| 493 | if( skip>0 || cnt>n ){ |
| 494 | style_submenu_element("All", "All entries", |
| 495 | "%s/access_log?n=10000000", g.zTop); |
| 496 | } |
| 497 | @ </tbody></table></center> |
| 498 | db_finalize(&q); |
| 499 | @ <hr> |
| 500 | @ <form method="post" action="%s(g.zTop)/access_log"> |
| 501 | @ <label><input type="checkbox" name="delold"> |
| 502 | @ Delete all but the most recent 200 entries</input></label> |
| @@ -515,7 +515,8 @@ | |
| 515 | @ <form method="post" action="%s(g.zTop)/access_log"> |
| 516 | @ <label><input type="checkbox" name="delall"> |
| 517 | @ Delete all entries</input></label> |
| 518 | @ <input type="submit" name="delallbtn" value="Delete"></input> |
| 519 | @ </form> |
| 520 | output_table_sorting_javascript("logtable", "Ttt", 1); |
| 521 | style_footer(); |
| 522 | } |
| 523 |