Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Enhance the table sorting javascript to support initial reverse-order sorting. Add table sorting to the user log. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA1: |
0cdec7d290da52b472d3a4e0e4997203 |
| User & Date: | drh 2015-01-22 23:45:15.316 |
Context
|
2015-01-23
| ||
| 02:05 | Use IPv6 for "fossil sync" when available. ... (check-in: 1dbd4d0d0b user: drh tags: trunk) | |
| 01:58 | Use IPv6 when available for "fossil sync". ... (Closed-Leaf check-in: 3842742871 user: drh tags: ipv6-sync) | |
|
2015-01-22
| ||
| 23:45 | Enhance the table sorting javascript to support initial reverse-order sorting. Add table sorting to the user log. ... (check-in: 0cdec7d290 user: drh tags: trunk) | |
| 22:52 | Make table sorting (by clicking on column headers) stable. In other words, identical values in the column being sorted preserve their prior relative order. Patch suggested by Jacek Cała. ... (check-in: fe61f4958d user: drh tags: trunk) | |
Changes
Changes to src/branch.c.
| ︙ | ︙ | |||
365 366 367 368 369 370 371 |
const char *zLastCkin = db_column_text(&q, 5);
char *zAge = human_readable_age(rNow - rMtime);
sqlite3_int64 iMtime = (sqlite3_int64)(rMtime*86400.0);
if( zMergeTo && zMergeTo[0]==0 ) zMergeTo = 0;
@ <tr>
@ <td>%z(href("%R/timeline?n=100&r=%T",zBranch))%h(zBranch)</a></td>
@ <td data-sortkey="%016llx(-iMtime)">%s(zAge)</td>
| | | | 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 |
const char *zLastCkin = db_column_text(&q, 5);
char *zAge = human_readable_age(rNow - rMtime);
sqlite3_int64 iMtime = (sqlite3_int64)(rMtime*86400.0);
if( zMergeTo && zMergeTo[0]==0 ) zMergeTo = 0;
@ <tr>
@ <td>%z(href("%R/timeline?n=100&r=%T",zBranch))%h(zBranch)</a></td>
@ <td data-sortkey="%016llx(-iMtime)">%s(zAge)</td>
@ <td>%d(nCkin)</td>
fossil_free(zAge);
@ <td>%s(isClosed?"closed":"")</td>
if( zMergeTo ){
@ <td>merged into
@ %z(href("%R/timeline?f=%s",zLastCkin))%h(zMergeTo)</a></td>
}else{
@ <td></td>
}
@ </tr>
}
@ </tbody></table></div>
db_finalize(&q);
output_table_sorting_javascript("branchlisttable","tkNtt",2);
style_footer();
}
/*
** WEBPAGE: brlist
** Show a list of branches
** Query parameters:
|
| ︙ | ︙ |
Changes to src/report.c.
| ︙ | ︙ | |||
931 932 933 934 935 936 937 938 939 940 941 942 943 944 | ** argument. Each character of the second argument represent a column. ** ** t Sort by text ** n Sort numerically ** k Sort by the data-sortkey property ** x This column is not sortable ** ** If there are fewer characters in zColumnTypes[] than their are columns, ** the all extra columns assume type "t" (text). ** ** The third parameter is the column that was initially sorted (using 1-based ** column numbers, like SQL). Make this value 0 if none of the columns are ** initially sorted. Make the value negative if the column is initially sorted ** in reverse order. | > | 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 | ** argument. Each character of the second argument represent a column. ** ** t Sort by text ** n Sort numerically ** k Sort by the data-sortkey property ** x This column is not sortable ** ** Capital letters mean sort in reverse order. ** If there are fewer characters in zColumnTypes[] than their are columns, ** the all extra columns assume type "t" (text). ** ** The third parameter is the column that was initially sorted (using 1-based ** column numbers, like SQL). Make this value 0 if none of the columns are ** initially sorted. Make the value negative if the column is initially sorted ** in reverse order. |
| ︙ | ︙ | |||
954 955 956 957 958 959 960 |
@ function SortableTable(tableEl,columnTypes,initSort){
@ this.tbody = tableEl.getElementsByTagName('tbody');
@ this.columnTypes = columnTypes;
@ this.sort = function (cell) {
@ var column = cell.cellIndex;
@ var sortFn;
@ switch( cell.sortType ){
| | | | | > > > | 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 |
@ function SortableTable(tableEl,columnTypes,initSort){
@ this.tbody = tableEl.getElementsByTagName('tbody');
@ this.columnTypes = columnTypes;
@ this.sort = function (cell) {
@ var column = cell.cellIndex;
@ var sortFn;
@ switch( cell.sortType ){
@ case "N": case "n": sortFn = this.sortNumeric; break;
@ case "T": case "t": sortFn = this.sortText; break;
@ case "K": case "k": sortFn = this.sortKey; break;
@ default: return;
@ }
@ this.sortIndex = column;
@ var newRows = new Array();
@ for (j = 0; j < this.tbody[0].rows.length; j++) {
@ newRows[j] = this.tbody[0].rows[j];
@ }
@ if( this.sortIndex==Math.abs(this.prevColumn)-1 ){
@ newRows.reverse();
@ this.prevColumn = -this.prevColumn;
@ }else{
@ newRows.sort(sortFn);
@ this.prevColumn = this.sortIndex+1;
@ if( cell.sortType>="A" && cell.sortType<="Z" ){
@ newRows.reverse();
@ }
@ }
@ for (i=0;i<newRows.length;i++) {
@ this.tbody[0].appendChild(newRows[i]);
@ }
@ this.setHdrIcons();
@ }
@ this.setHdrIcons = function() {
|
| ︙ | ︙ |
Changes to src/user.c.
| ︙ | ︙ | |||
465 466 467 468 469 470 471 |
blob_append_sql(&sql," ORDER BY rowid DESC LIMIT %d OFFSET %d", n+1, skip);
if( skip ){
style_submenu_element("Newer", "Newer entries",
"%s/access_log?o=%d&n=%d&y=%d", g.zTop, skip>=n ? skip-n : 0,
n, y);
}
rc = db_prepare_ignore_error(&q, "%s", blob_sql_text(&sql));
| | | | | 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 |
blob_append_sql(&sql," ORDER BY rowid DESC LIMIT %d OFFSET %d", n+1, skip);
if( skip ){
style_submenu_element("Newer", "Newer entries",
"%s/access_log?o=%d&n=%d&y=%d", g.zTop, skip>=n ? skip-n : 0,
n, y);
}
rc = db_prepare_ignore_error(&q, "%s", blob_sql_text(&sql));
@ <center><table border="1" cellpadding="5" id='logtable'>
@ <thead><tr><th width="33%%">Date</th><th width="34%%">User</th>
@ <th width="33%%">IP Address</th></tr></thead><tbody>
while( rc==SQLITE_OK && db_step(&q)==SQLITE_ROW ){
const char *zName = db_column_text(&q, 0);
const char *zIP = db_column_text(&q, 1);
const char *zDate = db_column_text(&q, 2);
int bSuccess = db_column_int(&q, 3);
cnt++;
if( cnt>n ){
|
| ︙ | ︙ | |||
490 491 492 493 494 495 496 |
}
@ <td>%s(zDate)</td><td>%h(zName)</td><td>%h(zIP)</td></tr>
}
if( skip>0 || cnt>n ){
style_submenu_element("All", "All entries",
"%s/access_log?n=10000000", g.zTop);
}
| | | 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 |
}
@ <td>%s(zDate)</td><td>%h(zName)</td><td>%h(zIP)</td></tr>
}
if( skip>0 || cnt>n ){
style_submenu_element("All", "All entries",
"%s/access_log?n=10000000", g.zTop);
}
@ </tbody></table></center>
db_finalize(&q);
@ <hr>
@ <form method="post" action="%s(g.zTop)/access_log">
@ <label><input type="checkbox" name="delold">
@ Delete all but the most recent 200 entries</input></label>
@ <input type="submit" name="deloldbtn" value="Delete"></input>
@ </form>
|
| ︙ | ︙ | |||
513 514 515 516 517 518 519 520 521 | @ <input type="submit" name="delfailbtn" value="Delete"></input> @ </form> @ <form method="post" action="%s(g.zTop)/access_log"> @ <label><input type="checkbox" name="delall"> @ Delete all entries</input></label> @ <input type="submit" name="delallbtn" value="Delete"></input> @ </form> style_footer(); } | > | 513 514 515 516 517 518 519 520 521 522 |
@ <input type="submit" name="delfailbtn" value="Delete"></input>
@ </form>
@ <form method="post" action="%s(g.zTop)/access_log">
@ <label><input type="checkbox" name="delall">
@ Delete all entries</input></label>
@ <input type="submit" name="delallbtn" value="Delete"></input>
@ </form>
output_table_sorting_javascript("logtable", "Ttt", 1);
style_footer();
}
|