00001
00002
00003
00009 #include "webcit.h"
00010 #include "groupdav.h"
00011 #include "webserver.h"
00012
00017 void display_note(long msgnum)
00018 {
00019 char buf[SIZ];
00020 char notetext[SIZ];
00021 char display_notetext[SIZ];
00022 char eid[128];
00023 int in_text = 0;
00024 int i;
00025
00026 wprintf("<IMG ALIGN=MIDDLE src=\"static/storenotes_48x.gif\">\n");
00027
00028 serv_printf("MSG0 %ld", msgnum);
00029 serv_getln(buf, sizeof buf);
00030 if (buf[0] != '1') {
00031 wprintf("%s<br />\n", &buf[4]);
00032 return;
00033 }
00034
00035 strcpy(notetext, "");
00036 strcpy(eid, "");
00037 while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
00038
00040 if ( (in_text) && (strlen(notetext) < SIZ-256) ) {
00041 strcat(notetext, buf);
00042 }
00043
00044 if ( (!in_text) && (!strncasecmp(buf, "exti=", 5)) ) {
00045 safestrncpy(eid, &buf[5], sizeof eid);
00046 }
00047
00048 if ( (!in_text) && (!strcasecmp(buf, "text")) ) {
00049 in_text = 1;
00050 }
00051 }
00052
00054 for (i=0; i<strlen(notetext); ++i) {
00055 if (isspace(notetext[i])) notetext[i] = ' ';
00056 }
00057
00059 stresc(display_notetext, notetext, 0, 0);
00060 if (strlen(eid) > 0) {
00061 wprintf("<span id=\"note%s\">%s</span><br />\n", eid, display_notetext);
00062 }
00063 else {
00064 wprintf("<span id=\"note%ld\">%s</span><br />\n", msgnum, display_notetext);
00065 }
00066
00068 if (strlen(eid) > 0) {
00069 wprintf("<script type=\"text/javascript\">"
00070 " new Ajax.InPlaceEditor('note%s', 'updatenote?eid=%s', {rows:5,cols:72}); "
00071 "</script>\n",
00072 eid,
00073 eid
00074 );
00075 }
00076 }
00077
00078
00082 void updatenote(void)
00083 {
00084 char buf[SIZ];
00085 char notetext[SIZ];
00086 char display_notetext[SIZ];
00087 long msgnum;
00088 int in_text = 0;
00089 int i;
00090
00091 serv_printf("ENT0 1||0|0||||||%s", bstr("eid"));
00092 serv_getln(buf, sizeof buf);
00093 if (buf[0] == '4') {
00094 text_to_server(bstr("value"));
00095 serv_puts("000");
00096 }
00097
00098 begin_ajax_response();
00099 msgnum = locate_message_by_uid(bstr("eid"));
00100 if (msgnum >= 0L) {
00101 serv_printf("MSG0 %ld", msgnum);
00102 serv_getln(buf, sizeof buf);
00103 if (buf[0] == '1') {
00104 while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
00105
00107 if ( (in_text) && (strlen(notetext) < SIZ-256) ) {
00108 strcat(notetext, buf);
00109 }
00110
00111 if ( (!in_text) && (!strcasecmp(buf, "text")) ) {
00112 in_text = 1;
00113 }
00114 }
00116 for (i=0; i<strlen(notetext); ++i) {
00117 if (isspace(notetext[i])) notetext[i] = ' ';
00118 }
00119
00121 stresc(display_notetext, notetext, 0, 0);
00122 wprintf("%s\n", display_notetext);
00123 }
00124 }
00125 else {
00126 wprintf("%s", _("An error has occurred."));
00127 }
00128
00129 end_ajax_response();
00130 }
00131
00132
00133