diff --git a/src/elogd.c b/src/elogd.c index 79f8231e..69121d2a 100755 --- a/src/elogd.c +++ b/src/elogd.c @@ -6,6 +6,9 @@ Contents: Web server program for Electronic Logbook ELOG $Log$ + Revision 1.10 2003/02/14 22:07:56 midas + Made most HTML pages pass validator.w3.org + Revision 1.9 2003/02/14 19:17:36 midas Implemented quick filters for free-form attributes (without an options list) @@ -3769,7 +3772,7 @@ char str[256]; if (getcfg("global", "charset", str)) rsprintf("Content-Type: text/html;charset=%s\r\n", str); else - rsprintf("Content-Type: text/html\r\n"); + rsprintf("Content-Type: text/html;charset=iso-8859-1\r\n"); if (use_keepalive) { @@ -3792,6 +3795,9 @@ char css[256], str[256]; show_http_header(expires); + /* DOCTYPE */ + rsprintf("\n"); + /* page title */ rsprintf("%s\n", title); @@ -4073,7 +4079,7 @@ LBLIST clb, flb, nlb, lbl; /*---- title row ----*/ - rsprintf("\n"); + rsprintf("
\n"); /* left cell */ rsprintf("\n\n"); + rsprintf("\n\n"); /*---- entry form ----*/ /* table for two-column items */ - rsprintf("\n\n"); + rsprintf("\n\n"); /* table for two-column items */ rsprintf("\n"); @@ -7056,7 +7060,7 @@ char ref[256], str[256]; char list[MAX_N_LIST][NAME_LENGTH]; rsprintf("
"); @@ -4097,7 +4103,7 @@ LBLIST clb, flb, nlb, lbl; if (getcfg(logbook, "Title image URL", str)) rsprintf("\n", str); - rsprintf(""); + rsprintf("\"ELOG"); if (getcfg(logbook, "Title image URL", str)) rsprintf("\n"); @@ -4753,12 +4759,12 @@ time_t now; rsprintf("\n", loc("Submit")); rsprintf("\n", loc("Back")); - rsprintf("
"); + rsprintf("\n\n"); + rsprintf("\n\n"); /*---- entry form ----*/ @@ -5272,7 +5278,7 @@ char str[256], mode[256]; rsprintf("\n"); - rsprintf("\n\n"); + rsprintf("\n\n"); /* table for two-column items */ rsprintf("
"); /* print required message if one of the attributes has it set */ for (i= 0 ; i < lbs->n_attr ; i++) @@ -4806,7 +4812,7 @@ time_t now; strcpy(str, ctime(&now)); } - rsprintf("", loc("Entry date")); + rsprintf("", loc("Entry date")); rsprintf("\n", str); /* display attributes */ @@ -5213,7 +5219,7 @@ time_t now; rsprintf("\n\n"); + rsprintf("\n\n"); rsprintf("
%s:
%s:%s
\n"); rsprintf("\n", loc("Submit")); rsprintf("\n", loc("Back")); - rsprintf("
\n"); rsprintf("\r\n"); @@ -5241,7 +5247,7 @@ char str[256], mode[256]; rsprintf("\n", loc("Search")); rsprintf("\n", loc("Reset Form")); rsprintf("\n", loc("Back")); - rsprintf("
%s:
", loc("Options")); + rsprintf("
%s:
", loc("Options")); if (!getcfg(lbs->name, "Number attachments", str) || atoi(str) > 0) rsprintf("%s
\n", loc("Show attachments")); @@ -5312,9 +5318,9 @@ char str[256], mode[256]; rsprintf("
%s:
", loc("Filters")); /* table for two-column items */ - rsprintf("\n"); + rsprintf("
\n"); - rsprintf("", loc("Start date")); + rsprintf("", loc("Start date")); rsprintf("\n"); - rsprintf("\n"); - for (i=0 ; in_attr ; i++) { rsprintf("", attr_list[i]); @@ -5434,7 +5438,7 @@ char str[256]; rsprintf("\n\n"); + rsprintf("\n\n"); /*---- entry form ----*/ @@ -5481,7 +5485,7 @@ char str[256]; rsprintf("\n", loc("Save")); rsprintf("\n", loc("Cancel")); - rsprintf("\n\n"); + rsprintf("\n\n"); rsprintf("
%s:
%s:", loc("Year")); rsprintf("
%s:
\n"); rsprintf("\n", loc("Save")); rsprintf("\n", loc("Cancel")); - rsprintf("
\n\n"); rsprintf("\r\n"); @@ -5900,11 +5904,11 @@ int i; rsprintf("\n", loc("Cancel")); rsprintf("\n", user); - rsprintf("
"); - rsprintf("\n"); + rsprintf("
\n"); /*---- if admin user, show user list ----*/ @@ -5912,7 +5916,7 @@ int i; strstr(str, getparam("unm")) != 0) { rsprintf("\n"); - rsprintf("\n", loc("Select user")); + rsprintf("\n", loc("Select user")); rsprintf("\n", loc("Login name")); + rsprintf("\n", loc("Login name")); if (get_user_line(lbs->name, user, password, full_name, user_email, email_notify) != 1) sprintf(str, loc("User [%s] has been deleted"), user); @@ -5944,11 +5948,11 @@ int i; rsprintf("\n", str); - rsprintf("\n", loc("Full name")); + rsprintf("\n", loc("Full name")); rsprintf("\n", full_name); - rsprintf("\n"); + rsprintf("\n"); rsprintf("
%s:
%s:
%s:
%s:
%s:
%s:
Email:
Email:    \n", user_email); @@ -5974,7 +5978,7 @@ int i; /* hidden field for password */ rsprintf("\n", password); - rsprintf("
\n\n"); + rsprintf("
\n\n"); rsprintf("\r\n"); } @@ -6000,31 +6004,31 @@ void show_new_user_page(LOGBOOK *lbs) rsprintf("\n", loc("Save")); rsprintf("\n", loc("Cancel")); - rsprintf("
"); - rsprintf("\n"); + rsprintf("
\n"); /*---- entry form ----*/ - rsprintf("\n", loc("Login name")); + rsprintf("\n", loc("Login name")); rsprintf("\n", loc("name may not contain blanks")); - rsprintf("\n", loc("Full name")); + rsprintf("\n", loc("Full name")); rsprintf("\n"); - rsprintf("\n"); + rsprintf("\n"); rsprintf("\n"); rsprintf("\n"); - rsprintf("\n", loc("Password")); + rsprintf("\n", loc("Password")); rsprintf("\n", loc("Retype password")); + rsprintf("\n", loc("Retype password")); rsprintf("
%s:
%s: (%s)
%s:
%s:
Email:
Email:
%s: \n", loc("Enable email notifications")); rsprintf("
%s:
%s:\n"); - rsprintf("
%s:
%s:\n"); rsprintf("
\n"); - rsprintf("\n"); @@ -7179,7 +7183,7 @@ char list[MAX_N_LIST][NAME_LENGTH]; if (attr_options[i][0][0] == 0) { - rsprintf("\n", + rsprintf("\n", list[index], getparam(list[index])); } else @@ -7294,7 +7298,7 @@ char ref[256]; rsprintf("%s\n", ref, loc("All")); } - rsprintf("\n"); + rsprintf("\n"); } /*------------------------------------------------------------------*/ @@ -8115,7 +8119,7 @@ LOGBOOK *lbs_cur; else rsprintf("
Error: file \"%s\" not found
", file_name); - rsprintf(""); + rsprintf(""); } /*---- display filters ----*/ @@ -8130,11 +8134,11 @@ LOGBOOK *lbs_cur; if (disp_filter) { rsprintf("
\n"); - rsprintf("\n"); + rsprintf("
\n"); if (*getparam("m1") || *getparam("y1") || *getparam("d1")) { - rsprintf("", loc("Start date")); + rsprintf("", loc("Start date")); rsprintf("", mname[m1-1], d1, y1); } @@ -8153,7 +8157,7 @@ LOGBOOK *lbs_cur; ltime -= 3600*24; memcpy(&tms, localtime(<ime), sizeof(struct tm)); - rsprintf("", loc("End date")); + rsprintf("", loc("End date")); rsprintf("", mname[tms.tm_mon], tms.tm_mday, tms.tm_year + 1900); } @@ -8162,7 +8166,7 @@ LOGBOOK *lbs_cur; { if (*getparam(attr_list[i])) { - rsprintf("", + rsprintf("", attr_list[i]); rsprintf("", getparam(attr_list[i])); } @@ -8170,7 +8174,7 @@ LOGBOOK *lbs_cur; if (*getparam("subtext")) { - rsprintf("", loc("Text")); + rsprintf("", loc("Text")); rsprintf("", getparam("subtext")); } @@ -8204,7 +8208,7 @@ LOGBOOK *lbs_cur; /*---- table titles ----*/ /* overall listing table */ - rsprintf("\n"); if (n_display) rsprintf("\n", n_display); @@ -8465,7 +8469,7 @@ LOGBOOK *lbs_cur; /* add little logo */ rsprintf("
ELOG V%s
", VERSION); - rsprintf("\r\n"); + rsprintf("\r\n"); free(msg_list); } @@ -9034,7 +9038,7 @@ void show_elog_message(LOGBOOK *lbs, char *dec_path, char *command) int size, i, j, n, n_log, status, fh, length, message_error, index; int message_id, orig_message_id; char str[1000], ref[256], file_name[256], attrib[MAX_N_ATTR][NAME_LENGTH]; -char date[80], text[TEXT_SIZE], menu_str[1000], cmd[256], +char date[80], text[TEXT_SIZE], menu_str[1000], cmd[256], cmd_enc[256], orig_tag[80], reply_tag[256], attachment[MAX_ATTACHMENTS][256], encoding[80], att[256], lattr[256]; char menu_item[MAX_N_LIST][NAME_LENGTH], format[80], admin_user[80], slist[MAX_N_ATTR+10][NAME_LENGTH], svalue[MAX_N_ATTR+10][NAME_LENGTH], *p; @@ -9247,7 +9251,7 @@ BOOL first; /*---- menu buttons ----*/ rsprintf("
%s:
%s:%s %d, %d
%s:
%s:%s %d, %d
%s:
%s:%s
%s:
%s:%s
\n"); + rsprintf("\n"); + rsprintf("
\n"); size = printable ? 2 : 3; @@ -8288,7 +8292,7 @@ LOGBOOK *lbs_cur; else if (strcmp(getparam("rsort"), disp_attr[i]) == 0) strcpy(img, ""); - rsprintf("\n", + rsprintf("\n", ref, disp_attr[i], img); } @@ -8408,7 +8412,7 @@ LOGBOOK *lbs_cur; } } - rsprintf("
%s%s%s%s
\n"); - rsprintf("\n"); + rsprintf("
\n"); rsprintf("\n"); @@ -9374,13 +9385,13 @@ BOOL first; else rsprintf("
Error: file \"%s\" not found
", file_name); - rsprintf(""); + rsprintf(""); } /*---- message ----*/ /* overall message table */ - rsprintf("
\n"); n = strbreak(menu_str, menu_item, MAX_N_LIST); @@ -9269,12 +9273,15 @@ BOOL first; strcpy(ref, lbk_list[j]); url_encode(ref, sizeof(ref)); + strcpy(cmd_enc, loc(cmd)); + url_encode(cmd_enc, sizeof(cmd_enc)); + if (equal_ustring(cmd, loc("Copy to"))) rsprintf(" %s \"%s\" |\n", - lbs->name_enc, message_id, loc(cmd), ref, loc(cmd), lbk_list[j]); + lbs->name_enc, message_id, cmd_enc, ref, loc(cmd), lbk_list[j]); else rsprintf(" %s \"%s\" |\n", - lbs->name_enc, message_id, loc(cmd), ref, loc(cmd), lbk_list[j]); + lbs->name_enc, message_id, cmd_enc, ref, loc(cmd), lbk_list[j]); } } else @@ -9293,12 +9300,16 @@ BOOL first; strlcpy(ref, str, sizeof(ref)); url_encode(ref, sizeof(ref)); + + strcpy(cmd_enc, loc(cmd)); + url_encode(cmd_enc, sizeof(cmd_enc)); + if (equal_ustring(cmd, "Copy to")) - rsprintf(" %s \"%s\" |\n", - lbs->name_enc, message_id, loc(cmd), ref, loc(cmd), str); + rsprintf(" %s \"%s\" |\n", + lbs->name_enc, message_id, cmd_enc, ref, loc(cmd), str); else - rsprintf(" %s \"%s\" |\n", - lbs->name_enc, message_id, loc(cmd), ref, loc(cmd), str); + rsprintf(" %s \"%s\" |\n", + lbs->name_enc, message_id, cmd_enc, ref, loc(cmd), str); } } } @@ -9321,15 +9332,15 @@ BOOL first; if (!getcfg(lbs->name, "Enable browsing", str) || atoi(str) == 1) { - rsprintf("\n"); + rsprintf("\n"); - rsprintf("\n", + rsprintf("\n", loc("First entry")); - rsprintf("\n", + rsprintf("\n", loc("Previous entry")); - rsprintf("\n", + rsprintf("\n", loc("Next entry")); - rsprintf("\n", + rsprintf("\n", loc("Last entry")); rsprintf("
\n"); + rsprintf("\n"); /*---- message text ----*/ @@ -9599,9 +9609,9 @@ BOOL first; url_encode(ref, sizeof(ref)); /* for file names with special characters like "+" */ /* overall table */ - rsprintf("
\n"); if (message_error == EL_EMPTY) rsprintf("\n", loc("Logbook is empty")); @@ -9435,7 +9446,7 @@ BOOL first; /*---- display message ID ----*/ - rsprintf("\n\n", + rsprintf("\n\n", loc("Message ID"), message_id); /*---- display date ----*/ @@ -9461,11 +9472,11 @@ BOOL first; mktime(&ts); strftime(str, sizeof(str), format, &ts); - rsprintf("\n", ref, orig_tag); } if (reply_tag[0]) { - rsprintf("\n"); rsputs("
%s
%s:%d
%s:%d
%s:%s\n\n", + rsprintf("
%s:%s\n\n", loc("Entry date"), str); } else - rsprintf("
%s:%s\n\n", + rsprintf("
%s:%s\n\n", loc("Entry date"), date); for (i=0 ; in_attr ; i++) @@ -9483,14 +9494,14 @@ BOOL first; if (orig_tag[0]) { - rsprintf("
"); + rsprintf("
"); sprintf(ref, "%s", orig_tag); rsprintf("%s:", loc("In reply to")); rsprintf("%s
"); + rsprintf("
"); rsprintf("%s:", loc("Reply to this")); p = strtok(reply_tag, ","); @@ -9514,7 +9525,7 @@ BOOL first; for (i=0 ; in_attr ; i++) { sprintf(lattr, "l%s", attr_list[i]); - rsprintf("
"); + rsprintf("
"); if (!getcfg(lbs->name, "Filtered browsing", str) || atoi(str) == 1) @@ -9551,7 +9562,6 @@ BOOL first; } } - rsprintf("
\n"); + rsprintf("\n"); + rsprintf("
\n"); - rsprintf("\n", + rsprintf("\n", loc("Attachment"), index+1); rsprintf("
%s %d:
%s %d:%s\n", @@ -9673,7 +9683,7 @@ BOOL first; } /* overall table */ - rsprintf("
\n"); if (getcfg(lbs->name, "bottom text", str)) { @@ -9708,7 +9718,7 @@ BOOL first; /* add little logo */ rsprintf("
ELOG V%s
", VERSION); - rsprintf("\r\n"); + rsprintf("\r\n"); } /*------------------------------------------------------------------*/ @@ -11886,7 +11896,7 @@ redir: if (return_length != -1) { if (return_length == 0) - return_length = strlen_retbuf+1; + return_length = strlen_retbuf; if (keep_alive && strstr(return_buffer, "Content-Length") == NULL || strstr(return_buffer, "Content-Length") >