Fossil SCM

Click on the column labels to sort on the /brlist page.

drh 2015-01-04 00:28 trunk
Commit e35b9cb74cbf0de3f577529487f768b38be772d3
2 files changed +7 -6 +15 -1
+7 -6
--- src/branch.c
+++ src/branch.c
@@ -346,26 +346,27 @@
346346
login_anonymous_available();
347347
348348
assert( orderByMtime==0 || orderByMtime==1 );
349349
db_prepare(&q, brlistQuery/*works-like:"%d"*/, 2-orderByMtime);
350350
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>
353353
@ <th>Branch Name</th>
354354
@ <th>Age</th>
355355
@ <th>Status</th>
356
- @ </tr>
356
+ @ </tr></thead><tbody>
357357
while( db_step(&q)==SQLITE_ROW ){
358358
const char *zBranch = db_column_text(&q, 0);
359359
double rMtime = db_column_double(&q, 1);
360360
int isClosed = db_column_int(&q, 2);
361361
const char *zMergeTo = db_column_text(&q, 3);
362362
char *zAge = human_readable_age(rNow - rMtime);
363
+ sqlite3_int64 iMtime = (sqlite3_int64)(rMtime*86400.0);
363364
if( zMergeTo && zMergeTo[0]==0 ) zMergeTo = 0;
364365
@ <tr>
365366
@ <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)
367368
fossil_free(zAge);
368369
if( isClosed && zMergeTo ){
369370
@ <td>closed,
370371
}else if( isClosed ){
371372
@ <td>closed
@@ -375,13 +376,13 @@
375376
if( zMergeTo ){
376377
@ merged into %z(href("%R/timeline?r=%T",zMergeTo))%h(zMergeTo)</a>
377378
}
378379
@ </tr>
379380
}
380
- @ </table></div>
381
-
381
+ @ </tbody></table></div>
382382
db_finalize(&q);
383
+ output_table_sorting_javascript("branchlisttable","tkx");
383384
style_footer();
384385
}
385386
386387
/*
387388
** WEBPAGE: brlist
388389
--- 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 @@
938938
@ <script>
939939
@ function SortableTable(tableEl,columnTypes){
940940
@ this.tbody = tableEl.getElementsByTagName('tbody');
941941
@ this.sort = function (cell) {
942942
@ 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
+ @ }
944950
@ this.sortIndex = column;
945951
@ var newRows = new Array();
946952
@ for (j = 0; j < this.tbody[0].rows.length; j++) {
947953
@ newRows[j] = this.tbody[0].rows[j];
948954
@ }
@@ -970,10 +976,18 @@
970976
@ aa = parseFloat(a.cells[i].textContent);
971977
@ if (isNaN(aa)) aa = 0;
972978
@ bb = parseFloat(b.cells[i].textContent);
973979
@ if (isNaN(bb)) bb = 0;
974980
@ 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;
975989
@ }
976990
@ var thisObject = this;
977991
@ var x = tableEl.getElementsByTagName('thead');
978992
@ if(!(this.tbody && this.tbody[0].rows && this.tbody[0].rows.length>0)){
979993
@ return;
980994
--- 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

Keyboard Shortcuts

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