static char *footer;
static char *ppa_body;
static char *pkg_body;
+static char *header;
#define HTML_VERSION_TEMPLATE \
"<html>\n\
</div>\n\
</div>\n"
-#define HTML_HEADER \
-"<html>\n\
- <head>\n\
- <title>%s</title>\n\
- <link type=\"text/css\"\n\
- rel=\"stylesheet\"\n\
- href=\
-\"http://fonts.googleapis.com/css?family=Ubuntu:regular,bold&subset=Latin\">\n\
- <link type=\"text/css\" href=\"css/ppastats.css\"\n\
- rel=\"stylesheet\"/>\n\
- <link type=\"text/css\" href=\"css/jquery.jqplot.min.css\"\n\
- rel=\"stylesheet\" />\n\
-<!--[if lt IE 9]><script \
-language=\"javascript\" \
-type=\"text/javascript\" \
-src=\"js/excanvas.js\"></script><![endif]-->\n\
- <script type=\"text/javascript\"\n\
- src=\"js/jquery.min.js\"></script>\n\
- <script type=\"text/javascript\"\n\
- src=\"js/jquery.jqplot.min.js\"></script>\n\
- <script type=\"text/javascript\"\n\
- src=\"js/jqplot.dateAxisRenderer.min.js\"></script>\n\
- <script type=\"text/javascript\"\n\
- src=\"js/ppastats.js\"></script>\n\
- <script>%s</script>\n\
- </head>\n\
- <body>\n"
-
static char *path_new(const char *dir, const char *file, const char *suffixe)
{
char *path;
return path;
}
+static const char *get_header()
+{
+ const char *path;
+
+ if (!header) {
+ path = DEFAULT_WWW_DIR"/header.tpl";
+ header = file_get_content(path);
+
+ if (!header)
+ log_err("Failed to read header template: %s", path);
+ }
+
+ return header;
+}
+
static const char *get_footer()
{
const char *path;
{
FILE *f;
const char *footer;
+ const char *header;
+
+ header = get_header();
+ if (!header)
+ return ;
f = fopen(path, "w");
return ;
}
- fprintf(f, HTML_HEADER, title, script);
+ fprintf(f, header, title, script);
fputs(body_template, f);
footer = get_footer();