Fossil

Check-in [39f084cf2c]
Login

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

Overview
Comment:Improved management of resource names so that it is not necessary to press "Reload" after changing skins either in the admin screens or using the --skin command-line option.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 39f084cf2cf8791dbf3a59cacaddd64f70c474fb
User & Date: drh 2015-03-14 15:21:53.225
Context
2015-03-14
17:24
Always include the txt option when adding the ln= parameter because lines on rendered content doesn't work. check-in: 1992856655 user: andybradford tags: trunk
15:21
Improved management of resource names so that it is not necessary to press "Reload" after changing skins either in the admin screens or using the --skin command-line option. check-in: 39f084cf2c user: drh tags: trunk
14:46
The former "San Francisco Modern" skin is now the default. The old default skin is renamed to "Original". check-in: 756a58531b user: drh tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to skins/blitz/header.txt.
1
2
3
4
5
6
7
8
9
10
11
12
13
<html>
  <head>
    <base href="$baseurl/$current_page" />
    <title>$<project_name>: $<title></title>
      <link rel="alternate" type="application/rss+xml" title="RSS Feed" href="$home/timeline.rss" />
      <link rel="stylesheet" href="$home/style.css?default" type="text/css" media="screen" />
  </head>

  <body>
    <div class="header">
      <div class="container">

        <!-- Header -->





|







1
2
3
4
5
6
7
8
9
10
11
12
13
<html>
  <head>
    <base href="$baseurl/$current_page" />
    <title>$<project_name>: $<title></title>
      <link rel="alternate" type="application/rss+xml" title="RSS Feed" href="$home/timeline.rss" />
      <link rel="stylesheet" href="$stylesheet_url" type="text/css" media="screen" />
  </head>

  <body>
    <div class="header">
      <div class="container">

        <!-- Header -->
Changes to skins/blitz_no_logo/header.txt.
1
2
3
4
5
6
7
8
9
10
11
12
13
<html>
  <head>
    <base href="$baseurl/$current_page" />
    <title>$<project_name>: $<title></title>
      <link rel="alternate" type="application/rss+xml" title="RSS Feed" href="$home/timeline.rss" />
      <link rel="stylesheet" href="$home/style.css?default" type="text/css" media="screen" />
  </head>

  <body>
    <div class="header">
      <div class="container">

        <div class="login pull-right">





|







1
2
3
4
5
6
7
8
9
10
11
12
13
<html>
  <head>
    <base href="$baseurl/$current_page" />
    <title>$<project_name>: $<title></title>
      <link rel="alternate" type="application/rss+xml" title="RSS Feed" href="$home/timeline.rss" />
      <link rel="stylesheet" href="$stylesheet_url" type="text/css" media="screen" />
  </head>

  <body>
    <div class="header">
      <div class="container">

        <div class="login pull-right">
Changes to skins/default/header.txt.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
<html>
  <head>
    <base href="$baseurl/$current_page" />
    <title>$<project_name>: $<title></title>
      <link rel="alternate" type="application/rss+xml" title="RSS Feed"
            href="$home/timeline.rss" />
      <link rel="stylesheet" href="$home/style.css?default" type="text/css"
            media="screen" />
  </head>

  <body>
    <div class="header">
      <div class="title"><h1>$<project_name></h1>$<title></div>
        <div class="status"><th1>






|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
<html>
  <head>
    <base href="$baseurl/$current_page" />
    <title>$<project_name>: $<title></title>
      <link rel="alternate" type="application/rss+xml" title="RSS Feed"
            href="$home/timeline.rss" />
      <link rel="stylesheet" href="$stylesheet_url" type="text/css"
            media="screen" />
  </head>

  <body>
    <div class="header">
      <div class="title"><h1>$<project_name></h1>$<title></div>
        <div class="status"><th1>
Changes to src/skins.c.
148
149
150
151
152
153
154


































155
156
157
158
159
160
161
  if( pAltSkin ){
    rc = pAltSkin->whiteForeground;
  }else{
    rc = db_get_boolean("white-foreground",0);
  }
  return rc;
}



































/*
** For a skin named zSkinName, compute the name of the CONFIG table
** entry where that skin is stored and return it.
**
** Return NULL if zSkinName is NULL or an empty string.
**







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
  if( pAltSkin ){
    rc = pAltSkin->whiteForeground;
  }else{
    rc = db_get_boolean("white-foreground",0);
  }
  return rc;
}

/*
** Hash function for computing a skin id.
*/
static unsigned int skin_hash(unsigned int h, const char *z){
  if( z==0 ) return h;
  while( z[0] ){
    h = (h<<11) ^ (h<<1) ^ (h>>3) ^ z[0];
    z++;
  }
  return h;
}

/*
** Return an identifier that is (probably) different for every skin
** but that is (probably) the same if the skin is unchanged.  This
** identifier can be attached to resource URLs to force reloading when
** the resources change but allow the resources to be read from cache
** as long as they are unchanged.
*/
unsigned int skin_id(const char *zResource){
  unsigned int h = 0;
  if( zAltSkinDir ){
    h = skin_hash(0, zAltSkinDir);
  }else if( pAltSkin ){
    h = skin_hash(0, pAltSkin->zLabel);
  }else{
    char *zMTime = db_get_mtime(zResource, 0, 0);
    h = skin_hash(0, zMTime);
    fossil_free(zMTime);
  }
  h = skin_hash(h, MANIFEST_UUID);
  return h;
}

/*
** For a skin named zSkinName, compute the name of the CONFIG table
** entry where that skin is stored and return it.
**
** Return NULL if zSkinName is NULL or an empty string.
**
Changes to src/style.c.
323
324
325
326
327
328
329
330
331
332
333


334
335
336
337
338
339
340
341
342
** The resulting variable name will be of the form $[zVarPrefix]_url.
*/
static void url_var(
  const char *zVarPrefix,
  const char *zConfigName,
  const char *zPageName
){
  char *zMtime = db_get_mtime(zConfigName, 0, 0);
  char *zUrl = mprintf("%s/%s/%s%.5s", g.zTop, zPageName, zMtime,
                       MANIFEST_UUID);
  char *zVarName = mprintf("%s_url", zVarPrefix);


  Th_Store(zVarName, zUrl);
  free(zMtime);
  free(zUrl);
  free(zVarName);
}

/*
** Create a TH1 variable containing the URL for the specified config image.
** The resulting variable name will be of the form $[zImageName]_image_url.







<
<
<

>
>

<







323
324
325
326
327
328
329



330
331
332
333

334
335
336
337
338
339
340
** The resulting variable name will be of the form $[zVarPrefix]_url.
*/
static void url_var(
  const char *zVarPrefix,
  const char *zConfigName,
  const char *zPageName
){



  char *zVarName = mprintf("%s_url", zVarPrefix);
  char *zUrl = mprintf("%s/%s?id=%x", g.zTop, zPageName,
                       skin_id(zConfigName));
  Th_Store(zVarName, zUrl);

  free(zUrl);
  free(zVarName);
}

/*
** Create a TH1 variable containing the URL for the specified config image.
** The resulting variable name will be of the form $[zImageName]_image_url.