Fossil

Diff
Login

Differences From Artifact [de7ae94198]:

To Artifact [c73f2d52a8]:


81
82
83
84
85
86
87





88
89
90
91
92
93
94
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99







+
+
+
+
+







static int sideboxUsed = 0;

/*
** Ad-unit styles.
*/
static unsigned adUnitFlags = 0;

/*
** Page data JSON
*/
static Blob pageDataJson = BLOB_INITIALIZER;


/*
** List of hyperlinks and forms that need to be resolved by javascript in
** the footer.
*/
char **aHref = 0;
int nHref = 0;
190
191
192
193
194
195
196













197
198
199
200
201
202
203
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221







+
+
+
+
+
+
+
+
+
+
+
+
+







    int n;
    aFormAction = fossil_realloc(aFormAction, (nFormAction+1)*sizeof(char*));
    aFormAction[nFormAction++] = zLink;
    n = nFormAction;
    @ <form id="form%d(n)" method="POST" action='%R/login' %s(zOtherArgs)>
  }
}

/*
** Append page-data JSON
*/
void style_pagedata_appendf(const char *zFormat, ...){
  va_list ap;
  if( blob_size(&pageDataJson)==0 ){
    blob_append(&pageDataJson, "[", 1);
  }
  va_start(ap, zFormat);
  blob_vappendf(&pageDataJson, zFormat, ap);
  va_end(ap);
}

/*
** Generate javascript that will set the href= attribute on all anchors.
*/
void style_resolve_href(void){
  int i;
  int nDelay = db_get_int("auto-hyperlink-delay",10);
421
422
423
424
425
426
427


428
429
430
431
432




433
434
435
436
437
438
439
439
440
441
442
443
444
445
446
447
448




449
450
451
452
453
454
455
456
457
458
459







+
+

-
-
-
-
+
+
+
+







** header template lacks a <body> tag, then all of the following is
** prepended.
*/
static char zDfltHeader[] = 
@ <html>
@ <head>
@ <base href="$baseurl/$current_page" />
@ <meta http-equiv="Content-Security-Policy-xxx" \
@  content="default-src 'self' 'unsafe-inline'" />
@ <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" />
@ <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>
;

/*
** Draw the header.
*/
722
723
724
725
726
727
728






729


730
731
732
733
734
735
736
742
743
744
745
746
747
748
749
750
751
752
753
754

755
756
757
758
759
760
761
762
763







+
+
+
+
+
+
-
+
+







    cgi_append_content("<span class=\"thTrace\"><hr />\n", -1);
    cgi_append_content(blob_str(&g.thLog), blob_size(&g.thLog));
    cgi_append_content("</span>\n", -1);
  }

  /* Add document end mark if it was not in the footer */
  if( sqlite3_strlike("%</body>%", zFooter, 0)!=0 ){
    style_pagedata_appendf("{'op':'no-op'}]");
    @ <script type='application/json' id='page-data'>
    @ %s(blob_str(&pageDataJson))
    @ </script>
    @ <script src='%s(g.zBaseURL)/main.js' type='application/javascript'>\
    @ <script>
    @ </body></html>
    @ </body>
    @ </html>
  }
}

/*
** Begin a side-box on the right-hand side of a page.  The title and
** the width of the box are given as arguments.  The width is usually
** a percentage of total screen width.
856
857
858
859
860
861
862













863
864
865
866
867
868
869
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909







+
+
+
+
+
+
+
+
+
+
+
+
+







  image_url_var("logo");
  image_url_var("background");
  Th_Render(blob_str(&css));

  /* Tell CGI that the content returned by this page is considered cacheable */
  g.isConst = 1;
}

/*
** WEBPAGE: main.js
**
** Return the javascript
*/
void page_main_js(void){
  Blob mainjs;
  cgi_set_content_type("application/javascript");
  blob_init(&mainjs, builtin_text("main.js"), -1);
  cgi_set_content(&mainjs);
}


/*
** WEBPAGE: test_env
**
** Display CGI-variables and other aspects of the run-time
** environment, for debugging and trouble-shooting purposes.
*/