Fossil SCM

Use "Reports" for the /reportlist element, as per [1a1c0ebe3cf9]. Also be more pedantic when composing user-visible labels for the parameter-induced hyperlinks.

george 2021-04-09 02:58 rptview-submenu-paralink
Commit 8861a68e2c3a232a3a80df6a274706a6d4ea1f0bc39cb5a17732a081562ee011
2 files changed +2 -9 +16 -6
+2 -9
--- src/report.c
+++ src/report.c
@@ -1037,23 +1037,16 @@
10371037
struct GenerateHTML sState = { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
10381038
const char *zQS = PD("QUERY_STRING","");
10391039
10401040
db_multi_exec("PRAGMA empty_result_callbacks=ON");
10411041
style_set_current_feature("report");
1042
- /*
1043
- ** Lets use a funcy button for /reportlist since that page may be
1044
- ** heavily customized by the user. Some variants: ⊚ ⦾ ❊ ⊛ ⚛ ⸎ 💠
1045
- ** Enclosing it inside of square brackets makes its position
1046
- ** determenistic and clearly distincts regular submenu links from
1047
- ** those that are induced by the query string parameters.
1048
- */
10491042
if( zQS[0] ){
10501043
style_submenu_element("Raw","%R/%s?tablist=1&%s",g.zPath,zQS);
1051
- style_submenu_element("[⊚]","%R/reportlist?%s",zQS);
1044
+ style_submenu_element("Reports","%R/reportlist?%s",zQS);
10521045
} else {
10531046
style_submenu_element("Raw","%R/%s?tablist=1",g.zPath);
1054
- style_submenu_element("[⊚]","%R/reportlist");
1047
+ style_submenu_element("Reports","%R/reportlist");
10551048
}
10561049
style_submenu_parametric("rptview_",5);
10571050
style_submenu_parametric("rv",5);
10581051
10591052
if( g.perm.Admin
10601053
--- src/report.c
+++ src/report.c
@@ -1037,23 +1037,16 @@
1037 struct GenerateHTML sState = { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
1038 const char *zQS = PD("QUERY_STRING","");
1039
1040 db_multi_exec("PRAGMA empty_result_callbacks=ON");
1041 style_set_current_feature("report");
1042 /*
1043 ** Lets use a funcy button for /reportlist since that page may be
1044 ** heavily customized by the user. Some variants: ⊚ ⦾ ❊ ⊛ ⚛ ⸎ 💠
1045 ** Enclosing it inside of square brackets makes its position
1046 ** determenistic and clearly distincts regular submenu links from
1047 ** those that are induced by the query string parameters.
1048 */
1049 if( zQS[0] ){
1050 style_submenu_element("Raw","%R/%s?tablist=1&%s",g.zPath,zQS);
1051 style_submenu_element("[⊚]","%R/reportlist?%s",zQS);
1052 } else {
1053 style_submenu_element("Raw","%R/%s?tablist=1",g.zPath);
1054 style_submenu_element("[⊚]","%R/reportlist");
1055 }
1056 style_submenu_parametric("rptview_",5);
1057 style_submenu_parametric("rv",5);
1058
1059 if( g.perm.Admin
1060
--- src/report.c
+++ src/report.c
@@ -1037,23 +1037,16 @@
1037 struct GenerateHTML sState = { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
1038 const char *zQS = PD("QUERY_STRING","");
1039
1040 db_multi_exec("PRAGMA empty_result_callbacks=ON");
1041 style_set_current_feature("report");
 
 
 
 
 
 
 
1042 if( zQS[0] ){
1043 style_submenu_element("Raw","%R/%s?tablist=1&%s",g.zPath,zQS);
1044 style_submenu_element("Reports","%R/reportlist?%s",zQS);
1045 } else {
1046 style_submenu_element("Raw","%R/%s?tablist=1",g.zPath);
1047 style_submenu_element("Reports","%R/reportlist");
1048 }
1049 style_submenu_parametric("rptview_",5);
1050 style_submenu_parametric("rv",5);
1051
1052 if( g.perm.Admin
1053
+16 -6
--- src/style.c
+++ src/style.c
@@ -346,14 +346,14 @@
346346
*/
347347
void style_submenu_parametric(
348348
const char *zPrefix, /* common prefix of the query parameters names */
349349
const int nMaxDigit /* maximal digit on the end of param names */
350350
){
351
- const char *zQS; /* QUERY_STRING */
352
- const char *suffix = "smpl"; /* common suffix for all parameters */
353
- const short sfxlen = 4; /* length of the above suffix */
354
- char zN[32]; /* short names => no dynamic allocations */
351
+ static const char *suffix = "smpl"; /* common suffix for param names */
352
+ static const short sfxlen = 4; /* length of the above suffix */
353
+ const char *zQS; /* QUERY_STRING */
354
+ char zN[32]; /* buffer for parameter names to probe */
355355
short i,l;
356356
357357
/* zPrefix must be tidy and short; also filter out ENV/CGI variables */
358358
assert( zPrefix != 0 && fossil_islower(zPrefix[0]) );
359359
l = strnlen( zPrefix, sizeof(zN) );
@@ -378,14 +378,24 @@
378378
else break;
379379
}
380380
if( z[0] != 0 && z[0] != '/' )
381381
continue;
382382
assert( nSubmenu < count(aSubmenu) );
383
- if(fossil_islower(zV[0])){
383
+ if(fossil_islower(zV[0]) && z[0]=='/'){
384384
aSubmenu[nSubmenu].zLabel = mprintf( "%s",zV); /* memory leak? */
385385
}else{
386
- aSubmenu[nSubmenu].zLabel = mprintf("✧%s",zV); /* maybe: ◦✧⸰⸎ ✨ */
386
+ /* prepend a label with an unobtrusive symbol that "sorts-last";
387
+ ** this clearly distincts it from the built-in elements */
388
+ static const char *mark = "✧";
389
+ char *z = mprintf("%s%s",mark,zV);
390
+ aSubmenu[nSubmenu].zLabel = z;
391
+ /* also prettify the first segment */
392
+ z += strlen(mark);
393
+ z[0] = fossil_toupper(z[0]);
394
+ for(; z[0]!=0 && z[0]!='/'; z++ ){
395
+ if( z[0]=='_' ) z[0] = ' ';
396
+ }
387397
}
388398
if( zQS[0] ){
389399
aSubmenu[nSubmenu].zLink = mprintf("%R/%s?%s",zV,zQS);
390400
}else{
391401
aSubmenu[nSubmenu].zLink = mprintf("%R/%s",zV);
392402
--- src/style.c
+++ src/style.c
@@ -346,14 +346,14 @@
346 */
347 void style_submenu_parametric(
348 const char *zPrefix, /* common prefix of the query parameters names */
349 const int nMaxDigit /* maximal digit on the end of param names */
350 ){
351 const char *zQS; /* QUERY_STRING */
352 const char *suffix = "smpl"; /* common suffix for all parameters */
353 const short sfxlen = 4; /* length of the above suffix */
354 char zN[32]; /* short names => no dynamic allocations */
355 short i,l;
356
357 /* zPrefix must be tidy and short; also filter out ENV/CGI variables */
358 assert( zPrefix != 0 && fossil_islower(zPrefix[0]) );
359 l = strnlen( zPrefix, sizeof(zN) );
@@ -378,14 +378,24 @@
378 else break;
379 }
380 if( z[0] != 0 && z[0] != '/' )
381 continue;
382 assert( nSubmenu < count(aSubmenu) );
383 if(fossil_islower(zV[0])){
384 aSubmenu[nSubmenu].zLabel = mprintf( "%s",zV); /* memory leak? */
385 }else{
386 aSubmenu[nSubmenu].zLabel = mprintf("✧%s",zV); /* maybe: ◦✧⸰⸎ ✨ */
 
 
 
 
 
 
 
 
 
 
387 }
388 if( zQS[0] ){
389 aSubmenu[nSubmenu].zLink = mprintf("%R/%s?%s",zV,zQS);
390 }else{
391 aSubmenu[nSubmenu].zLink = mprintf("%R/%s",zV);
392
--- src/style.c
+++ src/style.c
@@ -346,14 +346,14 @@
346 */
347 void style_submenu_parametric(
348 const char *zPrefix, /* common prefix of the query parameters names */
349 const int nMaxDigit /* maximal digit on the end of param names */
350 ){
351 static const char *suffix = "smpl"; /* common suffix for param names */
352 static const short sfxlen = 4; /* length of the above suffix */
353 const char *zQS; /* QUERY_STRING */
354 char zN[32]; /* buffer for parameter names to probe */
355 short i,l;
356
357 /* zPrefix must be tidy and short; also filter out ENV/CGI variables */
358 assert( zPrefix != 0 && fossil_islower(zPrefix[0]) );
359 l = strnlen( zPrefix, sizeof(zN) );
@@ -378,14 +378,24 @@
378 else break;
379 }
380 if( z[0] != 0 && z[0] != '/' )
381 continue;
382 assert( nSubmenu < count(aSubmenu) );
383 if(fossil_islower(zV[0]) && z[0]=='/'){
384 aSubmenu[nSubmenu].zLabel = mprintf( "%s",zV); /* memory leak? */
385 }else{
386 /* prepend a label with an unobtrusive symbol that "sorts-last";
387 ** this clearly distincts it from the built-in elements */
388 static const char *mark = "✧";
389 char *z = mprintf("%s%s",mark,zV);
390 aSubmenu[nSubmenu].zLabel = z;
391 /* also prettify the first segment */
392 z += strlen(mark);
393 z[0] = fossil_toupper(z[0]);
394 for(; z[0]!=0 && z[0]!='/'; z++ ){
395 if( z[0]=='_' ) z[0] = ' ';
396 }
397 }
398 if( zQS[0] ){
399 aSubmenu[nSubmenu].zLink = mprintf("%R/%s?%s",zV,zQS);
400 }else{
401 aSubmenu[nSubmenu].zLink = mprintf("%R/%s",zV);
402

Keyboard Shortcuts

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