From a0f36f610b83676b029b41249db6817a96e9ccc9 Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Tue, 8 Mar 2005 04:59:34 +0000 Subject: [PATCH] * More attractive display of vCards (hide unknown fields) * Added "title" and "organization" to vCard display/edit * Replaced semicolon with comma-space in vCard name display --- webcit/ChangeLog | 6 ++ webcit/messages.c | 100 ++++++++++++++++++++++++------ webcit/static/body-background.gif | Bin 0 -> 93 bytes webcit/static/head.html | 5 +- webcit/vcard_edit.c | 96 +++++++++++++++++++--------- 5 files changed, 158 insertions(+), 49 deletions(-) create mode 100644 webcit/static/body-background.gif diff --git a/webcit/ChangeLog b/webcit/ChangeLog index 92e219904..90383bbf2 100644 --- a/webcit/ChangeLog +++ b/webcit/ChangeLog @@ -1,4 +1,9 @@ $Log$ +Revision 603.10 2005/03/08 04:59:31 ajc +* More attractive display of vCards (hide unknown fields) +* Added "title" and "organization" to vCard display/edit +* Replaced semicolon with comma-space in vCard name display + Revision 603.9 2005/03/07 04:03:28 ajc * auth.c: shrink the margins on the login screen so the user sees something resembling a window. @@ -2469,3 +2474,4 @@ Sun Dec 6 19:50:55 EST 1998 Art Cancro 1998-12-03 Nathan Bryant * webserver.c: warning fix + diff --git a/webcit/messages.c b/webcit/messages.c index 1af10564c..6b82e1e30 100644 --- a/webcit/messages.c +++ b/webcit/messages.c @@ -91,25 +91,57 @@ char buf[]; } +/* + * Turn a vCard "n" (name) field into something displayable. + */ +void vcard_n_prettyize(char *name) +{ + char *original_name; + int i; + + original_name = strdup(name); + for (i=0; i<5; ++i) { + if (strlen(original_name) > 0) { + if (original_name[strlen(original_name)-1] == ' ') { + original_name[strlen(original_name)-1] = 0; + } + if (original_name[strlen(original_name)-1] == ';') { + original_name[strlen(original_name)-1] = 0; + } + } + } + strcpy(name, ""); + for (i=0; inumprops) for (i=0; i<(v->numprops); ++i) { - if (!strcasecmp(v->prop[i].name, "n")) { - strcpy(storename, v->prop[i].value); - if ((strlen(storename)>0) && (storename[0] != ';')) { - while(storename[strlen(storename)-1] == ';') { - storename[strlen(storename)-1] = 0; - } - } - } + + name = vcard_get_prop(v, "n", 1, 0, 0); + if (name != NULL) { + strcpy(storename, name); + /* vcard_n_prettyize(storename); */ } + } @@ -137,12 +169,16 @@ void display_parsed_vcard(struct vCard *v, int full) { int pass; char displayname[SIZ]; + char title[SIZ]; + char org[SIZ]; char phone[SIZ]; char mailto[SIZ]; strcpy(displayname, ""); strcpy(phone, ""); strcpy(mailto, ""); + strcpy(title, ""); + strcpy(org, ""); if (!full) { wprintf(""); @@ -151,7 +187,9 @@ void display_parsed_vcard(struct vCard *v, int full) { escputs(name); } else if (name = vcard_get_prop(v, "n", 1, 0, 0), name != NULL) { - escputs(name); + strcpy(displayname, name); + vcard_n_prettyize(displayname); + escputs(displayname); } else { wprintf(" "); @@ -160,7 +198,7 @@ void display_parsed_vcard(struct vCard *v, int full) { return; } - wprintf(""); + wprintf("
"); for (pass=1; pass<=2; ++pass) { if (v->numprops) for (i=0; i<(v->numprops); ++i) { @@ -203,6 +241,7 @@ void display_parsed_vcard(struct vCard *v, int full) { if (!strcasecmp(firsttoken, "n")) { if (strlen(displayname) == 0) { strcpy(displayname, thisvalue); + vcard_n_prettyize(displayname); } } @@ -210,6 +249,16 @@ void display_parsed_vcard(struct vCard *v, int full) { else if (!strcasecmp(firsttoken, "fn")) { strcpy(displayname, thisvalue); } + + /* title */ + else if (!strcasecmp(firsttoken, "title")) { + strcpy(title, thisvalue); + } + + /* organization */ + else if (!strcasecmp(firsttoken, "org")) { + strcpy(org, thisvalue); + } else if (!strcasecmp(firsttoken, "email")) { if (strlen(mailto) > 0) strcat(mailto, "
"); @@ -248,7 +297,8 @@ void display_parsed_vcard(struct vCard *v, int full) { extract_token(buf, thisvalue, j, ';'); if (strlen(buf) > 0) { escputs(buf); - wprintf("
"); + if (j<3) wprintf("
"); + else wprintf(" "); } } wprintf("\n"); @@ -264,6 +314,8 @@ void display_parsed_vcard(struct vCard *v, int full) { /* ignore */ } else { + + /*** Don't show extra fields. They're ugly. if (pass == 2) { wprintf("\n"); } + ***/ } free(thisname); @@ -283,7 +336,18 @@ void display_parsed_vcard(struct vCard *v, int full) { "" ""); escputs(displayname); - wprintf("\n"); + wprintf(""); + if (strlen(title) > 0) { + wprintf("
"); + escputs(title); + wprintf("
"); + } + if (strlen(org) > 0) { + wprintf("
"); + escputs(org); + wprintf("
"); + } + wprintf("\n"); if (strlen(phone) > 0) wprintf("\n", phone); @@ -293,7 +357,7 @@ void display_parsed_vcard(struct vCard *v, int full) { } - wprintf("
"); escputs(thisname); @@ -271,6 +323,7 @@ void display_parsed_vcard(struct vCard *v, int full) { escputs(thisvalue); wprintf("
Telephone:%s
\n"); + wprintf("\n"); } @@ -525,18 +589,18 @@ void read_message(long msgnum) { wprintf("&subject="); if (strncasecmp(m_subject, "Re:", 3)) wprintf("Re:%20"); urlescputs(m_subject); - wprintf("\">Reply "); + wprintf("\">[Reply] "); if (WC->is_room_aide) { /* Move */ - wprintf("Move ", + wprintf("[Move] ", msgnum); /* Delete */ wprintf("" - "Delete", msgnum); + "[Delete]", msgnum); } diff --git a/webcit/static/body-background.gif b/webcit/static/body-background.gif new file mode 100644 index 0000000000000000000000000000000000000000..e69942eb8233ab1b0ded940bea98ec51b2d78c04 GIT binary patch literal 93 zcmZ?wbh9u|WMg1uc+AD{=+UFcj~_pI^5p5$r_Y`}d;a|Six)3mzI^%W)vMR9U;oDd hIt)Mn(#yaiRItG45`z*0Q<>fjN1pbE%y1S4YXATsHKYIl literal 0 HcmV?d00001 diff --git a/webcit/static/head.html b/webcit/static/head.html index 82f7aeed2..d544708fd 100644 --- a/webcit/static/head.html +++ b/webcit/static/head.html @@ -18,7 +18,7 @@ body { padding: 0 0 0 0; height: 100%; overflow: auto; - background: #aaaaaa; + background-image:url(static/body-background.gif); color: #000000; font-family: "Bitstream Vera Sans",Arial,Helvetica,sans-serif; font-weight: normal; @@ -140,7 +140,8 @@ html>body #button li a { } #button li a:hover { - background-color: #ddddff; + //background-color: #ddddff; + background-image:url(static/body-background.gif); color: #000000; } diff --git a/webcit/vcard_edit.c b/webcit/vcard_edit.c index fb18a33e4..23c8df4a8 100644 --- a/webcit/vcard_edit.c +++ b/webcit/vcard_edit.c @@ -58,6 +58,8 @@ void do_edit_vcard(long msgnum, char *partnum, char *return_to) { char primary_inetemail[SIZ]; char other_inetemail[SIZ]; char extrafields[SIZ]; + char title[SIZ]; + char org[SIZ]; lastname[0] = 0; firstname[0] = 0; @@ -75,6 +77,8 @@ void do_edit_vcard(long msgnum, char *partnum, char *return_to) { worktel[0] = 0; primary_inetemail[0] = 0; other_inetemail[0] = 0; + title[0] = 0; + org[0] = 0; extrafields[0] = 0; strcpy(whatuser, ""); @@ -129,6 +133,14 @@ void do_edit_vcard(long msgnum, char *partnum, char *return_to) { extract_token(prefix, value, 3, ';'); extract_token(suffix, value, 4, ';'); } + + else if (!strcasecmp(key, "title")) { + strcpy(title, value); + } + + else if (!strcasecmp(key, "org")) { + strcpy(org, value); + } else if (!strcasecmp(key, "adr")) { extract_token(pobox, value, 0, ';'); @@ -178,10 +190,8 @@ void do_edit_vcard(long msgnum, char *partnum, char *return_to) { "
" "" "" - "Contact information for " - ); - escputs(whatuser); - wprintf("" + "Edit contact information" + "" "
\n" "\n
\n" ); @@ -197,7 +207,7 @@ void do_edit_vcard(long msgnum, char *partnum, char *return_to) { "Last" "Suffix\n"); wprintf("", + "VALUE=\"%s\" MAXLENGTH=\"5\" SIZE=\"5\">", prefix); wprintf("", @@ -209,48 +219,72 @@ void do_edit_vcard(long msgnum, char *partnum, char *return_to) { "VALUE=\"%s\" MAXLENGTH=\"29\">", lastname); wprintf("\n", + "VALUE=\"%s\" MAXLENGTH=\"10\" SIZE=\"10\">\n", suffix); - wprintf("" - "\n", + wprintf("
PO box (optional):
"); + wprintf("\n", country); + wprintf("
"); + + wprintf("Title:
" + "

\n", + title + ); + + wprintf("Organization:
" + "

\n", + org + ); + + wprintf("
"); + + wprintf(""); + wprintf("\n", pobox); - wprintf("" - "\n", + wprintf("\n", extadr); - wprintf("" - "\n", + wprintf("\n", street); - wprintf("" - "\n", city); - wprintf(" State: " + wprintf("\n", state); - wprintf(" ZIP code: " + wprintf("\n", + "VALUE=\"%s\" MAXLENGTH=\"10\">\n", zipcode); - wprintf("" - "
PO box:" + "
Address line 1:
Address:" + "
Address line 2:
" + "
City:\n", + wprintf("
City:" + "
State:" "\n", + "VALUE=\"%s\" MAXLENGTH=\"2\">
ZIP code:" "
Country:
\n", + wprintf("
Country:" + "
\n"); + + wprintf("\n"); wprintf("" "\n", + "VALUE=\"%s\" MAXLENGTH=\"29\">\n", hometel); - wprintf("" + wprintf("" "
Home telephone:
Work telephone:Work telephone:
\n", worktel); - wprintf("
" + wprintf("
"); + wprintf("
"); + + wprintf("" "
Primary Internet e-mail address
" "" "

\n"); + wprintf("
\n"); + + wprintf("\n"); wprintf("