Fossil SCM
Add the "Links from other repositories" section on the /urllist page.
Commit
6916a058abd2645c9f628340bcfbe9114b4527d2976f6f5edd548e554ba6886a
Parent
12d2f70bdff5541…
1 file changed
+43
+43
| --- src/stat.c | ||
| +++ src/stat.c | ||
| @@ -505,10 +505,11 @@ | ||
| 505 | 505 | Stmt q; |
| 506 | 506 | int cnt; |
| 507 | 507 | int showAll = P("all")!=0; |
| 508 | 508 | int nOmitted; |
| 509 | 509 | sqlite3_int64 iNow; |
| 510 | + char *zPriorRepo = 0; | |
| 510 | 511 | |
| 511 | 512 | login_check_credentials(); |
| 512 | 513 | if( !g.perm.Admin ){ login_needed(0); return; } |
| 513 | 514 | |
| 514 | 515 | style_set_current_feature("stat"); |
| @@ -590,10 +591,52 @@ | ||
| 590 | 591 | } |
| 591 | 592 | db_finalize(&q); |
| 592 | 593 | if( cnt ){ |
| 593 | 594 | @ </table> |
| 594 | 595 | } |
| 596 | + | |
| 597 | + cnt = 0; | |
| 598 | + db_prepare(&q, | |
| 599 | + "SELECT" | |
| 600 | + " substr(name,6)," | |
| 601 | + " datetime(mtime,'unixepoch')," | |
| 602 | + " json_extract(value,'$.type')," | |
| 603 | + " json_extract(value,'$.src')\n" | |
| 604 | + "FROM config\n" | |
| 605 | + "WHERE name GLOB 'link:*'\n" | |
| 606 | + "AND json_valid(value)\n" | |
| 607 | + "ORDER BY 4, 2 DESC" | |
| 608 | + ); | |
| 609 | + while( db_step(&q)==SQLITE_ROW ){ | |
| 610 | + const char *zUrl = db_column_text(&q, 0); | |
| 611 | + const char *zType = db_column_text(&q, 2); | |
| 612 | + const char *zSrc = db_column_text(&q, 3); | |
| 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 | + } | |
| 624 | + @ <tr><td> </td> | |
| 625 | + @ <td width='90%%'><a href='%h(zUrl)'>%h(zUrl)</a></td> | |
| 626 | + if( zType ){ | |
| 627 | + @ <td> (%h(zType)) </td> | |
| 628 | + }else{ | |
| 629 | + @ <td> </td> | |
| 630 | + } | |
| 631 | + @ <td><nobr>%h(db_column_text(&q,1))</nobr></td></tr> | |
| 632 | + } | |
| 633 | + db_finalize(&q); | |
| 634 | + fossil_free(zPriorRepo); | |
| 635 | + if( cnt ){ | |
| 636 | + @ </table> | |
| 637 | + } | |
| 595 | 638 | style_finish_page(); |
| 596 | 639 | } |
| 597 | 640 | |
| 598 | 641 | /* |
| 599 | 642 | ** WEBPAGE: repo_schema |
| 600 | 643 |
| --- src/stat.c | |
| +++ src/stat.c | |
| @@ -505,10 +505,11 @@ | |
| 505 | Stmt q; |
| 506 | int cnt; |
| 507 | int showAll = P("all")!=0; |
| 508 | int nOmitted; |
| 509 | sqlite3_int64 iNow; |
| 510 | |
| 511 | login_check_credentials(); |
| 512 | if( !g.perm.Admin ){ login_needed(0); return; } |
| 513 | |
| 514 | style_set_current_feature("stat"); |
| @@ -590,10 +591,52 @@ | |
| 590 | } |
| 591 | db_finalize(&q); |
| 592 | if( cnt ){ |
| 593 | @ </table> |
| 594 | } |
| 595 | style_finish_page(); |
| 596 | } |
| 597 | |
| 598 | /* |
| 599 | ** WEBPAGE: repo_schema |
| 600 |
| --- src/stat.c | |
| +++ src/stat.c | |
| @@ -505,10 +505,11 @@ | |
| 505 | Stmt q; |
| 506 | int cnt; |
| 507 | int showAll = P("all")!=0; |
| 508 | int nOmitted; |
| 509 | sqlite3_int64 iNow; |
| 510 | char *zPriorRepo = 0; |
| 511 | |
| 512 | login_check_credentials(); |
| 513 | if( !g.perm.Admin ){ login_needed(0); return; } |
| 514 | |
| 515 | style_set_current_feature("stat"); |
| @@ -590,10 +591,52 @@ | |
| 591 | } |
| 592 | db_finalize(&q); |
| 593 | if( cnt ){ |
| 594 | @ </table> |
| 595 | } |
| 596 | |
| 597 | cnt = 0; |
| 598 | db_prepare(&q, |
| 599 | "SELECT" |
| 600 | " substr(name,6)," |
| 601 | " datetime(mtime,'unixepoch')," |
| 602 | " json_extract(value,'$.type')," |
| 603 | " json_extract(value,'$.src')\n" |
| 604 | "FROM config\n" |
| 605 | "WHERE name GLOB 'link:*'\n" |
| 606 | "AND json_valid(value)\n" |
| 607 | "ORDER BY 4, 2 DESC" |
| 608 | ); |
| 609 | while( db_step(&q)==SQLITE_ROW ){ |
| 610 | const char *zUrl = db_column_text(&q, 0); |
| 611 | const char *zType = db_column_text(&q, 2); |
| 612 | const char *zSrc = db_column_text(&q, 3); |
| 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 | } |
| 624 | @ <tr><td> </td> |
| 625 | @ <td width='90%%'><a href='%h(zUrl)'>%h(zUrl)</a></td> |
| 626 | if( zType ){ |
| 627 | @ <td> (%h(zType)) </td> |
| 628 | }else{ |
| 629 | @ <td> </td> |
| 630 | } |
| 631 | @ <td><nobr>%h(db_column_text(&q,1))</nobr></td></tr> |
| 632 | } |
| 633 | db_finalize(&q); |
| 634 | fossil_free(zPriorRepo); |
| 635 | if( cnt ){ |
| 636 | @ </table> |
| 637 | } |
| 638 | style_finish_page(); |
| 639 | } |
| 640 | |
| 641 | /* |
| 642 | ** WEBPAGE: repo_schema |
| 643 |