* The 'delete' button on sticky notes now works.
[citadel.git] / webcit / static / wclib.js
index 853f01b353721f78f4a0f51e536f0176c77f6f62..5eec5d0d4a45043610bc51bd078ce758319c809a 100644 (file)
@@ -571,13 +571,26 @@ function NotesResizeMouseDown(evt, uid) {
 }
 
 
+function DeleteStickyNote(evt, uid, confirmation_prompt) {
+       uid_of_note_being_deleted = uid;
+       d = $('note-' + uid_of_note_being_deleted);
 
+       if (confirm(confirmation_prompt)) {
+               new Effect.Puff(d);
 
-
-
-
-
-
+               // submit an ajax http call to delete it on the server
+               p = 'note_uid=' + uid_of_note_being_deleted
+                       + '&deletenote=yes'
+                       + '&r=' + CtdlRandomString();
+               new Ajax.Request(
+                       'ajax_update_note',
+                       {
+                               method: 'post',
+                               parameters: p
+                       }
+               );
+       }
+}
 
 
 
@@ -723,23 +736,6 @@ function ctdl_ts_getInnerText(el) {
 }
 
 
-
-// This function handles the creation of new notes in the "Notes" view.
-//
-function add_new_note() {
-
-       new_eid = CtdlRandomString();
-
-       $('new_notes_here').innerHTML = $('new_notes_here').innerHTML
-               + '<IMG ALIGN=MIDDLE src=\"static/storenotes_48x.gif\" id=\"' + new_eid + '\" alt=\"Note\" class=\"notes\">'
-               + '<script type=\"text/javascript\">new Draggable (\"%s\", {revert:true})</script>'
-               + '<span id=\"note' + new_eid + '\">' + Date() + '</span><br />'
-       ;
-
-       new Ajax.InPlaceEditor('note' + new_eid,
-               'updatenote?eid=' + new_eid , {rows:5,cols:72});
-}
-
 function CtdlShowRaw(msgnum) {
 var customnav = document.createElement("span");
 var mode_citadel = document.createElement("a");