* New "notes" icon
authorArt Cancro <ajc@citadel.org>
Wed, 20 Oct 2004 02:41:45 +0000 (02:41 +0000)
committerArt Cancro <ajc@citadel.org>
Wed, 20 Oct 2004 02:41:45 +0000 (02:41 +0000)
* Added the notes room to the icon bar
* Set up an initial implementation of Notes view.  Attractive enough to
  publish, but read-only.  Needs a note editor.

webcit/ChangeLog
webcit/iconbar.c
webcit/notes.c
webcit/static/note.gif [new file with mode: 0644]

index 56067409c252bb22c95359d6e4617d6e2ecdff09..8ce9d9b7a4f6fdb629b67bf25c669e7b7b9cbb5d 100644 (file)
@@ -1,4 +1,10 @@
 $Log$
+Revision 524.6  2004/10/20 02:41:41  ajc
+* New "notes" icon
+* Added the notes room to the icon bar
+* Set up an initial implementation of Notes view.  Attractive enough to
+  publish, but read-only.  Needs a note editor.
+
 Revision 524.5  2004/10/15 03:10:24  ajc
 * Calendar objects UID now generated by generate_uuid() which creates
   pseudo-DCE-ish UUID's.
@@ -2097,4 +2103,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 ab5ce32af33a7b47d49f01f8fb7c55347da8d1cb..9a93203987c7d5c38a505d5ed9e3676b99c7f831 100644 (file)
@@ -45,6 +45,7 @@ void do_iconbar(void) {
        int ib_inbox = 0;       /* Inbox icon */
        int ib_calendar = 0;    /* Calendar icon */
        int ib_contacts = 0;    /* Contacts icon */
+       int ib_notes = 0;       /* Notes icon */
        int ib_tasks = 0;       /* Tasks icon */
        int ib_rooms = 1;       /* Rooms icon */
        int ib_users = 1;       /* Users icon */
@@ -67,6 +68,7 @@ void do_iconbar(void) {
                if (!strcasecmp(key, "ib_inbox")) ib_inbox = atoi(value);
                if (!strcasecmp(key, "ib_calendar")) ib_calendar = atoi(value);
                if (!strcasecmp(key, "ib_contacts")) ib_contacts = atoi(value);
+               if (!strcasecmp(key, "ib_notes")) ib_notes = atoi(value);
                if (!strcasecmp(key, "ib_tasks")) ib_tasks = atoi(value);
                if (!strcasecmp(key, "ib_rooms")) ib_rooms = atoi(value);
                if (!strcasecmp(key, "ib_users")) ib_users = atoi(value);
@@ -151,6 +153,22 @@ void do_iconbar(void) {
                wprintf("</A></P></SPAN>\n");
        }
 
+       if (ib_notes) {
+               wprintf("<SPAN CLASS=\"iconbar_link\"><P>"
+                       "<A HREF=\"/dotgoto?room=Notes\" "
+                       "TITLE=\"Go to your personal notes\" "
+                       "TARGET=\"workspace\">"
+               );
+               if (ib_displayas != IB_TEXTONLY) {
+                       wprintf("<IMG BORDER=\"0\" WIDTH=\"32\" HEIGHT=\"32\" "
+                       "SRC=\"/static/note.gif\"><BR>");
+               }
+               if (ib_displayas != IB_PICONLY) {
+                       wprintf("Notes<BR>");
+               }
+               wprintf("</A></P></SPAN>\n");
+       }
+
        if (ib_tasks)  {
                wprintf("<SPAN CLASS=\"iconbar_link\"><P>"
                        "<A HREF=\"/dotgoto?room=Tasks\" "
@@ -291,6 +309,7 @@ void display_customize_iconbar(void) {
        int ib_inbox = 0;       /* Inbox icon */
        int ib_calendar = 0;    /* Calendar icon */
        int ib_contacts = 0;    /* Contacts icon */
+       int ib_notes = 0;       /* Notes icon */
        int ib_tasks = 0;       /* Tasks icon */
        int ib_rooms = 1;       /* Rooms icon */
        int ib_users = 1;       /* Users icon */
@@ -313,6 +332,7 @@ void display_customize_iconbar(void) {
                if (!strcasecmp(key, "ib_inbox")) ib_inbox = atoi(value);
                if (!strcasecmp(key, "ib_calendar")) ib_calendar = atoi(value);
                if (!strcasecmp(key, "ib_contacts")) ib_contacts = atoi(value);
+               if (!strcasecmp(key, "ib_notes")) ib_notes = atoi(value);
                if (!strcasecmp(key, "ib_tasks")) ib_tasks = atoi(value);
                if (!strcasecmp(key, "ib_rooms")) ib_rooms = atoi(value);
                if (!strcasecmp(key, "ib_users")) ib_users = atoi(value);
@@ -397,8 +417,21 @@ void display_customize_iconbar(void) {
                (ib_contacts ? "CHECKED" : "")
        );
 
-#ifdef WEBCIT_WITH_CALENDAR_SERVICE
        wprintf("<TR BGCOLOR=\"#CCCCCC\"><TD>"
+               "<INPUT TYPE=\"checkbox\" NAME=\"ib_notes\" "
+               "VALUE=\"yes\" %s>"
+               "</TD><TD>"
+               "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
+               "SRC=\"/static/note.gif\" ALT=\"&nbsp;\">"
+               "</TD><TD>"
+               "<B>Notes</B><BR>"
+               "Your personal notes."
+               "</TD></TR>\n",
+               (ib_notes ? "CHECKED" : "")
+       );
+
+#ifdef WEBCIT_WITH_CALENDAR_SERVICE
+       wprintf("<TR><TD>"
                "<INPUT TYPE=\"checkbox\" NAME=\"ib_calendar\" "
                "VALUE=\"yes\" %s>"
                "</TD><TD>"
@@ -411,7 +444,7 @@ void display_customize_iconbar(void) {
                (ib_calendar ? "CHECKED" : "")
        );
 
-       wprintf("<TR><TD>"
+       wprintf("<TR BGCOLOR=\"#CCCCCC\"><TD>"
                "<INPUT TYPE=\"checkbox\" NAME=\"ib_tasks\" VALUE=\"yes\" %s>"
                "</TD><TD>"
                "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
@@ -424,7 +457,7 @@ void display_customize_iconbar(void) {
        );
 #endif /* WEBCIT_WITH_CALENDAR_SERVICE */
 
-       wprintf("<TR BGCOLOR=\"#CCCCCC\"><TD>"
+       wprintf("<TR><TD>"
                "<INPUT TYPE=\"checkbox\" NAME=\"ib_rooms\" VALUE=\"yes\" %s>"
                "</TD><TD>"
                "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
@@ -437,7 +470,7 @@ void display_customize_iconbar(void) {
                (ib_rooms ? "CHECKED" : "")
        );
 
-       wprintf("<TR><TD>"
+       wprintf("<TR BGCOLOR=\"#CCCCCC\"><TD>"
                "<INPUT TYPE=\"checkbox\" NAME=\"ib_users\" VALUE=\"yes\" %s>"
                "</TD><TD>"
                "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
@@ -450,7 +483,7 @@ void display_customize_iconbar(void) {
                (ib_users ? "CHECKED" : "")
        );
 
-       wprintf("<TR BGCOLOR=\"#CCCCCC\"><TD>"
+       wprintf("<TR><TD>"
                "<INPUT TYPE=\"checkbox\" NAME=\"ib_chat\" VALUE=\"yes\" %s>"
                "</TD><TD>"
                "<IMG BORDER=\"0\" WIDTH=\"48\" HEIGHT=\"48\" "
@@ -463,7 +496,7 @@ void display_customize_iconbar(void) {
                (ib_chat ? "CHECKED" : "")
        );
 
-       wprintf("<TR><TD>"
+       wprintf("<TR BGCOLOR=\"#CCCCCC\"><TD>"
                "<INPUT TYPE=\"checkbox\" NAME=\"ib_advanced\" "
                "VALUE=\"yes\" %s>"
                "</TD><TD>"
@@ -476,7 +509,7 @@ void display_customize_iconbar(void) {
                (ib_advanced ? "CHECKED" : "")
        );
 
-       wprintf("<TR BGCOLOR=\"#CCCCCC\"><TD>"
+       wprintf("<TR><TD>"
                "<INPUT TYPE=\"checkbox\" NAME=\"ib_logoff\" "
                "VALUE=\"yes\" %s>"
                "</TD><TD>"
@@ -489,7 +522,7 @@ void display_customize_iconbar(void) {
                "</TD></TR>\n",
                (ib_logoff ? "CHECKED" : "")
        );
-       wprintf("<TR><TD>"
+       wprintf("<TR BGCOLOR=\"#CCCCCC\"><TD>"
                "<INPUT TYPE=\"checkbox\" NAME=\"ib_citadel\" "
                "VALUE=\"yes\" %s>"
                "</TD><TD>"
@@ -525,6 +558,7 @@ void commit_iconbar(void) {
                "ib_inbox",
                "ib_calendar",
                "ib_contacts",
+               "ib_notes",
                "ib_tasks",
                "ib_rooms",
                "ib_users",
index 8fccbdcdffb4df1b0d17b43c0d6598e25961c560..2e6d7ce09e915e796879e1ee4ca2ebe693689a74 100644 (file)
 #include "webserver.h"
 
 void display_note(long msgnum) {
-       wprintf("<TABLE border=2><TR><TD>\n");
-       wprintf("FIXME note #%ld\n", msgnum);
-       wprintf("</TD></TR></TABLE\n");
+       char buf[SIZ];
+       char notetext[SIZ];
+       char display_notetext[SIZ];
+       int in_text = 0;
+       int i;
+
+       wprintf("<IMG ALIGN=MIDDLE SRC=\"/static/note.gif\">\n");
+
+       serv_printf("MSG0 %ld", msgnum);
+       serv_gets(buf);
+       if (buf[0] != '1') {
+               wprintf("%s<BR>\n", &buf[4]);
+               return;
+       }
+
+       strcpy(notetext, "");
+       while (serv_gets(buf), strcmp(buf, "000")) {
+
+               /* Fill the buffer to at least 256 characters */
+               if ( (in_text) && (strlen(notetext) < 256) ) {
+                       strcat(notetext, buf);
+               }
+
+               if ( (!in_text) && (!strcasecmp(buf, "text")) ) {
+                       in_text = 1;
+               }
+       }
+
+       /* Now sanitize the buffer, and shorten it to just a small snippet */
+       for (i=0; i<strlen(notetext); ++i) {
+               if (isspace(notetext[i])) notetext[i] = ' ';
+       }
+       strcpy(&notetext[72], "...");
+
+       /* Make it HTML-happy and print it. */
+       stresc(display_notetext, notetext, 1, 1);
+       wprintf("%s<BR>\n", display_notetext);
 }
diff --git a/webcit/static/note.gif b/webcit/static/note.gif
new file mode 100644 (file)
index 0000000..ac6a860
Binary files /dev/null and b/webcit/static/note.gif differ