]> code.citadel.org Git - citadel.git/blobdiff - webcit/vcard_edit.c
Saving vCards now requires the API caller to specify the room
[citadel.git] / webcit / vcard_edit.c
index 4f6183dc570775b37d05cec92022d16092f07a59..52cea9bd0d12992a3f221d47eee5c5a51d82b5e0 100644 (file)
@@ -18,7 +18,7 @@
  * \param partnum what???
  * \param return_to where to go back in the browser after edit ????
  */
-void do_edit_vcard(long msgnum, char *partnum, char *return_to) {
+void do_edit_vcard(long msgnum, char *partnum, char *return_to, char *force_room) {
        char buf[SIZ];
        char *serialized_vcard = NULL;
        size_t total_len = 0;
@@ -174,17 +174,20 @@ 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");
-       wprintf("<img src=\"static/savecontact_48x.gif\">");
-       wprintf("<h1>");
-       wprintf(_("Edit contact information"));
-       wprintf("</h1>");
-       wprintf("</div>\n");
-       wprintf("<div id=\"content\" class=\"service\">\n");
+       output_headers(1, 1, 1, 0, 0, 0);
+
+       svprintf("BOXTITLE", WCS_STRING, _("Edit contact information"));
+       do_template("beginbox");
 
        wprintf("<form method=\"POST\" action=\"submit_vcard\">\n");
        wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%ld\">\n", WC->nonce);
+
+       if (force_room != NULL) {
+               wprintf("<input type=\"hidden\" name=\"force_room\" value=\"");
+               escputs(force_room);
+               wprintf("\">\n");
+       }
+
        wprintf("<div class=\"fix_scrollbar_bug\">"
                "<table class=\"vcard_edit_background\"><tr><td>\n");
 
@@ -324,16 +327,17 @@ void do_edit_vcard(long msgnum, char *partnum, char *return_to) {
        urlescputs(return_to);
        wprintf("\">\n");
 
-       wprintf("<center>\n"
+       wprintf("<div class=\"buttons\">\n"
                "<input type=\"submit\" name=\"ok_button\" value=\"%s\">"
                "&nbsp;"
                "<input type=\"submit\" name=\"cancel_button\" value=\"%s\">"
-               "</center></form>\n",
+               "</div></form>\n",
                _("Save changes"),
                _("Cancel")
        );
        
-       wprintf("</td></tr></table></div>\n");
+       wprintf("</td></tr></table>\n");
+       do_template("endbox");
        wDumpContent(1);
 }
 
@@ -347,7 +351,7 @@ void edit_vcard(void) {
 
        msgnum = atol(bstr("msgnum"));
        partnum = bstr("partnum");
-       do_edit_vcard(msgnum, partnum, "");
+       do_edit_vcard(msgnum, partnum, "", NULL);
 }
 
 
@@ -366,6 +370,10 @@ void submit_vcard(void) {
                return;
        }
 
+       if (!IsEmptyStr(bstr("force_room"))) {
+               gotoroom(bstr("force_room"));
+       }
+
        sprintf(buf, "ENT0 1|||4||");
        serv_puts(buf);
        serv_getln(buf, sizeof buf);