* Fixed the autocompletion for CC: and BCC:
authorArt Cancro <ajc@citadel.org>
Sat, 17 Sep 2005 03:00:06 +0000 (03:00 +0000)
committerArt Cancro <ajc@citadel.org>
Sat, 17 Sep 2005 03:00:06 +0000 (03:00 +0000)
* Moved the autocompletion styles into the stylesheet where they belong

webcit/ChangeLog
webcit/autocompletion.c
webcit/messages.c
webcit/static/webcit.css
webcit/webcit.c
webcit/webcit.h

index 13c1a78c5d0151ddf91d10edd545e7d34af52ba3..228569f9ec89aeddf465c274021f4cd3b7d815d9 100644 (file)
@@ -1,4 +1,8 @@
 $Log$
+Revision 625.6  2005/09/17 03:00:06  ajc
+* Fixed the autocompletion for CC: and BCC:
+* Moved the autocompletion styles into the stylesheet where they belong
+
 Revision 625.5  2005/09/16 04:34:46  ajc
 * Initial hack of Cc: and Bcc: support
 
@@ -2972,4 +2976,3 @@ Sun Dec  6 19:50:55 EST 1998 Art Cancro <ajc@uncnsrd.mt-kisco.ny.us>
 
 1998-12-03 Nathan Bryant <bryant@cs.usm.maine.edu>
        * webserver.c: warning fix
-
index 9c99817350d1c4b55d4cf618ae1c3c607e61ffc3..43904bdecc9645a3238c02299e81f0cff3c1ba8b 100644 (file)
@@ -6,11 +6,10 @@
 
 #include "webcit.h"
 
-
 /*
  * Recipient autocompletion results
  */
