diff --git a/elogd.c b/elogd.c index 32bfaa41..fba77a8d 100755 --- a/elogd.c +++ b/elogd.c @@ -6,6 +6,9 @@ Contents: Web server program for Electronic Logbook ELOG $Log$ + Revision 2.135 2003/01/29 12:05:15 midas + CSS half finished + Revision 2.134 2003/01/13 19:18:34 midas Fixed yet another bug with logbook_dir @@ -506,7 +509,7 @@ \********************************************************************/ /* Version of ELOG */ -#define VERSION "2.2.5" +#define VERSION "2.2.6" #include #include @@ -692,6 +695,7 @@ struct { char type[32]; } filetype[] = { + { ".CSS", "text/css" }, { ".JPG", "image/jpeg" }, { ".JPEG", "image/jpeg" }, { ".GIF", "image/gif" }, @@ -746,7 +750,6 @@ typedef struct { LOGBOOK *lb_list = NULL; void show_error(char *error); -void show_http_header(BOOL expires); BOOL enum_user_line(LOGBOOK *lbs, int n, char *user); int get_user_line(char *logbook_name, char *user, char *password, char *full_name, char *email, char *email_notify); int strbreak(char *str, char list[][NAME_LENGTH], int size); @@ -3771,15 +3774,75 @@ int i, j, n, m; /*------------------------------------------------------------------*/ +void show_http_header(BOOL expires) +{ +char str[256]; + + rsprintf("HTTP/1.1 200 Document follows\r\n"); + rsprintf("Server: ELOG HTTP %s\r\n", VERSION); + + if (getcfg("global", "charset", str)) + rsprintf("Content-Type: text/html;charset=%s\r\n", str); + else + rsprintf("Content-Type: text/html\r\n"); + + if (use_keepalive) + { + rsprintf("Connection: Keep-Alive\r\n"); + rsprintf("Keep-Alive: timeout=60, max=10\r\n"); + } + + if (expires) + { + rsprintf("Pragma: no-cache\r\n"); + rsprintf("Expires: Fri, 01 Jan 1983 00:00:00 GMT\r\n"); + } + + rsprintf("\r\n"); +} + +void show_html_header(LOGBOOK *lbs, BOOL expires, char *title) +{ +char css[256], str[256]; + + show_http_header(expires); + + /* page title */ + rsprintf("%s\n", title); + + /* Cascading Style Sheet */ + strlcpy(css, "default.css", sizeof(css)); + + if (lbs != NULL && getcfg(lbs->name, "CSS", str)) + strlcpy(css, str, sizeof(css)); + + else if (lbs == NULL && getcfg("global", "CSS", str)) + strlcpy(css, str, sizeof(css)); + + rsprintf("", css); + + rsprintf("\n"); +} + +void show_standard_header(LOGBOOK *lbs, BOOL expires, char *title, char *path) +{ + show_html_header(lbs, expires, title); + + rsprintf("\n"); + + if (path) + rsprintf("
\n\n", path); + else + rsprintf("\n\n"); +} + +/*------------------------------------------------------------------*/ + void show_upgrade_page(LOGBOOK *lbs) { char str[1000]; - show_http_header(FALSE); - - rsprintf("\n"); - rsprintf("ELOG Electronic Logbook Upgrade Information\n"); - rsprintf("\n\n"); + show_html_header(lbs, FALSE, "ELOG Upgrade Information"); rsprintf("\n"); @@ -3826,52 +3889,6 @@ char str[1000]; /*------------------------------------------------------------------*/ -void show_http_header(BOOL expires) -{ -char str[256]; - - rsprintf("HTTP/1.1 200 Document follows\r\n"); - rsprintf("Server: ELOG HTTP %s\r\n", VERSION); - - if (getcfg("global", "charset", str)) - rsprintf("Content-Type: text/html;charset=%s\r\n", str); - else - rsprintf("Content-Type: text/html\r\n"); - - if (use_keepalive) - { - rsprintf("Connection: Keep-Alive\r\n"); - rsprintf("Keep-Alive: timeout=60, max=10\r\n"); - } - - if (expires) - { - rsprintf("Pragma: no-cache\r\n"); - rsprintf("Expires: Fri, 01 Jan 1983 00:00:00 GMT\r\n"); - } - - rsprintf("\r\n"); -} - -void show_standard_header(char *title, char *path) -{ - show_http_header(TRUE); - - rsprintf("%s\n", title); - - if (*gt("BGImage")) - rsprintf("\n", gt("BGImage")); - else - rsprintf("\n"); - - if (path) - rsprintf("\n\n", path); - else - rsprintf("\n\n"); -} - -/*------------------------------------------------------------------*/ - int get_logbook_hierarchy(LBLIST *lblist) { int i, j, k, n, m; @@ -3975,17 +3992,14 @@ int i; void show_standard_title(char *logbook, char *text, int printable) { -char str[256], ref[256], bgcolor[32], fontcolor[32]; +char str[256], ref[256], sclass[32]; int i, j, n_grp, n_lb, nnum, level; LBLIST clb, flb, nlb, lbl; - /* overall table, containing title, menu and message body */ if (printable) - rsprintf("\n\n", - gt("Border width"), gt("Frame color")); + rsprintf("
\n\n"); else - rsprintf("
\n\n", - gt("Table width"), gt("Border width"), gt("Frame color")); + rsprintf("
\n\n"); /* scan logbook hierarchy */ n_grp = get_logbook_hierarchy(&lbl); @@ -3999,10 +4013,10 @@ LBLIST clb, flb, nlb, lbl; { for (level = 0 ; ; level++) { - rsprintf("\n\n"); @@ -4097,49 +4091,26 @@ LBLIST clb, flb, nlb, lbl; /*---- title row ----*/ - if (getcfg(logbook, "Title BGcolor", str)) - strlcpy(bgcolor, str, sizeof(bgcolor)); - else - strlcpy(bgcolor, gt("Title BGColor"), sizeof(bgcolor)); - - if (getcfg(logbook, "Title Fontcolor", str)) - strlcpy(fontcolor, str, sizeof(fontcolor)); - else - strlcpy(fontcolor, gt("Title Fontcolor"), sizeof(fontcolor)); - - rsprintf("
\n"); + rsprintf("
\n"); if (level == 0 && getcfg("global", "main tab", str)) - rsprintf(" %s  \n", str); + rsprintf(" %s \n", str); for (i=0 ; i ", - fontcolor, bgcolor); - rsprintf("", fontcolor, ref); - } + /* selected logbook */ + strcpy(sclass, "sltab"); else - { - rsprintf(" ", - gt("GTab1 Fontcolor"), gt("GTab1 BGColor")); - rsprintf("", gt("GTab1 Fontcolor"), ref); - } + /* selected group */ + strcpy(sclass, "sgtab"); } else { if (clb[i].member == NULL) - { - rsprintf(" ", - gt("LTab2 Fontcolor"), gt("LTab2 BGColor")); - rsprintf("", gt("LTab2 Fontcolor"), ref); - } + /* unselected logbook */ + strcpy(sclass, "ltab"); else - { - rsprintf(" ", - gt("GTab2 Fontcolor"), gt("GTab2 BGColor")); - rsprintf("", gt("GTab2 Fontcolor"), ref); - } + /* unselected group */ + strcpy(sclass, "gtab"); } + rsprintf(" ", sclass, sclass, ref); + strlcpy(str, clb[i].name, sizeof(str)); for (j=0 ; j<(int)strlen(str) ; j++) @@ -4075,7 +4069,7 @@ LBLIST clb, flb, nlb, lbl; else rsprintf("%c", str[j]); - rsprintf("  \n"); + rsprintf(" \n"); } rsprintf("
\n", - gt("Title cellpadding")); + rsprintf("
\n"); /* left cell */ - rsprintf("\n"); + rsprintf("  %s%s \n", str, text); /* middle cell */ if (*getparam("full_name")) - { - rsprintf("\n", - fontcolor, loc("Logged in as"), getparam("full_name")); - } + rsprintf("\n", loc("Logged in as"), getparam("full_name")); else - { if (getcfg(logbook, "Guest menu commands", str)) - { - rsprintf("\n", - fontcolor, loc("Not logged in")); - } - } + rsprintf("\n", loc("Not logged in")); /* right cell */ - rsprintf("
", bgcolor); + rsprintf("
"); /* use comment as title if available, else logbook name */ if (!getcfg(logbook, "Comment", str)) strcpy(str, logbook); - rsprintf("  %s%s\n", - fontcolor, str, text); - rsprintf(" ", bgcolor); - rsprintf("  %s \"%s\"%s \"%s\"", gt("Title BGColor")); - rsprintf("  %s%s", bgcolor); + rsprintf(""); if (*gt("Title image URL")) rsprintf("\n", gt("Title image URL")); @@ -4147,8 +4118,7 @@ LBLIST clb, flb, nlb, lbl; if (*gt("Title image")) rsprintf("", gt("Title image")); else - rsprintf("ELOG V%s  ", - fontcolor, VERSION); + rsprintf("ELOG V%s  ", VERSION); if (*gt("Title image URL")) rsprintf("\n"); @@ -4163,16 +4133,13 @@ LBLIST clb, flb, nlb, lbl; void show_error(char *error) { /* header */ - show_standard_header("ELOG error", ""); + show_html_header(NULL, FALSE, "ELOG error"); - rsprintf("

", - gt("Border width"), gt("Frame color")); - rsprintf("
\n", gt("Frame color")); - rsprintf("\n\n"); + rsprintf("\n\n"); } /*------------------------------------------------------------------*/ -void show_elog_submit_find(LOGBOOK *lbs, INT past_n, INT last_n, INT page_n) +void show_elog_list(LOGBOOK *lbs, INT past_n, INT last_n, INT page_n) { int i, j, n, index, size, status, d1, m1, y1, d2, m2, y2, n_line; int current_year, current_month, current_day, printable, n_logbook, n_display, @@ -7488,7 +7326,7 @@ char str[256], col[80], ref[256], img[80]; char mode[80]; char menu_str[1000], menu_item[MAX_N_LIST][NAME_LENGTH]; char *p , *pt, *pt1, *pt2; -BOOL show_attachments, threaded, mode_commands, expand, filtering; +BOOL show_attachments, threaded, mode_commands, expand, filtering, disp_filter; time_t ltime, ltime_start, ltime_end, now; struct tm tms, *ptms; MSG_LIST *msg_list; @@ -8030,7 +7868,7 @@ LOGBOOK *lbs_cur; /*---- header ----*/ - show_standard_header(loc("ELOG search result"), NULL); + show_standard_header(lbs, FALSE, loc("ELOG Entries"), NULL); /*---- title ----*/ @@ -8057,10 +7895,7 @@ LOGBOOK *lbs_cur; if (!printable) { - rsprintf("\n\n"); + rsprintf("\n\n"); } - /*---- find menu text ----*/ if (getcfg(lbs->name, "find menu text", str) && !printable) @@ -8200,10 +7999,7 @@ LOGBOOK *lbs_cur; FILE *f; char file_name[256], *buf; - rsprintf(""); + rsprintf(""); } /*---- display filters ----*/ - rsprintf("\n\n"); + } /* get number of summary lines */ n_line = 3; @@ -8306,8 +8112,8 @@ LOGBOOK *lbs_cur; /*---- table titles ----*/ - rsprintf("\n"); - if (n_msg == 0) - { - rsprintf("", loc("No entries found")); /*---- select navigation ----*/ @@ -8575,7 +8374,7 @@ LOGBOOK *lbs_cur; } else /* add little logo */ - rsprintf("
ELOG V%s
", VERSION); + rsprintf("
ELOG V%s
", VERSION); rsprintf("\r\n"); @@ -8720,7 +8519,7 @@ int i, j, n, missing, first, index, suppress, message_id, resubmit_orig, mail { for (j=0 ; j 0) { mail_to[strlen(mail_to)-1] = 0; /* strip last ',' */ - compose_mail(lbs, mail_to, message_id, attrib, mail_param, *getparam("edit")); + if (compose_mail(lbs, mail_to, message_id, attrib, mail_param, *getparam("edit")) == 0) + return; } free(mail_to); @@ -9118,7 +8918,7 @@ LOGBOOK *lbs_dest; /* display status message */ sprintf(str, "%d", source_id); - show_standard_header(loc("Copy ELog entry"), str); + show_standard_header(lbs, FALSE, loc("Copy ELog entry"), str); rsprintf("

"); + rsprintf("
\n"); + rsprintf("\n", error); - rsprintf("%s\n", error); - - rsprintf("
%s
", gt("Cell BGColor")); + rsprintf("
"); /* rsprintf(" \n"); - rsprintf("%s: \n", loc("Selected entries")); + rsprintf("%s: \n", loc("Selected entries")); rsprintf("\n", loc("Toggle all")); @@ -7470,12 +7308,12 @@ char lbk_list[MAX_N_LIST][NAME_LENGTH]; } - rsprintf("
\n", - gt("Menu1 cellpadding"), gt("Frame color")); - - rsprintf("
\n", gt("Menu1 Align"), gt("Menu1 BGColor")); + rsprintf("
\n"); /* current command line for select command */ strcpy(str, getparam("cmdline")); @@ -8077,7 +7912,6 @@ LOGBOOK *lbs_cur; /* store current command line as hidden parameter for page navigation */ if (str[0] && !equal_ustring(str, "?")) { - //##url_encode(str, sizeof(str)); rsprintf("\n", str); } @@ -8100,99 +7934,64 @@ LOGBOOK *lbs_cur; n = strbreak(menu_str, menu_item, MAX_N_LIST); - if (atoi(gt("Use buttons")) == 1) + for (i=0 ; i\n", mode); + sprintf(str, loc("Last %d days"), past_n*2); + rsprintf(" %s |\n", past_n*2, mode, str); + } - if (past_n) + if (last_n) + { + sprintf(str, loc("Last %d entries"), last_n*2); + rsprintf(" %s |\n", last_n*2, mode, str); + } + } + else if (equal_ustring(menu_item[i], "Select")) + { + strcpy(str, getparam("cmdline")); + if (atoi(getparam("select")) == 1) + { + /* remove select switch */ + if (strstr(str, "select=1")) { - sprintf(str, loc("Last %d days"), past_n*2); - rsprintf("\n", str); - } - - if (last_n) - { - sprintf(str, loc("Last %d entries"), last_n*2); - rsprintf("\n", str); + *strstr(str, "select=1") = 0; + if (strlen(str) > 1 && + (str[strlen(str)-1] == '&' || str[strlen(str)-1] == '?')) + str[strlen(str)-1] = 0; } } else - rsprintf("\n", loc(menu_item[i])); + { + /* add select switch */ + if (strchr(str, '?')) + strcat(str, "&select=1"); + else + strcat(str, "?select=1"); + } + rsprintf(" %s |\n", str, loc("Select")); } - } - } - else - { - rsprintf("\n"); - - for (i=0 ; i%s |\n", past_n*2, mode, str); - } + strcpy(str, loc(menu_item[i])); + url_encode(str, sizeof(str)); - if (last_n) - { - sprintf(str, loc("Last %d entries"), last_n*2); - rsprintf(" %s |\n", last_n*2, mode, str); - } - } - else if (equal_ustring(menu_item[i], "Select")) - { - strcpy(str, getparam("cmdline")); - if (atoi(getparam("select")) == 1) - { - /* remove select switch */ - if (strstr(str, "select=1")) - { - *strstr(str, "select=1") = 0; - if (strlen(str) > 1 && - (str[strlen(str)-1] == '&' || str[strlen(str)-1] == '?')) - str[strlen(str)-1] = 0; - } - } - else - { - /* add select switch */ - if (strchr(str, '?')) - strcat(str, "&select=1"); - else - strcat(str, "?select=1"); - } - rsprintf(" %s |\n", str, loc("Select")); - } + if (i < n-1) + rsprintf(" %s |\n", str, loc(menu_item[i])); else - { - strcpy(str, loc(menu_item[i])); - url_encode(str, sizeof(str)); - - if (i < n-1) - rsprintf(" %s |\n", str, loc(menu_item[i])); - else - rsprintf(" %s \n", str, loc(menu_item[i])); - } + rsprintf(" %s \n", str, loc(menu_item[i])); } } - - rsprintf("\n"); } - rsprintf("
\n", - gt("Menu1 cellpadding"), gt("Frame color")); - - rsprintf("
\n", gt("Menu1 Align"), gt("Menu1 BGColor")); + rsprintf("
\n"); /* check if file starts with an absolute directory */ if (str[0] == DIR_SEPARATOR || str[1] == ':') @@ -8233,53 +8029,63 @@ LOGBOOK *lbs_cur; else rsprintf("
Error: file \"%s\" not found
", file_name); - rsprintf("
\n", - printable ? "1" : gt("Border width"), gt("Categories cellpadding")); - - if (*getparam("m1") || *getparam("y1") || *getparam("d1")) - rsprintf("", - gt("Categories bgcolor1"), loc("Start date"), gt("Categories bgcolor2"), mname[m1-1], d1, y1); - - if (*getparam("m2") || *getparam("y2") || *getparam("d2")) - { - /* calculate previous day */ - memset(&tms, 0, sizeof(struct tm)); - tms.tm_year = y2 % 100; - tms.tm_mon = m2-1; - tms.tm_mday = d2; - tms.tm_hour = 12; - - if (tms.tm_year < 90) - tms.tm_year += 100; - ltime = mktime(&tms); - ltime -= 3600*24; - memcpy(&tms, localtime(<ime), sizeof(struct tm)); - - rsprintf("", - gt("Categories bgcolor1"), loc("End date"), gt("Categories bgcolor2"), - mname[tms.tm_mon], tms.tm_mday, tms.tm_year + 1900); - } + disp_filter = *getparam("m1") || *getparam("y1") || *getparam("d1") || + *getparam("m2") || *getparam("y2") || *getparam("d2") || *getparam("subtext"); for (i=0 ; in_attr ; i++) - { if (*getparam(attr_list[i])) - rsprintf("", - gt("Categories bgcolor1"), attr_list[i], gt("Categories bgcolor2"), getparam(attr_list[i])); - } + disp_filter = TRUE; - if (*getparam("subtext")) + if (disp_filter) { - rsprintf("", gt("Categories bgcolor1"), loc("Text")); - rsprintf("", - gt("Categories bgcolor2"), getparam("subtext")); - } + rsprintf("\n\n"); + if (*getparam("m1") || *getparam("y1") || *getparam("d1")) + rsprintf("", + gt("Categories bgcolor1"), loc("Start date"), gt("Categories bgcolor2"), mname[m1-1], d1, y1); + + if (*getparam("m2") || *getparam("y2") || *getparam("d2")) + { + /* calculate previous day */ + memset(&tms, 0, sizeof(struct tm)); + tms.tm_year = y2 % 100; + tms.tm_mon = m2-1; + tms.tm_mday = d2; + tms.tm_hour = 12; + + if (tms.tm_year < 90) + tms.tm_year += 100; + ltime = mktime(&tms); + ltime -= 3600*24; + memcpy(&tms, localtime(<ime), sizeof(struct tm)); + + rsprintf("", + gt("Categories bgcolor1"), loc("End date"), gt("Categories bgcolor2"), + mname[tms.tm_mon], tms.tm_mday, tms.tm_year + 1900); + } + + for (i=0 ; in_attr ; i++) + { + if (*getparam(attr_list[i])) + rsprintf("", + gt("Categories bgcolor1"), attr_list[i], gt("Categories bgcolor2"), getparam(attr_list[i])); + } + + if (*getparam("subtext")) + { + rsprintf("", gt("Categories bgcolor1"), loc("Text")); + rsprintf("", + gt("Categories bgcolor2"), getparam("subtext")); + } + + rsprintf("
%s:%s %d, %d
%s:%s %d, %d
%s:%s
%s:%s
\n"); + rsprintf("\n"); - rsprintf("
%s:%s %d, %d
%s:%s %d, %d
%s:%s
%s:%s
\n", - printable ? "1" : gt("Border width"), gt("Categories cellpadding"), gt("Frame color")); + /* overall listing table */ + rsprintf("\n"); + if (n_display) rsprintf("\n", n_display); - rsprintf("
\n"); strcpy(col, gt("Categories bgcolor1")); @@ -8343,8 +8149,9 @@ LOGBOOK *lbs_cur; { rsprintf("\n"); + /* empty title for selection box */ if (atoi(getparam("select")) == 1) - rsprintf("\n", col); + rsprintf("\n", col); for (i=0 ; i"); - rsprintf("\n", - col, size, ref, disp_attr[i], img); + rsprintf("\n", + ref, disp_attr[i], img); } if (!equal_ustring(mode, "Full") && n_line > 0) - rsprintf("\n", - col, size); + rsprintf("\n"); rsprintf("\n\n"); } @@ -8513,20 +8319,13 @@ LOGBOOK *lbs_cur; } } + rsprintf("
%s%s%s%sTextText
\n", - printable ? "1" : gt("Border width"), gt("Categories cellpadding"), gt("Frame color")); - - rsprintf("", loc("No entries found")); - - rsprintf("
%s
\n"); - } + rsprintf("
%s
", gt("Border width"), gt("Frame color")); @@ -9166,7 +8966,7 @@ LOGBOOK *lbs_dest; /*------------------------------------------------------------------*/ -void show_elog_page(LOGBOOK *lbs, char *dec_path, char *command) +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; @@ -9415,12 +9215,12 @@ BOOL first; sprintf(ref, "%d", message_id); if (str[0]) - show_standard_header(str, ref); + show_standard_header(lbs, TRUE, str, ref); else - show_standard_header(lbs->name, ref); + show_standard_header(lbs, TRUE, lbs->name, ref); } else - show_standard_header("", ""); + show_standard_header(lbs, TRUE, "", ""); /*---- title ----*/ @@ -9428,161 +9228,82 @@ BOOL first; /*---- menu buttons ----*/ - rsprintf("
\n", - gt("Menu1 cellpadding"), gt("Frame color")); - - rsprintf("\n\n"); - } + rsprintf("\n\n"); /*---- next/previous buttons ----*/ if (!getcfg(lbs->name, "Enable browsing", str) || atoi(str) == 1) { - if (atoi(gt("Merge menus")) != 1) - { - rsprintf("
\n", gt("Menu1 Align"), gt("Menu1 BGColor")); + rsprintf("
\n"); + rsprintf("\n"); + rsprintf("\n"); - - if (atoi(gt("Merge menus")) != 1) - { - rsprintf("\n"); - rsprintf("
\n"); n = strbreak(menu_str, menu_item, MAX_N_LIST); - if (atoi(gt("Use buttons")) == 1) + for (i=0 ; i\n", cmd); - - if (equal_ustring(cmd, loc("Copy to")) || - equal_ustring(cmd, loc("Move to"))) + if (getcfg(lbs->name, cmd, str)) { - /* put one link for each logbook except current one */ - if (equal_ustring(cmd, loc("Copy to"))) + n_log = strbreak(str, lbk_list, MAX_N_LIST); + + for (j=0 ; jname, "Copy to", str); - rsprintf("\n"); - } + strcpy(ref, lbk_list[j]); + url_encode(ref, sizeof(ref)); - if (str[0]) - { - n_log = strbreak(str, lbk_list, MAX_N_LIST); - - for (j=0 ; j%s\n", lbk_list[j], lbk_list[j]); - } - else - { - for (j=0 ; ; j++) - { - if (!enumgrp(j, str)) - break; - - if (equal_ustring(str, "global")) - continue; - - if (equal_ustring(str, lbs->name)) - continue; - - rsprintf("
\n", - gt("Menu2 cellpadding"), gt("Frame color")); - rsprintf(""); + rsprintf(""); } /*---- message ----*/ - /* overall table for message giving blue frame */ - rsprintf("\n"); @@ -9992,7 +9703,7 @@ BOOL first; } else /* add little logo */ - rsprintf("
ELOG V%s
", VERSION); + rsprintf("
ELOG V%s
", VERSION); rsprintf("\r\n"); } @@ -10021,7 +9732,7 @@ char str[256]; } /* show web password page */ - show_standard_header(loc("ELOG password"), NULL); + show_standard_header(lbs, FALSE, loc("ELOG password"), NULL); /* define hidden fields for current destination */ if (redir[0]) @@ -10213,11 +9924,15 @@ int i; /*------------------------------------------------------------------*/ -BOOL check_user_password(char *logbook_name, char *user, char *password, char *redir) +BOOL check_user_password(LOGBOOK *lbs, char *user, char *password, char *redir) { char status, str[256], upwd[256], full_name[256], email[256]; - status = get_user_line(logbook_name, user, upwd, full_name, email, NULL); + if (lbs == NULL) + status = get_user_line("global", user, upwd, full_name, email, NULL); + else + status = get_user_line(lbs->name, user, upwd, full_name, email, NULL); + if (status == 1) { if (user[0] && strcmp(password, upwd) == 0) @@ -10234,7 +9949,7 @@ char status, str[256], upwd[256], full_name[256], email[256]; } /* show login password page */ - show_standard_header("ELOG login", NULL); + show_standard_header(lbs, FALSE, "ELOG login", NULL); /* define hidden fields for current destination */ rsprintf("\n", redir); @@ -10256,7 +9971,7 @@ char status, str[256], upwd[256], full_name[256], email[256]; rsprintf("\n", gt("Cell BGColor"), loc("Password")); - if (getcfg(logbook_name, "Self register", str) && atoi(str) > 0) + if (getcfg(lbs->name, "Self register", str) && atoi(str) > 0) rsprintf("", gt("Cell BGColor"), loc("Register as new user")); @@ -10275,7 +9990,7 @@ char status, str[256], upwd[256], full_name[256], email[256]; sprintf(full_name, loc("Invalid user name %s"), user); else { - getcfg(logbook_name, "Password file", str); + getcfg(lbs->name, "Password file", str); sprintf(full_name, loc("Cannot open file %s"), str); } show_error(full_name); @@ -10290,21 +10005,12 @@ void show_selection_page() int i; char str[10000]; - show_http_header(TRUE); - - rsprintf("\n"); - rsprintf("\n"); - - if (getcfg("global", "Page Title", str)) - { - rsprintf(""); - rsputs(str); - rsprintf("\n"); - } - else - rsprintf("ELOG Logbook Selection\n"); - - rsprintf("\n\n"); + if (getcfg("global", "Page Title", str)) + { + show_html_header(NULL, FALSE, str); + } + else + show_html_header(NULL, FALSE, "ELOG Logbook Selection"); rsprintf("\n\n"); @@ -10385,7 +10091,7 @@ char str[256]; /* display account request notification */ if (equal_ustring(command, "Requested")) { - show_standard_header(loc("ELOG registration"), ""); + show_standard_header(lbs, FALSE, loc("ELOG registration"), ""); rsprintf("

\n", gt("Menu2 Align"), gt("Menu2 BGColor")); - } - else - rsprintf("\n", gt("Menu2 Align"), gt("Menu2 BGColor")); + rsprintf("\n"); if (atoi(gt("Menu2 use images")) == 1) { @@ -9615,10 +9336,7 @@ BOOL first; FILE *f; char file_name[256], *buf; - rsprintf("
\n", - gt("Menu1 cellpadding"), gt("Frame color")); - - rsprintf("
\n", gt("Menu1 Align"), gt("Menu1 BGColor")); + rsprintf("
\n"); /* check if file starts with an absolute directory */ if (str[0] == DIR_SEPARATOR || str[1] == ':') @@ -9648,19 +9366,18 @@ BOOL first; else rsprintf("
Error: file \"%s\" not found
", file_name); - rsprintf("
\n", - gt("Categories border"), gt("Categories cellpadding"), gt("Frame color")); + /* overall message table */ + rsprintf("\n\n"); - /* overall table */ rsprintf("
\n"); if (message_error == EL_EMPTY) - rsprintf("\n", loc("Logbook is empty")); + rsprintf("\n", loc("Logbook is empty")); else if (message_error == EL_NO_MSG) - rsprintf("\n", loc("This message has been deleted")); + rsprintf("\n", loc("This message has been deleted")); else { /* check for locked attributes */ @@ -9676,20 +9393,17 @@ BOOL first; str[0] = 0; if (message_error == EL_LAST_MSG) - rsprintf("\n", + rsprintf("\n", loc("This is the last entry"), str); if (message_error == EL_FIRST_MSG) - rsprintf("\n", + rsprintf("\n", loc("This is the first entry"), str); /* check for mail submissions */ if (*getparam("suppress")) { - if (getcfg(lbs->name, "Suppress default", str) && atoi(str) == 1) - rsprintf("\n", loc("Email notification suppressed")); - else - rsprintf("\n", loc("Email notification suppressed")); + rsprintf("\n", loc("Email notification suppressed")); i = 1; } else @@ -9700,7 +9414,7 @@ BOOL first; if (*getparam(str)) { if (i==0) - rsprintf("\n\n", - gt("Categories bgcolor1"), loc("Message ID"), gt("Categories bgcolor2"), message_id); + rsprintf("\n\n", + loc("Message ID"), message_id); /*---- display date ----*/ @@ -9739,12 +9453,12 @@ BOOL first; mktime(&ts); strftime(str, sizeof(str), format, &ts); - rsprintf("\n", ref, orig_tag); } if (reply_tag[0]) { - rsprintf("\n", - attr_list[i], gt("Categories bgcolor2")); + rsprintf("%s:\n", + attr_list[i]); else - rsprintf("%s:\n", - attr_list[i], gt("Categories bgcolor2")); + rsprintf("%s:\n", + attr_list[i]); } /* display image for icon */ else if (attr_flags[i] & AF_ICON) { - rsprintf("%s:\n"); } else { - rsprintf("%s:\n"); } @@ -9838,16 +9550,11 @@ BOOL first; if (!getcfg(lbs->name, "Show text", str) || atoi(str) == 1) { - rsprintf("\n"); } for (index = 0 ; index < MAX_ATTACHMENTS ; index++) @@ -9884,21 +9590,25 @@ BOOL first; sprintf(ref, "%s/%s", str, attachment[index]+14); url_encode(ref, sizeof(ref)); /* for file names with special characters like "+" */ - rsprintf("\n"); if (!getcfg(lbs->name, "Show attachments", str) || atoi(str) == 1) @@ -9920,10 +9630,14 @@ BOOL first; strchr(att, '.') == NULL) { /* display attachment */ + rsprintf("\n"); + rsprintf("\n"); } } } @@ -9955,9 +9669,6 @@ BOOL first; } } - /* table for message body */ - rsprintf("

%s

%s

%s

%s
%s %s
%s %s
%s %s
%s %s
%s
%s
%s
"); + rsprintf("
"); rsprintf("%s %s
\n", loc("EMail sent to"), getparam(str)); } else @@ -9713,8 +9427,8 @@ BOOL first; /*---- display message ID ----*/ - rsprintf("
%s:%d
%s:%d
%s:%s\n\n", - gt("Categories bgcolor1"), loc("Entry date"), gt("Categories bgcolor2"), str); + rsprintf("
%s:%s\n\n", + loc("Entry date"), str); } else - rsprintf("
%s:%s\n\n", - gt("Categories bgcolor1"), loc("Entry date"), gt("Categories bgcolor2"), date); + rsprintf("
%s:%s\n\n", + loc("Entry date"), date); for (i=0 ; in_attr ; i++) rsprintf("\n", attr_list[i], attrib[i]); @@ -9761,15 +9475,15 @@ BOOL first; if (orig_tag[0]) { - rsprintf("
", gt("Categories bgcolor1")); + rsprintf("
"); sprintf(ref, "%s", orig_tag); - rsprintf("%s:", loc("In reply to"), gt("Menu2 bgcolor")); + rsprintf("%s:", loc("In reply to")); rsprintf("%s
", gt("Categories bgcolor1")); - rsprintf("%s:", loc("Reply to this"), gt("Menu2 bgcolor")); + rsprintf("
"); + rsprintf("%s:", loc("Reply to this")); p = strtok(reply_tag, ","); do @@ -9792,7 +9506,7 @@ BOOL first; for (i=0 ; in_attr ; i++) { sprintf(lattr, "l%s", attr_list[i]); - rsprintf("
", gt("Categories bgcolor1")); + rsprintf("
"); if (!getcfg(lbs->name, "Filtered browsing", str) || atoi(str) == 1) @@ -9807,25 +9521,23 @@ BOOL first; if (equal_ustring(attr_options[i][0], "boolean")) { if (atoi(attrib[i]) == 1) - rsprintf("%s:
\n", - attr_list[i], gt("Categories bgcolor2")); + rsprintf("%s:\n", attr_list[i]); if (attrib[i][0]) rsprintf("", attrib[i]); rsprintf(" 
\n", - attr_list[i], gt("Categories bgcolor2")); + rsprintf("%s:\n", attr_list[i]); rsputs2(attrib[i]); rsprintf(" 
\n", gt("Frame color")); - - if (*gt("BGTimage")) - rsprintf("\n"); - rsputs("
\n", gt("BGTimage"), gt("Text BGColor")); - else - rsprintf("
\n", gt("Text BGColor")); + rsprintf("
\n"); if (equal_ustring(encoding, "plain")) { - rsputs("
");
+        rsputs("
");
         rsputs2(text);
         rsputs("
"); } @@ -9855,7 +9562,6 @@ BOOL first; rsputs(text); rsputs("
\n", gt("Frame color")); + /* overall table */ + rsprintf("\n"); + rsprintf("
\n"); - rsprintf("", - gt("Categories bgcolor1"), loc("Attachment"), index+1); - rsprintf("\n", + loc("Attachment"), index+1); + + rsprintf("
 %s %d: %s\n", - gt("Categories bgcolor2"), ref, attachment[index]+14); + rsprintf("
%s %d:%s\n", + ref, attachment[index]+14); + + rsprintf(" "); if (length < 1024) - rsprintf(" %d Bytes", length); + rsprintf("%d Bytes", length); else if (length < 1024*1024) - rsprintf(" %d kB", length/1024); + rsprintf("%d kB", length/1024); else - rsprintf(" %1.3lf MB", length/1024.0/1024.0); + rsprintf("%1.3lf MB", length/1024.0/1024.0); - rsprintf("
\n"); + + /* rsprintf("
\n", gt("Frame color")); rsprintf("
", gt("Text bgcolor")); + */ if (!strstr(att, ".HTML")) - rsprintf("
");
+                rsprintf("
");
 
               strlcpy(file_name, lbs->data_dir, sizeof(file_name));
               strlcat(file_name, attachment[index], sizeof(file_name));
@@ -9947,7 +9661,7 @@ BOOL   first;
               if (!strstr(att, ".HTML"))
                 rsprintf("
"); rsprintf("\n"); - rsprintf("
%s:   
%s
", gt("Border width"), gt("Frame color")); @@ -10674,7 +10380,7 @@ FILE *f; else strcpy(str, getparam("cmdline")); - if (!check_user_password(lbs->name, getparam("uname"), enc_pwd, str)) + if (!check_user_password(lbs, getparam("uname"), enc_pwd, str)) return; logf("Login of user \"%s\" (successful)", getparam("uname")); @@ -10701,14 +10407,14 @@ FILE *f; } logf("Connection of user \"%s\"",getparam("unm")); - if (!check_user_password(lbs->name, getparam("unm"), getparam("upwd"), getparam("cmdline"))) + if (!check_user_password(lbs, getparam("unm"), getparam("upwd"), getparam("cmdline"))) return; } } if (equal_ustring(command, loc("Login"))) { - check_user_password(lbs->name, "", "", path); + check_user_password(lbs, "", "", path); return; } @@ -10786,7 +10492,7 @@ FILE *f; if (strncmp(path, "past", 4) == 0 && *getparam("cmd") == 0) { - show_elog_submit_find(lbs, atoi(path+4), 0, 0); + show_elog_list(lbs, atoi(path+4), 0, 0); return; } @@ -10794,7 +10500,7 @@ FILE *f; (!isparam("cmd") || equal_ustring(getparam("cmd"), loc("Select"))) && !isparam("newpwd")) { - show_elog_submit_find(lbs, 0, atoi(path+4), 0); + show_elog_list(lbs, 0, atoi(path+4), 0); return; } @@ -10802,9 +10508,9 @@ FILE *f; *getparam("cmd") == 0) { if (!path[4]) - show_elog_submit_find(lbs, 0, 0, -1); + show_elog_list(lbs, 0, 0, -1); else - show_elog_submit_find(lbs, 0, 0, atoi(path+4)); + show_elog_list(lbs, 0, 0, atoi(path+4)); return; } @@ -10813,7 +10519,8 @@ FILE *f; if ((strlen(dec_path) > 13 && dec_path[6] == '_' && dec_path[13] == '_') || (strlen(dec_path) > 13 && dec_path[6] == '_' && dec_path[13] == '/') || strstr(dec_path, ".gif") || strstr(dec_path, ".jpg") || - strstr(dec_path, ".jpeg") || strstr(dec_path, ".png")) + strstr(dec_path, ".jpeg") || strstr(dec_path, ".png") || + strstr(dec_path, ".css")) { if ((strlen(dec_path) > 13 && dec_path[6] == '_' && dec_path[13] == '_') || (strlen(dec_path) > 13 && dec_path[6] == '_' && dec_path[13] == '/')) @@ -10829,7 +10536,7 @@ FILE *f; { /* file from theme directory requested */ strlcpy(file_name, resource_dir, sizeof(file_name)); - if (file_name[0]) + if (file_name[strlen(file_name)-1] != DIR_SEPARATOR) strlcat(file_name, DIR_SEPARATOR_STR, sizeof(file_name)); strlcat(file_name, "themes", sizeof(file_name)); strlcat(file_name, DIR_SEPARATOR_STR, sizeof(file_name)); @@ -10950,7 +10657,7 @@ FILE *f; redirect(str); return; } - show_elog_find(lbs); + show_find_form(lbs); return; } @@ -10963,7 +10670,7 @@ FILE *f; return; } - show_elog_submit_find(lbs, 0, 0, 1); + show_elog_list(lbs, 0, 0, 1); return; } @@ -11120,9 +10827,9 @@ FILE *f; /* show page listing or display single entry */ if (dec_path[0] == 0) - show_elog_submit_find(lbs, 0, 0, 1); + show_elog_list(lbs, 0, 0, 1); else - show_elog_page(lbs, dec_path, command); + show_elog_message(lbs, dec_path, command); return; }