Fossil SCM

make the quickfilter optional for repolist based on the value of FOSSIL_REPOLIST_QUICKFILTER

jkosche 2025-03-30 12:02 quickfilter
Commit 79488503206c0b677c2164d6c00e0255c4f1bee54099dcb9e279de9411c795a8
1 file changed +25 -4
+25 -4
--- src/repolist.c
+++ src/repolist.c
@@ -115,10 +115,11 @@
115115
int allRepo; /* True if running "fossil ui all".
116116
** False if a directory scan of base for repos */
117117
Blob html; /* Html for the body of the repository list */
118118
char *zSkinRepo = 0; /* Name of the repository database used for skins */
119119
char *zSkinUrl = 0; /* URL for the skin database */
120
+ int quickfilter = 0; /* Is quickfilter is enabled? */
120121
121122
assert( g.db==0 );
122123
blob_init(&html, 0, 0);
123124
if( fossil_strcmp(g.zRepositoryName,"/")==0 && !g.fJail ){
124125
/* For the special case of the "repository directory" being "/",
@@ -304,22 +305,27 @@
304305
set_base_url(zNewBase);
305306
db_open_repository(zSkinRepo);
306307
fossil_free(zSkinRepo);
307308
fossil_free(zSkinUrl);
308309
}
310
+ quickfilter = is_quickfilter_enabled();
309311
if( g.repositoryOpen ){
310312
/* This case runs if remote_repo_info() found a repository
311313
** that has the "repolist_skin" property set to non-zero and left
312314
** that repository open in g.db. Use the skin of that repository
313315
** for display. */
314316
login_check_credentials();
315317
style_set_current_feature("repolist");
316318
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
+ }
318322
@ %s(blob_str(&html))
319323
style_table_sorter();
320
- style_quickfilter();
324
+ if( quickfilter ){
325
+ style_quickfilter();
326
+ }
321327
style_finish_page();
322328
}else{
323329
const char *zTitle = PD("FOSSIL_REPOLIST_TITLE","Repository List");
324330
/* If no repositories were found that had the "repolist_skin"
325331
** property set, then use a default skin */
@@ -329,14 +335,18 @@
329335
@ <meta name="viewport" content="width=device-width, initial-scale=1.0">
330336
@ <title>%h(zTitle)</title>
331337
@ </head>
332338
@ <body>
333339
@ <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
+ }
335343
@ %s(blob_str(&html))
336344
@ <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
+ }
338348
@ </body>
339349
@ </html>
340350
}
341351
blob_reset(&html);
342352
cgi_reply();
@@ -358,5 +368,16 @@
358368
g.zRepositoryName = g.argv[2];
359369
}
360370
g.httpOut = stdout;
361371
repo_list_page();
362372
}
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
+}
363384
--- 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

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button