Skip to content

Commit

Permalink
More web interface cleanup.
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelrsweet committed Apr 9, 2020
1 parent d9a4070 commit 023bab9
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 18 deletions.
1 change: 0 additions & 1 deletion pappl/Makefile
Expand Up @@ -48,7 +48,6 @@ HEADERS = \
system.h

RESOURCES = \
apple-touch-icon.png \
icon-sm.png \
icon-md.png \
icon-lg.png \
Expand Down
Binary file removed pappl/apple-touch-icon.png
Binary file not shown.
5 changes: 2 additions & 3 deletions pappl/client-webif.c
Expand Up @@ -252,8 +252,7 @@ papplClientHTMLHeader(
"<html>\n"
" <head>\n"
" <title>%s - %s</title>\n"
" <link rel=\"shortcut icon\" href=\"/apple-touch-icon.png\" type=\"image/png\">\n"
" <link rel=\"apple-touch-icon\" href=\"/apple-touch-icon.png\" type=\"image/png\">\n"
" <link rel=\"shortcut icon\" href=\"/favicon.png\" type=\"image/png\">\n"
" <link rel=\"stylesheet\" href=\"/style.css\">\n"
" <meta http-equiv=\"X-UA-Compatible\" content=\"IE=9\">\n", title, name);
if (refresh > 0)
Expand All @@ -265,7 +264,7 @@ papplClientHTMLHeader(
" <div class=\"header\">\n"
" <div class=\"row\">\n"
" <div class=\"col-12 nav\">\n"
" <a class=\"btn\" href=\"/\"><img src=\"%s\"> %s:</a>\n", (system->options & PAPPL_SOPTIONS_MULTI_QUEUE) ? "/nav-icon.png" : "/icon-sm.png", name);
" <a class=\"btn\" href=\"/\"><img src=\"%s\"></a>\n", (system->options & PAPPL_SOPTIONS_MULTI_QUEUE) ? "/navicon.png" : "/icon-sm.png");

pthread_rwlock_rdlock(&system->rwlock);

