5 * \defgroup StickyNotes Functions which handle "sticky notes"
6 * \ingroup WebcitDisplayItems
11 #include "webserver.h"
14 * \brief display sticky notes
15 * \param msgnum the citadel mesage number
17 void display_note(long msgnum)
21 char display_notetext[SIZ];
26 wprintf("<IMG ALIGN=MIDDLE src=\"static/storenotes_48x.gif\">\n");
28 serv_printf("MSG0 %ld", msgnum);
29 serv_getln(buf, sizeof buf);
31 wprintf("%s<br />\n", &buf[4]);
37 while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
39 /** Fill the buffer */
40 if ( (in_text) && (strlen(notetext) < SIZ-256) ) {
41 strcat(notetext, buf);
44 if ( (!in_text) && (!strncasecmp(buf, "exti=", 5)) ) {
45 safestrncpy(eid, &buf[5], sizeof eid);
48 if ( (!in_text) && (!strcasecmp(buf, "text")) ) {
53 /** Now sanitize the buffer */
54 len = strlen(notetext);
55 for (i=0; i<len; ++i) {
56 if (isspace(notetext[i])) notetext[i] = ' ';
59 /** Make it HTML-happy and print it. */
60 stresc(display_notetext, notetext, 0, 0);
61 if (!IsEmptyStr(eid)) {
62 wprintf("<span id=\"note%s\">%s</span><br />\n", eid, display_notetext);
65 wprintf("<span id=\"note%ld\">%s</span><br />\n", msgnum, display_notetext);
68 /** Offer in-place editing. */
69 if (!IsEmptyStr(eid)) {
70 wprintf("<script type=\"text/javascript\">"
71 "new Ajax.InPlaceEditor('note%s', 'updatenote?nonce=%ld?eid=%s', {rows:5,cols:72});"
82 * \brief This gets called by the Ajax.InPlaceEditor when we save a note.
88 char display_notetext[SIZ];
93 serv_printf("ENT0 1||0|0||||||%s", bstr("eid"));
94 serv_getln(buf, sizeof buf);
96 text_to_server(bstr("value"));
100 begin_ajax_response();
101 msgnum = locate_message_by_uid(bstr("eid"));
103 serv_printf("MSG0 %ld", msgnum);
104 serv_getln(buf, sizeof buf);
106 while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
108 /** Fill the buffer */
109 if ( (in_text) && (strlen(notetext) < SIZ-256) ) {
110 strcat(notetext, buf);
113 if ( (!in_text) && (!strcasecmp(buf, "text")) ) {
117 /** Now sanitize the buffer */
118 len = strlen(notetext);
119 for (i=0; i<len; ++i) {
120 if (isspace(notetext[i])) notetext[i] = ' ';
123 /** Make it HTML-happy and print it. */
124 stresc(display_notetext, notetext, 0, 0);
125 wprintf("%s\n", display_notetext);
129 wprintf("%s", _("An error has occurred."));