Fossil SCM
--skin "" now forces use of the current edited skin and the warning on the /skins page about a forced skin now distinguishes between /draft and --skin ... usage.
Commit
816f6c040d0739b2d631ccedc4da98b01543ece10fd89496de9f7b1862eaf440
Parent
fbad2772263c717…
2 files changed
+5
-2
+20
-9
+5
-2
| --- src/main.c | ||
| +++ src/main.c | ||
| @@ -2456,11 +2456,13 @@ | ||
| 2456 | 2456 | /* skin: LABEL |
| 2457 | 2457 | ** |
| 2458 | 2458 | ** Use one of the built-in skins defined by LABEL. LABEL is the |
| 2459 | 2459 | ** name of the subdirectory under the skins/ directory that holds |
| 2460 | 2460 | ** the elements of the built-in skin. If LABEL does not match, |
| 2461 | - ** this directive is a silent no-op. | |
| 2461 | + ** this directive is a silent no-op. It may alternately be | |
| 2462 | + ** an absolute path to a directory which holds skin definition | |
| 2463 | + ** files (header.txt, footer.txt, etc.). | |
| 2462 | 2464 | */ |
| 2463 | 2465 | fossil_free(skin_use_alternative(blob_str(&value), 1)); |
| 2464 | 2466 | blob_reset(&value); |
| 2465 | 2467 | continue; |
| 2466 | 2468 | } |
| @@ -2719,11 +2721,12 @@ | ||
| 2719 | 2721 | ** --out FILE Write the HTTP reply to FILE instead of to |
| 2720 | 2722 | ** standard output |
| 2721 | 2723 | ** --pkey FILE Read the private key used for TLS from FILE. |
| 2722 | 2724 | ** --repolist If REPOSITORY is directory, URL "/" lists all repos |
| 2723 | 2725 | ** --scgi Interpret input as SCGI rather than HTTP |
| 2724 | -** --skin LABEL Use override skin LABEL | |
| 2726 | +** --skin LABEL Use override skin LABEL. Use an empty string ("") | |
| 2727 | +** to force use of the current local skin config. | |
| 2725 | 2728 | ** --th-trace Trace TH1 execution (for debugging purposes) |
| 2726 | 2729 | ** --usepidkey Use saved encryption key from parent process. This is |
| 2727 | 2730 | ** only necessary when using SEE on Windows. |
| 2728 | 2731 | ** |
| 2729 | 2732 | ** See also: [[cgi]], [[server]], [[winsrv]] |
| 2730 | 2733 |
| --- src/main.c | |
| +++ src/main.c | |
| @@ -2456,11 +2456,13 @@ | |
| 2456 | /* skin: LABEL |
| 2457 | ** |
| 2458 | ** Use one of the built-in skins defined by LABEL. LABEL is the |
| 2459 | ** name of the subdirectory under the skins/ directory that holds |
| 2460 | ** the elements of the built-in skin. If LABEL does not match, |
| 2461 | ** this directive is a silent no-op. |
| 2462 | */ |
| 2463 | fossil_free(skin_use_alternative(blob_str(&value), 1)); |
| 2464 | blob_reset(&value); |
| 2465 | continue; |
| 2466 | } |
| @@ -2719,11 +2721,12 @@ | |
| 2719 | ** --out FILE Write the HTTP reply to FILE instead of to |
| 2720 | ** standard output |
| 2721 | ** --pkey FILE Read the private key used for TLS from FILE. |
| 2722 | ** --repolist If REPOSITORY is directory, URL "/" lists all repos |
| 2723 | ** --scgi Interpret input as SCGI rather than HTTP |
| 2724 | ** --skin LABEL Use override skin LABEL |
| 2725 | ** --th-trace Trace TH1 execution (for debugging purposes) |
| 2726 | ** --usepidkey Use saved encryption key from parent process. This is |
| 2727 | ** only necessary when using SEE on Windows. |
| 2728 | ** |
| 2729 | ** See also: [[cgi]], [[server]], [[winsrv]] |
| 2730 |
| --- src/main.c | |
| +++ src/main.c | |
| @@ -2456,11 +2456,13 @@ | |
| 2456 | /* skin: LABEL |
| 2457 | ** |
| 2458 | ** Use one of the built-in skins defined by LABEL. LABEL is the |
| 2459 | ** name of the subdirectory under the skins/ directory that holds |
| 2460 | ** the elements of the built-in skin. If LABEL does not match, |
| 2461 | ** this directive is a silent no-op. It may alternately be |
| 2462 | ** an absolute path to a directory which holds skin definition |
| 2463 | ** files (header.txt, footer.txt, etc.). |
| 2464 | */ |
| 2465 | fossil_free(skin_use_alternative(blob_str(&value), 1)); |
| 2466 | blob_reset(&value); |
| 2467 | continue; |
| 2468 | } |
| @@ -2719,11 +2721,12 @@ | |
| 2721 | ** --out FILE Write the HTTP reply to FILE instead of to |
| 2722 | ** standard output |
| 2723 | ** --pkey FILE Read the private key used for TLS from FILE. |
| 2724 | ** --repolist If REPOSITORY is directory, URL "/" lists all repos |
| 2725 | ** --scgi Interpret input as SCGI rather than HTTP |
| 2726 | ** --skin LABEL Use override skin LABEL. Use an empty string ("") |
| 2727 | ** to force use of the current local skin config. |
| 2728 | ** --th-trace Trace TH1 execution (for debugging purposes) |
| 2729 | ** --usepidkey Use saved encryption key from parent process. This is |
| 2730 | ** only necessary when using SEE on Windows. |
| 2731 | ** |
| 2732 | ** See also: [[cgi]], [[server]], [[winsrv]] |
| 2733 |
+20
-9
| --- src/skins.c | ||
| +++ src/skins.c | ||
| @@ -71,10 +71,16 @@ | ||
| 71 | 71 | ** or NULL if the skin should be as configured. |
| 72 | 72 | */ |
| 73 | 73 | static struct BuiltinSkin *pAltSkin = 0; |
| 74 | 74 | static char *zAltSkinDir = 0; |
| 75 | 75 | static int iDraftSkin = 0; |
| 76 | +/* | |
| 77 | +** Used by skin_use_alternative() to store the current skin rank skin | |
| 78 | +** so that the /skins page can, if warranted, warn the user that skin | |
| 79 | +** changes won't have any effect. | |
| 80 | +*/ | |
| 81 | +static int nSkinRank = 5; | |
| 76 | 82 | |
| 77 | 83 | /* |
| 78 | 84 | ** Skin details are a set of key/value pairs that define display |
| 79 | 85 | ** attributes of the skin that cannot be easily specified using CSS |
| 80 | 86 | ** or that need to be known on the server-side. |
| @@ -139,15 +145,14 @@ | ||
| 139 | 145 | ** As a special case, a NULL or empty name resets zAltSkinDir and |
| 140 | 146 | ** pAltSkin to 0 to indicate that the current config-side skin should |
| 141 | 147 | ** be used (rank 3, above), then returns 0. |
| 142 | 148 | */ |
| 143 | 149 | char *skin_use_alternative(const char *zName, int rank){ |
| 144 | - static int currentRank = 5; | |
| 145 | 150 | int i; |
| 146 | 151 | Blob err = BLOB_INITIALIZER; |
| 147 | - if(rank > currentRank) return 0; | |
| 148 | - currentRank = rank; | |
| 152 | + if(rank > nSkinRank) return 0; | |
| 153 | + nSkinRank = rank; | |
| 149 | 154 | if( zName && 1==rank && strchr(zName, '/')!=0 ){ |
| 150 | 155 | zAltSkinDir = fossil_strdup(zName); |
| 151 | 156 | return 0; |
| 152 | 157 | } |
| 153 | 158 | if( zName && sqlite3_strglob("draft[1-9]", zName)==0 ){ |
| @@ -1198,16 +1203,22 @@ | ||
| 1198 | 1203 | } |
| 1199 | 1204 | fossil_free(zPattern); |
| 1200 | 1205 | } |
| 1201 | 1206 | login_check_credentials(); |
| 1202 | 1207 | style_header("Skins"); |
| 1203 | - if(zAltSkinDir && zAltSkinDir[0]){ | |
| 1204 | - @ <p class="warning">Warning: this fossil instance was started with | |
| 1205 | - @ a hard-coded skin value which trumps any option selected below. | |
| 1206 | - @ A skins selected below will be recorded in your prefere cookie | |
| 1207 | - @ but will not be used until/unless the site administrator | |
| 1208 | - @ configures the site to run without a forced hard-coded skin. | |
| 1208 | + if( iDraftSkin || nSkinRank<=1 ){ | |
| 1209 | + @ <p class="warning">Warning: | |
| 1210 | + if( iDraftSkin>0 ){ | |
| 1211 | + @ you are using a draft skin, | |
| 1212 | + }else{ | |
| 1213 | + @ this fossil instance was started with a hard-coded skin | |
| 1214 | + @ value, | |
| 1215 | + } | |
| 1216 | + @ which trumps any option selected below. A skin selected | |
| 1217 | + @ below will be recorded in your preference cookie | |
| 1218 | + @ but will not be used so long as the site has a | |
| 1219 | + @ higher-priority skin in place. | |
| 1209 | 1220 | @ </p> |
| 1210 | 1221 | } |
| 1211 | 1222 | @ <p>The following skins are available for this repository:</p> |
| 1212 | 1223 | @ <ul> |
| 1213 | 1224 | if( pAltSkin==0 && zAltSkinDir==0 && iDraftSkin==0 ){ |
| 1214 | 1225 |
| --- src/skins.c | |
| +++ src/skins.c | |
| @@ -71,10 +71,16 @@ | |
| 71 | ** or NULL if the skin should be as configured. |
| 72 | */ |
| 73 | static struct BuiltinSkin *pAltSkin = 0; |
| 74 | static char *zAltSkinDir = 0; |
| 75 | static int iDraftSkin = 0; |
| 76 | |
| 77 | /* |
| 78 | ** Skin details are a set of key/value pairs that define display |
| 79 | ** attributes of the skin that cannot be easily specified using CSS |
| 80 | ** or that need to be known on the server-side. |
| @@ -139,15 +145,14 @@ | |
| 139 | ** As a special case, a NULL or empty name resets zAltSkinDir and |
| 140 | ** pAltSkin to 0 to indicate that the current config-side skin should |
| 141 | ** be used (rank 3, above), then returns 0. |
| 142 | */ |
| 143 | char *skin_use_alternative(const char *zName, int rank){ |
| 144 | static int currentRank = 5; |
| 145 | int i; |
| 146 | Blob err = BLOB_INITIALIZER; |
| 147 | if(rank > currentRank) return 0; |
| 148 | currentRank = rank; |
| 149 | if( zName && 1==rank && strchr(zName, '/')!=0 ){ |
| 150 | zAltSkinDir = fossil_strdup(zName); |
| 151 | return 0; |
| 152 | } |
| 153 | if( zName && sqlite3_strglob("draft[1-9]", zName)==0 ){ |
| @@ -1198,16 +1203,22 @@ | |
| 1198 | } |
| 1199 | fossil_free(zPattern); |
| 1200 | } |
| 1201 | login_check_credentials(); |
| 1202 | style_header("Skins"); |
| 1203 | if(zAltSkinDir && zAltSkinDir[0]){ |
| 1204 | @ <p class="warning">Warning: this fossil instance was started with |
| 1205 | @ a hard-coded skin value which trumps any option selected below. |
| 1206 | @ A skins selected below will be recorded in your prefere cookie |
| 1207 | @ but will not be used until/unless the site administrator |
| 1208 | @ configures the site to run without a forced hard-coded skin. |
| 1209 | @ </p> |
| 1210 | } |
| 1211 | @ <p>The following skins are available for this repository:</p> |
| 1212 | @ <ul> |
| 1213 | if( pAltSkin==0 && zAltSkinDir==0 && iDraftSkin==0 ){ |
| 1214 |
| --- src/skins.c | |
| +++ src/skins.c | |
| @@ -71,10 +71,16 @@ | |
| 71 | ** or NULL if the skin should be as configured. |
| 72 | */ |
| 73 | static struct BuiltinSkin *pAltSkin = 0; |
| 74 | static char *zAltSkinDir = 0; |
| 75 | static int iDraftSkin = 0; |
| 76 | /* |
| 77 | ** Used by skin_use_alternative() to store the current skin rank skin |
| 78 | ** so that the /skins page can, if warranted, warn the user that skin |
| 79 | ** changes won't have any effect. |
| 80 | */ |
| 81 | static int nSkinRank = 5; |
| 82 | |
| 83 | /* |
| 84 | ** Skin details are a set of key/value pairs that define display |
| 85 | ** attributes of the skin that cannot be easily specified using CSS |
| 86 | ** or that need to be known on the server-side. |
| @@ -139,15 +145,14 @@ | |
| 145 | ** As a special case, a NULL or empty name resets zAltSkinDir and |
| 146 | ** pAltSkin to 0 to indicate that the current config-side skin should |
| 147 | ** be used (rank 3, above), then returns 0. |
| 148 | */ |
| 149 | char *skin_use_alternative(const char *zName, int rank){ |
| 150 | int i; |
| 151 | Blob err = BLOB_INITIALIZER; |
| 152 | if(rank > nSkinRank) return 0; |
| 153 | nSkinRank = rank; |
| 154 | if( zName && 1==rank && strchr(zName, '/')!=0 ){ |
| 155 | zAltSkinDir = fossil_strdup(zName); |
| 156 | return 0; |
| 157 | } |
| 158 | if( zName && sqlite3_strglob("draft[1-9]", zName)==0 ){ |
| @@ -1198,16 +1203,22 @@ | |
| 1203 | } |
| 1204 | fossil_free(zPattern); |
| 1205 | } |
| 1206 | login_check_credentials(); |
| 1207 | style_header("Skins"); |
| 1208 | if( iDraftSkin || nSkinRank<=1 ){ |
| 1209 | @ <p class="warning">Warning: |
| 1210 | if( iDraftSkin>0 ){ |
| 1211 | @ you are using a draft skin, |
| 1212 | }else{ |
| 1213 | @ this fossil instance was started with a hard-coded skin |
| 1214 | @ value, |
| 1215 | } |
| 1216 | @ which trumps any option selected below. A skin selected |
| 1217 | @ below will be recorded in your preference cookie |
| 1218 | @ but will not be used so long as the site has a |
| 1219 | @ higher-priority skin in place. |
| 1220 | @ </p> |
| 1221 | } |
| 1222 | @ <p>The following skins are available for this repository:</p> |
| 1223 | @ <ul> |
| 1224 | if( pAltSkin==0 && zAltSkinDir==0 && iDraftSkin==0 ){ |
| 1225 |