Address book popup is now rendered using an ajax refresh
[citadel.git] / webcit / addressbook_popup.c
1 /*
2  * $Id:  $
3  *//**
4  * \defgroup AjaxAutoCompletion ajax-powered autocompletion...
5  * \ingroup ClientPower
6  */
7
8 /*@{*/
9 #include "webcit.h"
10
11
12 /**
13  * \brief Address book popup window
14  */
15 void display_address_book_middle_div(void) {
16         char buf[256];
17         char ebuf[256];
18
19         begin_ajax_response();
20
21         wprintf("<table border=0 width=100%%><tr valign=middle>");
22         wprintf("<td align=left><img src=\"static/viewcontacts_32x.gif\"></td>");
23         wprintf("<td align=center>");
24
25         wprintf("<form><select class=\"address_book_popup_title\" size=1>");
26         serv_puts("LKRA");
27         serv_getln(buf, sizeof buf);
28         if (buf[0] == '1') while(serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
29                 if (extract_int(buf, 6) == VIEW_ADDRESSBOOK) {
30                         extract_token(ebuf, buf, 0, '|', sizeof ebuf);
31                         wprintf("<option value=\"");
32                         urlescputs(ebuf);
33                         wprintf("\">");
34                         escputs(ebuf);
35                         wprintf("</option>\n");
36                 }
37         }
38         wprintf("</select></form>");
39
40         wprintf("</td>");
41         wprintf("<td align=right "
42                 "onclick=\"javascript:$('address_book_popup').style.display='none';\" "
43                 "><img src=\"static/closewindow.gif\">");
44         wprintf("</td></tr></table>");
45
46         end_ajax_response();
47 }
48
49
50
51 /**
52  * \brief Address book popup results
53  */
54 void display_address_book_inner_div(void) {
55         int i;
56
57         begin_ajax_response();
58
59         wprintf("<div align=center><form>"
60                 "<select name=\"whichaddr\" size=\"15\">\n");
61
62         for (i=0; i<100; ++i) {
63                 wprintf("<option>Contact %d &lt;contact%d@example.com&gt;</option>\n", i, i);
64         }
65
66         wprintf("</select></form></div>\n");
67
68         end_ajax_response();
69 }
70
71
72 /** @} */