2026-03-02 07:39:31 +09:00
|
|
|
#include <taiga.h>
|
|
|
|
|
|
2026-03-02 17:32:20 +09:00
|
|
|
#include "image/fill.h"
|
2026-03-02 17:59:05 +09:00
|
|
|
#include "image/valid-html401.h"
|
|
|
|
|
#include "image/valid-css.h"
|
2026-03-02 18:52:43 +09:00
|
|
|
#include "image/fixme.h"
|
|
|
|
|
#include "image/warning.h"
|
|
|
|
|
#include "image/note.h"
|
2026-03-02 17:32:20 +09:00
|
|
|
|
|
|
|
|
void classic_stylesheet(FILE* out, const char* top) {
|
|
|
|
|
FILE* f;
|
|
|
|
|
char path[128];
|
|
|
|
|
char* breadcrumb_bgcolor = NULL;
|
|
|
|
|
xl_node_t** nodes;
|
2026-03-02 21:51:27 +09:00
|
|
|
int i;
|
2026-03-02 18:52:43 +09:00
|
|
|
char* messages[] = {
|
|
|
|
|
"fixme", "#cc6600", /**/
|
|
|
|
|
"warning", "#990000", /**/
|
|
|
|
|
"note", "#006699" /**/
|
|
|
|
|
};
|
2026-03-02 17:32:20 +09:00
|
|
|
|
|
|
|
|
sprintf(path, "%sfill.gif", top);
|
|
|
|
|
f = fopen(path, "wb");
|
|
|
|
|
fwrite(image_fill, 1, image_fill_len, f);
|
|
|
|
|
fclose(f);
|
|
|
|
|
|
2026-03-02 17:59:05 +09:00
|
|
|
sprintf(path, "%svalid-html401.png", top);
|
|
|
|
|
f = fopen(path, "wb");
|
|
|
|
|
fwrite(image_valid_html401, 1, image_valid_html401_len, f);
|
|
|
|
|
fclose(f);
|
|
|
|
|
|
|
|
|
|
sprintf(path, "%svalid-css.png", top);
|
|
|
|
|
f = fopen(path, "wb");
|
|
|
|
|
fwrite(image_valid_css, 1, image_valid_css_len, f);
|
|
|
|
|
fclose(f);
|
|
|
|
|
|
2026-03-02 18:52:43 +09:00
|
|
|
sprintf(path, "%sfixme.png", top);
|
|
|
|
|
f = fopen(path, "wb");
|
|
|
|
|
fwrite(image_fixme, 1, image_fixme_len, f);
|
|
|
|
|
fclose(f);
|
|
|
|
|
|
|
|
|
|
sprintf(path, "%swarning.png", top);
|
|
|
|
|
f = fopen(path, "wb");
|
|
|
|
|
fwrite(image_warning, 1, image_warning_len, f);
|
|
|
|
|
fclose(f);
|
|
|
|
|
|
|
|
|
|
sprintf(path, "%snote.png", top);
|
|
|
|
|
f = fopen(path, "wb");
|
|
|
|
|
fwrite(image_note, 1, image_note_len, f);
|
|
|
|
|
fclose(f);
|
|
|
|
|
|
2026-03-02 17:32:20 +09:00
|
|
|
if((nodes = xl_get_path(skinconf->root, "breadcrumb")) != NULL) {
|
|
|
|
|
breadcrumb_bgcolor = xl_get_attribute(nodes[0], "color");
|
|
|
|
|
|
|
|
|
|
free(nodes);
|
|
|
|
|
}
|
|
|
|
|
if(breadcrumb_bgcolor == NULL) breadcrumb_bgcolor = "#003366";
|
|
|
|
|
|
2026-03-02 07:39:31 +09:00
|
|
|
fprintf(out, "body {\n");
|
|
|
|
|
fprintf(out, " padding: 0;\n");
|
|
|
|
|
fprintf(out, " margin: 0;\n");
|
2026-03-02 20:30:51 +09:00
|
|
|
fprintf(out, " font-family: Verdana, Helvetica, Arial, sans-serif;\n");
|
2026-03-02 07:39:31 +09:00
|
|
|
fprintf(out, "}\n");
|
|
|
|
|
fprintf(out, "\n");
|
|
|
|
|
fprintf(out, "#breadcrumb {\n");
|
2026-03-02 17:32:20 +09:00
|
|
|
fprintf(out, " background-color: %s;\n", breadcrumb_bgcolor);
|
2026-03-02 07:39:31 +09:00
|
|
|
fprintf(out, " font-weight: bold;\n");
|
|
|
|
|
fprintf(out, " color: #fff;\n");
|
|
|
|
|
fprintf(out, " padding-left: 8px;\n");
|
|
|
|
|
fprintf(out, " padding-top: 2px;\n");
|
|
|
|
|
fprintf(out, " padding-bottom: 2px;\n");
|
|
|
|
|
fprintf(out, "}\n");
|
2026-03-02 18:52:43 +09:00
|
|
|
fprintf(out, "\n");
|
2026-03-02 17:32:20 +09:00
|
|
|
fprintf(out, "form {\n");
|
|
|
|
|
fprintf(out, " margin-top: 0;\n");
|
|
|
|
|
fprintf(out, " margin-bottom: 0;\n");
|
|
|
|
|
fprintf(out, "}\n");
|
|
|
|
|
fprintf(out, "#breadcrumb, #breadcrumb *, #copyright, #nav {\n");
|
|
|
|
|
fprintf(out, " font-size: x-small;\n");
|
|
|
|
|
fprintf(out, "}\n");
|
2026-03-02 07:39:31 +09:00
|
|
|
fprintf(out, "\n");
|
|
|
|
|
fprintf(out, "#nav {\n");
|
|
|
|
|
fprintf(out, " background-color: #eeeeee;\n");
|
|
|
|
|
fprintf(out, " border-right: solid 1px #aaaaaa;\n");
|
|
|
|
|
fprintf(out, " border-bottom: solid 1px #aaaaaa;\n");
|
|
|
|
|
fprintf(out, " padding: 8px;\n");
|
|
|
|
|
fprintf(out, "}\n");
|
|
|
|
|
fprintf(out, "\n");
|
|
|
|
|
fprintf(out, "#content {\n");
|
|
|
|
|
fprintf(out, " padding: 8px;\n");
|
|
|
|
|
fprintf(out, "}\n");
|
|
|
|
|
fprintf(out, "\n");
|
|
|
|
|
fprintf(out, ".section {\n");
|
|
|
|
|
fprintf(out, " background-color: #eeeeee;\n");
|
|
|
|
|
fprintf(out, " padding-left: 8px;\n");
|
|
|
|
|
fprintf(out, " font-weight: bold;\n");
|
|
|
|
|
fprintf(out, " color: #000088;\n");
|
|
|
|
|
fprintf(out, "}\n");
|
|
|
|
|
fprintf(out, "\n");
|
|
|
|
|
fprintf(out, "a {\n");
|
|
|
|
|
fprintf(out, " text-decoration: none;\n");
|
|
|
|
|
fprintf(out, "}\n");
|
|
|
|
|
fprintf(out, "\n");
|
|
|
|
|
fprintf(out, "#breadcrumb a {\n");
|
|
|
|
|
fprintf(out, " color: #ffff44;\n");
|
|
|
|
|
fprintf(out, "}\n");
|
|
|
|
|
fprintf(out, "\n");
|
|
|
|
|
fprintf(out, "a:link {\n");
|
|
|
|
|
fprintf(out, " color: #003366;\n");
|
|
|
|
|
fprintf(out, "}\n");
|
|
|
|
|
fprintf(out, "\n");
|
|
|
|
|
fprintf(out, "a:visited {\n");
|
|
|
|
|
fprintf(out, " color: blue;\n");
|
|
|
|
|
fprintf(out, "}\n");
|
|
|
|
|
fprintf(out, "\n");
|
|
|
|
|
fprintf(out, "a:hover, #breadcrumb a:hover {\n");
|
|
|
|
|
fprintf(out, " color: #ff3300;\n");
|
|
|
|
|
fprintf(out, "}\n");
|
|
|
|
|
fprintf(out, "\n");
|
|
|
|
|
fprintf(out, ".linkgroup {\n");
|
2026-03-02 21:05:55 +09:00
|
|
|
fprintf(out, " padding-left: 12px;\n");
|
2026-03-02 07:39:31 +09:00
|
|
|
fprintf(out, "}\n");
|
|
|
|
|
fprintf(out, "\n");
|
|
|
|
|
fprintf(out, ".linkgrouptitle {\n");
|
|
|
|
|
fprintf(out, " font-weight: bold;\n");
|
|
|
|
|
fprintf(out, "}\n");
|
|
|
|
|
fprintf(out, "\n");
|
|
|
|
|
fprintf(out, "#content p {\n");
|
|
|
|
|
fprintf(out, " padding-left: 8px;\n");
|
|
|
|
|
fprintf(out, "}\n");
|
|
|
|
|
fprintf(out, "\n");
|
|
|
|
|
fprintf(out, "tr.even {\n");
|
|
|
|
|
fprintf(out, " background-color: #eeeeee;\n");
|
|
|
|
|
fprintf(out, "}\n");
|
|
|
|
|
fprintf(out, "\n");
|
|
|
|
|
fprintf(out, "tr.odd {\n");
|
|
|
|
|
fprintf(out, " background-color: #dddddd;\n");
|
|
|
|
|
fprintf(out, "}\n");
|
2026-03-02 18:52:43 +09:00
|
|
|
fprintf(out, "\n");
|
|
|
|
|
for(i = 0; i < sizeof(messages) / sizeof(messages[0]); i += 2) {
|
|
|
|
|
fprintf(out, ".%s-message {\n", messages[i]);
|
|
|
|
|
fprintf(out, " border-top: solid 5px %s;\n", messages[i + 1]);
|
|
|
|
|
fprintf(out, " border-left: solid 1px %s;\n", messages[i + 1]);
|
|
|
|
|
fprintf(out, " padding: 0.33em 0 0.67em 5px;\n");
|
|
|
|
|
fprintf(out, " margin: 0.67em 0;\n");
|
|
|
|
|
fprintf(out, "}\n");
|
|
|
|
|
}
|
2026-03-02 07:39:31 +09:00
|
|
|
}
|
|
|
|
|
|
2026-03-02 17:32:20 +09:00
|
|
|
void classic_head(FILE* out, const char* top, xl_node_t* header) {
|
2026-03-02 07:39:31 +09:00
|
|
|
fprintf(out, " <link rel=\"stylesheet\" href=\"%sstyle.css\">\n", top);
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-02 17:32:20 +09:00
|
|
|
void classic_body(FILE* out, const char* top, const char* title, xl_node_t* body) {
|
|
|
|
|
char year[4 + 1 + 4 + 1]; /* no one would use our software in year 10000... right? :) */
|
|
|
|
|
char* holder = "Unknown people";
|
|
|
|
|
char* sitesearch = NULL;
|
|
|
|
|
xl_node_t** nodes;
|
2026-03-02 17:59:05 +09:00
|
|
|
xl_node_t* child;
|
2026-03-02 21:51:27 +09:00
|
|
|
int i;
|
|
|
|
|
char* images[] = {
|
|
|
|
|
"group", "Group", /**/
|
|
|
|
|
"project", "Project" /**/
|
|
|
|
|
};
|
2026-03-02 17:32:20 +09:00
|
|
|
|
|
|
|
|
strcpy(year, "Some year");
|
|
|
|
|
|
|
|
|
|
if((nodes = xl_get_path(skinconf->root, "copyright.holder")) != NULL) {
|
|
|
|
|
holder = nodes[0]->text;
|
|
|
|
|
|
|
|
|
|
free(nodes);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if((nodes = xl_get_path(skinconf->root, "copyright.year")) != NULL) {
|
|
|
|
|
time_t t = time(NULL);
|
|
|
|
|
struct tm* tm = localtime(&t);
|
|
|
|
|
int cyear = tm->tm_year + 1900;
|
|
|
|
|
int xyear = atoi(nodes[0]->text);
|
|
|
|
|
|
|
|
|
|
if(cyear == xyear) {
|
|
|
|
|
sprintf(year, "%d", cyear);
|
|
|
|
|
} else {
|
|
|
|
|
int low = cyear < xyear ? cyear : xyear;
|
|
|
|
|
int high = cyear > xyear ? cyear : xyear;
|
|
|
|
|
|
|
|
|
|
sprintf(year, "%d-%d", low, high);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
free(nodes);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if((nodes = xl_get_path(skinconf->root, "search")) != NULL) {
|
|
|
|
|
sitesearch = xl_get_attribute(nodes[0], "domain");
|
|
|
|
|
|
|
|
|
|
free(nodes);
|
|
|
|
|
}
|
|
|
|
|
if(sitesearch == NULL) sitesearch = "https://invalid.link";
|
|
|
|
|
|
2026-03-02 21:51:27 +09:00
|
|
|
fprintf(out, " <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%%\">\n");
|
|
|
|
|
fprintf(out, " <tr width=\"100%%\">\n");
|
|
|
|
|
fprintf(out, " <td>\n");
|
|
|
|
|
for(i = 0; i < sizeof(images) / sizeof(images[0]); i++) {
|
|
|
|
|
char path[64];
|
2026-03-02 22:03:39 +09:00
|
|
|
char* name;
|
|
|
|
|
char* link;
|
2026-03-02 21:51:27 +09:00
|
|
|
|
|
|
|
|
sprintf(path, "%s.name", images[i]);
|
|
|
|
|
if((nodes = xl_get_path(skinconf->root, path)) != NULL) {
|
2026-03-02 22:03:39 +09:00
|
|
|
name = nodes[0]->text;
|
2026-03-02 21:51:27 +09:00
|
|
|
free(nodes);
|
|
|
|
|
}
|
2026-03-02 22:03:39 +09:00
|
|
|
if(name == NULL) name = "Logo";
|
|
|
|
|
|
|
|
|
|
sprintf(path, "%s.link", images[i]);
|
|
|
|
|
if((nodes = xl_get_path(skinconf->root, path)) != NULL) {
|
|
|
|
|
link = xl_get_attribute(nodes[0], "href");
|
|
|
|
|
free(nodes);
|
|
|
|
|
}
|
|
|
|
|
if(link == NULL) link = "https://invalid.link";
|
2026-03-02 21:51:27 +09:00
|
|
|
|
|
|
|
|
sprintf(path, "%s.image", images[i]);
|
|
|
|
|
if((nodes = xl_get_path(skinconf->root, path)) != NULL) {
|
|
|
|
|
char* text = xl_get_attribute(nodes[0], "src");
|
|
|
|
|
|
|
|
|
|
if(text != NULL) {
|
|
|
|
|
text = u_path(top, text);
|
2026-03-02 22:03:39 +09:00
|
|
|
fprintf(out, " <a href=\"%s\"><img src=\"%s\" alt=\"%s\"></a>\n", link, text, images[i + 1], name);
|
2026-03-02 21:51:27 +09:00
|
|
|
free(text);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
free(nodes);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
fprintf(out, " </td>\n");
|
|
|
|
|
fprintf(out, " </tr>\n");
|
|
|
|
|
fprintf(out, " </table>\n");
|
2026-03-02 17:32:20 +09:00
|
|
|
fprintf(out, " <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%%\" id=\"breadcrumb\">\n");
|
|
|
|
|
fprintf(out, " <tr width=\"100%%\">\n");
|
|
|
|
|
fprintf(out, " <td>\n");
|
|
|
|
|
if((nodes = xl_get_path(skinconf->root, "breadcrumb.link")) != NULL) {
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
for(i = 0; nodes[i] != NULL; i++) {
|
|
|
|
|
char* link = xl_get_attribute(nodes[i], "href");
|
|
|
|
|
char* name = xl_get_attribute(nodes[i], "name");
|
|
|
|
|
|
|
|
|
|
if(link == NULL) link = "https://invalid.link";
|
|
|
|
|
if(title == NULL) title = link;
|
|
|
|
|
|
|
|
|
|
if(i > 0) fprintf(out, " |\n");
|
|
|
|
|
fprintf(out, " <a href=\"%s\">%s</a>\n", link, name);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
free(nodes);
|
|
|
|
|
}
|
|
|
|
|
fprintf(out, " </td>\n");
|
|
|
|
|
fprintf(out, " <td nowrap=\"1\" align=\"right\">\n");
|
|
|
|
|
fprintf(out, " <form action=\"https://www.google.com/search\" method=\"GET\">\n");
|
|
|
|
|
fprintf(out, " Search\n");
|
|
|
|
|
fprintf(out, " <input type=\"hidden\" name=\"sitesearch\" value=\"%s\">\n", sitesearch);
|
|
|
|
|
fprintf(out, " <input name=\"q\" size=\"10\">\n");
|
|
|
|
|
fprintf(out, " <input type=\"submit\" value=\"Go\">\n");
|
|
|
|
|
fprintf(out, " </form>\n");
|
|
|
|
|
fprintf(out, " </td>\n");
|
|
|
|
|
fprintf(out, " </tr>\n");
|
|
|
|
|
fprintf(out, " </table>\n");
|
|
|
|
|
fprintf(out, " <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%%\">\n");
|
|
|
|
|
fprintf(out, " <tr>\n");
|
|
|
|
|
fprintf(out, " <td width=\"150\" valign=\"top\">\n");
|
|
|
|
|
fprintf(out, " <div id=\"nav\">\n");
|
2026-03-02 21:05:55 +09:00
|
|
|
|
|
|
|
|
if((nodes = xl_get_path(skinconf->root, "nav")) != NULL) {
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
child = nodes[0]->first_child;
|
|
|
|
|
while(child != NULL) {
|
|
|
|
|
default_nav(out, top, child, 6);
|
|
|
|
|
|
|
|
|
|
child = child->next;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
free(nodes);
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-02 17:32:20 +09:00
|
|
|
fprintf(out, " </div>\n");
|
|
|
|
|
fprintf(out, " </td>\n");
|
|
|
|
|
fprintf(out, " <td valign=\"top\">\n");
|
|
|
|
|
fprintf(out, " <div id=\"content\">\n");
|
2026-03-02 17:59:05 +09:00
|
|
|
|
|
|
|
|
child = body->first_child;
|
|
|
|
|
while(child != NULL) {
|
2026-03-02 21:05:55 +09:00
|
|
|
default_node(out, top, child, 6);
|
2026-03-02 17:59:05 +09:00
|
|
|
|
|
|
|
|
child = child->next;
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-02 17:32:20 +09:00
|
|
|
fprintf(out, " </div>\n");
|
|
|
|
|
fprintf(out, " </td>\n");
|
|
|
|
|
fprintf(out, " </tr>\n");
|
|
|
|
|
fprintf(out, " </table>\n");
|
2026-03-02 17:59:05 +09:00
|
|
|
fprintf(out, " <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%%\">\n");
|
|
|
|
|
fprintf(out, " <tr>\n");
|
|
|
|
|
fprintf(out, " <td id=\"copyright\" align=\"center\">\n");
|
|
|
|
|
fprintf(out, " Copyright © %s %s%s All rights reserved.\n", year, holder, (strlen(holder) > 0 && holder[strlen(holder) - 1] == '.') ? "" : ".");
|
|
|
|
|
fprintf(out, " <td>\n");
|
|
|
|
|
fprintf(out, " </tr>\n");
|
|
|
|
|
fprintf(out, " <tr>\n");
|
|
|
|
|
fprintf(out, " <td align=\"right\">\n");
|
|
|
|
|
fprintf(out, " <a href=\"https://validator.w3.org/check/referer\"><img src=\"%svalid-html401.png\" alt=\"Valid HTML 4.01\" border=\"0\"></a>", top);
|
|
|
|
|
fprintf(out, " <a href=\"https://jigsaw.w3.org/css-validator/\"><img src=\"%svalid-css.png\" alt=\"Valid CSS\" border=\"0\"></a>", top);
|
|
|
|
|
fprintf(out, " <td>\n");
|
|
|
|
|
fprintf(out, " </tr>\n");
|
|
|
|
|
fprintf(out, " </table>\n");
|
2026-03-02 17:32:20 +09:00
|
|
|
fprintf(out, " <!--[if lte IE 6]>\n");
|
|
|
|
|
fprintf(out, " <script language=\"javascript\" type=\"text/javascript\">\n");
|
|
|
|
|
fprintf(out, " for(var i = 0; i < document.images.length; i++){\n");
|
|
|
|
|
fprintf(out, " var s = document.images[i].src;\n");
|
|
|
|
|
fprintf(out, " if(s.indexOf('.png') > 0){\n");
|
|
|
|
|
fprintf(out, " var oldw = document.images[i].clientWidth;\n");
|
|
|
|
|
fprintf(out, " var oldh = document.images[i].clientHeight;\n");
|
2026-03-02 17:59:05 +09:00
|
|
|
fprintf(out, " document.images[i].src = '%sfill.gif';\n", top);
|
2026-03-02 17:32:20 +09:00
|
|
|
fprintf(out, " document.images[i].style.filter = \"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='\" + s + \"', sizingMethod='scale')\";\n");
|
|
|
|
|
fprintf(out, " document.images[i].style.width = oldw + \"px\";\n");
|
|
|
|
|
fprintf(out, " document.images[i].style.height = oldh + \"px\";\n");
|
|
|
|
|
fprintf(out, " }\n");
|
|
|
|
|
fprintf(out, " }\n");
|
|
|
|
|
fprintf(out, " </script>\n");
|
|
|
|
|
fprintf(out, " <![endif]-->\n");
|
2026-03-02 07:39:31 +09:00
|
|
|
}
|