| | @@ -330,72 +330,10 @@ |
| 330 | 330 | aSubmenuCtrl[nSubmenuCtrl].eType = FF_MULTI; |
| 331 | 331 | nSubmenuCtrl++; |
| 332 | 332 | } |
| 333 | 333 | } |
| 334 | 334 | |
| 335 | | -/* Add hyperlinks depending on the existence and values of special |
| 336 | | -** parameters in the request's query string. The names of these |
| 337 | | -** parameters that are investigated are obtainted by concatenation |
| 338 | | -** of zPrefix with suffix "smplX", where X is either nothing or |
| 339 | | -** a positive digit <= nMaxDigit. zPrefix must start with a lowercase |
| 340 | | -** letter, be short and have no strange characters. A value is |
| 341 | | -** well-formed if its first filepath segment (separated by '/') |
| 342 | | -** has no strange characters. The labels of the resulting submenu items |
| 343 | | -** are equal to the well-formed values that are prepended by "✧" |
| 344 | | -** unless a value starts with a lowercase letter. |
| 345 | | -** Malformed values are silently ignored. |
| 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) ); |
| 360 | | - assert( l+sfxlen+2 <= sizeof(zN) ); |
| 361 | | - assert( fossil_no_strange_characters(zPrefix) ); |
| 362 | | - /* concatenate zPrefix and suffix */ |
| 363 | | - strcpy( zN, zPrefix ); |
| 364 | | - strcpy( zN + l, suffix ); |
| 365 | | - l += sfxlen; |
| 366 | | - zN[l+1] = 0; /* nul-terminator after digit's placeholder (if any) */ |
| 367 | | - zQS = PD("QUERY_STRING",""); |
| 368 | | - for( i = 0; i <= 9 && i <= nMaxDigit; i++ ){ |
| 369 | | - const char *zV, *z; |
| 370 | | - zN[l] = ( i == 0 ? 0 : '0' + i ); /* ...smpl instead of ...smpl0 */ |
| 371 | | - zV = PD(zN,""); |
| 372 | | - if( zV[0] == 0 || zV[0] == '/' ){ |
| 373 | | - continue; |
| 374 | | - } |
| 375 | | - /* require the first path segment to be unfancy ASCII string */ |
| 376 | | - for( z = zV; z[0] && z[0] != '/' ;){ |
| 377 | | - if( fossil_isalnum(z[0]) || z[0]=='_' || z[0]=='-' ) z++; |
| 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 | | - } |
| 393 | | - nSubmenu++; |
| 394 | | - } |
| 395 | | -} |
| 396 | | - |
| 397 | 335 | /* |
| 398 | 336 | ** Disable or enable the submenu |
| 399 | 337 | */ |
| 400 | 338 | void style_submenu_enable(int onOff){ |
| 401 | 339 | submenuEnable = onOff; |
| 402 | 340 | |