Fossil

Check-in [8861a68e]
Login

Check-in [8861a68e]

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

Overview
Comment:Use "Reports" for the /reportlist element, as per [1a1c0ebe3cf9]. Also be more pedantic when composing user-visible labels for the parameter-induced hyperlinks.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | rptview-submenu-paralink
Files: files | file ages | folders
SHA3-256: 8861a68e2c3a232a3a80df6a274706a6d4ea1f0bc39cb5a17732a081562ee011
User & Date: george 2021-04-09 02:58:23
Context
2021-04-09
04:21
Remove useless 'nMaxDigit' parameter from the signature of the style_submenu_parametric(). Also edit a corresponding comment. ... (check-in: d1651e7e 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: 8861a68e user: george tags: rptview-submenu-paralink)
2021-03-26
17:59
Merge-in changes from trunk (~ version 2.15) ... (check-in: 29067107 user: george tags: rptview-submenu-paralink)
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/report.c.

1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
  count = 0;
  if( !tabs ){
    struct GenerateHTML sState = { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
    const char *zQS = PD("QUERY_STRING","");

    db_multi_exec("PRAGMA empty_result_callbacks=ON");
    style_set_current_feature("report");
    /*
    ** Lets use a funcy button for /reportlist since that page may be
    ** heavily customized by the user. Some variants: ⊚ ⦾  ❊ ⊛ ⚛ ⸎  💠
    ** Enclosing it inside of square brackets makes its  position
    ** determenistic and clearly distincts regular submenu links from
    ** those that are induced by the query string parameters.
    */
    if( zQS[0] ){
      style_submenu_element("Raw","%R/%s?tablist=1&%s",g.zPath,zQS);
      style_submenu_element("[⊚]","%R/reportlist?%s",zQS);
    } else {
      style_submenu_element("Raw","%R/%s?tablist=1",g.zPath);
      style_submenu_element("[⊚]","%R/reportlist");
    }
    style_submenu_parametric("rptview_",5);
    style_submenu_parametric("rv",5);

    if( g.perm.Admin
       || (g.perm.TktFmt && g.zLogin && fossil_strcmp(g.zLogin,zOwner)==0) ){
      style_submenu_element("Edit", "rptedit?rn=%d", rn);







<
<
<
<
<
<
<


|


|







1035
1036
1037
1038
1039
1040
1041







1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
  count = 0;
  if( !tabs ){
    struct GenerateHTML sState = { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
    const char *zQS = PD("QUERY_STRING","");

    db_multi_exec("PRAGMA empty_result_callbacks=ON");
    style_set_current_feature("report");







    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_",5);
    style_submenu_parametric("rv",5);

    if( g.perm.Admin
       || (g.perm.TktFmt && g.zLogin && fossil_strcmp(g.zLogin,zOwner)==0) ){
      style_submenu_element("Edit", "rptedit?rn=%d", rn);

Changes to src/style.c.

344
345
346
347
348
349
350
351
352
353

354
355
356
357
358
359
360
361
** unless a value starts with a lowercase letter.
** Malformed values are silently ignored.
*/
void style_submenu_parametric(
  const char *zPrefix,   /* common prefix of the query parameters names */
  const int  nMaxDigit   /* maximal digit on the end of param names     */
){
  const char *zQS;             /* QUERY_STRING */
  const char *suffix = "smpl"; /* common suffix for all parameters      */
  const short sfxlen =  4;     /* length of the above suffix            */

  char  zN[32];                /* short names => no dynamic allocations */
  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) );







<
|
|
>
|







344
345
346
347
348
349
350

351
352
353
354
355
356
357
358
359
360
361
** unless a value starts with a lowercase letter.
** Malformed values are silently ignored.
*/
void style_submenu_parametric(
  const char *zPrefix,   /* common prefix of the query parameters names */
  const int  nMaxDigit   /* maximal digit on the end of param 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) );
376
377
378
379
380
381
382
383
384
385




386






387
388
389
390
391
392
393
    for( z = zV; z[0] && z[0] != '/' ;){
      if( fossil_isalnum(z[0]) || z[0]=='_' || z[0]=='-' ) z++;
      else break;
    }
    if( z[0] != 0 && z[0] != '/' )
      continue;
    assert( nSubmenu < count(aSubmenu) );
    if(fossil_islower(zV[0])){
      aSubmenu[nSubmenu].zLabel = mprintf( "%s",zV); /* memory leak?  */
    }else{




      aSubmenu[nSubmenu].zLabel = mprintf("✧%s",zV); /* maybe: ◦✧⸰⸎ ✨ */






    }
    if( zQS[0] ){
      aSubmenu[nSubmenu].zLink  = mprintf("%R/%s?%s",zV,zQS);
    }else{
      aSubmenu[nSubmenu].zLink  = mprintf("%R/%s",zV);
    }
    nSubmenu++;







|


>
>
>
>
|
>
>
>
>
>
>







376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
    for( z = zV; z[0] && z[0] != '/' ;){
      if( fossil_isalnum(z[0]) || z[0]=='_' || z[0]=='-' ) z++;
      else break;
    }
    if( z[0] != 0 && z[0] != '/' )
      continue;
    assert( nSubmenu < count(aSubmenu) );
    if(fossil_islower(zV[0]) && z[0]=='/'){
      aSubmenu[nSubmenu].zLabel = mprintf( "%s",zV); /* memory leak?  */
    }else{
      /* prepend a label with an unobtrusive symbol that "sorts-last";
      ** this clearly distincts it from the built-in elements */
      static const char *mark = "✧";
      char *z = mprintf("%s%s",mark,zV);
      aSubmenu[nSubmenu].zLabel = z;
      /* also prettify the first segment */
      z += strlen(mark);
      z[0] = fossil_toupper(z[0]);
      for(; z[0]!=0 && z[0]!='/'; z++ ){
        if( z[0]=='_' ) z[0] = ' ';
      }
    }
    if( zQS[0] ){
      aSubmenu[nSubmenu].zLink  = mprintf("%R/%s?%s",zV,zQS);
    }else{
      aSubmenu[nSubmenu].zLink  = mprintf("%R/%s",zV);
    }
    nSubmenu++;