Changes to make notes deleteable... INCOMPLETE..
authorDave West <davew@uncensored.citadel.org>
Mon, 5 Nov 2007 00:03:07 +0000 (00:03 +0000)
committerDave West <davew@uncensored.citadel.org>
Mon, 5 Nov 2007 00:03:07 +0000 (00:03 +0000)
Note icon is now draggable.
Added a bit of text to act as a place holder for a trashcan object.
If a note is dragged to the trash object the note icon is hidden but the
note is not yet deleted.

webcit/messages.c
webcit/notes.c

index e6ced3fb7bffb61401c2cef6ee2026eb9a924a06..d392b4b69d961064f77265d794b9cc161677ab0b 100644 (file)
@@ -2552,6 +2552,12 @@ void readloop(char *oper)
                /** end bbview scroller */
        }
 
+       if (is_notes)
+       {
+               wprintf ("<script src=\"/static/dragdrop.js\" type=\"text/javascript\"></script>\n");
+       }
+
+
 
 
        for (a = 0; a < nummsgs; ++a) {
@@ -2594,7 +2600,6 @@ void readloop(char *oper)
                }
        }
 
-
        /** Output loop */
        if (displayed_msgs != NULL) {
                if (bbs_reverse) {
@@ -2717,6 +2722,40 @@ void readloop(char *oper)
                wprintf("</form>\n");
                /** end bbview scroller */
        }
+       
+       if (is_notes)
+       {
+//             wprintf ("</div>\n");
+               wprintf ("<div id=\"wastebin\" align=middle>Drop notes here to remove them.</div>\n");
+               wprintf ("<script type=\"text/javascript\">\n");
+//             wprintf ("//<![CDATA[\n");
+               wprintf ("Droppables.add(\"wastebin\",\n");
+               wprintf ("\t{\n");
+               wprintf ("\t\taccept:'notes',\n");
+               wprintf ("\t\tonDrop:function(element)\n");
+               wprintf ("\t\t{\n");
+               wprintf ("\t\t\tElement.hide(element);\n");
+               wprintf ("\t\t\tnew Ajax.Updater('notes', 'delnote',\n");
+               wprintf ("\t\t\t{\n");
+               wprintf ("\t\t\t\tasynchronous:true,\n");
+               wprintf ("\t\t\t\tevalScripts:true,\n");
+               wprintf ("\t\t\t\tonComplete:function(request)\n");
+               wprintf ("\t\t\t\t{\n");
+               wprintf ("\t\t\t\t\tElement.hide('indicator')\n");
+               wprintf ("\t\t\t\t},\n");
+               wprintf ("\t\t\t\tonLoading:function(request)\n");
+               wprintf ("\t\t\t\t{\n");
+               wprintf ("\t\t\t\t\tElement.show('indicator')\n");
+               wprintf ("\t\t\t\t},\n");
+               wprintf ("\t\t\t\tparameters:'id=' + encodeURIComponent(element.id)\n");
+               wprintf ("\t\t\t})\n");
+               wprintf ("\t\t}\n");
+               wprintf ("\t})\n");
+//             wprintf ("//]]>\n");
+               wprintf ("</script>\n");
+       }
+
+
 
 DONE:
        if (is_tasks) {
index f6e295154f78339c24061f312f46f0bc202d5e3d..ffd6f33af9ce8a9e67d9f9723764cd9122652302 100644 (file)
@@ -23,8 +23,7 @@ void display_note(long msgnum)
        int in_text = 0;
        int i, len;
 
-       wprintf("<IMG ALIGN=MIDDLE src=\"static/storenotes_48x.gif\">\n");
-
+//     wprintf("<IMG ALIGN=MIDDLE src=\"static/storenotes_48x.gif\">\n");
        serv_printf("MSG0 %ld", msgnum);
        serv_getln(buf, sizeof buf);
        if (buf[0] != '1') {
@@ -58,6 +57,26 @@ void display_note(long msgnum)
 
        /** Make it HTML-happy and print it. */
        stresc(display_notetext, SIZ, notetext, 0, 0);
+/* Lets try it as a draggable */
+       if (!IsEmptyStr(eid)) {
+               wprintf ("<IMG ALIGN=MIDDLE src=\"static/storenotes_48x.gif\" id=\"note_%s\" alt=\"Note\" ", eid); 
+               wprintf ("class=\"notes\">\n");
+               wprintf ("<script type=\"text/javascript\">\n");
+//             wprintf ("//<![CDATA[\n");
+               wprintf ("new Draggable (\"note_%s\", {revert:true})\n", eid);
+//             wprintf ("//]]>\n");
+               wprintf ("</script>\n");
+       }
+       else {
+               wprintf ("<IMG ALIGN=MIDDLE src=\"static/storenotes_48x.gif\" id=\"note_%s\" ", msgnum); 
+               wprintf ("class=\"notes\">\n");
+               wprintf ("<script type=\"text/javascript\">\n");
+//             wprintf ("//<![CDATA[\n");
+               wprintf ("new Draggable (\"note_%s\", {revert:true})\n", msgnum);
+//             wprintf ("//]]>\n");
+               wprintf ("</script>\n");
+       }
+       
        if (!IsEmptyStr(eid)) {
                wprintf("<span id=\"note%s\">%s</span><br />\n", eid, display_notetext);
        }