]> code.citadel.org Git - citadel.git/blobdiff - webcit/vcard_edit.c
Revert "Revert "Removed the "fix_scrollbarbug" div and all references to it.""
[citadel.git] / webcit / vcard_edit.c
index cca07c265a59c00afcb6d9d80d95559b90656df6..c2bf41d47ead02572c55867f203341df14064c76 100644 (file)
@@ -1,6 +1,3 @@
-/*
- * $Id$
- */
 
 #include "webcit.h"
 #include "calendar.h"
@@ -29,47 +26,6 @@ void nametab(char *tabbuf, long len, char *name) {
 }
 
 
-/*
- * display the adressbook overview
- */
-void display_addressbook(long msgnum, char alpha) {
-       //char buf[SIZ];
-       /* char mime_partnum[SIZ]; */
-       ///char mime_disposition[SIZ];
-       //int mime_length;
-       char vcard_partnum[SIZ];
-       StrBuf *vcard_source = NULL;
-       message_summary summ;////TODO: this will leak
-
-       memset(&summ, 0, sizeof(summ));
-       // safestrncpy(summ.subj, _("(no subject)"), sizeof summ.subj);
-       // Load Message headers
-       if (!IsEmptyStr(vcard_partnum)) {
-               vcard_source = load_mimepart(msgnum, vcard_partnum);
-               if (vcard_source != NULL) {
-
-                       /* Display the summary line */
-                       display_vcard(WC->WBuf, vcard_source, alpha, 0, NULL, msgnum);
-
-                       /* If it's my vCard I can edit it */
-                       if (    (!strcasecmp(ChrPtr(WC->CurRoom.name), USERCONFIGROOM))
-                               || (!strcasecmp(&(ChrPtr(WC->CurRoom.name)[11]), USERCONFIGROOM))
-                               || (WC->CurRoom.view == VIEW_ADDRESSBOOK)
-                       ) {
-                               wc_printf("<a href=\"edit_vcard?"
-                                       "msgnum=%ld&partnum=%s\">",
-                                       msgnum, vcard_partnum);
-                               wc_printf("[%s]</a>", _("edit"));
-                       }
-
-                       FreeStrBuf(&vcard_source);
-               }
-       }
-
-}
-
-
-
 /*
  * If it's an old "Firstname Lastname" style record, try to convert it.
  */
@@ -148,7 +104,7 @@ void fetch_ab_name(message_summary *Msg, char **namebuf) {
                return;
 
        /* Grab the name off the card */
-       display_vcard(WC->WBuf, VCMime->Data, 0, 0, namebuf, Msg->msgnum);
+       display_vcard(WC->WBuf, VCMime, 0, 0, namebuf, Msg->msgnum);
 
        if (*namebuf != NULL) {
                lastfirst_firstlast(*namebuf);
@@ -284,7 +240,8 @@ void fetchname_parsed_vcard(struct vCard *v, char **storename) {
  * full                display all items of the vcard?
  * msgnum      Citadel message pointer
  */
-void display_parsed_vcard(StrBuf *Target, struct vCard *v, int full, long msgnum) {
+void display_parsed_vcard(StrBuf *Target, struct vCard *v, int full, wc_mime_attachment *Mime)
+{
        int i, j;
        char buf[SIZ];
        char *name;
@@ -539,7 +496,7 @@ void display_parsed_vcard(StrBuf *Target, struct vCard *v, int full, long msgnum
  * msgnum      Citadel message pointer
  */
 void display_vcard(StrBuf *Target, 
-                  StrBuf *vcard_source, 
+                  wc_mime_attachment *Mime, 
                   char alpha, 
                   int full, 
                   char **storename, 
@@ -551,7 +508,7 @@ void display_vcard(StrBuf *Target,
        StrBuf *Buf2;
        char this_alpha = 0;
 
-       v = VCardLoad(vcard_source);
+       v = VCardLoad(Mime->Data);
 
        if (v == NULL) return;
 
@@ -568,12 +525,12 @@ void display_vcard(StrBuf *Target,
        if (storename != NULL) {
                fetchname_parsed_vcard(v, storename);
        }
-       else if (
-               (alpha == 0)
-               || ((isalpha(alpha)) && (tolower(alpha) == tolower(this_alpha)))
-               || ((!isalpha(alpha)) && (!isalpha(this_alpha)))
-       {
-               display_parsed_vcard(Target, v, full,msgnum);
+       else if ((alpha == 0) || 
+                ((isalpha(alpha)) && (tolower(alpha) == tolower(this_alpha))) || 
+                ((!isalpha(alpha)) && (!isalpha(this_alpha)))
+               ) 
+       {
+               display_parsed_vcard(Target, v, full, Mime);
        }
 
        vcard_free(v);
@@ -871,8 +828,9 @@ void do_edit_vcard(long msgnum, char *partnum,
        /* Display the form */
        output_headers(1, 1, 1, 0, 0, 0);
 
-       svput("BOXTITLE", WCS_STRING, _("Edit contact information"));
-       do_template("beginboxx", NULL);
+       do_template("beginbox_1", NULL);
+       StrBufAppendBufPlain(WC->WBuf, _("Edit contact information"), -1, 0);
+       do_template("beginbox_2", NULL);
 
        wc_printf("<form method=\"POST\" action=\"submit_vcard\">\n");
        wc_printf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
@@ -883,8 +841,7 @@ void do_edit_vcard(long msgnum, char *partnum,
                wc_printf("\">\n");
        }
 
-       wc_printf("<div class=\"fix_scrollbar_bug\">"
-               "<table class=\"vcard_edit_background\"><tr><td>\n");
+       wc_printf("<table class=\"vcard_edit_background\"><tr><td>\n");
 
        wc_printf("<table border=0><tr>"
                "<td>%s</td>"
@@ -892,7 +849,7 @@ void do_edit_vcard(long msgnum, char *partnum,
                "<td>%s</td>"
                "<td>%s</td>"
                "<td>%s</td></tr>\n",
-               _("Prefix"), _("First"), _("Middle"), _("Last"), _("Suffix")
+               _("Prefix"), _("First Name"), _("Middle Name"), _("Last Name"), _("Suffix")
        );
        wc_printf("<tr><td><input type=\"text\" name=\"prefix\" "
                "value=\"%s\" maxlength=\"5\" size=\"5\"></td>",
@@ -1078,7 +1035,7 @@ void submit_vcard(void) {
        int i;
 
        if (!havebstr("ok_button")) { 
-               readloop(readnew);
+               readloop(readnew, eUseDefault);
                return;
        }
 
@@ -1107,7 +1064,7 @@ void submit_vcard(void) {
                                http_redirect(bstr("return_to"));
                        }
                        else {
-                               readloop(readnew);
+                               readloop(readnew, eUseDefault);
                        }
                        return;
                }
@@ -1199,7 +1156,7 @@ void submit_vcard(void) {
                http_redirect(bstr("return_to"));
        }
        else {
-               readloop(readnew);
+               readloop(readnew, eUseDefault);
        }
 }
 
@@ -1335,6 +1292,7 @@ InitModule_VCARD
                VIEW_ADDRESSBOOK,
                vcard_GetParamsGetServerCall,
                NULL,
+               NULL, 
                vcard_LoadMsgFromServer,
                vcard_RenderView_or_Tail,
                vcard_Cleanup);