|
|
@ -383,7 +383,7 @@ static int dpi_serve_zet_all(int fd) {
|
|
|
|
"<title>Notes - All</title>"
|
|
|
|
"<title>Notes - All</title>"
|
|
|
|
"<meta charset=utf-8>"
|
|
|
|
"<meta charset=utf-8>"
|
|
|
|
"</head>"
|
|
|
|
"</head>"
|
|
|
|
"<body>");
|
|
|
|
"<body style=\"margin:0\">");
|
|
|
|
rc |= write_topbar(fd, PAGE_ALL, NULL, NULL);
|
|
|
|
rc |= write_topbar(fd, PAGE_ALL, NULL, NULL);
|
|
|
|
rc |= write_buf(fd, "<ul>");
|
|
|
|
rc |= write_buf(fd, "<ul>");
|
|
|
|
if (rc < 0) { warn("write"); close(fd); return 0; }
|
|
|
|
if (rc < 0) { warn("write"); close(fd); return 0; }
|
|
|
@ -442,7 +442,7 @@ static int dpi_serve_zet_recent(int fd) {
|
|
|
|
"<title>Notes - Recent</title>"
|
|
|
|
"<title>Notes - Recent</title>"
|
|
|
|
"<meta charset=utf-8>"
|
|
|
|
"<meta charset=utf-8>"
|
|
|
|
"</head>"
|
|
|
|
"</head>"
|
|
|
|
"<body>");
|
|
|
|
"<body style=\"margin:0\">");
|
|
|
|
rc |= write_topbar(fd, PAGE_RECENT, NULL, NULL);
|
|
|
|
rc |= write_topbar(fd, PAGE_RECENT, NULL, NULL);
|
|
|
|
rc |= write_buf(fd, "<ul>");
|
|
|
|
rc |= write_buf(fd, "<ul>");
|
|
|
|
if (rc < 0) { warn("write"); goto cleanup; }
|
|
|
|
if (rc < 0) { warn("write"); goto cleanup; }
|
|
|
@ -542,7 +542,7 @@ static int dpi_serve_zet_search(int fd, char *qs) {
|
|
|
|
"<title>Notes</title>"
|
|
|
|
"<title>Notes</title>"
|
|
|
|
"<meta charset=utf-8>"
|
|
|
|
"<meta charset=utf-8>"
|
|
|
|
"</head>"
|
|
|
|
"</head>"
|
|
|
|
"<body>"
|
|
|
|
"<body style=\"margin:0\">"
|
|
|
|
);
|
|
|
|
);
|
|
|
|
rc |= write_topbar(fd, PAGE_SEARCH, query, NULL);
|
|
|
|
rc |= write_topbar(fd, PAGE_SEARCH, query, NULL);
|
|
|
|
rc |= write_buf(fd, "<ul>");
|
|
|
|
rc |= write_buf(fd, "<ul>");
|
|
|
@ -597,10 +597,10 @@ static int dpi_serve_zet_new(int fd) {
|
|
|
|
"<title>New Note</title>"
|
|
|
|
"<title>New Note</title>"
|
|
|
|
"<meta charset=utf-8>"
|
|
|
|
"<meta charset=utf-8>"
|
|
|
|
"</head>"
|
|
|
|
"</head>"
|
|
|
|
"<body>");
|
|
|
|
"<body style=\"margin:0\">");
|
|
|
|
write_topbar(fd, PAGE_NEW, NULL, NULL);
|
|
|
|
write_topbar(fd, PAGE_NEW, NULL, NULL);
|
|
|
|
dprintf(fd,
|
|
|
|
dprintf(fd,
|
|
|
|
"<table style=\"width:100%%; height:100%%\"><tr>"
|
|
|
|
"<table style=\"width:100%%; height:100%%; border-collapse:collapse\"><tr>"
|
|
|
|
"<td><form method=post action=\"%snew\" enctype=\"multipart/form-data\">"
|
|
|
|
"<td><form method=post action=\"%snew\" enctype=\"multipart/form-data\">"
|
|
|
|
"<textarea name=text cols=64 rows=8 style=\"width:50%%\"></textarea><br>"
|
|
|
|
"<textarea name=text cols=64 rows=8 style=\"width:50%%\"></textarea><br>"
|
|
|
|
"<input type=submit value=\"Save\">"
|
|
|
|
"<input type=submit value=\"Save\">"
|
|
|
@ -822,11 +822,16 @@ static int dpi_serve_zet(int fd, char *path) {
|
|
|
|
rc |= dprintf(fd,
|
|
|
|
rc |= dprintf(fd,
|
|
|
|
"</title>"
|
|
|
|
"</title>"
|
|
|
|
"<meta charset=utf-8>"
|
|
|
|
"<meta charset=utf-8>"
|
|
|
|
"</head><body>");
|
|
|
|
"<style>"
|
|
|
|
|
|
|
|
"pre { white-space: pre-wrap; }"
|
|
|
|
|
|
|
|
"td { padding: 0; }"
|
|
|
|
|
|
|
|
"</style>"
|
|
|
|
|
|
|
|
"</head>");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
rc |= write_buf(fd, "<body style=\"margin:0\">");
|
|
|
|
rc |= write_topbar(fd, PAGE_ZET, id, title);
|
|
|
|
rc |= write_topbar(fd, PAGE_ZET, id, title);
|
|
|
|
rc |= dprintf(fd,
|
|
|
|
rc |= dprintf(fd,
|
|
|
|
"<table style=\"width:100%%; height:100%%\"><tr>"
|
|
|
|
"<table style=\"width:100%%; height:100%%; border-collapse:collapse\"><tr>"
|
|
|
|
"<td style=\"width:50%%\"><form method=post action=\"%s%s\" enctype=\"multipart/form-data\" style=\"height:100%%\">"
|
|
|
|
"<td style=\"width:50%%\"><form method=post action=\"%s%s\" enctype=\"multipart/form-data\" style=\"height:100%%\">"
|
|
|
|
"<textarea name=text cols=64 rows=%d style=\"width:100%%\">\n"
|
|
|
|
"<textarea name=text cols=64 rows=%d style=\"width:100%%\">\n"
|
|
|
|
, server_url, id, rows);
|
|
|
|
, server_url, id, rows);
|
|
|
@ -836,7 +841,6 @@ static int dpi_serve_zet(int fd, char *path) {
|
|
|
|
"<input type=submit value=\"Save\">"
|
|
|
|
"<input type=submit value=\"Save\">"
|
|
|
|
" <input type=submit name=add_new_id value=\"Add New ID\">"
|
|
|
|
" <input type=submit name=add_new_id value=\"Add New ID\">"
|
|
|
|
"</form></td>"
|
|
|
|
"</form></td>"
|
|
|
|
"<style>pre { white-space: pre-wrap; }</style>"
|
|
|
|
|
|
|
|
"<td>"
|
|
|
|
"<td>"
|
|
|
|
);
|
|
|
|
);
|
|
|
|
if (rc < 0) { warn("dpi_send_header"); close(fd); return 0; }
|
|
|
|
if (rc < 0) { warn("dpi_send_header"); close(fd); return 0; }
|
|
|
@ -846,6 +850,7 @@ static int dpi_serve_zet(int fd, char *path) {
|
|
|
|
if (rc < 0) warnx("dprintf");
|
|
|
|
if (rc < 0) warnx("dprintf");
|
|
|
|
close(fd);
|
|
|
|
close(fd);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
char *text = note_fd >= 0 ? read_full(note_fd) : NULL;
|
|
|
|
char *text = note_fd >= 0 ? read_full(note_fd) : NULL;
|
|
|
|
if (text == NULL) {
|
|
|
|
if (text == NULL) {
|
|
|
|
rc = dprintf(fd, "\n<strong>Error</strong>: %s", strerror(errno));
|
|
|
|
rc = dprintf(fd, "\n<strong>Error</strong>: %s", strerror(errno));
|
|
|
@ -915,8 +920,10 @@ static int dpi_serve_zet(int fd, char *path) {
|
|
|
|
if (rc < 0) warn("dprintf");
|
|
|
|
if (rc < 0) warn("dprintf");
|
|
|
|
(void)zet_search_close(&zs);
|
|
|
|
(void)zet_search_close(&zs);
|
|
|
|
|
|
|
|
|
|
|
|
rc = dprintf(fd, "</table></body></html>");
|
|
|
|
rc = write_buf(fd, "</table>");
|
|
|
|
if (rc < 0) warn("dprintf");
|
|
|
|
if (rc < 0) warn("write_buf");
|
|
|
|
|
|
|
|
rc = write_buf(fd, "</body></html>");
|
|
|
|
|
|
|
|
if (rc < 0) warn("write_buf");
|
|
|
|
|
|
|
|
|
|
|
|
close(fd);
|
|
|
|
close(fd);
|
|
|
|
return 0;
|
|
|
|
return 0;
|
|
|
|