]> code.citadel.org Git - citadel.git/blobdiff - webcit/vcard_edit.c
use the same way to display all banners and services contents
[citadel.git] / webcit / vcard_edit.c
index 3a6f33c14d6980a4c6af55cc222ca13ccd44de37..4f6183dc570775b37d05cec92022d16092f07a59 100644 (file)
@@ -89,21 +89,18 @@ void do_edit_vcard(long msgnum, char *partnum, char *return_to) {
                        }
                }
        
-               sprintf(buf, "OPNA %ld|%s", msgnum, partnum);
+               sprintf(buf, "DLAT %ld|%s", msgnum, partnum);
                serv_puts(buf);
                serv_getln(buf, sizeof buf);
-               if (buf[0] != '2') {
+               if (buf[0] != '6') {
                        convenience_page("770000", "Error", &buf[4]);
                        return;
                }
        
                total_len = atoi(&buf[4]);
                serialized_vcard = malloc(total_len + 2);
-       
-               read_server_binary(serialized_vcard, total_len);
-       
-               serv_puts("CLOS");
-               serv_getln(buf, sizeof buf);
+
+               serv_read(serialized_vcard, total_len);
                serialized_vcard[total_len] = 0;
        
                v = vcard_load(serialized_vcard);
@@ -178,19 +175,18 @@ void do_edit_vcard(long msgnum, char *partnum, char *return_to) {
 
        /** Display the form */
        output_headers(1, 1, 2, 0, 0, 0);
-       wprintf("<div id=\"banner\">\n"
-               "<table width=100%% border=0 bgcolor=\"#444455\"><tr><td>"
-               "<span class=\"titlebar\">"
-               "<img src=\"static/savecontact_48x.gif\">");
+       wprintf("<div id=\"banner\">\n");
+       wprintf("<img src=\"static/savecontact_48x.gif\">");
+       wprintf("<h1>");
        wprintf(_("Edit contact information"));
-       wprintf("</span>"
-               "</td></tr></table>\n"
-               "</div>\n<div id=\"content\">\n"
-       );
+       wprintf("</h1>");
+       wprintf("</div>\n");
+       wprintf("<div id=\"content\" class=\"service\">\n");
 
        wprintf("<form method=\"POST\" action=\"submit_vcard\">\n");
+       wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%ld\">\n", WC->nonce);
        wprintf("<div class=\"fix_scrollbar_bug\">"
-               "<table border=0 width=100%% bgcolor=\"#ffffff\"><tr><td>\n");
+               "<table class=\"vcard_edit_background\"><tr><td>\n");
 
        wprintf("<table border=0><tr>"
                "<td>%s</td>"
@@ -216,7 +212,7 @@ void do_edit_vcard(long msgnum, char *partnum, char *return_to) {
                "value=\"%s\" maxlength=\"10\" size=\"10\"></td></tr></table>\n",
                suffix);
 
-       wprintf("<table border=0 width=100%% bgcolor=\"#dddddd\">");
+       wprintf("<table  class=\"vcard_edit_background_alt\">");
        wprintf("<tr><td>");
 
        wprintf(_("Display name:"));
@@ -269,7 +265,7 @@ void do_edit_vcard(long msgnum, char *partnum, char *return_to) {
        wprintf(_("State:"));
        wprintf("</td><td>"
                "<input type=\"text\" name=\"state\" "
-               "value=\"%s\" maxlength=\"2\"></td></tr>\n",
+               "value=\"%s\" maxlength=\"29\"></td></tr>\n",
                state);
        wprintf("<tr><td>");
        wprintf(_("ZIP code:"));
@@ -300,7 +296,7 @@ void do_edit_vcard(long msgnum, char *partnum, char *return_to) {
                "value=\"%s\" maxlength=\"29\"></td></tr></table>\n",
                worktel);
 
-       wprintf("<table border=0 width=100%% bgcolor=\"#dddddd\">");
+       wprintf("<table class=\"vcard_edit_background_alt\">");
        wprintf("<tr><td>");
 
        wprintf("<table border=0><TR>"
@@ -365,7 +361,7 @@ void submit_vcard(void) {
        char buf[SIZ];
        int i;
 
-       if (strlen(bstr("ok_button")) == 0) { 
+       if (IsEmptyStr(bstr("ok_button"))) { 
                readloop("readnew");
                return;
        }
@@ -421,7 +417,7 @@ void submit_vcard(void) {
 
        for (i=0; i<num_tokens(bstr("other_inetemail"), '\n'); ++i) {
                extract_token(buf, bstr("other_inetemail"), i, '\n', sizeof buf);
-               if (strlen(buf) > 0) {
+               if (!IsEmptyStr(buf)) {
                        vcard_add_prop(v, "email;internet", buf);
                }
        }