Fossil

Timeline
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Submenu parametric links

Submenu parametric link (or SMPL for short) is a lightweight method to add a few custom hyperlinks into the submenu of some pages.

SMPLs are "request-local": their existence and values are derived from the special parameters in the request's query string. The names of the query's parameters that are investigated and acted upon are formed by concatenation of the page-specific prefix and suffix "smplXY", where optional ending XY may vary (as explained below).

For the time of this writing, only /rptview and /wiki pages support SMPLs. /rptview pages recognize and respond to the query parameters named "rvsmplXY", /wiki pages - to the query parameters named "wikismplXY".

In all cases, an optional ending XY consists of a digit X from the set {1,2,3,4,5} and an optional letter Y which (if present) must be either 'a' or 's' (which are short for "alias" and "skin" respectively). This variance enables to request several SMPLs "within" a single page. It is suggested that parameters within URL aliases end with letter 'a' and parameters within custom skins' headers/footers end with letter 's'. Parameters without Y are suggested for the general use within the regular content of a repository.

The target of the hyperlink is always local to the repository: it is formed by concatenation of a repository's base URL with the value of the recognized parameter. Parameter's value is well-formed if its first filepath segment (separated by the first '/') has no strange characters (i.e. only alphanumeric ASCII characters, dashes and the underscores '_' are allowed). Parameters that have malformed values are silently ignored.

The text (label) on the resulting submenu element equals to the value of the parameter modulus some prettification for better UX:

  1. If a parameter's value starts with a lowercase letter and contains '/' then it goes unchanged into the user-visible label.

    • If the first letter is uppercase then the label is truncated at the first '/' (if any),
    • otherwise the first letter is capitalized.
  2. Underscores in the first path segment are replaced with spaces.

  3. If the resulting label starts with an uppercase letter then it is prepended with "✧" symbol for explicit distinction from the built-in labels.

See also

25 check-ins related to "rptview-submenu-paralink"
2022-02-10
00:22
Merge from trunk ... (Leaf check-in: a961a67ba7 user: george tags: rptview-submenu-paralink)
00:05
Remove unused local variable from cgi_parse_POST_JSON() to fix a compiler warning. ... (check-in: 96bf76a4b1 user: george tags: trunk)
2022-01-21
20:24
Merge from trunk ... (check-in: 9094def2b9 user: george tags: rptview-submenu-paralink)
11:38
Fix the previous check-in to list environment variables used by the CGI Server Extensions feature in the correct place. ... (check-in: 6eeb7ec10e user: florian tags: trunk)
2021-10-09
20:05
Merge in trunk (release 2.17) ... (check-in: a33f616e6a user: george tags: rptview-submenu-paralink)
14:43
Version 2.17 ... (check-in: f48180f2ff user: drh tags: trunk, release, version-2.17)
2021-08-15
23:49
Merge from trunk ... (check-in: 59010c7c09 user: george tags: rptview-submenu-paralink)
18:38
Remove a harmless unused variable. ... (check-in: a004b1729c user: drh tags: trunk)
2021-06-15
22:31
Do not allow links with "../" substring or <tt>'<'</tt> character. The former enforces that the link maps into a repo-local page; the later enforces defense against injection of malicious HTML elements. ... (check-in: 6261c94b1e user: george tags: rptview-submenu-paralink)
21:45
Merge from trunk ... (check-in: f445855917 user: george tags: rptview-submenu-paralink)
17:20
Factored out an extraneous var from [1bb06c94]. No functional changes. ... (check-in: e0686dda41 user: stephan tags: trunk)
2021-06-12
18:43
Add support for [/wiki?name=branch/rptview-submenu-paralink&p|submenu parametric hyperlinks] for [/help?cmd=/rptview|/rptview] and [/help?cmd=/wiki|/wiki] pages. ... (Closed-Leaf check-in: 9690fc39dc user: george tags: not-allowed.)
17:28
Add a note to the Changelog. No code changes. ... (check-in: 528d628947 user: george tags: rptview-submenu-paralink)
2021-06-08
01:04
Merge from trunk ... (check-in: 9712d59d9e user: george tags: rptview-submenu-paralink)
2021-06-07
17:48
Include the login-group in the repository list of "fossil all ui". ... (check-in: fe178faa44 user: drh tags: trunk)
2021-05-25
16:14
Split recognizable names of query parameters into three groups: 1) "...smplX" for the common use within user content 2) "...smplXa" that is provisioned to be used in aliases; 3) "...smplXs" that is provisioned to be used in custom skins. In all three groups X is a digit from {1,2,3,4,5}. ... (check-in: 588b376560 user: george tags: rptview-submenu-paralink)
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)
2021-03-26
18:25
Integrate <i>rptview-submenu-paralinks</i> branch. For this check-in parametric links in submenus are enabled on [/rptview?rn=6&wikismpl=rptview&rvsmpl=wiki/To+Do+List|/rptview] page (may be triggered by rvsmpl, rvsmplX, rptview_smpl, rptview_smplX parameter names) and also for [/wiki/To+Do+List?rn=6&wikismpl=rptview&rvsmpl=wiki/To+Do+List|/wiki] page (may be triggered by wikismpl, wikismplX parameter names). See also forum threads [forum:612170e310] and [forum:8cc4931e69]. ... (check-in: 5c5aa19cc5 user: george tags: trunk)
17:59
Merge-in changes from trunk (~ version 2.15) ... (check-in: 290671078c user: george tags: rptview-submenu-paralink)
17:28
Update the change log and index page with the new release information. ... (check-in: 97610f82f9 user: drh tags: trunk)
17:20
Allow a page's submenu to have multiple parametric hyperlinks induced by several different query string parameters. Use a common suffixes (smpl,smpl1,...smpl9) to probe for defined parameters. Relax constraints on hyperlink values to allow linking to wiki pages (for example). As a proof of concept add support of paralinks to the /wiki page. Get rid of dangling '&' at the endings. ... (check-in: d075801aa8 user: george tags: rptview-submenu-paralink)
2021-03-25
04:11
At /rptview page show link to /reportslist. If request's query string contains <b>rvsmpl</b> parameter then also show an auxiliary link to the page defined by the value of this parameter. Labels and links rendered via %s format specifier because %h and %T did not work properly. In this particular case this seems fine because style_finish_page() renders HTML via %h(...). Code review is very welcome though. ... (check-in: b982c00150 user: george tags: rptview-submenu-paralink)
2021-03-24
15:40
Update the form spider protections so that links to /register go through even if spider protection is fully enabled. This allows self-registration even if user "nobody" has no permissions. ... (check-in: 89b724dcfa user: drh tags: trunk)