Fossil

Diff
Login

Differences From Artifact [28394876ef]:

To Artifact [c9f2324688]:


368
369
370
371
372
373
374

375














376
377

378
379
380
381
382
383
384
385
386
*/
static void url_var(
  const char *zVarPrefix,
  const char *zConfigName,
  const char *zPageName
){
  char *zVarName = mprintf("%s_url", zVarPrefix);

  char *zUrl = mprintf("%R/%s?id=%x", 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.
*/
static void image_url_var(const char *zImageName){







>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|

>
|
|







368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
*/
static void url_var(
  const char *zVarPrefix,
  const char *zConfigName,
  const char *zPageName
){
  char *zVarName = mprintf("%s_url", zVarPrefix);
  char *zExtra = 0;
  char *zUrl = 0;
  if(0==strcmp("css",zConfigName)){
    /* Account for page-specific CSS, appending a /{{g.zPath}} to the
    ** url only if we have a corresponding built-in page-specific CSS
    ** file. Do not append it to all pages because we would
    ** effectively cache-bust all pages which do not have
    ** page-specific CSS. */
    char * zBuiltin = mprintf("style.%s.css", g.zPath);
    if(builtin_file(zBuiltin,0)!=0){
      zExtra = mprintf("/%s", g.zPath);
    }
    fossil_free(zBuiltin);
  }
  zUrl = mprintf("%R/%s%s?id=%x", zPageName,
                 zExtra ? zExtra : "",
                 skin_id(zConfigName));
  Th_Store(zVarName, zUrl);
  fossil_free(zExtra);
  fossil_free(zUrl);
  fossil_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.
*/
static void image_url_var(const char *zImageName){
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079

1080


1081
1082
1083
1084
1085

1086
1087
1088
1089






1090





1091



1092
1093

1094






1095
1096
1097
1098
1099
1100
1101

/*
** WEBPAGE: style.css
**
** Return the style sheet.
*/
void page_style_css(void){
  Blob css;
  int i;
  int isInit = 0;

  cgi_set_content_type("text/css");
  blob_init(&css,skin_get("css"),-1);

  /* add special missing definitions */
  for(i=1; cssDefaultList[i].elementClass; i++){
    char *z = blob_str(&css);
    if( !containsSelector(z, cssDefaultList[i].elementClass) ){
      if( !isInit ){

        isInit = 1;


        blob_append(&css,
          "\n/***********************************************************\n"
          "** All CSS above is supplied by the repository \"skin\".\n"
          "** That which follows is generated automatically by Fossil\n"
          "** to fill in needed selectors that are missing from the\n"

          "** \"skin\" CSS.\n"
          "***********************************************************/\n",
          -1);
      }






      blob_appendf(&css, "%s {\n%s}\n",





          cssDefaultList[i].elementClass,



          cssDefaultList[i].value);
    }

  }







  /* Process through TH1 in order to give an opportunity to substitute
  ** variables such as $baseurl.
  */
  Th_Store("baseurl", g.zBaseURL);
  Th_Store("secureurl", fossil_wants_https(1)? g.zHttpsURL: g.zBaseURL);
  Th_Store("home", g.zTop);







|

|


<
<




|
>
|
>
>
|
|
<
|
<
>
|
|
|
<
>
>
>
>
>
>
|
>
>
>
>
>
|
>
>
>
|

>

>
>
>
>
>
>







1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088


1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099

1100

1101
1102
1103
1104

1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137

/*
** WEBPAGE: style.css
**
** Return the style sheet.
*/
void page_style_css(void){
  Blob css = empty_blob;
  int i;
  const char *zPage = P("name");

  cgi_set_content_type("text/css");


  /* add special missing definitions */
  for(i=1; cssDefaultList[i].elementClass; i++){
    char *z = blob_str(&css);
    if( !containsSelector(z, cssDefaultList[i].elementClass) ){
      blob_appendf(&css, "%s {\n%s}\n",
          cssDefaultList[i].elementClass,
          cssDefaultList[i].value);
    }
  }
  blob_append(&css,
    "\n/***********************************************************\n"

    "** All CSS above is generated automatically by Fossil to\n"

    "** provide default rule implementations which the \"skin\"\n"
    "** may cascade.\n"
    "***********************************************************/\n",
    -1);

  blob_append(&css,skin_get("css"),-1);
  if(zPage!=0 && zPage[0]!=0){
    char * zFile = mprintf("style.%s.css", zPage);
    int nFile = 0;
    const char *zBuiltin = (const char *)builtin_file(zFile, &nFile);
    if(nFile>0){
      blob_appendf(&css,
        "\n/***********************************************************\n"
        "** Start of page-specific CSS for page %s...\n"
        "***********************************************************/\n",
        zPage);
      blob_append(&css, zBuiltin, nFile);
      blob_appendf(&css,
        "\n/***********************************************************\n"
        "** End of page-specific CSS for page %s.\n"
        "***********************************************************/\n",
        zPage);
    }
    fossil_free(zFile);
  }
  blob_append(&css,
     "\n/***********************************************************\n"
     "** All CSS which follows is supplied by the repository \"skin\".\n"
     "***********************************************************/\n",
     -1);
  blob_append(&css,skin_get("css"),-1);

  /* Process through TH1 in order to give an opportunity to substitute
  ** variables such as $baseurl.
  */
  Th_Store("baseurl", g.zBaseURL);
  Th_Store("secureurl", fossil_wants_https(1)? g.zHttpsURL: g.zBaseURL);
  Th_Store("home", g.zTop);