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.

stephan 2022-09-29 09:13 trunk
Commit 816f6c040d0739b2d631ccedc4da98b01543ece10fd89496de9f7b1862eaf440
2 files changed +5 -2 +20 -9
+5 -2
--- src/main.c
+++ src/main.c
@@ -2456,11 +2456,13 @@
24562456
/* skin: LABEL
24572457
**
24582458
** Use one of the built-in skins defined by LABEL. LABEL is the
24592459
** name of the subdirectory under the skins/ directory that holds
24602460
** 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.).
24622464
*/
24632465
fossil_free(skin_use_alternative(blob_str(&value), 1));
24642466
blob_reset(&value);
24652467
continue;
24662468
}
@@ -2719,11 +2721,12 @@
27192721
** --out FILE Write the HTTP reply to FILE instead of to
27202722
** standard output
27212723
** --pkey FILE Read the private key used for TLS from FILE.
27222724
** --repolist If REPOSITORY is directory, URL "/" lists all repos
27232725
** --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.
27252728
** --th-trace Trace TH1 execution (for debugging purposes)
27262729
** --usepidkey Use saved encryption key from parent process. This is
27272730
** only necessary when using SEE on Windows.
27282731
**
27292732
** See also: [[cgi]], [[server]], [[winsrv]]
27302733
--- 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 @@
7171
** or NULL if the skin should be as configured.
7272
*/
7373
static struct BuiltinSkin *pAltSkin = 0;
7474
static char *zAltSkinDir = 0;
7575
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;
7682
7783
/*
7884
** Skin details are a set of key/value pairs that define display
7985
** attributes of the skin that cannot be easily specified using CSS
8086
** or that need to be known on the server-side.
@@ -139,15 +145,14 @@
139145
** As a special case, a NULL or empty name resets zAltSkinDir and
140146
** pAltSkin to 0 to indicate that the current config-side skin should
141147
** be used (rank 3, above), then returns 0.
142148
*/
143149
char *skin_use_alternative(const char *zName, int rank){
144
- static int currentRank = 5;
145150
int i;
146151
Blob err = BLOB_INITIALIZER;
147
- if(rank > currentRank) return 0;
148
- currentRank = rank;
152
+ if(rank > nSkinRank) return 0;
153
+ nSkinRank = rank;
149154
if( zName && 1==rank && strchr(zName, '/')!=0 ){
150155
zAltSkinDir = fossil_strdup(zName);
151156
return 0;
152157
}
153158
if( zName && sqlite3_strglob("draft[1-9]", zName)==0 ){
@@ -1198,16 +1203,22 @@
11981203
}
11991204
fossil_free(zPattern);
12001205
}
12011206
login_check_credentials();
12021207
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.
12091220
@ </p>
12101221
}
12111222
@ <p>The following skins are available for this repository:</p>
12121223
@ <ul>
12131224
if( pAltSkin==0 && zAltSkinDir==0 && iDraftSkin==0 ){
12141225
--- 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

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button