Пример #1
0
static void print_html(int status, const char *title, int errnum, const char *errmsg)
{
    if (status)
	CGI_PRINTF("Status: %d\r\n", status);
    CGI_PRINTF("Content-Type: text/html\r\n\r\n");
    CGI_PRINTF(HTML_1, errmsg ? 653: 600);
    CGI_PUTS(HTML_2);
    CGI_PUTS(LOGO);
    CGI_PUTS(HTML_3);
    if (errmsg)
        CGI_PRINTF("<h2>Error %d: %s</h2>", errnum, errmsg);
    unsigned int version;
    const sx_uuid_t *cluster_uuid = sx_hashfs_uuid(hashfs);
    const sx_uuid_t *dist_uuid = sx_hashfs_distinfo(hashfs, &version, NULL);
    sx_uuid_t node_uuid;
    CGI_PRINTF(HTML_4,
               cluster_uuid->string,
               sx_hashfs_self_uuid(hashfs, &node_uuid) == OK ? node_uuid.string : "&lt;not assigned yet&gt;",
               dist_uuid ? dist_uuid->string : "&lt;not defined yet&gt;",
               dist_uuid ? version : 0
               );
}
Пример #2
0
static void print_html(int status, const char *title, int errnum, const char *errmsg)
{
    if (status)
	CGI_PRINTF("Status: %d\r\n", status);
    CGI_PRINTF("Content-Type: text/html\r\n\r\n\
<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n\
<html>\
    <head><title>%s</title></head>", title);
    CGI_PUTS("<body style='background-color:#9fcdea'>\
        <div style='position:absolute; top:50%; height:20em; margin-top: -10em; text-align:center; width: 90%;'>\
            <img src=\"");
    CGI_PUTS(LOGO1);/* too large to put into printf */
    CGI_PUTS(LOGO2);
    CGI_PUTS("\"/>");
    if (errmsg)
        CGI_PRINTF("<h2>Error %d</h2><pre>%s</pre>", errnum, errmsg);
    CGI_PUTS("\
            <h2>\
                This is an <a href=\"http://www.skylable.com/products/sx\">"SERVER_NAME" node</a>\
            </h2>\
        </div>\
        <div style=\"position: absolute; bottom:1em; right: 1em; border: #ddd 1px solid; font: 10px normal; color: #07c;\">");

    unsigned int version;
    const sx_uuid_t *cluster_uuid = sx_hashfs_uuid(hashfs);
    const sx_uuid_t *dist_uuid = sx_hashfs_distinfo(hashfs, &version, NULL);
    sx_uuid_t node_uuid;
    CGI_PRINTF("Cluster UUID: %s<br>Node UUID: %s<br>Distribution: ", cluster_uuid->string, sx_hashfs_self_uuid(hashfs, &node_uuid) == OK ? node_uuid.string : "&lt;not assigned yet&gt;");
    if(dist_uuid)
	CGI_PRINTF("%s(%u)", dist_uuid->string, version);
    else
	CGI_PUTS("&lt;not defined yet&gt;");
    CGI_PUTS("\
        </div>\
    </body>\
</html>");
}