Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Remove [forum:/forumpost/2f375863dbc6|useless] 'nMaxDigit' parameter from the signature of the <tt>style_submenu_parametric()</tt>. Also edit a corresponding comment. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | rptview-submenu-paralink |
| Files: | files | file ages | folders |
| SHA3-256: |
d1651e7e1711660e0648e10cead23477 |
| User & Date: | george 2021-04-09 04:21:14.943 |
Context
|
2021-04-14
| ||
| 18:48 | If a parameter's value starts with an uppercase letter then truncate resulting label to just the first path segment. This check-in also adds a few code-comments related to %s formatting. ... (check-in: b75ee4f28e user: george tags: rptview-submenu-paralink) | |
|
2021-04-09
| ||
| 04:21 | Remove [forum:/forumpost/2f375863dbc6|useless] 'nMaxDigit' parameter from the signature of the <tt>style_submenu_parametric()</tt>. Also edit a corresponding comment. ... (check-in: d1651e7e17 user: george tags: rptview-submenu-paralink) | |
| 02:58 | Use "Reports" for the /reportlist element, as per [1a1c0ebe3cf9]. Also be more pedantic when composing user-visible labels for the parameter-induced hyperlinks. ... (check-in: 8861a68e2c user: george tags: rptview-submenu-paralink) | |
Changes
Changes to src/report.c.
| ︙ | ︙ | |||
1042 1043 1044 1045 1046 1047 1048 |
if( zQS[0] ){
style_submenu_element("Raw","%R/%s?tablist=1&%s",g.zPath,zQS);
style_submenu_element("Reports","%R/reportlist?%s",zQS);
} else {
style_submenu_element("Raw","%R/%s?tablist=1",g.zPath);
style_submenu_element("Reports","%R/reportlist");
}
| | | | 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 |
if( zQS[0] ){
style_submenu_element("Raw","%R/%s?tablist=1&%s",g.zPath,zQS);
style_submenu_element("Reports","%R/reportlist?%s",zQS);
} else {
style_submenu_element("Raw","%R/%s?tablist=1",g.zPath);
style_submenu_element("Reports","%R/reportlist");
}
style_submenu_parametric("rptview_");
style_submenu_parametric("rv");
if( g.perm.Admin
|| (g.perm.TktFmt && g.zLogin && fossil_strcmp(g.zLogin,zOwner)==0) ){
style_submenu_element("Edit", "rptedit?rn=%d", rn);
}
if( g.perm.TktFmt ){
style_submenu_element("SQL", "rptsql?rn=%d",rn);
|
| ︙ | ︙ |
Changes to src/style.c.
| ︙ | ︙ | |||
329 330 331 332 333 334 335 |
aSubmenuCtrl[nSubmenuCtrl].eVisible = STYLE_NORMAL;
aSubmenuCtrl[nSubmenuCtrl].eType = FF_MULTI;
nSubmenuCtrl++;
}
}
/* Add hyperlinks depending on the existence and values of special
| | | | | | | | > > > | | < > | < | | 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 |
aSubmenuCtrl[nSubmenuCtrl].eVisible = STYLE_NORMAL;
aSubmenuCtrl[nSubmenuCtrl].eType = FF_MULTI;
nSubmenuCtrl++;
}
}
/* Add hyperlinks depending on the existence and values of special
** parameters in the request's query string. The names of a query's
** parameters that are investigated are obtainted by concatenation of
** the caller-provided zPrefix with suffix "smplX", where X is either
** nothing or a positive digit. zPrefix must start with a lowercase
** letter, be short and have no strange characters. Parameter's value
** is well-formed if its first filepath segment (separated by '/')
** has no strange characters. Malformed values are silently ignored.
**
** The text for the resulting submenu item equals to the value of the
** parameter modulus some prettification for better UX:
** "✧" symbol is prepended unless parameter's value starts with a
** lowercase letter or contains '/', also underscores in the first
** path segment are replaced with spaces.
*/
void style_submenu_parametric(
const char *zPrefix /* common prefix of the query parameters names */
){
static const char *suffix = "smpl"; /* common suffix for param names */
static const short sfxlen = 4; /* length of the above suffix */
const char *zQS; /* QUERY_STRING */
char zN[32]; /* buffer for parameter names to probe */
short i,l;
/* zPrefix must be tidy and short; also filter out ENV/CGI variables */
assert( zPrefix != 0 && fossil_islower(zPrefix[0]) );
l = strnlen( zPrefix, sizeof(zN) );
assert( l+sfxlen+2 <= sizeof(zN) );
assert( fossil_no_strange_characters(zPrefix) );
/* concatenate zPrefix and suffix */
strcpy( zN, zPrefix );
strcpy( zN + l, suffix );
l += sfxlen;
zN[l+1] = 0; /* nul-terminator after digit's placeholder (if any) */
zQS = PD("QUERY_STRING","");
for( i = 0; i <= 9; i++ ){
const char *zV, *z;
zN[l] = ( i == 0 ? 0 : '0' + i ); /* ...smpl instead of ...smpl0 */
zV = PD(zN,"");
if( zV[0] == 0 || zV[0] == '/' ){
continue;
}
/* require the first path segment to be unfancy ASCII string */
|
| ︙ | ︙ |
Changes to src/wiki.c.
| ︙ | ︙ | |||
591 592 593 594 595 596 597 |
){
style_submenu_element("Edit", "%R/wikiedit?name=%T", zPageName);
}else if( rid && g.perm.ApndWiki ){
style_submenu_element("Edit", "%R/wikiappend?name=%T", zPageName);
}
if( g.perm.Hyperlink ){
style_submenu_element("History", "%R/whistory?name=%T", zPageName);
| | | 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 |
){
style_submenu_element("Edit", "%R/wikiedit?name=%T", zPageName);
}else if( rid && g.perm.ApndWiki ){
style_submenu_element("Edit", "%R/wikiappend?name=%T", zPageName);
}
if( g.perm.Hyperlink ){
style_submenu_element("History", "%R/whistory?name=%T", zPageName);
style_submenu_parametric("wiki");
}
}
if( !isPopup ){
style_set_current_page("%T?name=%T", g.zPath, zPageName);
wiki_page_header(WIKITYPE_UNKNOWN, zPageName, "");
if( !noSubmenu ){
wiki_standard_submenu(submenuFlags);
|
| ︙ | ︙ |