}
+/*
+ * 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; i<strlen(original_name); ++i) {
+ if (original_name[i] == ';') {
+ strcat(name, ", ");
+ }
+ else {
+ name[strlen(name)+1] = 0;
+ name[strlen(name)] = original_name[i];
+ }
+ }
+ free(original_name);
+}
+
+
+
+
/* display_vcard() calls this after parsing the textual vCard into
* our 'struct vCard' data object.
* This gets called instead of display_parsed_vcard() if we are only looking
* to extract the person's name instead of displaying the card.
*/
void fetchname_parsed_vcard(struct vCard *v, char *storename) {
- int i;
+ char *name;
strcpy(storename, "");
- if (v->numprops) 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); */
}
+
}
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("<TD>");
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(" ");
return;
}
- wprintf("<TABLE bgcolor=#888888>");
+ wprintf("<div align=center><table bgcolor=#aaaaaa width=50%%>");
for (pass=1; pass<=2; ++pass) {
if (v->numprops) for (i=0; i<(v->numprops); ++i) {
thisname = strdup(v->prop[i].name);
- extract_token(firsttoken, thisname, 0, ';');
+ extract_token(firsttoken, thisname, 0, ';', sizeof firsttoken);
for (j=0; j<num_tokens(thisname, ';'); ++j) {
- extract_token(buf, thisname, j, ';');
+ extract_token(buf, thisname, j, ';', sizeof buf);
if (!strcasecmp(buf, "encoding=quoted-printable")) {
is_qp = 1;
remove_token(thisname, j, ';');
if (!strcasecmp(firsttoken, "n")) {
if (strlen(displayname) == 0) {
strcpy(displayname, thisvalue);
+ vcard_n_prettyize(displayname);
}
}
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, "<br />");
if (strlen(phone) > 0) strcat(phone, "<br />");
strcat(phone, thisvalue);
for (j=0; j<num_tokens(thisname, ';'); ++j) {
- extract_token(buf, thisname, j, ';');
+ extract_token(buf, thisname, j, ';', sizeof buf);
if (!strcasecmp(buf, "tel"))
strcat(phone, "");
else if (!strcasecmp(buf, "work"))
if (pass == 2) {
wprintf("<TR><TD>Address:</TD><TD>");
for (j=0; j<num_tokens(thisvalue, ';'); ++j) {
- extract_token(buf, thisvalue, j, ';');
+ extract_token(buf, thisvalue, j, ';', sizeof buf);
if (strlen(buf) > 0) {
escputs(buf);
- wprintf("<br />");
+ if (j<3) wprintf("<br />");
+ else wprintf(" ");
}
}
wprintf("</TD></TR>\n");
/* ignore */
}
else {
+
+ /*** Don't show extra fields. They're ugly.
if (pass == 2) {
wprintf("<TR><TD>");
escputs(thisname);
escputs(thisvalue);
wprintf("</TD></TR>\n");
}
+ ***/
}
free(thisname);
"<IMG ALIGN=CENTER SRC=\"/static/vcard.gif\">"
"<FONT SIZE=+1><B>");
escputs(displayname);
- wprintf("</B></FONT></TD></TR>\n");
+ wprintf("</B></FONT>");
+ if (strlen(title) > 0) {
+ wprintf("<div align=right>");
+ escputs(title);
+ wprintf("</div>");
+ }
+ if (strlen(org) > 0) {
+ wprintf("<div align=right>");
+ escputs(org);
+ wprintf("</div>");
+ }
+ wprintf("</TD></TR>\n");
if (strlen(phone) > 0)
wprintf("<TR><TD>Telephone:</TD><TD>%s</TD></TR>\n", phone);
}
- wprintf("</TABLE>\n");
+ wprintf("</table></div>\n");
}
if (storename != NULL) {
fetchname_parsed_vcard(v, storename);
}
- else if ( (alpha == 0)
- || ((isalpha(alpha)) && (tolower(alpha) == tolower(this_alpha)) )
- || ((!isalpha(alpha)) && (!isalpha(this_alpha))) ) {
+ else if ( (alpha == 0)
+ || ((isalpha(alpha)) && (tolower(alpha) == tolower(this_alpha)) )
+ || ((!isalpha(alpha)) && (!isalpha(this_alpha)))
+ ) {
display_parsed_vcard(v, full);
}
}
/* begin everythingamundo table */
- wprintf("<center><table width=99%% border=1 cellspacing=0 "
+ wprintf("<div id=\"fix_scrollbar_bug\">\n");
+ wprintf("<table width=100%% border=1 cellspacing=0 "
"cellpadding=0><TR><TD>\n");
/* begin message header table */
}
if (!strncasecmp(buf, "part=", 5)) {
- extract(mime_filename, &buf[5], 1);
- extract(mime_partnum, &buf[5], 2);
- extract(mime_disposition, &buf[5], 3);
- extract(mime_content_type, &buf[5], 4);
+ extract_token(mime_filename, &buf[5], 1, '|', sizeof mime_filename);
+ extract_token(mime_partnum, &buf[5], 2, '|', sizeof mime_partnum);
+ extract_token(mime_disposition, &buf[5], 3, '|', sizeof mime_disposition);
+ extract_token(mime_content_type, &buf[5], 4, '|', sizeof mime_content_type);
mime_length = extract_int(&buf[5], 5);
if (!strcasecmp(mime_disposition, "attachment")) {
/* start msg buttons */
wprintf("<TD ALIGN=RIGHT>\n");
- wprintf("<FORM METHOD=\"POST\" ACTION=\"/do_stuff_to_one_msg\">\n");
- wprintf("<INPUT TYPE=\"hidden\" NAME=\"msgid\" VALUE=\"%ld\">\n",
- msgnum);
- wprintf("<INPUT TYPE=\"hidden\" NAME=\"recp\" VALUE=\"");
- escputs(reply_to);
- wprintf("\">\n");
- if (!strncasecmp(m_subject, "Re:", 2)) {
- wprintf("<INPUT TYPE=\"hidden\" NAME=\"subject\" VALUE=\"");
- escputs(m_subject);
- wprintf("\">\n");
- }
- else if (strlen(m_subject) > 0) {
- wprintf("<INPUT TYPE=\"hidden\" NAME=\"subject\" VALUE=\"Re: ");
- escputs(m_subject);
- wprintf("\">\n");
- }
-
- wprintf("<INPUT TYPE=\"submit\" NAME=\"msg_oper\" STYLE=\"font-family: Bitstream Vera Sans,Arial,Helvetica,sans-serif; font-size: 7pt; background: blue; color: #FFFFFF;\" VALUE=\"Reply\">\n");
+ /* Reply */
+ wprintf("<a href=\"/display_enter?recp=");
+ urlescputs(reply_to);
+ wprintf("&subject=");
+ if (strncasecmp(m_subject, "Re:", 3)) wprintf("Re:%20");
+ urlescputs(m_subject);
+ wprintf("\">[Reply]</a> ");
if (WC->is_room_aide) {
- wprintf("<INPUT TYPE=\"submit\" NAME=\"msg_oper\" STYLE=\"font-family: Bitstream Vera Sans,Arial,Helvetica,sans-serif; font-size: 7pt; background: blue; color: #FFFFFF;\"VALUE=\"Move\">\n"
- "<INPUT TYPE=\"submit\" NAME=\"msg_oper\" STYLE=\"font-family: Bitstream Vera Sans,Arial,Helvetica,sans-serif; font-size: 7pt; background: blue; color: #FFFFFF;\" VALUE=\"Delete\""
- "onClick=\"return confirm('Delete this message?');\">\n");
+
+ /* Move */
+ wprintf("<a href=\"/confirm_move_msg?msgid=%ld\">[Move]</a> ",
+ msgnum);
+
+ /* Delete */
+ wprintf("<a href=\"/delete_msg?msgid=%ld\" "
+ "onClick=\"return confirm('Delete this message?');\">"
+ "[Delete]</a>", msgnum);
+
}
- wprintf("</FORM>\n"
- "</TD></TR></TABLE>\n");
+ wprintf("</TD></TR></TABLE>\n");
/* Begin body */
wprintf("<TABLE BORDER=0 WIDTH=100%% BGCOLOR=#FFFFFF "
if (part_source != NULL) {
/* If it's my vCard I can edit it */
- if ( (!strcasecmp(WC->wc_roomname, USERCONFIGROOM))
- || (!strcasecmp(&WC->wc_roomname[11], USERCONFIGROOM))) {
+ if ( (!strcasecmp(WC->wc_roomname, USERCONFIGROOM))
+ || (!strcasecmp(&WC->wc_roomname[11], USERCONFIGROOM))
+ || (WC->wc_view == VIEW_ADDRESSBOOK)
+ ) {
wprintf("<A HREF=\"/edit_vcard?"
"msgnum=%ld&partnum=%s\">",
msgnum, vcard_partnum);
- wprintf("(edit)</A>");
+ wprintf("[edit]</A>");
}
/* In all cases, display the full card */
wprintf("</TD></TR></TABLE>\n");
/* end everythingamundo table */
- wprintf("</TD></TR></TABLE></center><br />\n");
+ wprintf("</TD></TR></TABLE>\n");
+ wprintf("</div><br />\n");
}
while (serv_gets(buf), strcmp(buf, "000")) {
if (!strncasecmp(buf, "part=", 5)) {
- extract(mime_filename, &buf[5], 1);
- extract(mime_partnum, &buf[5], 2);
- extract(mime_disposition, &buf[5], 3);
- extract(mime_content_type, &buf[5], 4);
+ extract_token(mime_filename, &buf[5], 1, '|', sizeof mime_filename);
+ extract_token(mime_partnum, &buf[5], 2, '|', sizeof mime_partnum);
+ extract_token(mime_disposition, &buf[5], 3, '|', sizeof mime_disposition);
+ extract_token(mime_content_type, &buf[5], 4, '|', sizeof mime_content_type);
mime_length = extract_int(&buf[5], 5);
if (!strcasecmp(mime_content_type, "text/x-vcard")) {
display_vcard(vcard_source, alpha, 0, NULL);
/* If it's my vCard I can edit it */
- if ( (!strcasecmp(WC->wc_roomname, USERCONFIGROOM))
- || (!strcasecmp(&WC->wc_roomname[11], USERCONFIGROOM))) {
+ if ( (!strcasecmp(WC->wc_roomname, USERCONFIGROOM))
+ || (!strcasecmp(&WC->wc_roomname[11], USERCONFIGROOM))
+ || (WC->wc_view == VIEW_ADDRESSBOOK)
+ ) {
wprintf("<A HREF=\"/edit_vcard?"
"msgnum=%ld&partnum=%s\">",
msgnum, vcard_partnum);
- wprintf("(edit)</A>");
+ wprintf("[edit]</A>");
}
free(vcard_source);
i = num_tokens(namebuf, ' ');
if (i < 2) return;
- extract_token(lastname, namebuf, i-1, ' ');
+ extract_token(lastname, namebuf, i-1, ' ', sizeof lastname);
remove_token(namebuf, i-1, ' ');
strcpy(firstname, namebuf);
sprintf(namebuf, "%s; %s", lastname, firstname);
while (serv_gets(buf), strcmp(buf, "000")) {
if (!strncasecmp(buf, "part=", 5)) {
- extract(mime_filename, &buf[5], 1);
- extract(mime_partnum, &buf[5], 2);
- extract(mime_disposition, &buf[5], 3);
- extract(mime_content_type, &buf[5], 4);
+ extract_token(mime_filename, &buf[5], 1, '|', sizeof mime_filename);
+ extract_token(mime_partnum, &buf[5], 2, '|', sizeof mime_partnum);
+ extract_token(mime_disposition, &buf[5], 3, '|', sizeof mime_disposition);
+ extract_token(mime_content_type, &buf[5], 4, '|', sizeof mime_content_type);
mime_length = extract_int(&buf[5], 5);
if (!strcasecmp(mime_content_type, "text/x-vcard")) {
wprintf("<A HREF=\"/readfwd?startmsg=%ld&is_singlecard=1",
addrbook[i].ab_msgnum);
wprintf("&maxmsgs=1&summary=0&alpha=%s\">", bstr("alpha"));
+ vcard_n_prettyize(addrbook[i].ab_name);
escputs(addrbook[i].ab_name);
wprintf("</A></TD>\n");
++displayed;
}
}
- wprintf("<FORM NAME=\"msgomatic\" "
+ wprintf("<form name=\"msgomatic\" "
"METHOD=\"POST\" ACTION=\"/do_stuff_to_msgs\">\n");
if (is_summary) {
- wprintf(
- "<center><table border=0 cellspacing=0 "
- "cellpadding=0 width=99%%>\n"
+ wprintf("<div id=\"fix_scrollbar_bug\">"
+ "<table border=0 cellspacing=0 "
+ "cellpadding=0 width=100%%>\n"
"<TR>"
"<TD><I>Subject</I></TD>"
"<TD><I>Sender</I></TD>"
}
if (is_summary) {
- wprintf("</table></center>\n");
+ wprintf("</table></div>\n");
}
/* Bump these because although we're thinking in zero base, the user
if (num_displayed == 1) {
if ((!is_tasks) && (!is_calendar) && (!is_addressbook) && (!is_notes) && (!is_singlecard)) {
- wprintf("<CENTER>"
- "<TABLE BORDER=0 WIDTH=99%% BGCOLOR=\"#DDDDDD\"><TR><TD>"
+ wprintf("<div id=\"fix_scrollbar_bug\">"
+ "<table border=0 width=100%% bgcolor=\"#dddddd\"><tr><td>"
"Reading #%d of %d messages.</TD>\n"
"<TD ALIGN=RIGHT><FONT SIZE=+1>",
lowest_displayed, nummsgs);
oper,
WC->msgarr[0]);
+ wprintf("</td></tr></table></div>\n");
}
}
oper,
WC->msgarr[0], is_summary);
- wprintf("<OPTION VALUE=\"/%s?startmsg=%ld"
- "&maxmsgs=999999&summary=1\">"
- "Summary"
- "</OPTION>",
- oper,
- WC->msgarr[0]);
-
wprintf("</SELECT> of %d messages.", nummsgs);
if (is_summary) {
}
}
- if (is_summary) wprintf("</FORM>\n");
+ wprintf("</form>\n");
DONE:
if (is_tasks) {
wprintf("<div id=\"banner\">\n");
embed_room_banner(NULL, navbar_none);
wprintf("</div>\n");
- wprintf("<div id=\"content\">\n");
+ wprintf("<div id=\"content\">\n"
+ "<div id=\"fix_scrollbar_bug\">"
+ "<table width=100%% border=0 bgcolor=\"#ffffff\"><tr><td>");
sprintf(buf, "ENT0 0|%s|0|0", bstr("recp"));
serv_puts(buf);
stresc(&buf[strlen(buf)], WC->wc_roomname, 1, 1);
/* begin message entry screen */
- wprintf("<div style=\"position:absolute; left:1%%; width:96%%; height:100%%\">\n");
+ // wprintf("<div style=\"position:absolute; left:1%%; width:96%%; height:100%%\">\n");
wprintf("<form enctype=\"multipart/form-data\" "
"method=\"POST\" action=\"/post\" "
wprintf("\"> "
"<input type=\"submit\" name=\"sc\" value=\"Cancel\">\n");
- /* begin richedit box */
- wprintf("<div style=\"position:absolute; left:0%%; width:100%%; top:15%; height:80%%\">\n");
-
- wprintf("<script type=\"text/javascript\" "
+ wprintf("<center><script type=\"text/javascript\" "
"src=\"static/richtext.js\"></script>\n"
"<script type=\"text/javascript\">\n"
"function submitForm() { \n"
" \n"
"initRTE(\"static/\", \"static/\", \"\"); \n"
"</script> \n"
- "<noscript>JAVAscript MUST BE ENABLED.</noscript> \n"
+ "<noscript>JavaScript must be enabled.</noscript> \n"
"<script type=\"text/javascript\"> \n"
"writeRichText('msgtext', '");
msgescputs(bstr("msgtext"));
- wprintf("', '100%%', '80%%', true, false); \n"
- "</script> \n");
- wprintf("</div>\n"); /* end richedit box */
-
- /* Here comes the "do attachments" section on the bottom */
- wprintf("<div style=\"position:absolute; bottom:0px; left:0px; width:100%%\">\n");
+ wprintf("', '96%%', '200', true, false); \n"
+ "</script></center><br />\n");
/* Enumerate any attachments which are already in place... */
+ wprintf("<img src=\"/static/attachment.gif\" border=0 "
+ "align=middle height=16 width=16> Attachments: ");
+ wprintf("<select name=\"which_attachment\" size=1>");
for (att = WC->first_attachment; att != NULL; att = att->next) {
- wprintf("<IMG SRC=\"/static/attachment.gif\" "
- "BORDER=0 ALIGN=MIDDLE> Attachment: ");
+ wprintf("<option value=\"");
+ urlescputs(att->filename);
+ wprintf("\">");
escputs(att->filename);
- wprintf(" (%s, %d bytes)<br />\n",
- att->content_type, att->length);
+ /* wprintf(" (%s, %d bytes)",att->content_type,att->length); */
+ wprintf("</option>\n");
}
+ wprintf("</select>");
/* Now offer the ability to attach additional files... */
wprintf(" "
"Attach file: <input NAME=\"attachfile\" "
- "SIZE=48 TYPE=\"file\">\n "
+ "SIZE=16 TYPE=\"file\">\n "
"<input type=\"submit\" name=\"attach\" value=\"Add\">\n");
- wprintf("</div>\n"); /* end attachments section */
+ wprintf("</form>\n");
- wprintf("</FORM>\n");
-
- wprintf("</div>\n");
+ wprintf("</td></tr></table></div>\n");
DONE: wDumpContent(1);
}
output_headers(1, 1, 1, 0, 0, 0, 0);
- wprintf("<center><table width=99%% border=0 bgcolor=\"#444455\"><tr><td>");
+ wprintf("<div id=\"fix_scrollbar_bug\">"
+ "<table width=100%% border=0 bgcolor=\"#444455\"><tr><td>");
wprintf("<font size=+1 color=\"#ffffff\"");
wprintf("<b>Confirm move of message</b>\n");
- wprintf("</font></td></tr></table></center>\n");
+ wprintf("</font></td></tr></table></div>\n");
wprintf("<CENTER>");
wprintf("Move this message to:<br />\n");
- wprintf("<FORM METHOD=\"POST\" ACTION=\"/move_msg\">\n");
+ wprintf("<form METHOD=\"POST\" ACTION=\"/move_msg\">\n");
wprintf("<INPUT TYPE=\"hidden\" NAME=\"msgid\" VALUE=\"%s\">\n",
bstr("msgid"));
serv_gets(buf);
if (buf[0] == '1') {
while (serv_gets(buf), strcmp(buf, "000")) {
- extract(targ, buf, 0);
+ extract_token(targ, buf, 0, '|', sizeof targ);
wprintf("<OPTION>");
escputs(targ);
wprintf("\n");
wprintf("<INPUT TYPE=\"submit\" NAME=\"yesno\" VALUE=\"Move\">");
wprintf(" ");
wprintf("<INPUT TYPE=\"submit\" NAME=\"yesno\" VALUE=\"Cancel\">");
- wprintf("</FORM></CENTER>\n");
+ wprintf("</form></CENTER>\n");
wprintf("</CENTER>\n");
wDumpContent(1);
wDumpContent(1);
}
-/*
- * This gets called when a user selects Reply/Move/Del etc. on *one* message.
- */
-void do_stuff_to_one_msg(void) {
- char *msg_oper;
-
- msg_oper = bstr("msg_oper");
-
- if (!strcasecmp(msg_oper, "Delete")) {
- delete_msg(); /* It's already been confirmed using JS */
- return;
- }
- if (!strcasecmp(msg_oper, "Move")) {
- confirm_move_msg();
- return;
- }
- if (!strcasecmp(msg_oper, "Reply")) {
- display_enter(); /* recp and subject already set */
- return;
- }
-
- /* should never get here. FIXME: display an error */
-
-}
-
-
/*
* This gets called when a user selects multiple messages in a summary
* list and then clicks to perform a transformation of some sort on them