Fossil

Check-in [5289ab2a45]
Login

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

Overview
Comment:Corrected ability to be able to select the repository's configured skin, rather than just built-ins.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | skin-preference-cookie
Files: files | file ages | folders
SHA3-256: 5289ab2a458c60310fdfb5631a6529e89e40aef37cb2e3d6c0b24dd9cd61a084
User & Date: stephan 2021-03-02 08:09:01.506
Context
2021-03-02
08:54
Updated changes.wiki to replace skn_X references with skin=X. Closed-Leaf check-in: 7fed83c9b0 user: stephan tags: skin-preference-cookie
08:09
Corrected ability to be able to select the repository's configured skin, rather than just built-ins. check-in: 5289ab2a45 user: stephan tags: skin-preference-cookie
07:23
Minor doc clarification. check-in: c05ec7d924 user: stephan tags: skin-preference-cookie
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/skins.c.
131
132
133
134
135
136
137




138
139
140
141
142
143
144
145
146
147
148
149
150





151
152
153
154
155
156
157
** order. If the "skin" URL argument is provided and refers to a legal
** skin then that will update the display cookie. If the skin name is
** illegal it is silently ignored.
**
** 3) Skin properties from the CONFIG db table
**
** 4) Default skin.




*/
char *skin_use_alternative(const char *zName, int rank){
  static int currentRank = 5;
  int i;
  Blob err = BLOB_INITIALIZER;
  if(rank > currentRank) return 0;
  if( 1==rank && strchr(zName, '/')!=0 ){
    zAltSkinDir = fossil_strdup(zName);
    return 0;
  }
  if( sqlite3_strglob("draft[1-9]", zName)==0 ){
    skin_use_draft(zName[5] - '0');
    return 0;





  }
  for(i=0; i<count(aBuiltinSkin); i++){
    if( fossil_strcmp(aBuiltinSkin[i].zLabel, zName)==0 ){
      pAltSkin = &aBuiltinSkin[i];
      return 0;
    }
  }







>
>
>
>













>
>
>
>
>







131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
** order. If the "skin" URL argument is provided and refers to a legal
** skin then that will update the display cookie. If the skin name is
** illegal it is silently ignored.
**
** 3) Skin properties from the CONFIG db table
**
** 4) Default skin.
**
** As a special case, the name "_repo" resets zAltSkinDir and
** pAltSkin to 0 to indicate that the current config-side skin should
** be used (rank 3, above), then returns 0.
*/
char *skin_use_alternative(const char *zName, int rank){
  static int currentRank = 5;
  int i;
  Blob err = BLOB_INITIALIZER;
  if(rank > currentRank) return 0;
  if( 1==rank && strchr(zName, '/')!=0 ){
    zAltSkinDir = fossil_strdup(zName);
    return 0;
  }
  if( sqlite3_strglob("draft[1-9]", zName)==0 ){
    skin_use_draft(zName[5] - '0');
    return 0;
  }
  if(zName && 0==strcmp("_repo",zName)){
    pAltSkin = 0;
    zAltSkinDir = 0;
    return 0;
  }
  for(i=0; i<count(aBuiltinSkin); i++){
    if( fossil_strcmp(aBuiltinSkin[i].zLabel, zName)==0 ){
      pAltSkin = &aBuiltinSkin[i];
      return 0;
    }
  }
1193
1194
1195
1196
1197
1198
1199





1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
    @ A skins selected below will be recorded in your prefere cookie
    @ but will not be used until/unless the site administrator
    @ configures the site to run without a forced hard-coded skin.
    @ </p>
  }
  @ <p>The following skins are available for this repository:</p>
  @ <ul>





  for(i=0; i<count(aBuiltinSkin); i++){
    if( pAltSkin==&aBuiltinSkin[i] ){
      @ <li> %h(aBuiltinSkin[i].zDesc) &larr; <i>Currently in use</i>
    }else{
      char *zUrl = href("%s/skins?skin=%T", zBase, aBuiltinSkin[i].zLabel);
      @ <li> %z(zUrl)%h(aBuiltinSkin[i].zDesc)</a>
    }
  }
  @ </ul>
  style_finish_page();
  fossil_free(zBase);
}







>
>
>
>
>




|







1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
    @ A skins selected below will be recorded in your prefere cookie
    @ but will not be used until/unless the site administrator
    @ configures the site to run without a forced hard-coded skin.
    @ </p>
  }
  @ <p>The following skins are available for this repository:</p>
  @ <ul>
  if( pAltSkin==0 && zAltSkinDir==0 && iDraftSkin==0 ){
    @ <li> Standard skin for this repository &larr; <i>Currently in use</i>
  }else{
    @ <li> %z(href("%R/skins?skin=_repo"))Standard skin for this repository</a>
  }
  for(i=0; i<count(aBuiltinSkin); i++){
    if( pAltSkin==&aBuiltinSkin[i] ){
      @ <li> %h(aBuiltinSkin[i].zDesc) &larr; <i>Currently in use</i>
    }else{
      char *zUrl = href("%R/skins?skin=%T", aBuiltinSkin[i].zLabel);
      @ <li> %z(zUrl)%h(aBuiltinSkin[i].zDesc)</a>
    }
  }
  @ </ul>
  style_finish_page();
  fossil_free(zBase);
}