Fossil SCM
Improvements to the /urllist page.
Commit
8017aab792dc376084849817403c038edbc1150e79fd812c32c4fa88b08d0d3d
Parent
88a72f1e72730d8…
1 file changed
+26
-8
+26
-8
| --- src/stat.c | ||
| +++ src/stat.c | ||
| @@ -502,10 +502,11 @@ | ||
| 502 | 502 | ** Show ways in which this repository has been accessed |
| 503 | 503 | */ |
| 504 | 504 | void urllist_page(void){ |
| 505 | 505 | Stmt q; |
| 506 | 506 | int cnt; |
| 507 | + int total = 0; | |
| 507 | 508 | int showAll = P("all")!=0; |
| 508 | 509 | int nOmitted; |
| 509 | 510 | sqlite3_int64 iNow; |
| 510 | 511 | char *zPriorRepo = 0; |
| 511 | 512 | |
| @@ -516,36 +517,44 @@ | ||
| 516 | 517 | style_header("URLs and Checkouts"); |
| 517 | 518 | style_adunit_config(ADUNIT_RIGHT_OK); |
| 518 | 519 | style_submenu_element("Stat", "stat"); |
| 519 | 520 | style_submenu_element("Schema", "repo_schema"); |
| 520 | 521 | iNow = db_int64(0, "SELECT strftime('%%s','now')"); |
| 521 | - @ <div class="section">URLs used to access this repository</div> | |
| 522 | - @ <table border="0" width='100%%'> | |
| 522 | + | |
| 523 | + | |
| 523 | 524 | db_prepare(&q, "SELECT substr(name,9), datetime(mtime,'unixepoch'), mtime" |
| 524 | 525 | " FROM config WHERE name GLOB 'baseurl:*' ORDER BY 3 DESC"); |
| 525 | 526 | cnt = 0; |
| 526 | 527 | nOmitted = 0; |
| 527 | 528 | while( db_step(&q)==SQLITE_ROW ){ |
| 529 | + if( cnt==0 ){ | |
| 530 | + @ <div class="section">URLs used to access this repository</div> | |
| 531 | + @ <table border="0" width='100%%'> | |
| 532 | + } | |
| 528 | 533 | if( !showAll && db_column_int64(&q,2)<(iNow - 3600*24*30) && cnt>8 ){ |
| 529 | 534 | nOmitted++; |
| 530 | 535 | }else{ |
| 531 | 536 | @ <tr><td width='100%%'>%h(db_column_text(&q,0))</td> |
| 532 | 537 | @ <td><nobr>%h(db_column_text(&q,1))</nobr></td></tr> |
| 533 | 538 | } |
| 534 | 539 | cnt++; |
| 535 | 540 | } |
| 536 | 541 | db_finalize(&q); |
| 537 | - if( cnt==0 ){ | |
| 538 | - @ <tr><td>(none)</td> | |
| 539 | - }else if( nOmitted ){ | |
| 542 | + | |
| 543 | + if( nOmitted ){ | |
| 540 | 544 | @ <tr><td><a href="urllist?all"><i>Show %d(nOmitted) more...</i></a> |
| 541 | 545 | } |
| 542 | - @ </table> | |
| 546 | + if( cnt ){ | |
| 547 | + @ <tr><td>(none)</td> | |
| 548 | + total += cnt; | |
| 549 | + } | |
| 543 | 550 | if( P("urlonly") ){ |
| 544 | 551 | style_finish_page(); |
| 545 | 552 | return; |
| 546 | 553 | } |
| 554 | + | |
| 555 | + | |
| 547 | 556 | db_prepare(&q, "SELECT substr(name,7), datetime(mtime,'unixepoch')" |
| 548 | 557 | " FROM config WHERE name GLOB 'ckout:*' ORDER BY 2 DESC"); |
| 549 | 558 | cnt = 0; |
| 550 | 559 | while( db_step(&q)==SQLITE_ROW ){ |
| 551 | 560 | const char *zPath = db_column_text(&q,0); |
| @@ -560,11 +569,13 @@ | ||
| 560 | 569 | } |
| 561 | 570 | } |
| 562 | 571 | db_finalize(&q); |
| 563 | 572 | if( cnt ){ |
| 564 | 573 | @ </table> |
| 574 | + total += cnt; | |
| 565 | 575 | } |
| 576 | + | |
| 566 | 577 | cnt = 0; |
| 567 | 578 | db_prepare(&q, |
| 568 | 579 | "SELECT substr(name,10), datetime(mtime,'unixepoch')" |
| 569 | 580 | " FROM config WHERE name GLOB 'syncwith:*'" |
| 570 | 581 | "UNION ALL " |
| @@ -571,11 +582,11 @@ | ||
| 571 | 582 | "SELECT substr(name,10), datetime(mtime,'unixepoch')" |
| 572 | 583 | " FROM config WHERE name GLOB 'syncfrom:*'" |
| 573 | 584 | "UNION ALL " |
| 574 | 585 | "SELECT substr(name,9), datetime(mtime,'unixepoch')" |
| 575 | 586 | " FROM config WHERE name GLOB 'gitpush:*'" |
| 576 | - "ORDER BY 2 DESC" | |
| 587 | + "GROUP BY 1 ORDER BY 2 DESC" | |
| 577 | 588 | ); |
| 578 | 589 | while( db_step(&q)==SQLITE_ROW ){ |
| 579 | 590 | const char *zURL = db_column_text(&q,0); |
| 580 | 591 | UrlData x; |
| 581 | 592 | if( cnt==0 ){ |
| @@ -590,10 +601,11 @@ | ||
| 590 | 601 | url_unparse(&x); |
| 591 | 602 | } |
| 592 | 603 | db_finalize(&q); |
| 593 | 604 | if( cnt ){ |
| 594 | 605 | @ </table> |
| 606 | + total += cnt; | |
| 595 | 607 | } |
| 596 | 608 | |
| 597 | 609 | cnt = 0; |
| 598 | 610 | db_prepare(&q, |
| 599 | 611 | "SELECT" |
| @@ -613,11 +625,11 @@ | ||
| 613 | 625 | if( zUrl==0 || zSrc==0 ) continue; |
| 614 | 626 | if( cnt++==0 ){ |
| 615 | 627 | @ <div class="section">Links from other repositories</div> |
| 616 | 628 | @ <table border='0' width='100%%'> |
| 617 | 629 | } |
| 618 | - if( zPriorRepo==0 || strcmp(zUrl,zSrc)!=0 ){ | |
| 630 | + if( zPriorRepo==0 || strcmp(zPriorRepo,zSrc)!=0 ){ | |
| 619 | 631 | fossil_free(zPriorRepo); |
| 620 | 632 | zPriorRepo = fossil_strdup(zSrc); |
| 621 | 633 | @ <tr><td colspan="4">\ |
| 622 | 634 | @ From <a href='%T(zSrc)'>%h(zSrc)</a>...</td></tr> |
| 623 | 635 | } |
| @@ -632,10 +644,16 @@ | ||
| 632 | 644 | } |
| 633 | 645 | db_finalize(&q); |
| 634 | 646 | fossil_free(zPriorRepo); |
| 635 | 647 | if( cnt ){ |
| 636 | 648 | @ </table> |
| 649 | + total += cnt; | |
| 650 | + } | |
| 651 | + | |
| 652 | + | |
| 653 | + if( total==0 ){ | |
| 654 | + @ <p>No record of any URLs or checkouts</p> | |
| 637 | 655 | } |
| 638 | 656 | style_finish_page(); |
| 639 | 657 | } |
| 640 | 658 | |
| 641 | 659 | /* |
| 642 | 660 |
| --- src/stat.c | |
| +++ src/stat.c | |
| @@ -502,10 +502,11 @@ | |
| 502 | ** Show ways in which this repository has been accessed |
| 503 | */ |
| 504 | void urllist_page(void){ |
| 505 | Stmt q; |
| 506 | int cnt; |
| 507 | int showAll = P("all")!=0; |
| 508 | int nOmitted; |
| 509 | sqlite3_int64 iNow; |
| 510 | char *zPriorRepo = 0; |
| 511 | |
| @@ -516,36 +517,44 @@ | |
| 516 | style_header("URLs and Checkouts"); |
| 517 | style_adunit_config(ADUNIT_RIGHT_OK); |
| 518 | style_submenu_element("Stat", "stat"); |
| 519 | style_submenu_element("Schema", "repo_schema"); |
| 520 | iNow = db_int64(0, "SELECT strftime('%%s','now')"); |
| 521 | @ <div class="section">URLs used to access this repository</div> |
| 522 | @ <table border="0" width='100%%'> |
| 523 | db_prepare(&q, "SELECT substr(name,9), datetime(mtime,'unixepoch'), mtime" |
| 524 | " FROM config WHERE name GLOB 'baseurl:*' ORDER BY 3 DESC"); |
| 525 | cnt = 0; |
| 526 | nOmitted = 0; |
| 527 | while( db_step(&q)==SQLITE_ROW ){ |
| 528 | if( !showAll && db_column_int64(&q,2)<(iNow - 3600*24*30) && cnt>8 ){ |
| 529 | nOmitted++; |
| 530 | }else{ |
| 531 | @ <tr><td width='100%%'>%h(db_column_text(&q,0))</td> |
| 532 | @ <td><nobr>%h(db_column_text(&q,1))</nobr></td></tr> |
| 533 | } |
| 534 | cnt++; |
| 535 | } |
| 536 | db_finalize(&q); |
| 537 | if( cnt==0 ){ |
| 538 | @ <tr><td>(none)</td> |
| 539 | }else if( nOmitted ){ |
| 540 | @ <tr><td><a href="urllist?all"><i>Show %d(nOmitted) more...</i></a> |
| 541 | } |
| 542 | @ </table> |
| 543 | if( P("urlonly") ){ |
| 544 | style_finish_page(); |
| 545 | return; |
| 546 | } |
| 547 | db_prepare(&q, "SELECT substr(name,7), datetime(mtime,'unixepoch')" |
| 548 | " FROM config WHERE name GLOB 'ckout:*' ORDER BY 2 DESC"); |
| 549 | cnt = 0; |
| 550 | while( db_step(&q)==SQLITE_ROW ){ |
| 551 | const char *zPath = db_column_text(&q,0); |
| @@ -560,11 +569,13 @@ | |
| 560 | } |
| 561 | } |
| 562 | db_finalize(&q); |
| 563 | if( cnt ){ |
| 564 | @ </table> |
| 565 | } |
| 566 | cnt = 0; |
| 567 | db_prepare(&q, |
| 568 | "SELECT substr(name,10), datetime(mtime,'unixepoch')" |
| 569 | " FROM config WHERE name GLOB 'syncwith:*'" |
| 570 | "UNION ALL " |
| @@ -571,11 +582,11 @@ | |
| 571 | "SELECT substr(name,10), datetime(mtime,'unixepoch')" |
| 572 | " FROM config WHERE name GLOB 'syncfrom:*'" |
| 573 | "UNION ALL " |
| 574 | "SELECT substr(name,9), datetime(mtime,'unixepoch')" |
| 575 | " FROM config WHERE name GLOB 'gitpush:*'" |
| 576 | "ORDER BY 2 DESC" |
| 577 | ); |
| 578 | while( db_step(&q)==SQLITE_ROW ){ |
| 579 | const char *zURL = db_column_text(&q,0); |
| 580 | UrlData x; |
| 581 | if( cnt==0 ){ |
| @@ -590,10 +601,11 @@ | |
| 590 | url_unparse(&x); |
| 591 | } |
| 592 | db_finalize(&q); |
| 593 | if( cnt ){ |
| 594 | @ </table> |
| 595 | } |
| 596 | |
| 597 | cnt = 0; |
| 598 | db_prepare(&q, |
| 599 | "SELECT" |
| @@ -613,11 +625,11 @@ | |
| 613 | if( zUrl==0 || zSrc==0 ) continue; |
| 614 | if( cnt++==0 ){ |
| 615 | @ <div class="section">Links from other repositories</div> |
| 616 | @ <table border='0' width='100%%'> |
| 617 | } |
| 618 | if( zPriorRepo==0 || strcmp(zUrl,zSrc)!=0 ){ |
| 619 | fossil_free(zPriorRepo); |
| 620 | zPriorRepo = fossil_strdup(zSrc); |
| 621 | @ <tr><td colspan="4">\ |
| 622 | @ From <a href='%T(zSrc)'>%h(zSrc)</a>...</td></tr> |
| 623 | } |
| @@ -632,10 +644,16 @@ | |
| 632 | } |
| 633 | db_finalize(&q); |
| 634 | fossil_free(zPriorRepo); |
| 635 | if( cnt ){ |
| 636 | @ </table> |
| 637 | } |
| 638 | style_finish_page(); |
| 639 | } |
| 640 | |
| 641 | /* |
| 642 |
| --- src/stat.c | |
| +++ src/stat.c | |
| @@ -502,10 +502,11 @@ | |
| 502 | ** Show ways in which this repository has been accessed |
| 503 | */ |
| 504 | void urllist_page(void){ |
| 505 | Stmt q; |
| 506 | int cnt; |
| 507 | int total = 0; |
| 508 | int showAll = P("all")!=0; |
| 509 | int nOmitted; |
| 510 | sqlite3_int64 iNow; |
| 511 | char *zPriorRepo = 0; |
| 512 | |
| @@ -516,36 +517,44 @@ | |
| 517 | style_header("URLs and Checkouts"); |
| 518 | style_adunit_config(ADUNIT_RIGHT_OK); |
| 519 | style_submenu_element("Stat", "stat"); |
| 520 | style_submenu_element("Schema", "repo_schema"); |
| 521 | iNow = db_int64(0, "SELECT strftime('%%s','now')"); |
| 522 | |
| 523 | |
| 524 | db_prepare(&q, "SELECT substr(name,9), datetime(mtime,'unixepoch'), mtime" |
| 525 | " FROM config WHERE name GLOB 'baseurl:*' ORDER BY 3 DESC"); |
| 526 | cnt = 0; |
| 527 | nOmitted = 0; |
| 528 | while( db_step(&q)==SQLITE_ROW ){ |
| 529 | if( cnt==0 ){ |
| 530 | @ <div class="section">URLs used to access this repository</div> |
| 531 | @ <table border="0" width='100%%'> |
| 532 | } |
| 533 | if( !showAll && db_column_int64(&q,2)<(iNow - 3600*24*30) && cnt>8 ){ |
| 534 | nOmitted++; |
| 535 | }else{ |
| 536 | @ <tr><td width='100%%'>%h(db_column_text(&q,0))</td> |
| 537 | @ <td><nobr>%h(db_column_text(&q,1))</nobr></td></tr> |
| 538 | } |
| 539 | cnt++; |
| 540 | } |
| 541 | db_finalize(&q); |
| 542 | |
| 543 | if( nOmitted ){ |
| 544 | @ <tr><td><a href="urllist?all"><i>Show %d(nOmitted) more...</i></a> |
| 545 | } |
| 546 | if( cnt ){ |
| 547 | @ <tr><td>(none)</td> |
| 548 | total += cnt; |
| 549 | } |
| 550 | if( P("urlonly") ){ |
| 551 | style_finish_page(); |
| 552 | return; |
| 553 | } |
| 554 | |
| 555 | |
| 556 | db_prepare(&q, "SELECT substr(name,7), datetime(mtime,'unixepoch')" |
| 557 | " FROM config WHERE name GLOB 'ckout:*' ORDER BY 2 DESC"); |
| 558 | cnt = 0; |
| 559 | while( db_step(&q)==SQLITE_ROW ){ |
| 560 | const char *zPath = db_column_text(&q,0); |
| @@ -560,11 +569,13 @@ | |
| 569 | } |
| 570 | } |
| 571 | db_finalize(&q); |
| 572 | if( cnt ){ |
| 573 | @ </table> |
| 574 | total += cnt; |
| 575 | } |
| 576 | |
| 577 | cnt = 0; |
| 578 | db_prepare(&q, |
| 579 | "SELECT substr(name,10), datetime(mtime,'unixepoch')" |
| 580 | " FROM config WHERE name GLOB 'syncwith:*'" |
| 581 | "UNION ALL " |
| @@ -571,11 +582,11 @@ | |
| 582 | "SELECT substr(name,10), datetime(mtime,'unixepoch')" |
| 583 | " FROM config WHERE name GLOB 'syncfrom:*'" |
| 584 | "UNION ALL " |
| 585 | "SELECT substr(name,9), datetime(mtime,'unixepoch')" |
| 586 | " FROM config WHERE name GLOB 'gitpush:*'" |
| 587 | "GROUP BY 1 ORDER BY 2 DESC" |
| 588 | ); |
| 589 | while( db_step(&q)==SQLITE_ROW ){ |
| 590 | const char *zURL = db_column_text(&q,0); |
| 591 | UrlData x; |
| 592 | if( cnt==0 ){ |
| @@ -590,10 +601,11 @@ | |
| 601 | url_unparse(&x); |
| 602 | } |
| 603 | db_finalize(&q); |
| 604 | if( cnt ){ |
| 605 | @ </table> |
| 606 | total += cnt; |
| 607 | } |
| 608 | |
| 609 | cnt = 0; |
| 610 | db_prepare(&q, |
| 611 | "SELECT" |
| @@ -613,11 +625,11 @@ | |
| 625 | if( zUrl==0 || zSrc==0 ) continue; |
| 626 | if( cnt++==0 ){ |
| 627 | @ <div class="section">Links from other repositories</div> |
| 628 | @ <table border='0' width='100%%'> |
| 629 | } |
| 630 | if( zPriorRepo==0 || strcmp(zPriorRepo,zSrc)!=0 ){ |
| 631 | fossil_free(zPriorRepo); |
| 632 | zPriorRepo = fossil_strdup(zSrc); |
| 633 | @ <tr><td colspan="4">\ |
| 634 | @ From <a href='%T(zSrc)'>%h(zSrc)</a>...</td></tr> |
| 635 | } |
| @@ -632,10 +644,16 @@ | |
| 644 | } |
| 645 | db_finalize(&q); |
| 646 | fossil_free(zPriorRepo); |
| 647 | if( cnt ){ |
| 648 | @ </table> |
| 649 | total += cnt; |
| 650 | } |
| 651 | |
| 652 | |
| 653 | if( total==0 ){ |
| 654 | @ <p>No record of any URLs or checkouts</p> |
| 655 | } |
| 656 | style_finish_page(); |
| 657 | } |
| 658 | |
| 659 | /* |
| 660 |