-void recp_autocomplete(void) {
+void recp_autocomplete(char *partial) {
        char buf[1024];
        char name[128];
 
@@ -26,8 +25,7 @@ void recp_autocomplete(void) {
 
        wprintf("<ul>");
 
-
-       serv_printf("AUTO %s", bstr("recp"));
+       serv_printf("AUTO %s", partial);
        serv_getln(buf, sizeof buf);
        if (buf[0] == '1') {
                while(serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
index dac799a9ebef3795678366863c889f503ea9246b..96c597cf10d60258040aa2b4417609c1a39695b2 100644 (file)
@@ -2387,12 +2387,6 @@ void display_enter(void)
        stresc(&buf[strlen(buf)], WC->wc_roomname, 1, 1);
 
        /* begin message entry screen */
-
-
-       wprintf(
-       "<style> div.auto_complete { width: 350px; background: #fff; } div.auto_complete ul { border:1px solid #888; margin:0; padding:0; width:100%; list-style-type:none; } div.auto_complete ul li { margin:0; padding:3px; } div.auto_complete ul li.selected { background-color: #ffc; } div.auto_complete ul strong.highlight { color: #800; margin:0; padding:0; } </style> \n "
-       );
-
        wprintf("<form enctype=\"multipart/form-data\" "
                "method=\"POST\" action=\"/post\" "
                "name=\"enterform\""
@@ -2411,15 +2405,10 @@ void display_enter(void)
                wprintf(_("To:"));
                wprintf("</font>");
                wprintf("</td><td>"
-                       "<input autocomplete=\"off\" type=\"text\" name=\"recp\" id=\"recp_name\" value=\"");
+                       "<input autocomplete=\"off\" type=\"text\" name=\"recp\" id=\"recp_id\" value=\"");
                escputs(bstr("recp"));
-               wprintf("\" size=50 maxlength=1000>");
+               wprintf("\" size=50 maxlength=1000 />");
                wprintf("<div class=\"auto_complete\" id=\"recp_name_choices\"></div>");
-               wprintf("<script type=\"text/javascript\">                                      "
-                       " new Ajax.Autocompleter('recp_name', 'recp_name_choices',              "
-                       "       '/recp_autocomplete', {} );                             "
-                       "</script>\n                                                            "
-               );
                wprintf("</td><td></td></tr>\n");
 
                wprintf("<tr><td>");
@@ -2427,15 +2416,10 @@ void display_enter(void)
                wprintf(_("CC:"));
                wprintf("</font>");
                wprintf("</td><td>"
-                       "<input autocomplete=\"off\" type=\"text\" name=\"cc\" id=\"cc_name\" value=\"");
+                       "<input autocomplete=\"off\" type=\"text\" name=\"cc\" id=\"cc_id\" value=\"");
                escputs(bstr("cc"));
-               wprintf("\" size=50 maxlength=1000>");
+               wprintf("\" size=50 maxlength=1000 />");
                wprintf("<div class=\"auto_complete\" id=\"cc_name_choices\"></div>");
-               wprintf("<script type=\"text/javascript\">                                      "
-                       " new Ajax.Autocompleter('cc_name', 'cc_name_choices',          "
-                       "       '/recp_autocomplete', {} );                             "
-                       "</script>\n                                                            "
-               );
                wprintf("</td><td></td></tr>\n");
 
                wprintf("<tr><td>");
@@ -2443,17 +2427,23 @@ void display_enter(void)
                wprintf(_("BCC:"));
                wprintf("</font>");
                wprintf("</td><td>"
-                       "<input autocomplete=\"off\" type=\"text\" name=\"bcc\" id=\"bcc_name\" value=\"");
+                       "<input autocomplete=\"off\" type=\"text\" name=\"bcc\" id=\"bcc_id\" value=\"");
                escputs(bstr("bcc"));
-               wprintf("\" size=50 maxlength=1000>");
+               wprintf("\" size=50 maxlength=1000 />");
                wprintf("<div class=\"auto_complete\" id=\"bcc_name_choices\"></div>");
-               wprintf("<script type=\"text/javascript\">                                      "
-                       " new Ajax.Autocompleter('cc_name', 'bcc_name_choices',         "
-                       "       '/recp_autocomplete', {} );                             "
-                       "</script>\n                                                            "
-               );
                wprintf("</td><td></td></tr>\n");
 
+               /* Initialize the autocomplete ajax helpers */
+               wprintf("<script type=\"text/javascript\">                              \n"
+                       " new Ajax.Autocompleter('cc_id', 'cc_name_choices',            \n"
+                       "       '/cc_autocomplete', {} );                               \n"
+                       " new Ajax.Autocompleter('bcc_id', 'bcc_name_choices',          \n"
+                       "       '/bcc_autocomplete', {} );                              \n"
+                       " new Ajax.Autocompleter('recp_id', 'recp_name_choices',        \n"
+                       "       '/recp_autocomplete', {} );                             \n"
+                       "</script>                                                      \n"
+               );
+
        }
 
        wprintf("<tr><td>");
index fbec1c305016244540efb4f1740dd89d6fac3b55..92b784e7230a0439a1fadbb3cb6fe70325c328fb 100644 (file)
@@ -9,7 +9,7 @@ body {
        padding: 0 0 0 0;
        height: 100%;
        overflow: auto;
-       background-image:url(/static/body-background.gif);
+       background-image: url(/static/body-background.gif);
        color: #000000;
        font-family: "Bitstream Vera Sans",Arial,Helvetica,sans-serif;
        font-weight: normal;
@@ -491,4 +491,37 @@ td li.frameset, .elements li.frameset {
 
 <!-- end nanotree styles -->
 
+<!-- begin address autocompleter styles -->
+
+div.auto_complete {
+       width: 350px;
+       background: #fff;
+}
+
+div.auto_complete ul {
+       border:1px solid #888;
+       margin:0;
+       padding:0;
+       width:100%;
+       list-style-type: none;
+       background: #fff;
+}
+
+div.auto_complete ul li {
+       margin:0;
+       padding:3px;
+}
+
+div.auto_complete ul li.selected {
+       background-color: #ffc;
+} 
+
+div.auto_complete ul strong.highlight {
+       color: #800;
+       margin:0;
+       padding:0;
+}
+
+<!-- end address autocompleter styles -->
+
 </style>
index 21ae6231a0bfb46afa709b58d06ab416b5e8e7c8..399187f9091b849de6556459cec6e2b71591014c 100644 (file)
@@ -1360,7 +1360,11 @@ void session_loop(struct httprequest *req)
        } else if (!strcasecmp(action, "set_preferences")) {
                set_preferences();
        } else if (!strcasecmp(action, "recp_autocomplete")) {
-               recp_autocomplete();
+               recp_autocomplete(bstr("recp"));
+       } else if (!strcasecmp(action, "cc_autocomplete")) {
+               recp_autocomplete(bstr("cc"));
+       } else if (!strcasecmp(action, "bcc_autocomplete")) {
+               recp_autocomplete(bstr("bcc"));
        } else if (!strcasecmp(action, "diagnostics")) {
                output_headers(1, 1, 1, 0, 0, 0, 0);
                wprintf("Session: %d<hr />\n", WC->wc_session);
index 35c9f7358bf01288a6e78e2647ffe3ccd1d3c700..6d9b56da71f3e54f08ae4712c6babca4494ca214 100644 (file)
@@ -521,7 +521,7 @@ void save_inetconf(void);
 void generate_uuid(char *);
 void display_preferences(void);
 void set_preferences(void);
-void recp_autocomplete(void);
+void recp_autocomplete(char *);
 
 #ifdef WEBCIT_WITH_CALENDAR_SERVICE
 void display_edit_task(void);