Fossil SCM
Add the "URLs and Checkouts" page.
Commit
8b1f5e0eab08e96ff210333935bdc85dcc8bda90
Parent
b87d3b880429171…
1 file changed
+49
+49
| --- src/stat.c | ||
| +++ src/stat.c | ||
| @@ -53,10 +53,13 @@ | ||
| 53 | 53 | |
| 54 | 54 | login_check_credentials(); |
| 55 | 55 | if( !g.perm.Read ){ login_needed(); return; } |
| 56 | 56 | brief = P("brief")!=0; |
| 57 | 57 | style_header("Repository Statistics"); |
| 58 | + if( g.perm.Admin ){ | |
| 59 | + style_submenu_element("URLs", "URLs and Checkouts", "urllist"); | |
| 60 | + } | |
| 58 | 61 | @ <table class="label-value"> |
| 59 | 62 | @ <tr><th>Repository Size:</th><td> |
| 60 | 63 | fsize = file_size(g.zRepositoryName); |
| 61 | 64 | bigSizeName(sizeof(zBuf), zBuf, fsize); |
| 62 | 65 | @ %s(zBuf) |
| @@ -131,8 +134,54 @@ | ||
| 131 | 134 | @ %d(db_int(0, "PRAGMA %s.freelist_count", zDb)) free pages, |
| 132 | 135 | @ %s(db_text(0, "PRAGMA %s.encoding", zDb)), |
| 133 | 136 | @ %s(db_text(0, "PRAGMA %s.journal_mode", zDb)) mode |
| 134 | 137 | @ </td></tr> |
| 135 | 138 | |
| 139 | + @ </table> | |
| 140 | + style_footer(); | |
| 141 | +} | |
| 142 | + | |
| 143 | +/* | |
| 144 | +** WEBPAGE: urllist | |
| 145 | +** | |
| 146 | +** Show ways in which this repository has been accessed | |
| 147 | +*/ | |
| 148 | +void urllist_page(void){ | |
| 149 | + Stmt q; | |
| 150 | + int cnt; | |
| 151 | + login_check_credentials(); | |
| 152 | + if( !g.perm.Admin ){ login_needed(); return; } | |
| 153 | + | |
| 154 | + style_header("URLs and Checkouts"); | |
| 155 | + style_submenu_element("Stat", "Repository Stats", "stat"); | |
| 156 | + @ <div class="section">URLs</div> | |
| 157 | + @ <table border="0" width='100%%'> | |
| 158 | + db_prepare(&q, "SELECT substr(name,9), datetime(mtime,'unixepoch')" | |
| 159 | + " FROM config WHERE name GLOB 'baseurl:*' ORDER BY 2"); | |
| 160 | + cnt = 0; | |
| 161 | + while( db_step(&q)==SQLITE_ROW ){ | |
| 162 | + @ <tr><td width='100%%'>%h(db_column_text(&q,0))</td> | |
| 163 | + @ <td><nobr>%h(db_column_text(&q,1))</nobr></td></tr> | |
| 164 | + cnt++; | |
| 165 | + } | |
| 166 | + db_finalize(&q); | |
| 167 | + if( cnt==0 ){ | |
| 168 | + @ <tr><td>(none)</td> | |
| 169 | + } | |
| 170 | + @ </table> | |
| 171 | + @ <div class="section">Checkouts</div> | |
| 172 | + @ <table border="0" width='100%%'> | |
| 173 | + db_prepare(&q, "SELECT substr(name,7), datetime(mtime,'unixepoch')" | |
| 174 | + " FROM config WHERE name GLOB 'ckout:*' ORDER BY 2"); | |
| 175 | + cnt = 0; | |
| 176 | + while( db_step(&q)==SQLITE_ROW ){ | |
| 177 | + @ <tr><td width='100%%'>%h(db_column_text(&q,0))</td> | |
| 178 | + @ <td><nobr>%h(db_column_text(&q,1))</nobr></td></tr> | |
| 179 | + cnt++; | |
| 180 | + } | |
| 181 | + db_finalize(&q); | |
| 182 | + if( cnt==0 ){ | |
| 183 | + @ <tr><td>(none)</td> | |
| 184 | + } | |
| 136 | 185 | @ </table> |
| 137 | 186 | style_footer(); |
| 138 | 187 | } |
| 139 | 188 |
| --- src/stat.c | |
| +++ src/stat.c | |
| @@ -53,10 +53,13 @@ | |
| 53 | |
| 54 | login_check_credentials(); |
| 55 | if( !g.perm.Read ){ login_needed(); return; } |
| 56 | brief = P("brief")!=0; |
| 57 | style_header("Repository Statistics"); |
| 58 | @ <table class="label-value"> |
| 59 | @ <tr><th>Repository Size:</th><td> |
| 60 | fsize = file_size(g.zRepositoryName); |
| 61 | bigSizeName(sizeof(zBuf), zBuf, fsize); |
| 62 | @ %s(zBuf) |
| @@ -131,8 +134,54 @@ | |
| 131 | @ %d(db_int(0, "PRAGMA %s.freelist_count", zDb)) free pages, |
| 132 | @ %s(db_text(0, "PRAGMA %s.encoding", zDb)), |
| 133 | @ %s(db_text(0, "PRAGMA %s.journal_mode", zDb)) mode |
| 134 | @ </td></tr> |
| 135 | |
| 136 | @ </table> |
| 137 | style_footer(); |
| 138 | } |
| 139 |
| --- src/stat.c | |
| +++ src/stat.c | |
| @@ -53,10 +53,13 @@ | |
| 53 | |
| 54 | login_check_credentials(); |
| 55 | if( !g.perm.Read ){ login_needed(); return; } |
| 56 | brief = P("brief")!=0; |
| 57 | style_header("Repository Statistics"); |
| 58 | if( g.perm.Admin ){ |
| 59 | style_submenu_element("URLs", "URLs and Checkouts", "urllist"); |
| 60 | } |
| 61 | @ <table class="label-value"> |
| 62 | @ <tr><th>Repository Size:</th><td> |
| 63 | fsize = file_size(g.zRepositoryName); |
| 64 | bigSizeName(sizeof(zBuf), zBuf, fsize); |
| 65 | @ %s(zBuf) |
| @@ -131,8 +134,54 @@ | |
| 134 | @ %d(db_int(0, "PRAGMA %s.freelist_count", zDb)) free pages, |
| 135 | @ %s(db_text(0, "PRAGMA %s.encoding", zDb)), |
| 136 | @ %s(db_text(0, "PRAGMA %s.journal_mode", zDb)) mode |
| 137 | @ </td></tr> |
| 138 | |
| 139 | @ </table> |
| 140 | style_footer(); |
| 141 | } |
| 142 | |
| 143 | /* |
| 144 | ** WEBPAGE: urllist |
| 145 | ** |
| 146 | ** Show ways in which this repository has been accessed |
| 147 | */ |
| 148 | void urllist_page(void){ |
| 149 | Stmt q; |
| 150 | int cnt; |
| 151 | login_check_credentials(); |
| 152 | if( !g.perm.Admin ){ login_needed(); return; } |
| 153 | |
| 154 | style_header("URLs and Checkouts"); |
| 155 | style_submenu_element("Stat", "Repository Stats", "stat"); |
| 156 | @ <div class="section">URLs</div> |
| 157 | @ <table border="0" width='100%%'> |
| 158 | db_prepare(&q, "SELECT substr(name,9), datetime(mtime,'unixepoch')" |
| 159 | " FROM config WHERE name GLOB 'baseurl:*' ORDER BY 2"); |
| 160 | cnt = 0; |
| 161 | while( db_step(&q)==SQLITE_ROW ){ |
| 162 | @ <tr><td width='100%%'>%h(db_column_text(&q,0))</td> |
| 163 | @ <td><nobr>%h(db_column_text(&q,1))</nobr></td></tr> |
| 164 | cnt++; |
| 165 | } |
| 166 | db_finalize(&q); |
| 167 | if( cnt==0 ){ |
| 168 | @ <tr><td>(none)</td> |
| 169 | } |
| 170 | @ </table> |
| 171 | @ <div class="section">Checkouts</div> |
| 172 | @ <table border="0" width='100%%'> |
| 173 | db_prepare(&q, "SELECT substr(name,7), datetime(mtime,'unixepoch')" |
| 174 | " FROM config WHERE name GLOB 'ckout:*' ORDER BY 2"); |
| 175 | cnt = 0; |
| 176 | while( db_step(&q)==SQLITE_ROW ){ |
| 177 | @ <tr><td width='100%%'>%h(db_column_text(&q,0))</td> |
| 178 | @ <td><nobr>%h(db_column_text(&q,1))</nobr></td></tr> |
| 179 | cnt++; |
| 180 | } |
| 181 | db_finalize(&q); |
| 182 | if( cnt==0 ){ |
| 183 | @ <tr><td>(none)</td> |
| 184 | } |
| 185 | @ </table> |
| 186 | style_footer(); |
| 187 | } |
| 188 |