Expand Down
2 changes: 1 addition & 1 deletion pappl/printer-webif.c
Expand Up @@ -331,7 +331,7 @@ printer_header(pappl_client_t *client, // I - Client
" <div class=\"header2\">\n"
" <div class=\"row\">\n"
" <div class=\"col-12 nav\">\n"
" <a class=\"btn\" href=\"%s/\"><img src=\"%s/icon-sm.png\"> %s:</a>\n"
" <a class=\"btn\" href=\"%s/\"><img src=\"%s/icon-sm.png\"> %s</a>\n"
" <a class=\"btn\" href=\"%s/config\">Configuration</a>\n"
" <a class=\"btn\" href=\"%s/media\">Media</a>\n"
" <a class=\"btn\" href=\"%s/defaults\">Printing Defaults</a>\n", printer->uriname, printer->uriname, printer->name, printer->uriname, printer->uriname, printer->uriname);
Expand Down
10 changes: 5 additions & 5 deletions pappl/printer.c
Expand Up @@ -342,17 +342,17 @@ papplPrinterCreate(
{
bool label = (system->options & PAPPL_SOPTIONS_MULTI_QUEUE) == 0;

snprintf(path, sizeof(path), "%s/", printer->uriname);
papplSystemAddResourceCallback(system, label ? "Home" : NULL, path, "text/html", (pappl_resource_cb_t)_papplPrinterWebStatus, printer);

snprintf(path, sizeof(path), "%s/config", printer->uriname);
papplSystemAddResourceCallback(system, label ? "Configuration" : NULL, path, "text/html", (pappl_resource_cb_t)_papplPrinterWebConfig, printer);

snprintf(path, sizeof(path), "%s/defaults", printer->uriname);
papplSystemAddResourceCallback(system, label ? "Printing Defaults" : NULL, path, "text/html", (pappl_resource_cb_t)_papplPrinterWebDefaults, printer);

snprintf(path, sizeof(path), "%s/media", printer->uriname);
papplSystemAddResourceCallback(system, label ? "Media" : NULL, path, "text/html", (pappl_resource_cb_t)_papplPrinterWebMedia, printer);

snprintf(path, sizeof(path), "%s/", printer->uriname);
papplSystemAddResourceCallback(system, /* label */NULL, path, "text/html", (pappl_resource_cb_t)_papplPrinterWebStatus, printer);
snprintf(path, sizeof(path), "%s/printing", printer->uriname);
papplSystemAddResourceCallback(system, label ? "Printing Defaults" : NULL, path, "text/html", (pappl_resource_cb_t)_papplPrinterWebDefaults, printer);

snprintf(path, sizeof(path), "%s/supplies", printer->uriname);
papplSystemAddResourceCallback(system, label ? "Supplies" : NULL, path, "text/html", (pappl_resource_cb_t)_papplPrinterWebSupplies, printer);
Expand Down
17 changes: 11 additions & 6 deletions pappl/system.c
Expand Up @@ -317,22 +317,27 @@ papplSystemRun(pappl_system_t *system)// I - System
system->is_running = true;

// Add fallback resources...
papplSystemAddResourceData(system, "/apple-touch-icon.png", "image/png", apple_touch_icon_png, sizeof(apple_touch_icon_png));
papplSystemAddResourceData(system, "/nav-icon.png", "image/png", icon_sm_png, sizeof(icon_sm_png));
papplSystemAddResourceData(system, "/favicon.png", "image/png", icon_md_png, sizeof(icon_md_png));
papplSystemAddResourceData(system, "/navicon.png", "image/png", icon_sm_png, sizeof(icon_sm_png));
papplSystemAddResourceString(system, "/style.css", "text/css", style_css);

if (system->options & PAPPL_SOPTIONS_STANDARD)
{
if (system->options & PAPPL_SOPTIONS_MULTI_QUEUE)
papplSystemAddResourceCallback(system, "Home", "/", "text/html", (pappl_resource_cb_t)_papplSystemWebStatus, system);
if (system->options & PAPPL_SOPTIONS_MULTI_QUEUE)
papplSystemAddResourceCallback(system, "Configuration", "/config", "text/html", (pappl_resource_cb_t)_papplSystemWebConfig, system);
if (system->options & PAPPL_SOPTIONS_NETWORK)
papplSystemAddResourceCallback(system, /* label */NULL, "/network", "text/html", (pappl_resource_cb_t)_papplSystemWebNetwork, system);
papplSystemAddResourceCallback(system, "Networking", "/network", "text/html", (pappl_resource_cb_t)_papplSystemWebNetwork, system);
if (system->options & PAPPL_SOPTIONS_TLS)
papplSystemAddResourceCallback(system, /* label */NULL, "/security", "text/html", (pappl_resource_cb_t)_papplSystemWebTLS, system);
if (system->options & PAPPL_SOPTIONS_MULTI_QUEUE)
papplSystemAddResourceCallback(system, /* label */NULL, "/", "text/html", (pappl_resource_cb_t)_papplSystemWebStatus, system);
papplSystemAddResourceCallback(system, "Security", "/security", "text/html", (pappl_resource_cb_t)_papplSystemWebTLS, system);
if (system->options & PAPPL_SOPTIONS_USERS)
papplSystemAddResourceCallback(system, /* label */NULL, "/users", "text/html", (pappl_resource_cb_t)_papplSystemWebUsers, system);
if (!system->auth_service)
{
papplSystemAddResourceCallback(system, /* label */NULL, "/login", "text/html", (pappl_resource_cb_t)_papplSystemWebLogin, system);
papplSystemAddResourceCallback(system, /* label */NULL, "/logout", "text/html", (pappl_resource_cb_t)_papplSystemWebLogout, system);
}
}

// Catch important signals...
Expand Down
3 changes: 1 addition & 2 deletions pappl/test.html
Expand Up @@ -2,8 +2,7 @@
<html lang="en">
<head>
<title>Test Page for PAPPL Stylesheet</title>
<link rel="apple-touch-icon" sizes="160x160" href="apple-touch-icon.png">
<link rel="icon" href="apple-touch-icon.png" type="image/png">
<link rel="shortcut icon" href="favicon.png" type="image/png">
<link rel="stylesheet" href="style.css">
<meta charset="utf-8">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
Expand Down

0 comments on commit 023bab9

Please sign in to comment.