Fossil SCM
Add the colortest query parameter to the brlist webpage.
Commit
d0daac20dae97980a27b80f6c79618ad5a5153e7
Parent
130b8f77ff58562…
1 file changed
+21
-3
+21
-3
| --- src/branch.c | ||
| +++ src/branch.c | ||
| @@ -281,13 +281,18 @@ | ||
| 281 | 281 | void brlist_page(void){ |
| 282 | 282 | Stmt q; |
| 283 | 283 | int cnt; |
| 284 | 284 | int showClosed = P("closed")!=0; |
| 285 | 285 | int showAll = P("all")!=0; |
| 286 | + int colorTest = P("colortest")!=0; | |
| 286 | 287 | |
| 287 | 288 | login_check_credentials(); |
| 288 | 289 | if( !g.okRead ){ login_needed(); return; } |
| 290 | + if( colorTest ){ | |
| 291 | + showClosed = 0; | |
| 292 | + showAll = 1; | |
| 293 | + } | |
| 289 | 294 | |
| 290 | 295 | style_header(showClosed ? "Closed Branches" : |
| 291 | 296 | showAll ? "All Branches" : "Open Branches"); |
| 292 | 297 | style_submenu_element("Timeline", "Timeline", "brtimeline"); |
| 293 | 298 | if( showClosed ){ |
| @@ -298,10 +303,15 @@ | ||
| 298 | 303 | style_submenu_element("Open","Open","brlist"); |
| 299 | 304 | }else{ |
| 300 | 305 | style_submenu_element("All", "All", "brlist?all"); |
| 301 | 306 | style_submenu_element("Closed","Closed","brlist?closed"); |
| 302 | 307 | } |
| 308 | + if( !colorTest ){ | |
| 309 | + style_submenu_element("Color-Test", "Color-Test", "brlist?colortest"); | |
| 310 | + }else{ | |
| 311 | + style_submenu_element("All", "All", "brlist?all"); | |
| 312 | + } | |
| 303 | 313 | login_anonymous_available(); |
| 304 | 314 | style_sidebox_begin("Nomenclature:", "33%"); |
| 305 | 315 | @ <ol> |
| 306 | 316 | @ <li> An <div class="sideboxDescribed"><a href="brlist"> |
| 307 | 317 | @ open branch</a></div> is a branch that has one or |
| @@ -320,20 +330,28 @@ | ||
| 320 | 330 | prepareBranchQuery(&q, showAll, showClosed); |
| 321 | 331 | cnt = 0; |
| 322 | 332 | while( db_step(&q)==SQLITE_ROW ){ |
| 323 | 333 | const char *zBr = db_column_text(&q, 0); |
| 324 | 334 | if( cnt==0 ){ |
| 325 | - if( showClosed ){ | |
| 335 | + if( colorTest ){ | |
| 336 | + @ <h2>Default background colors for all branches:</h2> | |
| 337 | + }else if( showAll ){ | |
| 338 | + @ <h2>All Branches:</h2> | |
| 339 | + }else if( showClosed ){ | |
| 326 | 340 | @ <h2>Closed Branches:</h2> |
| 327 | 341 | }else{ |
| 328 | 342 | @ <h2>Open Branches:</h2> |
| 329 | 343 | } |
| 330 | 344 | @ <ul> |
| 331 | 345 | cnt++; |
| 332 | 346 | } |
| 333 | - if( g.okHistory ){ | |
| 334 | - @ <li><a href="%s(g.zTop)/timeline?r=%T(zBr)">%h(zBr)</a></li> | |
| 347 | + if( colorTest ){ | |
| 348 | + const char *zColor = hash_color(zBr); | |
| 349 | + @ <li><span style="background-color: %s(zColor)"> | |
| 350 | + @ %h(zBr) → %s(zColor)</span></li> | |
| 351 | + }else if( g.okHistory ){ | |
| 352 | + @ <li><a href="%s(g.zTop)/timeline?r=%T(zBr)")>%h(zBr)</a></li> | |
| 335 | 353 | }else{ |
| 336 | 354 | @ <li><b>%h(zBr)</b></li> |
| 337 | 355 | } |
| 338 | 356 | } |
| 339 | 357 | if( cnt ){ |
| 340 | 358 |
| --- src/branch.c | |
| +++ src/branch.c | |
| @@ -281,13 +281,18 @@ | |
| 281 | void brlist_page(void){ |
| 282 | Stmt q; |
| 283 | int cnt; |
| 284 | int showClosed = P("closed")!=0; |
| 285 | int showAll = P("all")!=0; |
| 286 | |
| 287 | login_check_credentials(); |
| 288 | if( !g.okRead ){ login_needed(); return; } |
| 289 | |
| 290 | style_header(showClosed ? "Closed Branches" : |
| 291 | showAll ? "All Branches" : "Open Branches"); |
| 292 | style_submenu_element("Timeline", "Timeline", "brtimeline"); |
| 293 | if( showClosed ){ |
| @@ -298,10 +303,15 @@ | |
| 298 | style_submenu_element("Open","Open","brlist"); |
| 299 | }else{ |
| 300 | style_submenu_element("All", "All", "brlist?all"); |
| 301 | style_submenu_element("Closed","Closed","brlist?closed"); |
| 302 | } |
| 303 | login_anonymous_available(); |
| 304 | style_sidebox_begin("Nomenclature:", "33%"); |
| 305 | @ <ol> |
| 306 | @ <li> An <div class="sideboxDescribed"><a href="brlist"> |
| 307 | @ open branch</a></div> is a branch that has one or |
| @@ -320,20 +330,28 @@ | |
| 320 | prepareBranchQuery(&q, showAll, showClosed); |
| 321 | cnt = 0; |
| 322 | while( db_step(&q)==SQLITE_ROW ){ |
| 323 | const char *zBr = db_column_text(&q, 0); |
| 324 | if( cnt==0 ){ |
| 325 | if( showClosed ){ |
| 326 | @ <h2>Closed Branches:</h2> |
| 327 | }else{ |
| 328 | @ <h2>Open Branches:</h2> |
| 329 | } |
| 330 | @ <ul> |
| 331 | cnt++; |
| 332 | } |
| 333 | if( g.okHistory ){ |
| 334 | @ <li><a href="%s(g.zTop)/timeline?r=%T(zBr)">%h(zBr)</a></li> |
| 335 | }else{ |
| 336 | @ <li><b>%h(zBr)</b></li> |
| 337 | } |
| 338 | } |
| 339 | if( cnt ){ |
| 340 |
| --- src/branch.c | |
| +++ src/branch.c | |
| @@ -281,13 +281,18 @@ | |
| 281 | void brlist_page(void){ |
| 282 | Stmt q; |
| 283 | int cnt; |
| 284 | int showClosed = P("closed")!=0; |
| 285 | int showAll = P("all")!=0; |
| 286 | int colorTest = P("colortest")!=0; |
| 287 | |
| 288 | login_check_credentials(); |
| 289 | if( !g.okRead ){ login_needed(); return; } |
| 290 | if( colorTest ){ |
| 291 | showClosed = 0; |
| 292 | showAll = 1; |
| 293 | } |
| 294 | |
| 295 | style_header(showClosed ? "Closed Branches" : |
| 296 | showAll ? "All Branches" : "Open Branches"); |
| 297 | style_submenu_element("Timeline", "Timeline", "brtimeline"); |
| 298 | if( showClosed ){ |
| @@ -298,10 +303,15 @@ | |
| 303 | style_submenu_element("Open","Open","brlist"); |
| 304 | }else{ |
| 305 | style_submenu_element("All", "All", "brlist?all"); |
| 306 | style_submenu_element("Closed","Closed","brlist?closed"); |
| 307 | } |
| 308 | if( !colorTest ){ |
| 309 | style_submenu_element("Color-Test", "Color-Test", "brlist?colortest"); |
| 310 | }else{ |
| 311 | style_submenu_element("All", "All", "brlist?all"); |
| 312 | } |
| 313 | login_anonymous_available(); |
| 314 | style_sidebox_begin("Nomenclature:", "33%"); |
| 315 | @ <ol> |
| 316 | @ <li> An <div class="sideboxDescribed"><a href="brlist"> |
| 317 | @ open branch</a></div> is a branch that has one or |
| @@ -320,20 +330,28 @@ | |
| 330 | prepareBranchQuery(&q, showAll, showClosed); |
| 331 | cnt = 0; |
| 332 | while( db_step(&q)==SQLITE_ROW ){ |
| 333 | const char *zBr = db_column_text(&q, 0); |
| 334 | if( cnt==0 ){ |
| 335 | if( colorTest ){ |
| 336 | @ <h2>Default background colors for all branches:</h2> |
| 337 | }else if( showAll ){ |
| 338 | @ <h2>All Branches:</h2> |
| 339 | }else if( showClosed ){ |
| 340 | @ <h2>Closed Branches:</h2> |
| 341 | }else{ |
| 342 | @ <h2>Open Branches:</h2> |
| 343 | } |
| 344 | @ <ul> |
| 345 | cnt++; |
| 346 | } |
| 347 | if( colorTest ){ |
| 348 | const char *zColor = hash_color(zBr); |
| 349 | @ <li><span style="background-color: %s(zColor)"> |
| 350 | @ %h(zBr) → %s(zColor)</span></li> |
| 351 | }else if( g.okHistory ){ |
| 352 | @ <li><a href="%s(g.zTop)/timeline?r=%T(zBr)")>%h(zBr)</a></li> |
| 353 | }else{ |
| 354 | @ <li><b>%h(zBr)</b></li> |
| 355 | } |
| 356 | } |
| 357 | if( cnt ){ |
| 358 |