Fossil SCM
make the quickfilter optional for repolist based on the value of FOSSIL_REPOLIST_QUICKFILTER
Commit
79488503206c0b677c2164d6c00e0255c4f1bee54099dcb9e279de9411c795a8
Parent
7d20f5020762c71…
1 file changed
+25
-4
+25
-4
| --- src/repolist.c | ||
| +++ src/repolist.c | ||
| @@ -115,10 +115,11 @@ | ||
| 115 | 115 | int allRepo; /* True if running "fossil ui all". |
| 116 | 116 | ** False if a directory scan of base for repos */ |
| 117 | 117 | Blob html; /* Html for the body of the repository list */ |
| 118 | 118 | char *zSkinRepo = 0; /* Name of the repository database used for skins */ |
| 119 | 119 | char *zSkinUrl = 0; /* URL for the skin database */ |
| 120 | + int quickfilter = 0; /* Is quickfilter is enabled? */ | |
| 120 | 121 | |
| 121 | 122 | assert( g.db==0 ); |
| 122 | 123 | blob_init(&html, 0, 0); |
| 123 | 124 | if( fossil_strcmp(g.zRepositoryName,"/")==0 && !g.fJail ){ |
| 124 | 125 | /* For the special case of the "repository directory" being "/", |
| @@ -304,22 +305,27 @@ | ||
| 304 | 305 | set_base_url(zNewBase); |
| 305 | 306 | db_open_repository(zSkinRepo); |
| 306 | 307 | fossil_free(zSkinRepo); |
| 307 | 308 | fossil_free(zSkinUrl); |
| 308 | 309 | } |
| 310 | + quickfilter = is_quickfilter_enabled(); | |
| 309 | 311 | if( g.repositoryOpen ){ |
| 310 | 312 | /* This case runs if remote_repo_info() found a repository |
| 311 | 313 | ** that has the "repolist_skin" property set to non-zero and left |
| 312 | 314 | ** that repository open in g.db. Use the skin of that repository |
| 313 | 315 | ** for display. */ |
| 314 | 316 | login_check_credentials(); |
| 315 | 317 | style_set_current_feature("repolist"); |
| 316 | 318 | style_header("Repository List"); |
| 317 | - @ <input type="text" id="quickfilter" placeholder="filter repository list..." style="display: none"> | |
| 319 | + if( quickfilter ){ | |
| 320 | + @ <input type="text" id="quickfilter" placeholder="filter repository list..."> | |
| 321 | + } | |
| 318 | 322 | @ %s(blob_str(&html)) |
| 319 | 323 | style_table_sorter(); |
| 320 | - style_quickfilter(); | |
| 324 | + if( quickfilter ){ | |
| 325 | + style_quickfilter(); | |
| 326 | + } | |
| 321 | 327 | style_finish_page(); |
| 322 | 328 | }else{ |
| 323 | 329 | const char *zTitle = PD("FOSSIL_REPOLIST_TITLE","Repository List"); |
| 324 | 330 | /* If no repositories were found that had the "repolist_skin" |
| 325 | 331 | ** property set, then use a default skin */ |
| @@ -329,14 +335,18 @@ | ||
| 329 | 335 | @ <meta name="viewport" content="width=device-width, initial-scale=1.0"> |
| 330 | 336 | @ <title>%h(zTitle)</title> |
| 331 | 337 | @ </head> |
| 332 | 338 | @ <body> |
| 333 | 339 | @ <h1 align="center">%h(zTitle)</h1> |
| 334 | - @ <input type="text" id="quickfilter" placeholder="filter repository list..." style="display: none"> | |
| 340 | + if( quickfilter ){ | |
| 341 | + @ <input type="text" id="quickfilter" placeholder="filter repository list..."> | |
| 342 | + } | |
| 335 | 343 | @ %s(blob_str(&html)) |
| 336 | 344 | @ <script>%s(builtin_text("sorttable.js"))</script> |
| 337 | - @ <script>%s(builtin_text("quickfilter.js"))</script> | |
| 345 | + if( quickfilter ){ | |
| 346 | + @ <script>%s(builtin_text("quickfilter.js"))</script> | |
| 347 | + } | |
| 338 | 348 | @ </body> |
| 339 | 349 | @ </html> |
| 340 | 350 | } |
| 341 | 351 | blob_reset(&html); |
| 342 | 352 | cgi_reply(); |
| @@ -358,5 +368,16 @@ | ||
| 358 | 368 | g.zRepositoryName = g.argv[2]; |
| 359 | 369 | } |
| 360 | 370 | g.httpOut = stdout; |
| 361 | 371 | repo_list_page(); |
| 362 | 372 | } |
| 373 | + | |
| 374 | +/* | |
| 375 | +** Return true if quickfilter for repolist is enabled via FOSSIL_REPOLIST_QUICKFILTER. | |
| 376 | +*/ | |
| 377 | +int is_quickfilter_enabled(void){ | |
| 378 | + const char *zQuickFilter = P("FOSSIL_REPOLIST_TITLE"); | |
| 379 | + if ( zQuickFilter==0 ) return 0; | |
| 380 | + if ( zQuickFilter[0]==0 ) return 0; | |
| 381 | + if( is_truth(zQuickFilter) ) return 1; | |
| 382 | + return 0; | |
| 383 | +} | |
| 363 | 384 |
| --- src/repolist.c | |
| +++ src/repolist.c | |
| @@ -115,10 +115,11 @@ | |
| 115 | int allRepo; /* True if running "fossil ui all". |
| 116 | ** False if a directory scan of base for repos */ |
| 117 | Blob html; /* Html for the body of the repository list */ |
| 118 | char *zSkinRepo = 0; /* Name of the repository database used for skins */ |
| 119 | char *zSkinUrl = 0; /* URL for the skin database */ |
| 120 | |
| 121 | assert( g.db==0 ); |
| 122 | blob_init(&html, 0, 0); |
| 123 | if( fossil_strcmp(g.zRepositoryName,"/")==0 && !g.fJail ){ |
| 124 | /* For the special case of the "repository directory" being "/", |
| @@ -304,22 +305,27 @@ | |
| 304 | set_base_url(zNewBase); |
| 305 | db_open_repository(zSkinRepo); |
| 306 | fossil_free(zSkinRepo); |
| 307 | fossil_free(zSkinUrl); |
| 308 | } |
| 309 | if( g.repositoryOpen ){ |
| 310 | /* This case runs if remote_repo_info() found a repository |
| 311 | ** that has the "repolist_skin" property set to non-zero and left |
| 312 | ** that repository open in g.db. Use the skin of that repository |
| 313 | ** for display. */ |
| 314 | login_check_credentials(); |
| 315 | style_set_current_feature("repolist"); |
| 316 | style_header("Repository List"); |
| 317 | @ <input type="text" id="quickfilter" placeholder="filter repository list..." style="display: none"> |
| 318 | @ %s(blob_str(&html)) |
| 319 | style_table_sorter(); |
| 320 | style_quickfilter(); |
| 321 | style_finish_page(); |
| 322 | }else{ |
| 323 | const char *zTitle = PD("FOSSIL_REPOLIST_TITLE","Repository List"); |
| 324 | /* If no repositories were found that had the "repolist_skin" |
| 325 | ** property set, then use a default skin */ |
| @@ -329,14 +335,18 @@ | |
| 329 | @ <meta name="viewport" content="width=device-width, initial-scale=1.0"> |
| 330 | @ <title>%h(zTitle)</title> |
| 331 | @ </head> |
| 332 | @ <body> |
| 333 | @ <h1 align="center">%h(zTitle)</h1> |
| 334 | @ <input type="text" id="quickfilter" placeholder="filter repository list..." style="display: none"> |
| 335 | @ %s(blob_str(&html)) |
| 336 | @ <script>%s(builtin_text("sorttable.js"))</script> |
| 337 | @ <script>%s(builtin_text("quickfilter.js"))</script> |
| 338 | @ </body> |
| 339 | @ </html> |
| 340 | } |
| 341 | blob_reset(&html); |
| 342 | cgi_reply(); |
| @@ -358,5 +368,16 @@ | |
| 358 | g.zRepositoryName = g.argv[2]; |
| 359 | } |
| 360 | g.httpOut = stdout; |
| 361 | repo_list_page(); |
| 362 | } |
| 363 |
| --- src/repolist.c | |
| +++ src/repolist.c | |
| @@ -115,10 +115,11 @@ | |
| 115 | int allRepo; /* True if running "fossil ui all". |
| 116 | ** False if a directory scan of base for repos */ |
| 117 | Blob html; /* Html for the body of the repository list */ |
| 118 | char *zSkinRepo = 0; /* Name of the repository database used for skins */ |
| 119 | char *zSkinUrl = 0; /* URL for the skin database */ |
| 120 | int quickfilter = 0; /* Is quickfilter is enabled? */ |
| 121 | |
| 122 | assert( g.db==0 ); |
| 123 | blob_init(&html, 0, 0); |
| 124 | if( fossil_strcmp(g.zRepositoryName,"/")==0 && !g.fJail ){ |
| 125 | /* For the special case of the "repository directory" being "/", |
| @@ -304,22 +305,27 @@ | |
| 305 | set_base_url(zNewBase); |
| 306 | db_open_repository(zSkinRepo); |
| 307 | fossil_free(zSkinRepo); |
| 308 | fossil_free(zSkinUrl); |
| 309 | } |
| 310 | quickfilter = is_quickfilter_enabled(); |
| 311 | if( g.repositoryOpen ){ |
| 312 | /* This case runs if remote_repo_info() found a repository |
| 313 | ** that has the "repolist_skin" property set to non-zero and left |
| 314 | ** that repository open in g.db. Use the skin of that repository |
| 315 | ** for display. */ |
| 316 | login_check_credentials(); |
| 317 | style_set_current_feature("repolist"); |
| 318 | style_header("Repository List"); |
| 319 | if( quickfilter ){ |
| 320 | @ <input type="text" id="quickfilter" placeholder="filter repository list..."> |
| 321 | } |
| 322 | @ %s(blob_str(&html)) |
| 323 | style_table_sorter(); |
| 324 | if( quickfilter ){ |
| 325 | style_quickfilter(); |
| 326 | } |
| 327 | style_finish_page(); |
| 328 | }else{ |
| 329 | const char *zTitle = PD("FOSSIL_REPOLIST_TITLE","Repository List"); |
| 330 | /* If no repositories were found that had the "repolist_skin" |
| 331 | ** property set, then use a default skin */ |
| @@ -329,14 +335,18 @@ | |
| 335 | @ <meta name="viewport" content="width=device-width, initial-scale=1.0"> |
| 336 | @ <title>%h(zTitle)</title> |
| 337 | @ </head> |
| 338 | @ <body> |
| 339 | @ <h1 align="center">%h(zTitle)</h1> |
| 340 | if( quickfilter ){ |
| 341 | @ <input type="text" id="quickfilter" placeholder="filter repository list..."> |
| 342 | } |
| 343 | @ %s(blob_str(&html)) |
| 344 | @ <script>%s(builtin_text("sorttable.js"))</script> |
| 345 | if( quickfilter ){ |
| 346 | @ <script>%s(builtin_text("quickfilter.js"))</script> |
| 347 | } |
| 348 | @ </body> |
| 349 | @ </html> |
| 350 | } |
| 351 | blob_reset(&html); |
| 352 | cgi_reply(); |
| @@ -358,5 +368,16 @@ | |
| 368 | g.zRepositoryName = g.argv[2]; |
| 369 | } |
| 370 | g.httpOut = stdout; |
| 371 | repo_list_page(); |
| 372 | } |
| 373 | |
| 374 | /* |
| 375 | ** Return true if quickfilter for repolist is enabled via FOSSIL_REPOLIST_QUICKFILTER. |
| 376 | */ |
| 377 | int is_quickfilter_enabled(void){ |
| 378 | const char *zQuickFilter = P("FOSSIL_REPOLIST_TITLE"); |
| 379 | if ( zQuickFilter==0 ) return 0; |
| 380 | if ( zQuickFilter[0]==0 ) return 0; |
| 381 | if( is_truth(zQuickFilter) ) return 1; |
| 382 | return 0; |
| 383 | } |
| 384 |